Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: tests_lit/assembler/x86/immediate_encodings.ll

Issue 476323004: Start adding an integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: make fixups part of address Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/llvm2ice.cpp ('k') | tests_lit/llvm2ice_tests/align-spill-locations.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
3 ; This assumes that EAX is chosen as the first free register in O2 mode.
4
5 ; RUN: %llvm2ice -O2 --verbose none %s \
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
8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
11 ; RUN: | FileCheck --check-prefix=DUMP %s
12
13 define internal i32 @testXor8Imm(i32 %arg) {
14 entry:
15 %arg_i8 = trunc i32 %arg to i8
16 %result_i8 = xor i8 %arg_i8, 127
17 %result = zext i8 %result_i8 to i32
18 ret i32 %result
19 }
20 ; CHECK-LABEL: testXor8Imm
21 ; CHECK: 34 7f xor al, 127
22
23 define internal i32 @testXor8ImmNeg(i32 %arg) {
24 entry:
25 %arg_i8 = trunc i32 %arg to i8
26 %result_i8 = xor i8 %arg_i8, -128
27 %result = zext i8 %result_i8 to i32
28 ret i32 %result
29 }
30 ; CHECK-LABEL: testXor8ImmNeg
31 ; CHECK: 34 80 xor al, -128
32
33 define internal i32 @testXor8ImmGeneral(i32 %arg, i32 %arg2, i32 %arg3) {
34 entry:
35 %arg_i8 = trunc i32 %arg to i8
36 %arg2_i8 = trunc i32 %arg2 to i8
37 %arg3_i8 = trunc i32 %arg3 to i8
38 %x1 = xor i8 %arg_i8, 127
39 %x2 = xor i8 %arg2_i8, 127
40 %x3 = xor i8 %arg3_i8, 127
41 %x4 = add i8 %x1, %x2
42 %x5 = add i8 %x4, %x3
43 %result = zext i8 %x5 to i32
44 ret i32 %result
45 }
46 ; CHECK-LABEL: testXor8ImmGeneral
47 ; CHECK: 80 f1 7f xor {{[^a]}}l, 127
48
49 define internal i32 @testXor32Imm8(i32 %arg) {
50 entry:
51 %result = xor i32 %arg, 127
52 ret i32 %result
53 }
54 ; CHECK-LABEL: testXor32Imm8
55 ; CHECK: 83 f0 7f xor eax, 127
56
57 define internal i32 @testXor32Imm8Neg(i32 %arg) {
58 entry:
59 %result = xor i32 %arg, -128
60 ret i32 %result
61 }
62 ; CHECK-LABEL: testXor32Imm8Neg
63 ; CHECK: 83 f0 80 xor eax, -128
64
65 define internal i32 @testXor32ImmEax(i32 %arg) {
66 entry:
67 %result = xor i32 %arg, 16777216
68 ret i32 %result
69 }
70 ; CHECK-LABEL: testXor32ImmEax
71 ; CHECK: 35 00 00 00 01 xor eax, 16777216
72
73 define internal i32 @testXor32ImmNegEax(i32 %arg) {
74 entry:
75 %result = xor i32 %arg, -256
76 ret i32 %result
77 }
78 ; CHECK-LABEL: testXor32ImmNegEax
79 ; CHECK: 35 00 ff ff ff xor eax, 4294967040
80
81 define internal i32 @testXor32ImmGeneral(i32 %arg, i32 %arg2, i32 %arg3) {
82 entry:
83 %x = xor i32 %arg, 32767
84 %x2 = xor i32 %arg2, 32767
85 %x3 = xor i32 %arg3, 32767
86 %add1 = add i32 %x, %x2
87 %add2 = add i32 %add1, %x3
88 ret i32 %add2
89 }
90 ; CHECK-LABEL: testXor32ImmGeneral
91 ; CHECK: 81 f1 ff 7f 00 00 xor e{{[^a]}}x, 32767
92
93 ; ERRORS-NOT: ICE translation error
94 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/llvm2ice.cpp ('k') | tests_lit/llvm2ice_tests/align-spill-locations.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698