| 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 -filetype=obj \ | 6 ; RUN: | llvm-mc -triple=i686-none-nacl -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 | 8 |
| 9 define internal i32 @testXor8Imm8(i32 %arg) { | 9 define internal i32 @testXor8Imm8(i32 %arg) { |
| 10 entry: | 10 entry: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 ; CHECK: 66 83 f0 7f xor ax, 127 | 53 ; CHECK: 66 83 f0 7f xor ax, 127 |
| 54 | 54 |
| 55 define internal i32 @testXor16Imm8Neg(i32 %arg) { | 55 define internal i32 @testXor16Imm8Neg(i32 %arg) { |
| 56 entry: | 56 entry: |
| 57 %arg_i16 = trunc i32 %arg to i16 | 57 %arg_i16 = trunc i32 %arg to i16 |
| 58 %result_i16 = xor i16 %arg_i16, -128 | 58 %result_i16 = xor i16 %arg_i16, -128 |
| 59 %result = zext i16 %result_i16 to i32 | 59 %result = zext i16 %result_i16 to i32 |
| 60 ret i32 %result | 60 ret i32 %result |
| 61 } | 61 } |
| 62 ; CHECK-LABEL: testXor16Imm8Neg | 62 ; CHECK-LABEL: testXor16Imm8Neg |
| 63 ; CHECK: 66 83 f0 80 xor ax, 128 | 63 ; CHECK: 66 83 f0 80 xor ax, -128 |
| 64 | 64 |
| 65 define internal i32 @testXor16Imm16Eax(i32 %arg) { | 65 define internal i32 @testXor16Imm16Eax(i32 %arg) { |
| 66 entry: | 66 entry: |
| 67 %arg_i16 = trunc i32 %arg to i16 | 67 %arg_i16 = trunc i32 %arg to i16 |
| 68 %tmp = xor i16 %arg_i16, 1024 | 68 %tmp = xor i16 %arg_i16, 1024 |
| 69 %result_i16 = add i16 %tmp, 1 | 69 %result_i16 = add i16 %tmp, 1 |
| 70 %result = zext i16 %result_i16 to i32 | 70 %result = zext i16 %result_i16 to i32 |
| 71 ret i32 %result | 71 ret i32 %result |
| 72 } | 72 } |
| 73 ; CHECK-LABEL: testXor16Imm16Eax | 73 ; CHECK-LABEL: testXor16Imm16Eax |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 define internal i32 @testMul16Imm8Neg(i32 %arg) { | 187 define internal i32 @testMul16Imm8Neg(i32 %arg) { |
| 188 entry: | 188 entry: |
| 189 %arg_i16 = trunc i32 %arg to i16 | 189 %arg_i16 = trunc i32 %arg to i16 |
| 190 %tmp = mul i16 %arg_i16, -111 | 190 %tmp = mul i16 %arg_i16, -111 |
| 191 %result_i16 = add i16 %tmp, 1 | 191 %result_i16 = add i16 %tmp, 1 |
| 192 %result = zext i16 %result_i16 to i32 | 192 %result = zext i16 %result_i16 to i32 |
| 193 ret i32 %result | 193 ret i32 %result |
| 194 } | 194 } |
| 195 ; CHECK-LABEL: testMul16Imm8Neg | 195 ; CHECK-LABEL: testMul16Imm8Neg |
| 196 ; CHECK: 66 6b c0 91 imul ax, ax, 145 | 196 ; CHECK: 66 6b c0 91 imul ax, ax, -111 |
| 197 ; CHECK-NEXT: add ax, 1 | 197 ; CHECK-NEXT: add ax, 1 |
| 198 | 198 |
| 199 define internal i32 @testMul16Imm16(i32 %arg) { | 199 define internal i32 @testMul16Imm16(i32 %arg) { |
| 200 entry: | 200 entry: |
| 201 %arg_i16 = trunc i32 %arg to i16 | 201 %arg_i16 = trunc i32 %arg to i16 |
| 202 %tmp = mul i16 %arg_i16, 1024 | 202 %tmp = mul i16 %arg_i16, 1024 |
| 203 %result_i16 = add i16 %tmp, 1 | 203 %result_i16 = add i16 %tmp, 1 |
| 204 %result = zext i16 %result_i16 to i32 | 204 %result = zext i16 %result_i16 to i32 |
| 205 ret i32 %result | 205 ret i32 %result |
| 206 } | 206 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false) | 301 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false) |
| 302 %res1 = add i64 %r, %r2 | 302 %res1 = add i64 %r, %r2 |
| 303 %res2 = add i64 %r3, %r4 | 303 %res2 = add i64 %r3, %r4 |
| 304 %res = add i64 %res1, %res2 | 304 %res = add i64 %res1, %res2 |
| 305 ret i64 %res | 305 ret i64 %res |
| 306 } | 306 } |
| 307 ; CHECK-LABEL: test_via_ctlz_64 | 307 ; CHECK-LABEL: test_via_ctlz_64 |
| 308 ; CHECK-DAG: 85 c0 test eax, eax | 308 ; CHECK-DAG: 85 c0 test eax, eax |
| 309 ; CHECK-DAG: 85 db test ebx, ebx | 309 ; CHECK-DAG: 85 db test ebx, ebx |
| 310 ; CHECK-DAG: 85 f6 test esi, esi | 310 ; CHECK-DAG: 85 f6 test esi, esi |
| OLD | NEW |