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