OLD | NEW |
(Empty) | |
| 1 ; RUIN: %llvm2ice -verbose inst %s | FileCheck %s |
| 2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 3 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s |
| 4 |
| 5 define i32 @Add(i32 %a, i32 %b) { |
| 6 ; CHECK: define i32 @Add |
| 7 entry: |
| 8 %add = add i32 %b, %a |
| 9 ; CHECK: add |
| 10 tail call void @Use(i32 %add) |
| 11 ; CHECK: call Use |
| 12 ret i32 %add |
| 13 } |
| 14 |
| 15 declare void @Use(i32) |
| 16 |
| 17 define i32 @And(i32 %a, i32 %b) { |
| 18 ; CHECK: define i32 @And |
| 19 entry: |
| 20 %and = and i32 %b, %a |
| 21 ; CHECK: and |
| 22 tail call void @Use(i32 %and) |
| 23 ; CHECK: call Use |
| 24 ret i32 %and |
| 25 } |
| 26 |
| 27 define i32 @Or(i32 %a, i32 %b) { |
| 28 ; CHECK: define i32 @Or |
| 29 entry: |
| 30 %or = or i32 %b, %a |
| 31 ; CHECK: or |
| 32 tail call void @Use(i32 %or) |
| 33 ; CHECK: call Use |
| 34 ret i32 %or |
| 35 } |
| 36 |
| 37 define i32 @Xor(i32 %a, i32 %b) { |
| 38 ; CHECK: define i32 @Xor |
| 39 entry: |
| 40 %xor = xor i32 %b, %a |
| 41 ; CHECK: xor |
| 42 tail call void @Use(i32 %xor) |
| 43 ; CHECK: call Use |
| 44 ret i32 %xor |
| 45 } |
| 46 |
| 47 define i32 @Sub(i32 %a, i32 %b) { |
| 48 ; CHECK: define i32 @Sub |
| 49 entry: |
| 50 %sub = sub i32 %a, %b |
| 51 ; CHECK: sub |
| 52 tail call void @Use(i32 %sub) |
| 53 ; CHECK: call Use |
| 54 ret i32 %sub |
| 55 } |
| 56 |
| 57 define i32 @Mul(i32 %a, i32 %b) { |
| 58 ; CHECK: define i32 @Mul |
| 59 entry: |
| 60 %mul = mul i32 %b, %a |
| 61 ; CHECK: imul |
| 62 tail call void @Use(i32 %mul) |
| 63 ; CHECK: call Use |
| 64 ret i32 %mul |
| 65 } |
| 66 |
| 67 define i32 @Sdiv(i32 %a, i32 %b) { |
| 68 ; CHECK: define i32 @Sdiv |
| 69 entry: |
| 70 %div = sdiv i32 %a, %b |
| 71 ; CHECK: cdq |
| 72 ; CHECK: idiv |
| 73 tail call void @Use(i32 %div) |
| 74 ; CHECK: call Use |
| 75 ret i32 %div |
| 76 } |
| 77 |
| 78 define i32 @Srem(i32 %a, i32 %b) { |
| 79 ; CHECK: define i32 @Srem |
| 80 entry: |
| 81 %rem = srem i32 %a, %b |
| 82 ; CHECK: cdq |
| 83 ; CHECK: idiv |
| 84 tail call void @Use(i32 %rem) |
| 85 ; CHECK: call Use |
| 86 ret i32 %rem |
| 87 } |
| 88 |
| 89 define i32 @Udiv(i32 %a, i32 %b) { |
| 90 ; CHECK: define i32 @Udiv |
| 91 entry: |
| 92 %div = udiv i32 %a, %b |
| 93 ; CHECK: div |
| 94 tail call void @Use(i32 %div) |
| 95 ; CHECK: call Use |
| 96 ret i32 %div |
| 97 } |
| 98 |
| 99 define i32 @Urem(i32 %a, i32 %b) { |
| 100 ; CHECK: define i32 @Urem |
| 101 entry: |
| 102 %rem = urem i32 %a, %b |
| 103 ; CHECK: div |
| 104 tail call void @Use(i32 %rem) |
| 105 ; CHECK: call Use |
| 106 ret i32 %rem |
| 107 } |
| 108 |
| 109 ; ERRORS-NOT: ICE translation error |
| 110 ; DUMP-NOT: SZ |
OLD | NEW |