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

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: lit test to check encodings, swap complexi8 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
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 @testXorImm8(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: testXorImm8
21 ; CHECK: 34 7f xor al, 127
22
23 define internal i32 @testXorImm8Neg(i32 %arg) {
24 entry:
25 %arg_i8 = trunc i32 %arg to i8
26 %result_i8 = xor i8 %arg_i8, -56
27 %result = zext i8 %result_i8 to i32
28 ret i32 %result
29 }
30 ; CHECK-LABEL: testXorImm8Neg
31 ; CHECK: 34 c8 xor al, -56
32
33 define internal i32 @testXor32Imm8(i32 %arg) {
34 entry:
35 %result = xor i32 %arg, 127
36 ret i32 %result
37 }
38 ; CHECK-LABEL: testXor32Imm8
39 ; CHECK: 83 f0 7f xor eax, 127
40
41 define internal i32 @testXor32ImmEax(i32 %arg) {
42 entry:
43 %result = xor i32 %arg, 32767
44 ret i32 %result
45 }
46 ; CHECK-LABEL: testXor32ImmEax
47 ; CHECK: 35 ff 7f 00 00 xor eax, 32767
48
49 define internal i32 @testXor32ImmGeneral(i32 %arg, i32 %arg2, i32 %arg3) {
50 entry:
51 %x = xor i32 %arg, 32767
52 %x2 = xor i32 %arg2, 32767
53 %x3 = xor i32 %arg3, 32767
54 %add1 = add i32 %x, %x2
55 %add2 = add i32 %add1, %x3
56 ret i32 %add2
57 }
58 ; CHECK-LABEL: testXor32ImmGeneral
59 ; CHECK: 81 f1 ff 7f 00 00 xor e{{[^a]}}x, 32767
60
61 ; ERRORS-NOT: ICE translation error
62 ; DUMP-NOT: SZ
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698