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; XFAIL: * 6; SE needs improvement 7 8; CHECK: test_pos1_ir_slt 9; CHECK: bdnz 10; a < b 11define void @test_pos1_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 12entry: 13 %cmp3 = icmp slt i32 8531, %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 [ 8531, %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 slt 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_slt 38; FIXME: Support this loop! 39; CHECK: bdnz 40; a < b 41define void @test_pos2_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 42entry: 43 %cmp3 = icmp slt i32 9152, %b 44 br i1 %cmp3, label %for.body.lr.ph, label %for.end 45 46for.body.lr.ph: ; preds = %entry 47 br label %for.body 48 49for.body: ; preds = %for.body.lr.ph, %for.body 50 %i.04 = phi i32 [ 9152, %for.body.lr.ph ], [ %inc, %for.body ] 51 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 52 %0 = load i8, i8* %arrayidx, align 1 53 %conv = zext i8 %0 to i32 54 %add = add nsw i32 %conv, 1 55 %conv1 = trunc i32 %add to i8 56 store i8 %conv1, i8* %arrayidx, align 1 57 %inc = add nsw i32 %i.04, 2 58 %cmp = icmp slt i32 %inc, %b 59 br i1 %cmp, label %for.body, label %for.end 60 61for.end: ; preds = %for.body, %entry 62 ret void 63} 64 65 66 67; CHECK: test_pos4_ir_slt 68; FIXME: Support this loop! 69; CHECK: bdnz 70; a < b 71define void @test_pos4_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 72entry: 73 %cmp3 = icmp slt i32 18851, %b 74 br i1 %cmp3, label %for.body.lr.ph, label %for.end 75 76for.body.lr.ph: ; preds = %entry 77 br label %for.body 78 79for.body: ; preds = %for.body.lr.ph, %for.body 80 %i.04 = phi i32 [ 18851, %for.body.lr.ph ], [ %inc, %for.body ] 81 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 82 %0 = load i8, i8* %arrayidx, align 1 83 %conv = zext i8 %0 to i32 84 %add = add nsw i32 %conv, 1 85 %conv1 = trunc i32 %add to i8 86 store i8 %conv1, i8* %arrayidx, align 1 87 %inc = add nsw i32 %i.04, 4 88 %cmp = icmp slt i32 %inc, %b 89 br i1 %cmp, label %for.body, label %for.end 90 91for.end: ; preds = %for.body, %entry 92 ret void 93} 94 95 96 97; CHECK: test_pos8_ir_slt 98; CHECK: bdnz 99; a < b 100define void @test_pos8_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 101entry: 102 %cmp3 = icmp slt i32 25466, %b 103 br i1 %cmp3, label %for.body.lr.ph, label %for.end 104 105for.body.lr.ph: ; preds = %entry 106 br label %for.body 107 108for.body: ; preds = %for.body.lr.ph, %for.body 109 %i.04 = phi i32 [ 25466, %for.body.lr.ph ], [ %inc, %for.body ] 110 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 111 %0 = load i8, i8* %arrayidx, align 1 112 %conv = zext i8 %0 to i32 113 %add = add nsw i32 %conv, 1 114 %conv1 = trunc i32 %add to i8 115 store i8 %conv1, i8* %arrayidx, align 1 116 %inc = add nsw i32 %i.04, 8 117 %cmp = icmp slt i32 %inc, %b 118 br i1 %cmp, label %for.body, label %for.end 119 120for.end: ; preds = %for.body, %entry 121 ret void 122} 123 124 125 126; CHECK: test_pos16_ir_slt 127; CHECK: bdnz 128; a < b 129define void @test_pos16_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 130entry: 131 %cmp3 = icmp slt i32 9295, %b 132 br i1 %cmp3, label %for.body.lr.ph, label %for.end 133 134for.body.lr.ph: ; preds = %entry 135 br label %for.body 136 137for.body: ; preds = %for.body.lr.ph, %for.body 138 %i.04 = phi i32 [ 9295, %for.body.lr.ph ], [ %inc, %for.body ] 139 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 140 %0 = load i8, i8* %arrayidx, align 1 141 %conv = zext i8 %0 to i32 142 %add = add nsw i32 %conv, 1 143 %conv1 = trunc i32 %add to i8 144 store i8 %conv1, i8* %arrayidx, align 1 145 %inc = add nsw i32 %i.04, 16 146 %cmp = icmp slt i32 %inc, %b 147 br i1 %cmp, label %for.body, label %for.end 148 149for.end: ; preds = %for.body, %entry 150 ret void 151} 152 153 154 155; CHECK: test_pos1_ri_slt 156; CHECK: bdnz 157; a < b 158define void @test_pos1_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 159entry: 160 %cmp3 = icmp slt i32 %a, 31236 161 br i1 %cmp3, label %for.body.lr.ph, label %for.end 162 163for.body.lr.ph: ; preds = %entry 164 br label %for.body 165 166for.body: ; preds = %for.body.lr.ph, %for.body 167 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 168 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 169 %0 = load i8, i8* %arrayidx, align 1 170 %conv = zext i8 %0 to i32 171 %add = add nsw i32 %conv, 1 172 %conv1 = trunc i32 %add to i8 173 store i8 %conv1, i8* %arrayidx, align 1 174 %inc = add nsw i32 %i.04, 1 175 %cmp = icmp slt i32 %inc, 31236 176 br i1 %cmp, label %for.body, label %for.end 177 178for.end: ; preds = %for.body, %entry 179 ret void 180} 181 182 183 184; CHECK: test_pos2_ri_slt 185; CHECK: bdnz 186; a < b 187define void @test_pos2_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 188entry: 189 %cmp3 = icmp slt i32 %a, 22653 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 slt i32 %inc, 22653 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_slt 214; CHECK: bdnz 215; a < b 216define void @test_pos4_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 217entry: 218 %cmp3 = icmp slt i32 %a, 1431 219 br i1 %cmp3, label %for.body.lr.ph, label %for.end 220 221for.body.lr.ph: ; preds = %entry 222 br label %for.body 223 224for.body: ; preds = %for.body.lr.ph, %for.body 225 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 226 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 227 %0 = load i8, i8* %arrayidx, align 1 228 %conv = zext i8 %0 to i32 229 %add = add nsw i32 %conv, 1 230 %conv1 = trunc i32 %add to i8 231 store i8 %conv1, i8* %arrayidx, align 1 232 %inc = add nsw i32 %i.04, 4 233 %cmp = icmp slt i32 %inc, 1431 234 br i1 %cmp, label %for.body, label %for.end 235 236for.end: ; preds = %for.body, %entry 237 ret void 238} 239 240 241 242; CHECK: test_pos8_ri_slt 243; CHECK: bdnz 244; a < b 245define void @test_pos8_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 246entry: 247 %cmp3 = icmp slt i32 %a, 22403 248 br i1 %cmp3, label %for.body.lr.ph, label %for.end 249 250for.body.lr.ph: ; preds = %entry 251 br label %for.body 252 253for.body: ; preds = %for.body.lr.ph, %for.body 254 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 255 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 256 %0 = load i8, i8* %arrayidx, align 1 257 %conv = zext i8 %0 to i32 258 %add = add nsw i32 %conv, 1 259 %conv1 = trunc i32 %add to i8 260 store i8 %conv1, i8* %arrayidx, align 1 261 %inc = add nsw i32 %i.04, 8 262 %cmp = icmp slt i32 %inc, 22403 263 br i1 %cmp, label %for.body, label %for.end 264 265for.end: ; preds = %for.body, %entry 266 ret void 267} 268 269 270 271; CHECK: test_pos16_ri_slt 272; CHECK: bdnz 273; a < b 274define void @test_pos16_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 275entry: 276 %cmp3 = icmp slt i32 %a, 21715 277 br i1 %cmp3, label %for.body.lr.ph, label %for.end 278 279for.body.lr.ph: ; preds = %entry 280 br label %for.body 281 282for.body: ; preds = %for.body.lr.ph, %for.body 283 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 284 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 285 %0 = load i8, i8* %arrayidx, align 1 286 %conv = zext i8 %0 to i32 287 %add = add nsw i32 %conv, 1 288 %conv1 = trunc i32 %add to i8 289 store i8 %conv1, i8* %arrayidx, align 1 290 %inc = add nsw i32 %i.04, 16 291 %cmp = icmp slt i32 %inc, 21715 292 br i1 %cmp, label %for.body, label %for.end 293 294for.end: ; preds = %for.body, %entry 295 ret void 296} 297 298 299 300; CHECK: test_pos1_rr_slt 301; CHECK: bdnz 302; a < b 303define void @test_pos1_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 304entry: 305 %cmp3 = icmp slt i32 %a, %b 306 br i1 %cmp3, label %for.body.lr.ph, label %for.end 307 308for.body.lr.ph: ; preds = %entry 309 br label %for.body 310 311for.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, i8* %p, i32 %i.04 314 %0 = load i8, 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 slt i32 %inc, %b 321 br i1 %cmp, label %for.body, label %for.end 322 323for.end: ; preds = %for.body, %entry 324 ret void 325} 326 327 328 329; CHECK: test_pos2_rr_slt 330; CHECK: bdnz 331; a < b 332define void @test_pos2_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 333entry: 334 %cmp3 = icmp slt 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 slt 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_slt 359; CHECK: bdnz 360; a < b 361define void @test_pos4_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 362entry: 363 %cmp3 = icmp slt i32 %a, %b 364 br i1 %cmp3, label %for.body.lr.ph, label %for.end 365 366for.body.lr.ph: ; preds = %entry 367 br label %for.body 368 369for.body: ; preds = %for.body.lr.ph, %for.body 370 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 371 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 372 %0 = load i8, i8* %arrayidx, align 1 373 %conv = zext i8 %0 to i32 374 %add = add nsw i32 %conv, 1 375 %conv1 = trunc i32 %add to i8 376 store i8 %conv1, i8* %arrayidx, align 1 377 %inc = add nsw i32 %i.04, 4 378 %cmp = icmp slt i32 %inc, %b 379 br i1 %cmp, label %for.body, label %for.end 380 381for.end: ; preds = %for.body, %entry 382 ret void 383} 384 385 386 387; CHECK: test_pos8_rr_slt 388; CHECK: bdnz 389; a < b 390define void @test_pos8_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 391entry: 392 %cmp3 = icmp slt i32 %a, %b 393 br i1 %cmp3, label %for.body.lr.ph, label %for.end 394 395for.body.lr.ph: ; preds = %entry 396 br label %for.body 397 398for.body: ; preds = %for.body.lr.ph, %for.body 399 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 400 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 401 %0 = load i8, i8* %arrayidx, align 1 402 %conv = zext i8 %0 to i32 403 %add = add nsw i32 %conv, 1 404 %conv1 = trunc i32 %add to i8 405 store i8 %conv1, i8* %arrayidx, align 1 406 %inc = add nsw i32 %i.04, 8 407 %cmp = icmp slt i32 %inc, %b 408 br i1 %cmp, label %for.body, label %for.end 409 410for.end: ; preds = %for.body, %entry 411 ret void 412} 413 414 415 416; CHECK: test_pos16_rr_slt 417; CHECK: bdnz 418; a < b 419define void @test_pos16_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 420entry: 421 %cmp3 = icmp slt i32 %a, %b 422 br i1 %cmp3, label %for.body.lr.ph, label %for.end 423 424for.body.lr.ph: ; preds = %entry 425 br label %for.body 426 427for.body: ; preds = %for.body.lr.ph, %for.body 428 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 429 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 430 %0 = load i8, i8* %arrayidx, align 1 431 %conv = zext i8 %0 to i32 432 %add = add nsw i32 %conv, 1 433 %conv1 = trunc i32 %add to i8 434 store i8 %conv1, i8* %arrayidx, align 1 435 %inc = add nsw i32 %i.04, 16 436 %cmp = icmp slt i32 %inc, %b 437 br i1 %cmp, label %for.body, label %for.end 438 439for.end: ; preds = %for.body, %entry 440 ret void 441} 442