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 7 define void @test_pos1_ir_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 8 entry: 9 %cmp3 = icmp sle i32 28395, %b 10 br i1 %cmp3, label %for.body.lr.ph, label %for.end 11 12 for.body.lr.ph: ; preds = %entry 13 br label %for.body 14 15 for.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 27 for.end: ; preds = %for.body, %entry 28 ret void 29 } 30 31 32 33 ; CHECK: test_pos2_ir_sle 34 ; CHECK: loop0 35 ; a < b 36 define void @test_pos2_ir_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 37 entry: 38 %cmp3 = icmp sle i32 9073, %b 39 br i1 %cmp3, label %for.body.lr.ph, label %for.end 40 41 for.body.lr.ph: ; preds = %entry 42 br label %for.body 43 44 for.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 56 for.end: ; preds = %for.body, %entry 57 ret void 58 } 59 60 61 62 ; CHECK: test_pos4_ir_sle 63 ; CHECK: loop0 64 ; a < b 65 define void @test_pos4_ir_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 66 entry: 67 %cmp3 = icmp sle i32 21956, %b 68 br i1 %cmp3, label %for.body.lr.ph, label %for.end 69 70 for.body.lr.ph: ; preds = %entry 71 br label %for.body 72 73 for.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 85 for.end: ; preds = %for.body, %entry 86 ret void 87 } 88 89 90 91 ; CHECK: test_pos8_ir_sle 92 ; CHECK: loop0 93 ; a < b 94 define void @test_pos8_ir_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 95 entry: 96 %cmp3 = icmp sle i32 16782, %b 97 br i1 %cmp3, label %for.body.lr.ph, label %for.end 98 99 for.body.lr.ph: ; preds = %entry 100 br label %for.body 101 102 for.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 114 for.end: ; preds = %for.body, %entry 115 ret void 116 } 117 118 119 120 ; CHECK: test_pos16_ir_sle 121 ; CHECK: loop0 122 ; a < b 123 define void @test_pos16_ir_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 124 entry: 125 %cmp3 = icmp sle i32 19097, %b 126 br i1 %cmp3, label %for.body.lr.ph, label %for.end 127 128 for.body.lr.ph: ; preds = %entry 129 br label %for.body 130 131 for.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 143 for.end: ; preds = %for.body, %entry 144 ret void 145 } 146 147 148 149 ; CHECK: test_pos1_ri_sle 150 ; CHECK: loop0 151 ; a < b 152 define void @test_pos1_ri_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 153 entry: 154 %cmp3 = icmp sle i32 %a, 14040 155 br i1 %cmp3, label %for.body.lr.ph, label %for.end 156 157 for.body.lr.ph: ; preds = %entry 158 br label %for.body 159 160 for.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 172 for.end: ; preds = %for.body, %entry 173 ret void 174 } 175 176 177 178 ; CHECK: test_pos2_ri_sle 179 ; CHECK: loop0 180 ; a < b 181 define void @test_pos2_ri_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 182 entry: 183 %cmp3 = icmp sle i32 %a, 13710 184 br i1 %cmp3, label %for.body.lr.ph, label %for.end 185 186 for.body.lr.ph: ; preds = %entry 187 br label %for.body 188 189 for.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 201 for.end: ; preds = %for.body, %entry 202 ret void 203 } 204 205 206 207 ; CHECK: test_pos4_ri_sle 208 ; CHECK: loop0 209 ; a < b 210 define void @test_pos4_ri_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 211 entry: 212 %cmp3 = icmp sle i32 %a, 9920 213 br i1 %cmp3, label %for.body.lr.ph, label %for.end 214 215 for.body.lr.ph: ; preds = %entry 216 br label %for.body 217 218 for.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 230 for.end: ; preds = %for.body, %entry 231 ret void 232 } 233 234 235 236 ; CHECK: test_pos8_ri_sle 237 ; CHECK: loop0 238 ; a < b 239 define void @test_pos8_ri_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 240 entry: 241 %cmp3 = icmp sle i32 %a, 18924 242 br i1 %cmp3, label %for.body.lr.ph, label %for.end 243 244 for.body.lr.ph: ; preds = %entry 245 br label %for.body 246 247 for.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 259 for.end: ; preds = %for.body, %entry 260 ret void 261 } 262 263 264 265 ; CHECK: test_pos16_ri_sle 266 ; CHECK: loop0 267 ; a < b 268 define void @test_pos16_ri_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 269 entry: 270 %cmp3 = icmp sle i32 %a, 11812 271 br i1 %cmp3, label %for.body.lr.ph, label %for.end 272 273 for.body.lr.ph: ; preds = %entry 274 br label %for.body 275 276 for.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 288 for.end: ; preds = %for.body, %entry 289 ret void 290 } 291 292 293 294 ; CHECK: test_pos1_rr_sle 295 ; CHECK: loop0 296 ; a < b 297 define void @test_pos1_rr_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 298 entry: 299 %cmp3 = icmp sle i32 %a, %b 300 br i1 %cmp3, label %for.body.lr.ph, label %for.end 301 302 for.body.lr.ph: ; preds = %entry 303 br label %for.body 304 305 for.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 317 for.end: ; preds = %for.body, %entry 318 ret void 319 } 320 321 322 323 ; CHECK: test_pos2_rr_sle 324 ; CHECK: loop0 325 ; a < b 326 define void @test_pos2_rr_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 327 entry: 328 %cmp3 = icmp sle i32 %a, %b 329 br i1 %cmp3, label %for.body.lr.ph, label %for.end 330 331 for.body.lr.ph: ; preds = %entry 332 br label %for.body 333 334 for.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 346 for.end: ; preds = %for.body, %entry 347 ret void 348 } 349 350 351 352 ; CHECK: test_pos4_rr_sle 353 ; CHECK: loop0 354 ; a < b 355 define void @test_pos4_rr_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 356 entry: 357 %cmp3 = icmp sle i32 %a, %b 358 br i1 %cmp3, label %for.body.lr.ph, label %for.end 359 360 for.body.lr.ph: ; preds = %entry 361 br label %for.body 362 363 for.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 375 for.end: ; preds = %for.body, %entry 376 ret void 377 } 378 379 380 381 ; CHECK: test_pos8_rr_sle 382 ; CHECK: loop0 383 ; a < b 384 define void @test_pos8_rr_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 385 entry: 386 %cmp3 = icmp sle i32 %a, %b 387 br i1 %cmp3, label %for.body.lr.ph, label %for.end 388 389 for.body.lr.ph: ; preds = %entry 390 br label %for.body 391 392 for.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 404 for.end: ; preds = %for.body, %entry 405 ret void 406 } 407 408 409 410 ; CHECK: test_pos16_rr_sle 411 ; CHECK: loop0 412 ; a < b 413 define void @test_pos16_rr_sle(i8* nocapture %p, i32 %a, i32 %b) nounwind { 414 entry: 415 %cmp3 = icmp sle i32 %a, %b 416 br i1 %cmp3, label %for.body.lr.ph, label %for.end 417 418 for.body.lr.ph: ; preds = %entry 419 br label %for.body 420 421 for.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 433 for.end: ; preds = %for.body, %entry 434 ret void 435 } 436 437 438 439