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