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