OLD | NEW |
---|---|
(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 \ | |
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-9a-f]*[0-9a-f]*}}: R_386_32 .L$ i32${{[0-9]*}} | |
Jim Stichnoth
2015/06/19 16:57:22
I think you can simplify
{{[0-9a-f]*[0-9a-f]*}}
qining
2015/06/19 20:22:26
Done.
| |
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-9a-f]*[0-9a-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-9a-f]*[0-9a-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 ; BLINDINGO2-LABEL: load_arg_plus_64bits | |
81 ; BLINDINGO2: lea e{{[a-z]*}},{{[[]}}e{{[a-z]*}}+0x1a137{{[]]}} | |
82 ; BLINDINGO2: mov e{{[a-z]*}},DWORD PTR {{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
83 | |
84 ; BLINDINGOM1-LABEL: load_arg_plus_64bits | |
85 ; BLINDINGOM1: mov e{{[a-z]*}},0x1a137 | |
86 ; BLINDINGOM1-NEXT: lea e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
87 | |
88 ; POOLING-LABEL: load_arg_plus_64bits | |
89 ; POOLING: mov e{{[a-z]x}},DWORD PTR ds:0x0 {{[0-9a-f]*[0-9a-f]*}}: R_386_32 .L$ i32${{[0-9]*}} | |
90 } | |
91 | |
92 define internal i32 @add_const_8bits(i32 %a) { | |
93 entry: | |
94 %a_8 = trunc i32 %a to i8 | |
95 %add = add i8 %a_8, 123 | |
96 %ret = zext i8 %add to i32 | |
97 ret i32 %ret | |
98 | |
99 ; BLINDINGO2-LABEL: add_const_8bits | |
100 ; BLINDINGO2: mov e{{[a-z]*}},0x4222 | |
101 ; BLINDINGO2-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
102 | |
103 ; BLINDINGOM1-LABEL: add_const_8bits | |
104 ; BLINDINGOM1: mov e{{[a-z]*}},0x4222 | |
105 ; BLINDINGOM1-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
106 | |
107 ; POOLING-LABEL: add_const_8bits | |
108 ; POOLING: mov {{[a-z]l}},BYTE PTR ds:0x0 {{[0-9a-f]*[0-9a-f]*}}: R_386_32 .L$i8 ${{[0-9]*}} | |
109 } | |
110 | |
111 define internal i32 @add_const_16bits(i32 %a) { | |
112 entry: | |
113 %a_16 = trunc i32 %a to i16 | |
114 %add = add i16 %a_16, 32766 | |
115 %ret = zext i16 %add to i32 | |
116 ret i32 %ret | |
117 | |
118 ; BLINDINGO2-LABEL: add_const_16bits | |
119 ; BLINDINGO2: mov e{{[a-z]*}},0xc1a5 | |
120 ; BLINDINGO2-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
121 | |
122 ; BLINDINGOM1-LABEL: add_const_16bits | |
123 ; BLINDINGOM1: mov e{{[a-z]*}},0xc1a5 | |
124 ; BLINDINGOM1-NEXT: e{{[a-z]*}},{{[[]}}e{{[a-z]*}}-0x41a7{{[]]}} | |
125 | |
126 ; POOLING-LABEL: add_const_16bits | |
127 ; POOLING: mov {{[a-z]x}},WORD PTR ds:0x0 {{[0-9a-f]*[0-9a-f]*}}: R_386_32 .L$i1 6${{[0-9]*}} | |
128 | |
129 } | |
OLD | NEW |