1 ; RUN: llc -march=hexagon -O3 < %s | FileCheck %s 2 3 ; CHECK-LABEL: @test_pos1_ir_slt 4 ; CHECK: loop0 5 ; a < b 6 define void @test_pos1_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 7 entry: 8 %cmp3 = icmp slt i32 8531, %b 9 br i1 %cmp3, label %for.body.lr.ph, label %for.end 10 11 for.body.lr.ph: 12 br label %for.body 13 14 for.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 26 for.end: 27 ret void 28 } 29 30 ; CHECK-LABEL: @test_pos2_ir_slt 31 ; CHECK: loop0 32 ; a < b 33 define void @test_pos2_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 34 entry: 35 %cmp3 = icmp slt i32 9152, %b 36 br i1 %cmp3, label %for.body.lr.ph, label %for.end 37 38 for.body.lr.ph: 39 br label %for.body 40 41 for.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 53 for.end: 54 ret void 55 } 56 57 ; CHECK-LABEL: @test_pos4_ir_slt 58 ; CHECK: loop0 59 ; a < b 60 define void @test_pos4_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 61 entry: 62 %cmp3 = icmp slt i32 18851, %b 63 br i1 %cmp3, label %for.body.lr.ph, label %for.end 64 65 for.body.lr.ph: 66 br label %for.body 67 68 for.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 80 for.end: 81 ret void 82 } 83 84 ; CHECK-LABEL: @test_pos8_ir_slt 85 ; CHECK: loop0 86 ; a < b 87 define void @test_pos8_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 88 entry: 89 %cmp3 = icmp slt i32 25466, %b 90 br i1 %cmp3, label %for.body.lr.ph, label %for.end 91 92 for.body.lr.ph: 93 br label %for.body 94 95 for.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 107 for.end: 108 ret void 109 } 110 111 ; CHECK-LABEL: @test_pos16_ir_slt 112 ; CHECK: loop0 113 ; a < b 114 define void @test_pos16_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 115 entry: 116 %cmp3 = icmp slt i32 9295, %b 117 br i1 %cmp3, label %for.body.lr.ph, label %for.end 118 119 for.body.lr.ph: 120 br label %for.body 121 122 for.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 134 for.end: 135 ret void 136 } 137 138 ; CHECK-LABEL: @test_pos1_ri_slt 139 ; CHECK: loop0 140 ; a < b 141 define void @test_pos1_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 142 entry: 143 %cmp3 = icmp slt i32 %a, 31236 144 br i1 %cmp3, label %for.body.lr.ph, label %for.end 145 146 for.body.lr.ph: 147 br label %for.body 148 149 for.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 161 for.end: 162 ret void 163 } 164 165 ; CHECK-LABEL: @test_pos2_ri_slt 166 ; CHECK: loop0 167 ; a < b 168 define void @test_pos2_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 169 entry: 170 %cmp3 = icmp slt i32 %a, 22653 171 br i1 %cmp3, label %for.body.lr.ph, label %for.end 172 173 for.body.lr.ph: 174 br label %for.body 175 176 for.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 188 for.end: 189 ret void 190 } 191 192 ; CHECK-LABEL: @test_pos4_ri_slt 193 ; CHECK: loop0 194 ; a < b 195 define void @test_pos4_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 196 entry: 197 %cmp3 = icmp slt i32 %a, 1431 198 br i1 %cmp3, label %for.body.lr.ph, label %for.end 199 200 for.body.lr.ph: 201 br label %for.body 202 203 for.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 215 for.end: 216 ret void 217 } 218 219 ; CHECK-LABEL: @test_pos8_ri_slt 220 ; CHECK: loop0 221 ; a < b 222 define void @test_pos8_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 223 entry: 224 %cmp3 = icmp slt i32 %a, 22403 225 br i1 %cmp3, label %for.body.lr.ph, label %for.end 226 227 for.body.lr.ph: 228 br label %for.body 229 230 for.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 242 for.end: 243 ret void 244 } 245 246 ; CHECK-LABEL: @test_pos16_ri_slt 247 ; CHECK: loop0 248 ; a < b 249 define void @test_pos16_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 250 entry: 251 %cmp3 = icmp slt i32 %a, 21715 252 br i1 %cmp3, label %for.body.lr.ph, label %for.end 253 254 for.body.lr.ph: 255 br label %for.body 256 257 for.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 269 for.end: 270 ret void 271 } 272 273 ; CHECK-LABEL: @test_pos1_rr_slt 274 ; CHECK: loop0 275 ; a < b 276 define void @test_pos1_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 277 entry: 278 %cmp3 = icmp slt i32 %a, %b 279 br i1 %cmp3, label %for.body.lr.ph, label %for.end 280 281 for.body.lr.ph: 282 br label %for.body 283 284 for.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 296 for.end: 297 ret void 298 } 299 300 ; CHECK-LABEL: @test_pos2_rr_slt 301 ; CHECK: loop0 302 ; a < b 303 define void @test_pos2_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 304 entry: 305 %cmp3 = icmp slt i32 %a, %b 306 br i1 %cmp3, label %for.body.lr.ph, label %for.end 307 308 for.body.lr.ph: 309 br label %for.body 310 311 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, 2 320 %cmp = icmp slt i32 %inc, %b 321 br i1 %cmp, label %for.body, label %for.end 322 323 for.end: 324 ret void 325 } 326 327 ; CHECK-LABEL: @test_pos4_rr_slt 328 ; CHECK: loop0 329 ; a < b 330 define void @test_pos4_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 331 entry: 332 %cmp3 = icmp slt i32 %a, %b 333 br i1 %cmp3, label %for.body.lr.ph, label %for.end 334 335 for.body.lr.ph: 336 br label %for.body 337 338 for.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 350 for.end: 351 ret void 352 } 353 354 ; CHECK-LABEL: @test_pos8_rr_slt 355 ; CHECK: loop0 356 ; a < b 357 define void @test_pos8_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 358 entry: 359 %cmp3 = icmp slt i32 %a, %b 360 br i1 %cmp3, label %for.body.lr.ph, label %for.end 361 362 for.body.lr.ph: 363 br label %for.body 364 365 for.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 377 for.end: 378 ret void 379 } 380 381 ; CHECK-LABEL: @test_pos16_rr_slt 382 ; CHECK: loop0 383 ; a < b 384 define void @test_pos16_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind { 385 entry: 386 %cmp3 = icmp slt i32 %a, %b 387 br i1 %cmp3, label %for.body.lr.ph, label %for.end 388 389 for.body.lr.ph: 390 br label %for.body 391 392 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, 16 401 %cmp = icmp slt i32 %inc, %b 402 br i1 %cmp, label %for.body, label %for.end 403 404 for.end: 405 ret void 406 } 407 408 409 410