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