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

Side by Side Diff: tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll

Issue 1185703004: Add constant blinding/pooling option for X8632 code translation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Avoid calling randomizationOrPoolImmediate() multiple times on a same operand" Created 5 years, 6 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 ; This is a smoke test of constant blinding and constant pooling.
2
3 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
4 ; RUN: -sz-seed=1 -randomize-pool-immediates=ra ndomize \
Jim Stichnoth 2015/06/19 16:51:03 Reduce the indentation so lines don't exceed 80 co
qining 2015/06/19 20:22:26 Done.
5 ; RUN: | FileCheck %s --check-prefix=BLINDINGO2
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
7 ; RUN: -sz-seed=1 -randomize-pool-immediates=ra ndomize \
8 ; RUN: | FileCheck %s --check-prefix=BLINDINGOM1
9
10 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
11 ; RUN: -sz-seed=1 -randomize-pool-immediates=po ol \
12 ; RUN: | FileCheck %s --check-prefix=POOLING
13 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
14 ; RUN: -sz-seed=1 -randomize-pool-immediates=po ol \
15 ; RUN: | FileCheck %s --check-prefix=POOLING
16
17
18 define i32 @add_arg_plus_200000(i32 %arg) {
19 entry:
20 %res = add i32 200000, %arg
21 ret i32 %res
22
23 ; BLINDINGO2-LABEL: add_arg_plus_200000
24 ; BLINDINGO2: mov [[REG:e[a-z]*]],0x34ee7
25 ; BLINDINGO2-NEXT: lea [[REG]],{{[[]}}[[REG]]-0x41a7{{[]]}}
26
27 ; BLINDINGOM1-LABEL: add_arg_plus_200000
28 ; BLINDINGOM1: mov [[REG:e[a-z]*]],0x34ee7
29 ; BLINDINGOM1-NEXT: lea [[REG]],{{[[]}}[[REG]]-0x41a7{{[]]}}
30
31 ; POOLING-LABEL: add_arg_plus_200000
32 ; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{ [0-9]*}}
33 }
34
35 define float @load_arg_plus_200000(float* %arg) {
36 entry:
37 %arg.int = ptrtoint float* %arg to i32
38 %addr.int = add i32 %arg.int, 200000
39 %addr.ptr = inttoptr i32 %addr.int to float*
40 %addr.load = load float, float* %addr.ptr, align 4
41 ret float %addr.load
42 ; BLINDINGO2-LABEL: load_arg_plus_200000
43 ; BLINDINGO2: lea [[REG:e[a-z]*]],{{[[]}}{{e[a-z]*}}+0x34ee7{{[]]}}
44
45 ; BLINDINGOM1-LABEL: load_arg_plus_200000
46 ; BLINDINGOM1: lea [[REG:e[a-z]*]],{{[[]}}{{e[a-z]*}}-0x41a7{{[]]}}
47
48 ; POOLING-LABEL: load_arg_plus_200000
49 ; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{ [0-9]*}}
50 }
51
52 define i64 @add_arg_plus_64bits(i32 %arg) {
53 entry:
54 %0 = sext i32 %arg to i64
55 %res = add i64 90000000000, %0
56 ret i64 %res
57
58 ; BLINDINGO2-LABEL: add_arg_plus_64bits
59 ; BLINDINGO2: sar [[RHI:e[a-z]*]],0x1f
60 ; BLINDINGO2: mov [[RLO:e[a-z]*]],0xf46b45a7
61 ; BLINDINGO2-NEXT: lea [[RLO]],{{[[]}}[[RLO]]-0x41a7{{[]]}}
62
63 ; BLINDINGOM1-LABEL: add_arg_plus_64bits
64 ; BLINDINGOM1: sar [[RHI:e[a-z]*]],0x1f
65 ; BLINDINGOM1: mov [[RLO:e[a-z]*]],0xf46b45a7
66 ; BLINDINGOM1-NEXT: lea [[RLO]],{{[[]}}[[RLO]]-0x41a7{{[]]}}
67
68 ; POOLING-LABEL: add_arg_plus_64bits
69 ; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{ [0-9]*}}
70 }
71
72 define i64 @load_arg_plus_64bits(i64* %arg) {
73 entry:
74 %arg.int = ptrtoint i64* %arg to i32
75 %arg.new = add i32 %arg.int, 90000
76 %arg.ptr = inttoptr i32 %arg.new to i64*
77 %arg.load = load i64, i64* %arg.ptr, align 1
78 ret i64 %arg.load
79 }
80
81 define internal i32 @add_const_8bits(i32 %a) {
82 entry:
83 %a_8 = trunc i32 %a to i8
84 %add = add i8 %a_8, 123
85 %ret = zext i8 %add to i32
86 ret i32 %ret
87
88 ; BLINDINGO2-LABEL: add_const_8bits
89 ; BLINDINGO2: mov e{{[a-z]*}},0x4222
90 ; BLINDINGO2-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}}
91
92 ; BLINDINGOM1-LABEL: add_const_8bits
93 ; BLINDINGOM1: mov e{{[a-z]*}},0x4222
94 ; BLINDINGOM1-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}}
95
96 ; POOLING-LABEL: add_const_8bits
97 ; POOLING: mov {{[a-z]l}},BYTE PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i8${{[0- 9]*}}
98 }
99
100 define internal i32 @add_const_16bits(i32 %a) {
101 entry:
102 %a_16 = trunc i32 %a to i16
103 %add = add i16 %a_16, 32766
104 %ret = zext i16 %add to i32
105 ret i32 %ret
106
107 ; BLINDINGO2-LABEL: add_const_16bits
108 ; BLINDINGO2: mov e{{[a-z]*}},0xc1a5
109 ; BLINDINGO2-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}}
110
111 ; BLINDINGOM1-LABEL: add_const_16bits
112 ; BLINDINGOM1: mov e{{[a-z]*}},0xc1a5
113 ; BLINDINGOM1-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}}
114
115 ; POOLING-LABEL: add_const_16bits
116 ; POOLING: mov {{[a-z]x}},WORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i16${{[0 -9]*}}
117
118 }
OLDNEW
« src/IceTargetLoweringX8632.cpp ('K') | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698