1; RUN: llc -march=hexagon -O3 < %s | FileCheck %s 2 3; CHECK-LABEL: @test_pos1_ir_slt 4; CHECK: loop0 5; a < b 6define void @test_pos1_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 7entry: 8 %cmp3 = icmp slt i32 8531, %b 9 br i1 %cmp3, label %for.body.lr.ph, label %for.end 10 11for.body.lr.ph: 12 br label %for.body 13 14for.body: 15 %i.04 = phi i32 [ 8531, %for.body.lr.ph ], [ %inc, %for.body ] 16 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 17 %0 = load i8, i8* %arrayidx, align 1 18 %conv = zext i8 %0 to i32 19 %add = add nsw i32 %conv, 1 20 %conv1 = trunc i32 %add to i8 21 store i8 %conv1, i8* %arrayidx, align 1 22 %inc = add nsw i32 %i.04, 1 23 %cmp = icmp slt i32 %inc, %b 24 br i1 %cmp, label %for.body, label %for.end 25 26for.end: 27 ret void 28} 29 30; CHECK-LABEL: @test_pos2_ir_slt 31; CHECK: loop0 32; a < b 33define void @test_pos2_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 34entry: 35 %cmp3 = icmp slt i32 9152, %b 36 br i1 %cmp3, label %for.body.lr.ph, label %for.end 37 38for.body.lr.ph: 39 br label %for.body 40 41for.body: 42 %i.04 = phi i32 [ 9152, %for.body.lr.ph ], [ %inc, %for.body ] 43 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 44 %0 = load i8, i8* %arrayidx, align 1 45 %conv = zext i8 %0 to i32 46 %add = add nsw i32 %conv, 1 47 %conv1 = trunc i32 %add to i8 48 store i8 %conv1, i8* %arrayidx, align 1 49 %inc = add nsw i32 %i.04, 2 50 %cmp = icmp slt i32 %inc, %b 51 br i1 %cmp, label %for.body, label %for.end 52 53for.end: 54 ret void 55} 56 57; CHECK-LABEL: @test_pos4_ir_slt 58; CHECK: loop0 59; a < b 60define void @test_pos4_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 61entry: 62 %cmp3 = icmp slt i32 18851, %b 63 br i1 %cmp3, label %for.body.lr.ph, label %for.end 64 65for.body.lr.ph: 66 br label %for.body 67 68for.body: 69 %i.04 = phi i32 [ 18851, %for.body.lr.ph ], [ %inc, %for.body ] 70 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 71 %0 = load i8, i8* %arrayidx, align 1 72 %conv = zext i8 %0 to i32 73 %add = add nsw i32 %conv, 1 74 %conv1 = trunc i32 %add to i8 75 store i8 %conv1, i8* %arrayidx, align 1 76 %inc = add nsw i32 %i.04, 4 77 %cmp = icmp slt i32 %inc, %b 78 br i1 %cmp, label %for.body, label %for.end 79 80for.end: 81 ret void 82} 83 84; CHECK-LABEL: @test_pos8_ir_slt 85; CHECK: loop0 86; a < b 87define void @test_pos8_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 88entry: 89 %cmp3 = icmp slt i32 25466, %b 90 br i1 %cmp3, label %for.body.lr.ph, label %for.end 91 92for.body.lr.ph: 93 br label %for.body 94 95for.body: 96 %i.04 = phi i32 [ 25466, %for.body.lr.ph ], [ %inc, %for.body ] 97 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 98 %0 = load i8, i8* %arrayidx, align 1 99 %conv = zext i8 %0 to i32 100 %add = add nsw i32 %conv, 1 101 %conv1 = trunc i32 %add to i8 102 store i8 %conv1, i8* %arrayidx, align 1 103 %inc = add nsw i32 %i.04, 8 104 %cmp = icmp slt i32 %inc, %b 105 br i1 %cmp, label %for.body, label %for.end 106 107for.end: 108 ret void 109} 110 111; CHECK-LABEL: @test_pos16_ir_slt 112; CHECK: loop0 113; a < b 114define void @test_pos16_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 115entry: 116 %cmp3 = icmp slt i32 9295, %b 117 br i1 %cmp3, label %for.body.lr.ph, label %for.end 118 119for.body.lr.ph: 120 br label %for.body 121 122for.body: 123 %i.04 = phi i32 [ 9295, %for.body.lr.ph ], [ %inc, %for.body ] 124 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 125 %0 = load i8, i8* %arrayidx, align 1 126 %conv = zext i8 %0 to i32 127 %add = add nsw i32 %conv, 1 128 %conv1 = trunc i32 %add to i8 129 store i8 %conv1, i8* %arrayidx, align 1 130 %inc = add nsw i32 %i.04, 16 131 %cmp = icmp slt i32 %inc, %b 132 br i1 %cmp, label %for.body, label %for.end 133 134for.end: 135 ret void 136} 137 138; CHECK-LABEL: @test_pos1_ri_slt 139; CHECK: loop0 140; a < b 141define void @test_pos1_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 142entry: 143 %cmp3 = icmp slt i32 %a, 31236 144 br i1 %cmp3, label %for.body.lr.ph, label %for.end 145 146for.body.lr.ph: 147 br label %for.body 148 149for.body: 150 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 151 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 152 %0 = load i8, i8* %arrayidx, align 1 153 %conv = zext i8 %0 to i32 154 %add = add nsw i32 %conv, 1 155 %conv1 = trunc i32 %add to i8 156 store i8 %conv1, i8* %arrayidx, align 1 157 %inc = add nsw i32 %i.04, 1 158 %cmp = icmp slt i32 %inc, 31236 159 br i1 %cmp, label %for.body, label %for.end 160 161for.end: 162 ret void 163} 164 165; CHECK-LABEL: @test_pos2_ri_slt 166; CHECK: loop0 167; a < b 168define void @test_pos2_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 169entry: 170 %cmp3 = icmp slt i32 %a, 22653 171 br i1 %cmp3, label %for.body.lr.ph, label %for.end 172 173for.body.lr.ph: 174 br label %for.body 175 176for.body: 177 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 178 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 179 %0 = load i8, i8* %arrayidx, align 1 180 %conv = zext i8 %0 to i32 181 %add = add nsw i32 %conv, 1 182 %conv1 = trunc i32 %add to i8 183 store i8 %conv1, i8* %arrayidx, align 1 184 %inc = add nsw i32 %i.04, 2 185 %cmp = icmp slt i32 %inc, 22653 186 br i1 %cmp, label %for.body, label %for.end 187 188for.end: 189 ret void 190} 191 192; CHECK-LABEL: @test_pos4_ri_slt 193; CHECK: loop0 194; a < b 195define void @test_pos4_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 196entry: 197 %cmp3 = icmp slt i32 %a, 1431 198 br i1 %cmp3, label %for.body.lr.ph, label %for.end 199 200for.body.lr.ph: 201 br label %for.body 202 203for.body: 204 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 205 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 206 %0 = load i8, i8* %arrayidx, align 1 207 %conv = zext i8 %0 to i32 208 %add = add nsw i32 %conv, 1 209 %conv1 = trunc i32 %add to i8 210 store i8 %conv1, i8* %arrayidx, align 1 211 %inc = add nsw i32 %i.04, 4 212 %cmp = icmp slt i32 %inc, 1431 213 br i1 %cmp, label %for.body, label %for.end 214 215for.end: 216 ret void 217} 218 219; CHECK-LABEL: @test_pos8_ri_slt 220; CHECK: loop0 221; a < b 222define void @test_pos8_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 223entry: 224 %cmp3 = icmp slt i32 %a, 22403 225 br i1 %cmp3, label %for.body.lr.ph, label %for.end 226 227for.body.lr.ph: 228 br label %for.body 229 230for.body: 231 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 232 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 233 %0 = load i8, i8* %arrayidx, align 1 234 %conv = zext i8 %0 to i32 235 %add = add nsw i32 %conv, 1 236 %conv1 = trunc i32 %add to i8 237 store i8 %conv1, i8* %arrayidx, align 1 238 %inc = add nsw i32 %i.04, 8 239 %cmp = icmp slt i32 %inc, 22403 240 br i1 %cmp, label %for.body, label %for.end 241 242for.end: 243 ret void 244} 245 246; CHECK-LABEL: @test_pos16_ri_slt 247; CHECK: loop0 248; a < b 249define void @test_pos16_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 250entry: 251 %cmp3 = icmp slt i32 %a, 21715 252 br i1 %cmp3, label %for.body.lr.ph, label %for.end 253 254for.body.lr.ph: 255 br label %for.body 256 257for.body: 258 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 259 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 260 %0 = load i8, i8* %arrayidx, align 1 261 %conv = zext i8 %0 to i32 262 %add = add nsw i32 %conv, 1 263 %conv1 = trunc i32 %add to i8 264 store i8 %conv1, i8* %arrayidx, align 1 265 %inc = add nsw i32 %i.04, 16 266 %cmp = icmp slt i32 %inc, 21715 267 br i1 %cmp, label %for.body, label %for.end 268 269for.end: 270 ret void 271} 272 273; CHECK-LABEL: @test_pos1_rr_slt 274; CHECK: loop0 275; a < b 276define void @test_pos1_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 277entry: 278 %cmp3 = icmp slt i32 %a, %b 279 br i1 %cmp3, label %for.body.lr.ph, label %for.end 280 281for.body.lr.ph: 282 br label %for.body 283 284for.body: 285 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 286 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 287 %0 = load i8, i8* %arrayidx, align 1 288 %conv = zext i8 %0 to i32 289 %add = add nsw i32 %conv, 1 290 %conv1 = trunc i32 %add to i8 291 store i8 %conv1, i8* %arrayidx, align 1 292 %inc = add nsw i32 %i.04, 1 293 %cmp = icmp slt i32 %inc, %b 294 br i1 %cmp, label %for.body, label %for.end 295 296for.end: 297 ret void 298} 299 300; CHECK-LABEL: @test_pos2_rr_slt 301; CHECK: loop0 302; a < b 303define void @test_pos2_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: 309 br label %for.body 310 311for.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, 2 320 %cmp = icmp slt i32 %inc, %b 321 br i1 %cmp, label %for.body, label %for.end 322 323for.end: 324 ret void 325} 326 327; CHECK-LABEL: @test_pos4_rr_slt 328; CHECK: loop0 329; a < b 330define void @test_pos4_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 331entry: 332 %cmp3 = icmp slt i32 %a, %b 333 br i1 %cmp3, label %for.body.lr.ph, label %for.end 334 335for.body.lr.ph: 336 br label %for.body 337 338for.body: 339 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 340 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 341 %0 = load i8, i8* %arrayidx, align 1 342 %conv = zext i8 %0 to i32 343 %add = add nsw i32 %conv, 1 344 %conv1 = trunc i32 %add to i8 345 store i8 %conv1, i8* %arrayidx, align 1 346 %inc = add nsw i32 %i.04, 4 347 %cmp = icmp slt i32 %inc, %b 348 br i1 %cmp, label %for.body, label %for.end 349 350for.end: 351 ret void 352} 353 354; CHECK-LABEL: @test_pos8_rr_slt 355; CHECK: loop0 356; a < b 357define void @test_pos8_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 358entry: 359 %cmp3 = icmp slt i32 %a, %b 360 br i1 %cmp3, label %for.body.lr.ph, label %for.end 361 362for.body.lr.ph: 363 br label %for.body 364 365for.body: 366 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 367 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 368 %0 = load i8, i8* %arrayidx, align 1 369 %conv = zext i8 %0 to i32 370 %add = add nsw i32 %conv, 1 371 %conv1 = trunc i32 %add to i8 372 store i8 %conv1, i8* %arrayidx, align 1 373 %inc = add nsw i32 %i.04, 8 374 %cmp = icmp slt i32 %inc, %b 375 br i1 %cmp, label %for.body, label %for.end 376 377for.end: 378 ret void 379} 380 381; CHECK-LABEL: @test_pos16_rr_slt 382; CHECK: loop0 383; a < b 384define void @test_pos16_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 385entry: 386 %cmp3 = icmp slt i32 %a, %b 387 br i1 %cmp3, label %for.body.lr.ph, label %for.end 388 389for.body.lr.ph: 390 br label %for.body 391 392for.body: 393 %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ] 394 %arrayidx = getelementptr inbounds i8, i8* %p, i32 %i.04 395 %0 = load i8, i8* %arrayidx, align 1 396 %conv = zext i8 %0 to i32 397 %add = add nsw i32 %conv, 1 398 %conv1 = trunc i32 %add to i8 399 store i8 %conv1, i8* %arrayidx, align 1 400 %inc = add nsw i32 %i.04, 16 401 %cmp = icmp slt i32 %inc, %b 402 br i1 %cmp, label %for.body, label %for.end 403 404for.end: 405 ret void 406} 407 408 409 410