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 26 matching lines...) Expand all Loading... | |
37 %x2 = xor i8 %arg2_i8, 127 | 37 %x2 = xor i8 %arg2_i8, 127 |
38 %x3 = xor i8 %arg3_i8, 127 | 38 %x3 = xor i8 %arg3_i8, 127 |
39 %x4 = add i8 %x1, %x2 | 39 %x4 = add i8 %x1, %x2 |
40 %x5 = add i8 %x4, %x3 | 40 %x5 = add i8 %x4, %x3 |
41 %result = zext i8 %x5 to i32 | 41 %result = zext i8 %x5 to i32 |
42 ret i32 %result | 42 ret i32 %result |
43 } | 43 } |
44 ; CHECK-LABEL: testXor8Imm8NotEAX | 44 ; CHECK-LABEL: testXor8Imm8NotEAX |
45 ; CHECK: 80 f{{[1-3]}} 7f xor {{[^a]}}l, 127 | 45 ; CHECK: 80 f{{[1-3]}} 7f xor {{[^a]}}l, 127 |
46 | 46 |
47 define internal i32 @testXor16Imm8(i32 %arg) { | |
48 entry: | |
49 %arg_i16 = trunc i32 %arg to i16 | |
50 %result_i16 = xor i16 %arg_i16, 127 | |
51 %result = zext i16 %result_i16 to i32 | |
52 ret i32 %result | |
53 } | |
54 ; CHECK-LABEL: testXor16Imm8 | |
55 ; CHECK: 66 83 f0 7f xor ax, 127 | |
56 | |
57 define internal i32 @testXor16Imm8Neg(i32 %arg) { | |
58 entry: | |
59 %arg_i16 = trunc i32 %arg to i16 | |
60 %result_i16 = xor i16 %arg_i16, -128 | |
61 %result = zext i16 %result_i16 to i32 | |
62 ret i32 %result | |
63 } | |
64 ; CHECK-LABEL: testXor16Imm8Neg | |
65 ; CHECK: 66 83 f0 80 xor ax, 128 | |
66 | |
67 define internal i32 @testXor16Imm16Eax(i32 %arg) { | |
68 entry: | |
69 %arg_i16 = trunc i32 %arg to i16 | |
70 %tmp = xor i16 %arg_i16, 1024 | |
71 %result_i16 = add i16 %tmp, 1 | |
72 %result = zext i16 %result_i16 to i32 | |
73 ret i32 %result | |
74 } | |
75 ; CHECK-LABEL: testXor16Imm16Eax | |
76 ; CHECK: 66 35 00 04 xor ax, 1024 | |
77 ; CHECK-NEXT: add ax, 1 | |
78 | |
79 define internal i32 @testXor16Imm16NegEax(i32 %arg) { | |
80 entry: | |
81 %arg_i16 = trunc i32 %arg to i16 | |
82 %tmp = xor i16 %arg_i16, -256 | |
83 %result_i16 = add i16 %tmp, 1 | |
84 %result = zext i16 %result_i16 to i32 | |
85 ret i32 %result | |
86 } | |
87 ; CHECK-LABEL: testXor16Imm16NegEax | |
88 ; CHECK: 66 35 00 ff xor ax, 65280 | |
Jim Stichnoth
2014/09/28 18:14:28
Oddly, this part works correctly in master.
jvoung (off chromium)
2014/09/29 01:16:56
I think that llvm-objdump semi-silently ignored th
| |
89 ; CHECK-NEXT: add ax, 1 | |
90 | |
91 define internal i32 @testXor16Imm16NotEAX(i32 %arg_i32, i32 %arg2_i32, i32 %arg3 _i32) { | |
92 entry: | |
93 %arg = trunc i32 %arg_i32 to i16 | |
94 %arg2 = trunc i32 %arg2_i32 to i16 | |
95 %arg3 = trunc i32 %arg3_i32 to i16 | |
96 %x = xor i16 %arg, 32767 | |
97 %x2 = xor i16 %arg2, 32767 | |
98 %x3 = xor i16 %arg3, 32767 | |
99 %add1 = add i16 %x, %x2 | |
100 %add2 = add i16 %add1, %x3 | |
101 %result = zext i16 %add2 to i32 | |
102 ret i32 %result | |
103 } | |
104 ; CHECK-LABEL: testXor16Imm16NotEAX | |
105 ; CHECK: 66 81 f{{[1-3]}} ff 7f xor {{[^a]}}x, 32767 | |
106 ; CHECK-NEXT: 66 81 f{{[1-3]}} ff 7f xor {{[^a]}}x, 32767 | |
107 | |
47 define internal i32 @testXor32Imm8(i32 %arg) { | 108 define internal i32 @testXor32Imm8(i32 %arg) { |
48 entry: | 109 entry: |
49 %result = xor i32 %arg, 127 | 110 %result = xor i32 %arg, 127 |
50 ret i32 %result | 111 ret i32 %result |
51 } | 112 } |
52 ; CHECK-LABEL: testXor32Imm8 | 113 ; CHECK-LABEL: testXor32Imm8 |
53 ; CHECK: 83 f0 7f xor eax, 127 | 114 ; CHECK: 83 f0 7f xor eax, 127 |
54 | 115 |
55 define internal i32 @testXor32Imm8Neg(i32 %arg) { | 116 define internal i32 @testXor32Imm8Neg(i32 %arg) { |
56 entry: | 117 entry: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 %arg_i8 = trunc i32 %arg to i8 | 166 %arg_i8 = trunc i32 %arg to i8 |
106 %result_i8 = sub i8 %arg_i8, 125 | 167 %result_i8 = sub i8 %arg_i8, 125 |
107 %result = zext i8 %result_i8 to i32 | 168 %result = zext i8 %result_i8 to i32 |
108 ret i32 %result | 169 ret i32 %result |
109 } | 170 } |
110 ; CHECK-LABEL: testSub8Imm8 | 171 ; CHECK-LABEL: testSub8Imm8 |
111 ; CHECK: 2c 7d sub al, 125 | 172 ; CHECK: 2c 7d sub al, 125 |
112 | 173 |
113 ; ERRORS-NOT: ICE translation error | 174 ; ERRORS-NOT: ICE translation error |
114 ; DUMP-NOT: SZ | 175 ; DUMP-NOT: SZ |
OLD | NEW |