OLD | NEW |
(Empty) | |
| 1 ; This tries to be a comprehensive test of i8 operations. |
| 2 |
| 3 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
| 4 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 5 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 6 ; RUN: %p2i -i %s --args -Om1 --verbose none \ |
| 7 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 8 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 9 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s |
| 10 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 11 |
| 12 define internal i32 @add8Bit(i32 %a, i32 %b) { |
| 13 entry: |
| 14 %a_8 = trunc i32 %a to i8 |
| 15 %b_8 = trunc i32 %b to i8 |
| 16 %add = add i8 %b_8, %a_8 |
| 17 %ret = zext i8 %add to i32 |
| 18 ret i32 %ret |
| 19 } |
| 20 ; CHECK-LABEL: add8Bit |
| 21 ; CHECK: add {{[abcd]l}} |
| 22 |
| 23 define internal i32 @add8BitConst(i32 %a, i32 %b) { |
| 24 entry: |
| 25 %a_8 = trunc i32 %a to i8 |
| 26 %add = add i8 %a_8, 123 |
| 27 %ret = zext i8 %add to i32 |
| 28 ret i32 %ret |
| 29 } |
| 30 ; CHECK-LABEL: add8BitConst |
| 31 ; CHECK: add {{[abcd]l}} |
| 32 |
| 33 define internal i32 @sub8Bit(i32 %a, i32 %b) { |
| 34 entry: |
| 35 %a_8 = trunc i32 %a to i8 |
| 36 %b_8 = trunc i32 %b to i8 |
| 37 %sub = sub i8 %b_8, %a_8 |
| 38 %ret = zext i8 %sub to i32 |
| 39 ret i32 %ret |
| 40 } |
| 41 ; CHECK-LABEL: sub8Bit |
| 42 ; XCHECK: sub {{[abcd]l}} |
| 43 |
| 44 define internal i32 @sub8BitConst(i32 %a, i32 %b) { |
| 45 entry: |
| 46 %a_8 = trunc i32 %a to i8 |
| 47 %sub = sub i8 %a_8, 123 |
| 48 %ret = zext i8 %sub to i32 |
| 49 ret i32 %ret |
| 50 } |
| 51 ; CHECK-LABEL: sub8BitConst |
| 52 ; XCHECK: sub {{[abcd]l}} |
| 53 |
| 54 define internal i32 @mul8Bit(i32 %a, i32 %b) { |
| 55 entry: |
| 56 %a_8 = trunc i32 %a to i8 |
| 57 %b_8 = trunc i32 %b to i8 |
| 58 %mul = mul i8 %b_8, %a_8 |
| 59 %ret = zext i8 %mul to i32 |
| 60 ret i32 %ret |
| 61 } |
| 62 ; CHECK-LABEL: mul8Bit |
| 63 ; CHECK: mul {{[abcd]l|byte ptr}} |
| 64 |
| 65 define internal i32 @mul8BitConst(i32 %a, i32 %b) { |
| 66 entry: |
| 67 %a_8 = trunc i32 %a to i8 |
| 68 %mul = mul i8 %a_8, 56 |
| 69 %ret = zext i8 %mul to i32 |
| 70 ret i32 %ret |
| 71 } |
| 72 ; CHECK-LABEL: mul8BitConst |
| 73 ; 8-bit imul only accepts r/m, not imm |
| 74 ; CHECK: mov {{.*}}, 56 |
| 75 ; CHECK: mul {{[abcd]l|byte ptr}} |
| 76 |
| 77 define internal i32 @udiv8Bit(i32 %a, i32 %b) { |
| 78 entry: |
| 79 %a_8 = trunc i32 %a to i8 |
| 80 %b_8 = trunc i32 %b to i8 |
| 81 %udiv = udiv i8 %b_8, %a_8 |
| 82 %ret = zext i8 %udiv to i32 |
| 83 ret i32 %ret |
| 84 } |
| 85 ; CHECK-LABEL: udiv8Bit |
| 86 ; CHECK: div {{[abcd]l|byte ptr}} |
| 87 |
| 88 define internal i32 @udiv8BitConst(i32 %a, i32 %b) { |
| 89 entry: |
| 90 %a_8 = trunc i32 %a to i8 |
| 91 %udiv = udiv i8 %a_8, 123 |
| 92 %ret = zext i8 %udiv to i32 |
| 93 ret i32 %ret |
| 94 } |
| 95 ; CHECK-LABEL: udiv8BitConst |
| 96 ; CHECK: div {{[abcd]l|byte ptr}} |
| 97 |
| 98 define internal i32 @urem8Bit(i32 %a, i32 %b) { |
| 99 entry: |
| 100 %a_8 = trunc i32 %a to i8 |
| 101 %b_8 = trunc i32 %b to i8 |
| 102 %urem = urem i8 %b_8, %a_8 |
| 103 %ret = zext i8 %urem to i32 |
| 104 ret i32 %ret |
| 105 } |
| 106 ; CHECK-LABEL: urem8Bit |
| 107 ; CHECK: div {{[abcd]l|byte ptr}} |
| 108 |
| 109 define internal i32 @urem8BitConst(i32 %a, i32 %b) { |
| 110 entry: |
| 111 %a_8 = trunc i32 %a to i8 |
| 112 %urem = urem i8 %a_8, 123 |
| 113 %ret = zext i8 %urem to i32 |
| 114 ret i32 %ret |
| 115 } |
| 116 ; CHECK-LABEL: urem8BitConst |
| 117 ; CHECK: div {{[abcd]l|byte ptr}} |
| 118 |
| 119 |
| 120 define internal i32 @sdiv8Bit(i32 %a, i32 %b) { |
| 121 entry: |
| 122 %a_8 = trunc i32 %a to i8 |
| 123 %b_8 = trunc i32 %b to i8 |
| 124 %sdiv = sdiv i8 %b_8, %a_8 |
| 125 %ret = zext i8 %sdiv to i32 |
| 126 ret i32 %ret |
| 127 } |
| 128 ; CHECK-LABEL: sdiv8Bit |
| 129 ; CHECK: idiv {{[abcd]l|byte ptr}} |
| 130 |
| 131 define internal i32 @sdiv8BitConst(i32 %a, i32 %b) { |
| 132 entry: |
| 133 %a_8 = trunc i32 %a to i8 |
| 134 %sdiv = sdiv i8 %a_8, 123 |
| 135 %ret = zext i8 %sdiv to i32 |
| 136 ret i32 %ret |
| 137 } |
| 138 ; CHECK-LABEL: sdiv8BitConst |
| 139 ; CHECK: idiv {{[abcd]l|byte ptr}} |
| 140 |
| 141 define internal i32 @srem8Bit(i32 %a, i32 %b) { |
| 142 entry: |
| 143 %a_8 = trunc i32 %a to i8 |
| 144 %b_8 = trunc i32 %b to i8 |
| 145 %srem = srem i8 %b_8, %a_8 |
| 146 %ret = zext i8 %srem to i32 |
| 147 ret i32 %ret |
| 148 } |
| 149 ; CHECK-LABEL: srem8Bit |
| 150 ; CHECK: idiv {{[abcd]l|byte ptr}} |
| 151 |
| 152 define internal i32 @srem8BitConst(i32 %a, i32 %b) { |
| 153 entry: |
| 154 %a_8 = trunc i32 %a to i8 |
| 155 %srem = srem i8 %a_8, 123 |
| 156 %ret = zext i8 %srem to i32 |
| 157 ret i32 %ret |
| 158 } |
| 159 ; CHECK-LABEL: srem8BitConst |
| 160 ; CHECK: idiv {{[abcd]l|byte ptr}} |
| 161 |
| 162 |
| 163 ; ERRORS-NOT: ICE translation error |
| 164 ; DUMP-NOT: SZ |
OLD | NEW |