1target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64" 2target triple = "powerpc64-unknown-linux-gnu" 3; RUN: llc < %s -march=ppc64 | FileCheck %s 4 5; CHECK: test_pos1_ir_ne 6; CHECK: bdnz 7; a < b 8define void @test_pos1_ir_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 9entry: 10 %cmp3 = icmp slt i32 32623, %b 11 br i1 %cmp3, label %for.body.lr.ph, label %for.end 12 13for.body.lr.ph: ; preds = %entry 14 br label %for.body 15 16for.body: ; preds = %for.body.lr.ph, %for.body 17 %i.04 = phi i32 [ 32623, %for.body.lr.ph ], [ %inc, %for.body ] 18 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 19 %0 = load i8, i8* %arrayidx, align 1 20 %conv = zext i8 %0 to i32 21 %add = add nsw i32 %conv, 1 22 %conv1 = trunc i32 %add to i8 23 store i8 %conv1, i8* %arrayidx, align 1 24 %inc = add nsw i32 %i.04, 1 25 %cmp = icmp ne i32 %inc, %b 26 br i1 %cmp, label %for.body, label %for.end 27 28for.end: ; preds = %for.body, %entry 29 ret void 30} 31 32 33 34; CHECK: test_pos2_ir_ne 35; FIXME: Support this loop! 36; CHECK-NOT: bdnz 37; a < b 38define void @test_pos2_ir_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 39entry: 40 %cmp3 = icmp slt i32 29554, %b 41 br i1 %cmp3, label %for.body.lr.ph, label %for.end 42 43for.body.lr.ph: ; preds = %entry 44 br label %for.body 45 46for.body: ; preds = %for.body.lr.ph, %for.body 47 %i.04 = phi i32 [ 29554, %for.body.lr.ph ], [ %inc, %for.body ] 48 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 49 %0 = load i8, i8* %arrayidx, align 1 50 %conv = zext i8 %0 to i32 51 %add = add nsw i32 %conv, 1 52 %conv1 = trunc i32 %add to i8 53 store i8 %conv1, i8* %arrayidx, align 1 54 %inc = add nsw i32 %i.04, 2 55 %cmp = icmp ne i32 %inc, %b 56 br i1 %cmp, label %for.body, label %for.end 57 58for.end: ; preds = %for.body, %entry 59 ret void 60} 61 62 63 64; CHECK: test_pos4_ir_ne 65; FIXME: Support this loop! 66; CHECK-NOT: bdnz 67; a < b 68define void @test_pos4_ir_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 69entry: 70 %cmp3 = icmp slt i32 15692, %b 71 br i1 %cmp3, label %for.body.lr.ph, label %for.end 72 73for.body.lr.ph: ; preds = %entry 74 br label %for.body 75 76for.body: ; preds = %for.body.lr.ph, %for.body 77 %i.04 = phi i32 [ 15692, %for.body.lr.ph ], [ %inc, %for.body ] 78 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 79 %0 = load i8, i8* %arrayidx, align 1 80 %conv = zext i8 %0 to i32 81 %add = add nsw i32 %conv, 1 82 %conv1 = trunc i32 %add to i8 83 store i8 %conv1, i8* %arrayidx, align 1 84 %inc = add nsw i32 %i.04, 4 85 %cmp = icmp ne i32 %inc, %b 86 br i1 %cmp, label %for.body, label %for.end 87 88for.end: ; preds = %for.body, %entry 89 ret void 90} 91 92 93 94; CHECK: test_pos8_ir_ne 95; FIXME: Support this loop! 96; CHECK-NOT: bdnz 97; a < b 98define void @test_pos8_ir_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 99entry: 100 %cmp3 = icmp slt i32 10449, %b 101 br i1 %cmp3, label %for.body.lr.ph, label %for.end 102 103for.body.lr.ph: ; preds = %entry 104 br label %for.body 105 106for.body: ; preds = %for.body.lr.ph, %for.body 107 %i.04 = phi i32 [ 10449, %for.body.lr.ph ], [ %inc, %for.body ] 108 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 109 %0 = load i8, i8* %arrayidx, align 1 110 %conv = zext i8 %0 to i32 111 %add = add nsw i32 %conv, 1 112 %conv1 = trunc i32 %add to i8 113 store i8 %conv1, i8* %arrayidx, align 1 114 %inc = add nsw i32 %i.04, 8 115 %cmp = icmp ne i32 %inc, %b 116 br i1 %cmp, label %for.body, label %for.end 117 118for.end: ; preds = %for.body, %entry 119 ret void 120} 121 122 123 124; CHECK: test_pos16_ir_ne 125; FIXME: Support this loop! 126; CHECK-NOT: bdnz 127; a < b 128define void @test_pos16_ir_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 129entry: 130 %cmp3 = icmp slt i32 32087, %b 131 br i1 %cmp3, label %for.body.lr.ph, label %for.end 132 133for.body.lr.ph: ; preds = %entry 134 br label %for.body 135 136for.body: ; preds = %for.body.lr.ph, %for.body 137 %i.04 = phi i32 [ 32087, %for.body.lr.ph ], [ %inc, %for.body ] 138 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 139 %0 = load i8, i8* %arrayidx, align 1 140 %conv = zext i8 %0 to i32 141 %add = add nsw i32 %conv, 1 142 %conv1 = trunc i32 %add to i8 143 store i8 %conv1, i8* %arrayidx, align 1 144 %inc = add nsw i32 %i.04, 16 145 %cmp = icmp ne i32 %inc, %b 146 br i1 %cmp, label %for.body, label %for.end 147 148for.end: ; preds = %for.body, %entry 149 ret void 150} 151 152 153 154; CHECK: test_pos1_ri_ne 155; CHECK: bdnz 156; a < b 157define void @test_pos1_ri_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 158entry: 159 %cmp3 = icmp slt i32 %a, 3472 160 br i1 %cmp3, label %for.body.lr.ph, label %for.end 161 162for.body.lr.ph: ; preds = %entry 163 br label %for.body 164 165for.body: ; preds = %for.body.lr.ph, %for.body 166 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 167 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 168 %0 = load i8, i8* %arrayidx, align 1 169 %conv = zext i8 %0 to i32 170 %add = add nsw i32 %conv, 1 171 %conv1 = trunc i32 %add to i8 172 store i8 %conv1, i8* %arrayidx, align 1 173 %inc = add nsw i32 %i.04, 1 174 %cmp = icmp ne i32 %inc, 3472 175 br i1 %cmp, label %for.body, label %for.end 176 177for.end: ; preds = %for.body, %entry 178 ret void 179} 180 181 182 183; CHECK: test_pos2_ri_ne 184; FIXME: Support this loop! 185; CHECK-NOT: bdnz 186; a < b 187define void @test_pos2_ri_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 188entry: 189 %cmp3 = icmp slt i32 %a, 8730 190 br i1 %cmp3, label %for.body.lr.ph, label %for.end 191 192for.body.lr.ph: ; preds = %entry 193 br label %for.body 194 195for.body: ; preds = %for.body.lr.ph, %for.body 196 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 197 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 198 %0 = load i8, i8* %arrayidx, align 1 199 %conv = zext i8 %0 to i32 200 %add = add nsw i32 %conv, 1 201 %conv1 = trunc i32 %add to i8 202 store i8 %conv1, i8* %arrayidx, align 1 203 %inc = add nsw i32 %i.04, 2 204 %cmp = icmp ne i32 %inc, 8730 205 br i1 %cmp, label %for.body, label %for.end 206 207for.end: ; preds = %for.body, %entry 208 ret void 209} 210 211 212 213; CHECK: test_pos4_ri_ne 214; FIXME: Support this loop! 215; CHECK-NOT: bdnz 216; a < b 217define void @test_pos4_ri_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 218entry: 219 %cmp3 = icmp slt i32 %a, 1493 220 br i1 %cmp3, label %for.body.lr.ph, label %for.end 221 222for.body.lr.ph: ; preds = %entry 223 br label %for.body 224 225for.body: ; preds = %for.body.lr.ph, %for.body 226 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 227 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 228 %0 = load i8, i8* %arrayidx, align 1 229 %conv = zext i8 %0 to i32 230 %add = add nsw i32 %conv, 1 231 %conv1 = trunc i32 %add to i8 232 store i8 %conv1, i8* %arrayidx, align 1 233 %inc = add nsw i32 %i.04, 4 234 %cmp = icmp ne i32 %inc, 1493 235 br i1 %cmp, label %for.body, label %for.end 236 237for.end: ; preds = %for.body, %entry 238 ret void 239} 240 241 242 243; CHECK: test_pos8_ri_ne 244; FIXME: Support this loop! 245; CHECK-NOT: bdnz 246; a < b 247define void @test_pos8_ri_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 248entry: 249 %cmp3 = icmp slt i32 %a, 1706 250 br i1 %cmp3, label %for.body.lr.ph, label %for.end 251 252for.body.lr.ph: ; preds = %entry 253 br label %for.body 254 255for.body: ; preds = %for.body.lr.ph, %for.body 256 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 257 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 258 %0 = load i8, i8* %arrayidx, align 1 259 %conv = zext i8 %0 to i32 260 %add = add nsw i32 %conv, 1 261 %conv1 = trunc i32 %add to i8 262 store i8 %conv1, i8* %arrayidx, align 1 263 %inc = add nsw i32 %i.04, 8 264 %cmp = icmp ne i32 %inc, 1706 265 br i1 %cmp, label %for.body, label %for.end 266 267for.end: ; preds = %for.body, %entry 268 ret void 269} 270 271 272 273; CHECK: test_pos16_ri_ne 274; FIXME: Support this loop! 275; CHECK-NOT: bdnz 276; a < b 277define void @test_pos16_ri_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 278entry: 279 %cmp3 = icmp slt i32 %a, 1886 280 br i1 %cmp3, label %for.body.lr.ph, label %for.end 281 282for.body.lr.ph: ; preds = %entry 283 br label %for.body 284 285for.body: ; preds = %for.body.lr.ph, %for.body 286 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 287 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 288 %0 = load i8, i8* %arrayidx, align 1 289 %conv = zext i8 %0 to i32 290 %add = add nsw i32 %conv, 1 291 %conv1 = trunc i32 %add to i8 292 store i8 %conv1, i8* %arrayidx, align 1 293 %inc = add nsw i32 %i.04, 16 294 %cmp = icmp ne i32 %inc, 1886 295 br i1 %cmp, label %for.body, label %for.end 296 297for.end: ; preds = %for.body, %entry 298 ret void 299} 300 301 302 303; CHECK: test_pos1_rr_ne 304; CHECK: bdnz 305; a < b 306define void @test_pos1_rr_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 307entry: 308 %cmp3 = icmp slt i32 %a, %b 309 br i1 %cmp3, label %for.body.lr.ph, label %for.end 310 311for.body.lr.ph: ; preds = %entry 312 br label %for.body 313 314for.body: ; preds = %for.body.lr.ph, %for.body 315 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 316 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 317 %0 = load i8, i8* %arrayidx, align 1 318 %conv = zext i8 %0 to i32 319 %add = add nsw i32 %conv, 1 320 %conv1 = trunc i32 %add to i8 321 store i8 %conv1, i8* %arrayidx, align 1 322 %inc = add nsw i32 %i.04, 1 323 %cmp = icmp ne i32 %inc, %b 324 br i1 %cmp, label %for.body, label %for.end 325 326for.end: ; preds = %for.body, %entry 327 ret void 328} 329 330 331 332; CHECK: test_pos2_rr_ne 333; FIXME: Support this loop! 334; CHECK-NOT: bdnz 335; a < b 336define void @test_pos2_rr_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 337entry: 338 %cmp3 = icmp slt i32 %a, %b 339 br i1 %cmp3, label %for.body.lr.ph, label %for.end 340 341for.body.lr.ph: ; preds = %entry 342 br label %for.body 343 344for.body: ; preds = %for.body.lr.ph, %for.body 345 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 346 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 347 %0 = load i8, i8* %arrayidx, align 1 348 %conv = zext i8 %0 to i32 349 %add = add nsw i32 %conv, 1 350 %conv1 = trunc i32 %add to i8 351 store i8 %conv1, i8* %arrayidx, align 1 352 %inc = add nsw i32 %i.04, 2 353 %cmp = icmp ne i32 %inc, %b 354 br i1 %cmp, label %for.body, label %for.end 355 356for.end: ; preds = %for.body, %entry 357 ret void 358} 359 360 361 362; CHECK: test_pos4_rr_ne 363; FIXME: Support this loop! 364; CHECK-NOT: bdnz 365; a < b 366define void @test_pos4_rr_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 367entry: 368 %cmp3 = icmp slt i32 %a, %b 369 br i1 %cmp3, label %for.body.lr.ph, label %for.end 370 371for.body.lr.ph: ; preds = %entry 372 br label %for.body 373 374for.body: ; preds = %for.body.lr.ph, %for.body 375 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 376 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 377 %0 = load i8, i8* %arrayidx, align 1 378 %conv = zext i8 %0 to i32 379 %add = add nsw i32 %conv, 1 380 %conv1 = trunc i32 %add to i8 381 store i8 %conv1, i8* %arrayidx, align 1 382 %inc = add nsw i32 %i.04, 4 383 %cmp = icmp ne i32 %inc, %b 384 br i1 %cmp, label %for.body, label %for.end 385 386for.end: ; preds = %for.body, %entry 387 ret void 388} 389 390 391 392; CHECK: test_pos8_rr_ne 393; FIXME: Support this loop! 394; CHECK-NOT: bdnz 395; a < b 396define void @test_pos8_rr_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 397entry: 398 %cmp3 = icmp slt i32 %a, %b 399 br i1 %cmp3, label %for.body.lr.ph, label %for.end 400 401for.body.lr.ph: ; preds = %entry 402 br label %for.body 403 404for.body: ; preds = %for.body.lr.ph, %for.body 405 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 406 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 407 %0 = load i8, i8* %arrayidx, align 1 408 %conv = zext i8 %0 to i32 409 %add = add nsw i32 %conv, 1 410 %conv1 = trunc i32 %add to i8 411 store i8 %conv1, i8* %arrayidx, align 1 412 %inc = add nsw i32 %i.04, 8 413 %cmp = icmp ne i32 %inc, %b 414 br i1 %cmp, label %for.body, label %for.end 415 416for.end: ; preds = %for.body, %entry 417 ret void 418} 419 420 421 422; CHECK: test_pos16_rr_ne 423; FIXME: Support this loop! 424; CHECK-NOT: bdnz 425; a < b 426define void @test_pos16_rr_ne(i8* nocapture %p, i32 %a, i32 %b) nounwind { 427entry: 428 %cmp3 = icmp slt i32 %a, %b 429 br i1 %cmp3, label %for.body.lr.ph, label %for.end 430 431for.body.lr.ph: ; preds = %entry 432 br label %for.body 433 434for.body: ; preds = %for.body.lr.ph, %for.body 435 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 436 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 437 %0 = load i8, i8* %arrayidx, align 1 438 %conv = zext i8 %0 to i32 439 %add = add nsw i32 %conv, 1 440 %conv1 = trunc i32 %add to i8 441 store i8 %conv1, i8* %arrayidx, align 1 442 %inc = add nsw i32 %i.04, 16 443 %cmp = icmp ne i32 %inc, %b 444 br i1 %cmp, label %for.body, label %for.end 445 446for.end: ; preds = %for.body, %entry 447 ret void 448} 449 450