| OLD | NEW |
| 1 ; This tries to be a comprehensive test of i8 operations. | 1 ; This tries to be a comprehensive test of i8 operations. |
| 2 | 2 |
| 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ | 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ |
| 4 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 4 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ |
| 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 7 | 7 |
| 8 ; The following tests i8 srem/urem lowering on x86-64, specifically that the %ah |
| 9 ; result gets copied into %al/%bl/%cl/%dl before moved into its final register. |
| 10 ; This extra copy is forced by excluding al/bl/cl/dl by default (-reg-exclude), |
| 11 ; but allowing them to be used if absolutely necessary (-reg-reserve). |
| 12 |
| 13 ; RUN: %p2i --target=x8664 --filetype=obj --disassemble -i %s --args -O2 \ |
| 14 ; RUN: -reg-exclude=al,bl,cl,dl -reg-reserve \ |
| 15 ; RUN: -allow-externally-defined-symbols | FileCheck %s --check-prefix=REM |
| 16 |
| 8 declare void @useInt(i32 %x) | 17 declare void @useInt(i32 %x) |
| 9 | 18 |
| 10 define internal i32 @add8Bit(i32 %a, i32 %b) { | 19 define internal i32 @add8Bit(i32 %a, i32 %b) { |
| 11 entry: | 20 entry: |
| 12 %a_8 = trunc i32 %a to i8 | 21 %a_8 = trunc i32 %a to i8 |
| 13 %b_8 = trunc i32 %b to i8 | 22 %b_8 = trunc i32 %b to i8 |
| 14 %add = add i8 %b_8, %a_8 | 23 %add = add i8 %b_8, %a_8 |
| 15 %ret = zext i8 %add to i32 | 24 %ret = zext i8 %add to i32 |
| 16 ret i32 %ret | 25 ret i32 %ret |
| 17 } | 26 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 define internal i32 @urem8Bit(i32 %a, i32 %b) { | 105 define internal i32 @urem8Bit(i32 %a, i32 %b) { |
| 97 entry: | 106 entry: |
| 98 %a_8 = trunc i32 %a to i8 | 107 %a_8 = trunc i32 %a to i8 |
| 99 %b_8 = trunc i32 %b to i8 | 108 %b_8 = trunc i32 %b to i8 |
| 100 %urem = urem i8 %b_8, %a_8 | 109 %urem = urem i8 %b_8, %a_8 |
| 101 %ret = zext i8 %urem to i32 | 110 %ret = zext i8 %urem to i32 |
| 102 ret i32 %ret | 111 ret i32 %ret |
| 103 } | 112 } |
| 104 ; CHECK-LABEL: urem8Bit | 113 ; CHECK-LABEL: urem8Bit |
| 105 ; CHECK: div {{[abcd]l|BYTE PTR}} | 114 ; CHECK: div {{[abcd]l|BYTE PTR}} |
| 115 ; REM-LABEL: urem8Bit |
| 116 ; REM: div |
| 117 ; REM-NEXT: mov {{[abcd]}}l,ah |
| 106 | 118 |
| 107 define internal i32 @urem8BitConst(i32 %a) { | 119 define internal i32 @urem8BitConst(i32 %a) { |
| 108 entry: | 120 entry: |
| 109 %a_8 = trunc i32 %a to i8 | 121 %a_8 = trunc i32 %a to i8 |
| 110 %urem = urem i8 %a_8, 123 | 122 %urem = urem i8 %a_8, 123 |
| 111 %ret = zext i8 %urem to i32 | 123 %ret = zext i8 %urem to i32 |
| 112 ret i32 %ret | 124 ret i32 %ret |
| 113 } | 125 } |
| 114 ; CHECK-LABEL: urem8BitConst | 126 ; CHECK-LABEL: urem8BitConst |
| 115 ; CHECK: div {{[abcd]l|BYTE PTR}} | 127 ; CHECK: div {{[abcd]l|BYTE PTR}} |
| 128 ; REM-LABEL: urem8BitConst |
| 116 | 129 |
| 117 | 130 |
| 118 define internal i32 @sdiv8Bit(i32 %a, i32 %b) { | 131 define internal i32 @sdiv8Bit(i32 %a, i32 %b) { |
| 119 entry: | 132 entry: |
| 120 %a_8 = trunc i32 %a to i8 | 133 %a_8 = trunc i32 %a to i8 |
| 121 %b_8 = trunc i32 %b to i8 | 134 %b_8 = trunc i32 %b to i8 |
| 122 %sdiv = sdiv i8 %b_8, %a_8 | 135 %sdiv = sdiv i8 %b_8, %a_8 |
| 123 %ret = zext i8 %sdiv to i32 | 136 %ret = zext i8 %sdiv to i32 |
| 124 ret i32 %ret | 137 ret i32 %ret |
| 125 } | 138 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 139 define internal i32 @srem8Bit(i32 %a, i32 %b) { | 152 define internal i32 @srem8Bit(i32 %a, i32 %b) { |
| 140 entry: | 153 entry: |
| 141 %a_8 = trunc i32 %a to i8 | 154 %a_8 = trunc i32 %a to i8 |
| 142 %b_8 = trunc i32 %b to i8 | 155 %b_8 = trunc i32 %b to i8 |
| 143 %srem = srem i8 %b_8, %a_8 | 156 %srem = srem i8 %b_8, %a_8 |
| 144 %ret = zext i8 %srem to i32 | 157 %ret = zext i8 %srem to i32 |
| 145 ret i32 %ret | 158 ret i32 %ret |
| 146 } | 159 } |
| 147 ; CHECK-LABEL: srem8Bit | 160 ; CHECK-LABEL: srem8Bit |
| 148 ; CHECK: idiv {{[abcd]l|BYTE PTR}} | 161 ; CHECK: idiv {{[abcd]l|BYTE PTR}} |
| 162 ; REM-LABEL: srem8Bit |
| 163 ; REM: idiv |
| 164 ; REM-NEXT: mov {{[abcd]}}l,ah |
| 149 | 165 |
| 150 define internal i32 @srem8BitConst(i32 %a) { | 166 define internal i32 @srem8BitConst(i32 %a) { |
| 151 entry: | 167 entry: |
| 152 %a_8 = trunc i32 %a to i8 | 168 %a_8 = trunc i32 %a to i8 |
| 153 %srem = srem i8 %a_8, 123 | 169 %srem = srem i8 %a_8, 123 |
| 154 %ret = zext i8 %srem to i32 | 170 %ret = zext i8 %srem to i32 |
| 155 ret i32 %ret | 171 ret i32 %ret |
| 156 } | 172 } |
| 157 ; CHECK-LABEL: srem8BitConst | 173 ; CHECK-LABEL: srem8BitConst |
| 158 ; CHECK: idiv {{[abcd]l|BYTE PTR}} | 174 ; CHECK: idiv {{[abcd]l|BYTE PTR}} |
| 175 ; REM-LABEL: srem8BitConst |
| 159 | 176 |
| 160 define internal i32 @shl8Bit(i32 %a, i32 %b) { | 177 define internal i32 @shl8Bit(i32 %a, i32 %b) { |
| 161 entry: | 178 entry: |
| 162 %a_8 = trunc i32 %a to i8 | 179 %a_8 = trunc i32 %a to i8 |
| 163 %b_8 = trunc i32 %b to i8 | 180 %b_8 = trunc i32 %b to i8 |
| 164 %shl = shl i8 %b_8, %a_8 | 181 %shl = shl i8 %b_8, %a_8 |
| 165 %ret = zext i8 %shl to i32 | 182 %ret = zext i8 %shl to i32 |
| 166 ret i32 %ret | 183 ret i32 %ret |
| 167 } | 184 } |
| 168 ; CHECK-LABEL: shl8Bit | 185 ; CHECK-LABEL: shl8Bit |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}} | 383 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}} |
| 367 | 384 |
| 368 define void @store_i8_const(i32 %addr_arg) { | 385 define void @store_i8_const(i32 %addr_arg) { |
| 369 entry: | 386 entry: |
| 370 %addr = inttoptr i32 %addr_arg to i8* | 387 %addr = inttoptr i32 %addr_arg to i8* |
| 371 store i8 123, i8* %addr, align 1 | 388 store i8 123, i8* %addr, align 1 |
| 372 ret void | 389 ret void |
| 373 } | 390 } |
| 374 ; CHECK-LABEL: store_i8_const | 391 ; CHECK-LABEL: store_i8_const |
| 375 ; CHECK: mov BYTE PTR {{.*}},0x7b | 392 ; CHECK: mov BYTE PTR {{.*}},0x7b |
| OLD | NEW |