OLD | NEW |
1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter. | 1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter. |
2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX. | 2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX. |
3 ; This assumes that EAX is chosen as the first free register in O2 mode. | 3 ; This assumes that EAX is chosen as the first free register in O2 mode. |
4 | 4 |
5 ; RUN: %p2i -i %s --args -O2 --verbose none \ | 5 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
7 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 7 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
8 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | 8 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s |
9 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s | 9 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s |
10 | 10 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 ; CHECK: 69 c0 00 04 00 00 imul eax, eax, 1024 | 247 ; CHECK: 69 c0 00 04 00 00 imul eax, eax, 1024 |
248 | 248 |
249 define internal i32 @testMul32Imm16Neg(i32 %arg) { | 249 define internal i32 @testMul32Imm16Neg(i32 %arg) { |
250 entry: | 250 entry: |
251 %result = mul i32 %arg, -256 | 251 %result = mul i32 %arg, -256 |
252 ret i32 %result | 252 ret i32 %result |
253 } | 253 } |
254 ; CHECK-LABEL: testMul32Imm16Neg | 254 ; CHECK-LABEL: testMul32Imm16Neg |
255 ; CHECK: 69 c0 00 ff ff ff imul eax, eax, 4294967040 | 255 ; CHECK: 69 c0 00 ff ff ff imul eax, eax, 4294967040 |
256 | 256 |
| 257 ; The GPR shift instructions either allow an 8-bit immediate or |
| 258 ; have a special encoding for "1". |
| 259 define internal i32 @testShl16Imm8(i32 %arg) { |
| 260 entry: |
| 261 %arg_i16 = trunc i32 %arg to i16 |
| 262 %tmp = shl i16 %arg_i16, 13 |
| 263 %result = zext i16 %tmp to i32 |
| 264 ret i32 %result |
| 265 } |
| 266 ; CHECK-LABEL: testShl16Imm8 |
| 267 ; CHECK: 66 c1 e0 0d shl ax, 13 |
| 268 |
| 269 define internal i32 @testShl16Imm1(i32 %arg) { |
| 270 entry: |
| 271 %arg_i16 = trunc i32 %arg to i16 |
| 272 %tmp = shl i16 %arg_i16, 1 |
| 273 %result = zext i16 %tmp to i32 |
| 274 ret i32 %result |
| 275 } |
| 276 ; CHECK-LABEL: testShl16Imm1 |
| 277 ; CHECK: 66 d1 e0 shl ax |
| 278 |
257 ; ERRORS-NOT: ICE translation error | 279 ; ERRORS-NOT: ICE translation error |
258 ; DUMP-NOT: SZ | 280 ; DUMP-NOT: SZ |
OLD | NEW |