OLD | NEW |
1 ; This tests the NaCl intrinsics not related to atomic operations. | 1 ; This tests the NaCl intrinsics not related to atomic operations. |
2 | 2 |
3 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer | 3 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer |
4 ; doesn't know how to symbolize non-section-local functions. | 4 ; doesn't know how to symbolize non-section-local functions. |
5 ; The newer LLVM 3.6 one does work, but watch out for other bugs. | 5 ; The newer LLVM 3.6 one does work, but watch out for other bugs. |
6 | 6 |
7 ; RUN: %p2i -i %s --args -O2 --verbose none \ | 7 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
8 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s | 8 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s |
9 ; RUN: %p2i -i %s --args -O2 --verbose none -sandbox \ | 9 ; RUN: %p2i -i %s --args -O2 --verbose none -sandbox \ |
10 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 10 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 %__1 = ptrtoint i8* %ptr to i32 | 56 %__1 = ptrtoint i8* %ptr to i32 |
57 ret i32 %__1 | 57 ret i32 %__1 |
58 } | 58 } |
59 ; CHECK-LABEL: test_nacl_read_tp | 59 ; CHECK-LABEL: test_nacl_read_tp |
60 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 60 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
61 ; CHECKO2REM-LABEL: test_nacl_read_tp | 61 ; CHECKO2REM-LABEL: test_nacl_read_tp |
62 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 62 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
63 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp | 63 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp |
64 ; CHECKO2UNSANDBOXEDREM: call -4 | 64 ; CHECKO2UNSANDBOXEDREM: call -4 |
65 ; CALLTARGETS-LABEL: test_nacl_read_tp | 65 ; CALLTARGETS-LABEL: test_nacl_read_tp |
66 ; CALLTARGETS: call __nacl_read_tp | 66 ; CALLTARGETS: .long __nacl_read_tp |
67 | 67 |
68 define i32 @test_nacl_read_tp_more_addressing() { | 68 define i32 @test_nacl_read_tp_more_addressing() { |
69 entry: | 69 entry: |
70 %ptr = call i8* @llvm.nacl.read.tp() | 70 %ptr = call i8* @llvm.nacl.read.tp() |
71 %__1 = ptrtoint i8* %ptr to i32 | 71 %__1 = ptrtoint i8* %ptr to i32 |
72 %x = add i32 %__1, %__1 | 72 %x = add i32 %__1, %__1 |
73 %__3 = inttoptr i32 %x to i32* | 73 %__3 = inttoptr i32 %x to i32* |
74 %v = load i32* %__3, align 1 | 74 %v = load i32* %__3, align 1 |
75 %v_add = add i32 %v, 1 | 75 %v_add = add i32 %v, 1 |
76 | 76 |
77 %ptr2 = call i8* @llvm.nacl.read.tp() | 77 %ptr2 = call i8* @llvm.nacl.read.tp() |
78 %__6 = ptrtoint i8* %ptr2 to i32 | 78 %__6 = ptrtoint i8* %ptr2 to i32 |
79 %y = add i32 %__6, 4 | 79 %y = add i32 %__6, 4 |
80 %__8 = inttoptr i32 %y to i32* | 80 %__8 = inttoptr i32 %y to i32* |
81 %v_add2 = add i32 %v, 4 | 81 %v_add2 = add i32 %v, 4 |
82 store i32 %v_add2, i32* %__8, align 1 | 82 store i32 %v_add2, i32* %__8, align 1 |
83 ret i32 %v | 83 ret i32 %v |
84 } | 84 } |
85 ; CHECK-LABEL: test_nacl_read_tp_more_addressing | 85 ; CHECK-LABEL: test_nacl_read_tp_more_addressing |
86 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 86 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
87 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 87 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
88 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing | 88 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing |
89 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 89 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
90 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 90 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
91 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_more_addressing | 91 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_more_addressing |
92 ; CHECKO2UNSANDBOXEDREM: call -4 | 92 ; CHECKO2UNSANDBOXEDREM: call -4 |
93 ; CHECKO2UNSANDBOXEDREM: call -4 | 93 ; CHECKO2UNSANDBOXEDREM: call -4 |
94 ; CALLTARGETS-LABEL: test_nacl_read_tp_more_addressing | 94 ; CALLTARGETS-LABEL: test_nacl_read_tp_more_addressing |
95 ; CALLTARGETS: call __nacl_read_tp | 95 ; CALLTARGETS: .long __nacl_read_tp |
96 ; CALLTARGETS: call __nacl_read_tp | 96 ; CALLTARGETS: .long __nacl_read_tp |
97 | 97 |
98 define i32 @test_nacl_read_tp_dead(i32 %a) { | 98 define i32 @test_nacl_read_tp_dead(i32 %a) { |
99 entry: | 99 entry: |
100 %ptr = call i8* @llvm.nacl.read.tp() | 100 %ptr = call i8* @llvm.nacl.read.tp() |
101 ; Not actually using the result of nacl read tp call. | 101 ; Not actually using the result of nacl read tp call. |
102 ; In O2 mode this should be DCE'ed. | 102 ; In O2 mode this should be DCE'ed. |
103 ret i32 %a | 103 ret i32 %a |
104 } | 104 } |
105 ; Consider nacl.read.tp side-effect free, so it can be eliminated. | 105 ; Consider nacl.read.tp side-effect free, so it can be eliminated. |
106 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead | 106 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead |
107 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] | 107 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] |
108 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_dead | 108 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_dead |
109 ; CHECKO2UNSANDBOXEDREM-NOT: call -4 | 109 ; CHECKO2UNSANDBOXEDREM-NOT: call -4 |
110 ; CALLTARGETS-LABEL: test_nacl_read_tp_dead | 110 ; CALLTARGETS-LABEL: test_nacl_read_tp_dead |
111 ; CALLTARGETS-NOT: call __nacl_read_tp | 111 ; CALLTARGETS-NOT: call __nacl_read_tp |
112 | 112 |
113 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 113 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
114 entry: | 114 entry: |
115 %dst = inttoptr i32 %iptr_dst to i8* | 115 %dst = inttoptr i32 %iptr_dst to i8* |
116 %src = inttoptr i32 %iptr_src to i8* | 116 %src = inttoptr i32 %iptr_src to i8* |
117 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 117 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
118 i32 %len, i32 1, i1 false) | 118 i32 %len, i32 1, i1 false) |
119 ret void | 119 ret void |
120 } | 120 } |
121 ; CHECK-LABEL: test_memcpy | 121 ; CHECK-LABEL: test_memcpy |
122 ; CHECK: call -4 | 122 ; CHECK: call -4 |
123 ; CALLTARGETS-LABEL: test_memcpy | 123 ; CALLTARGETS-LABEL: test_memcpy |
124 ; CALLTARGETS: call memcpy | 124 ; CALLTARGETS: .long memcpy |
125 ; CHECKO2REM-LABEL: test_memcpy | 125 ; CHECKO2REM-LABEL: test_memcpy |
126 ; CHECKO2UNSANDBOXEDREM-LABEL: test_memcpy | 126 ; CHECKO2UNSANDBOXEDREM-LABEL: test_memcpy |
127 | 127 |
128 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, | 128 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, |
129 ; memset without a function call. | 129 ; memset without a function call. |
130 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { | 130 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { |
131 entry: | 131 entry: |
132 %dst = inttoptr i32 %iptr_dst to i8* | 132 %dst = inttoptr i32 %iptr_dst to i8* |
133 %src = inttoptr i32 %iptr_src to i8* | 133 %src = inttoptr i32 %iptr_src to i8* |
134 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 134 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
135 i32 8, i32 1, i1 false) | 135 i32 8, i32 1, i1 false) |
136 ret void | 136 ret void |
137 } | 137 } |
138 ; CHECK-LABEL: test_memcpy_const_len_align | 138 ; CHECK-LABEL: test_memcpy_const_len_align |
139 ; CHECK: call -4 | 139 ; CHECK: call -4 |
140 ; CALLTARGETS-LABEL: test_memcpy_const_len_align | 140 ; CALLTARGETS-LABEL: test_memcpy_const_len_align |
141 ; CALLTARGETS: call memcpy | 141 ; CALLTARGETS: .long memcpy |
142 | 142 |
143 define void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 143 define void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
144 entry: | 144 entry: |
145 %dst = inttoptr i32 %iptr_dst to i8* | 145 %dst = inttoptr i32 %iptr_dst to i8* |
146 %src = inttoptr i32 %iptr_src to i8* | 146 %src = inttoptr i32 %iptr_src to i8* |
147 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 147 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
148 i32 %len, i32 1, i1 false) | 148 i32 %len, i32 1, i1 false) |
149 ret void | 149 ret void |
150 } | 150 } |
151 ; CHECK-LABEL: test_memmove | 151 ; CHECK-LABEL: test_memmove |
152 ; CHECK: call -4 | 152 ; CHECK: call -4 |
153 ; CALLTARGETS-LABEL: test_memmove | 153 ; CALLTARGETS-LABEL: test_memmove |
154 ; CALLTARGETS: call memmove | 154 ; CALLTARGETS: .long memmove |
155 | 155 |
156 define void @test_memmove_const_len_align(i32 %iptr_dst, i32 %iptr_src) { | 156 define void @test_memmove_const_len_align(i32 %iptr_dst, i32 %iptr_src) { |
157 entry: | 157 entry: |
158 %dst = inttoptr i32 %iptr_dst to i8* | 158 %dst = inttoptr i32 %iptr_dst to i8* |
159 %src = inttoptr i32 %iptr_src to i8* | 159 %src = inttoptr i32 %iptr_src to i8* |
160 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 160 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
161 i32 8, i32 1, i1 false) | 161 i32 8, i32 1, i1 false) |
162 ret void | 162 ret void |
163 } | 163 } |
164 ; CHECK-LABEL: test_memmove_const_len_align | 164 ; CHECK-LABEL: test_memmove_const_len_align |
165 ; CHECK: call -4 | 165 ; CHECK: call -4 |
166 ; CALLTARGETS-LABEL: test_memmove_const_len_align | 166 ; CALLTARGETS-LABEL: test_memmove_const_len_align |
167 ; CALLTARGETS: call memmove | 167 ; CALLTARGETS: .long memmove |
168 | 168 |
169 define void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { | 169 define void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { |
170 entry: | 170 entry: |
171 %val = trunc i32 %wide_val to i8 | 171 %val = trunc i32 %wide_val to i8 |
172 %dst = inttoptr i32 %iptr_dst to i8* | 172 %dst = inttoptr i32 %iptr_dst to i8* |
173 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, | 173 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, |
174 i32 %len, i32 1, i1 false) | 174 i32 %len, i32 1, i1 false) |
175 ret void | 175 ret void |
176 } | 176 } |
177 ; CHECK-LABEL: test_memset | 177 ; CHECK-LABEL: test_memset |
178 ; CHECK: movzx | 178 ; CHECK: movzx |
179 ; CHECK: call -4 | 179 ; CHECK: call -4 |
180 ; CALLTARGETS-LABEL: test_memset | 180 ; CALLTARGETS-LABEL: test_memset |
181 ; CALLTARGETS: call memset | 181 ; CALLTARGETS: .long memset |
182 | 182 |
183 define void @test_memset_const_len_align(i32 %iptr_dst, i32 %wide_val) { | 183 define void @test_memset_const_len_align(i32 %iptr_dst, i32 %wide_val) { |
184 entry: | 184 entry: |
185 %val = trunc i32 %wide_val to i8 | 185 %val = trunc i32 %wide_val to i8 |
186 %dst = inttoptr i32 %iptr_dst to i8* | 186 %dst = inttoptr i32 %iptr_dst to i8* |
187 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, | 187 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, |
188 i32 8, i32 1, i1 false) | 188 i32 8, i32 1, i1 false) |
189 ret void | 189 ret void |
190 } | 190 } |
191 ; CHECK-LABEL: test_memset_const_len_align | 191 ; CHECK-LABEL: test_memset_const_len_align |
192 ; CHECK: movzx | 192 ; CHECK: movzx |
193 ; CHECK: call -4 | 193 ; CHECK: call -4 |
194 ; CALLTARGETS-LABEL: test_memset_const_len_align | 194 ; CALLTARGETS-LABEL: test_memset_const_len_align |
195 ; CALLTARGETS: call memset | 195 ; CALLTARGETS: .long memset |
196 | 196 |
197 define void @test_memset_const_val(i32 %iptr_dst, i32 %len) { | 197 define void @test_memset_const_val(i32 %iptr_dst, i32 %len) { |
198 entry: | 198 entry: |
199 %dst = inttoptr i32 %iptr_dst to i8* | 199 %dst = inttoptr i32 %iptr_dst to i8* |
200 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false) | 200 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false) |
201 ret void | 201 ret void |
202 } | 202 } |
203 ; CHECK-LABEL: test_memset_const_val | 203 ; CHECK-LABEL: test_memset_const_val |
204 ; Make sure the argument is legalized (can't movzx reg, 0). | 204 ; Make sure the argument is legalized (can't movzx reg, 0). |
205 ; CHECK: movzx {{.*}}, {{[^0]}} | 205 ; CHECK: movzx {{.*}}, {{[^0]}} |
206 ; CHECK: call -4 | 206 ; CHECK: call -4 |
207 ; CALLTARGETS-LABEL: test_memset_const_val | 207 ; CALLTARGETS-LABEL: test_memset_const_val |
208 ; CALLTARGETS: call memset | 208 ; CALLTARGETS: .long memset |
209 | 209 |
210 | 210 |
211 define i32 @test_setjmplongjmp(i32 %iptr_env) { | 211 define i32 @test_setjmplongjmp(i32 %iptr_env) { |
212 entry: | 212 entry: |
213 %env = inttoptr i32 %iptr_env to i8* | 213 %env = inttoptr i32 %iptr_env to i8* |
214 %i = call i32 @llvm.nacl.setjmp(i8* %env) | 214 %i = call i32 @llvm.nacl.setjmp(i8* %env) |
215 %r1 = icmp eq i32 %i, 0 | 215 %r1 = icmp eq i32 %i, 0 |
216 br i1 %r1, label %Zero, label %NonZero | 216 br i1 %r1, label %Zero, label %NonZero |
217 Zero: | 217 Zero: |
218 ; Redundant inttoptr, to make --pnacl cast-eliding/re-insertion happy. | 218 ; Redundant inttoptr, to make --pnacl cast-eliding/re-insertion happy. |
219 %env2 = inttoptr i32 %iptr_env to i8* | 219 %env2 = inttoptr i32 %iptr_env to i8* |
220 call void @llvm.nacl.longjmp(i8* %env2, i32 1) | 220 call void @llvm.nacl.longjmp(i8* %env2, i32 1) |
221 ret i32 0 | 221 ret i32 0 |
222 NonZero: | 222 NonZero: |
223 ret i32 1 | 223 ret i32 1 |
224 } | 224 } |
225 ; CHECK-LABEL: test_setjmplongjmp | 225 ; CHECK-LABEL: test_setjmplongjmp |
226 ; CHECK: call -4 | 226 ; CHECK: call -4 |
227 ; CHECK: call -4 | 227 ; CHECK: call -4 |
228 ; CHECKO2REM-LABEL: test_setjmplongjmp | 228 ; CHECKO2REM-LABEL: test_setjmplongjmp |
229 ; CHECKO2REM: call -4 | 229 ; CHECKO2REM: call -4 |
230 ; CHECKO2REM: call -4 | 230 ; CHECKO2REM: call -4 |
231 ; CALLTARGETS-LABEL: test_setjmplongjmp | 231 ; CALLTARGETS-LABEL: test_setjmplongjmp |
232 ; CALLTARGETS: call setjmp | 232 ; CALLTARGETS: .long setjmp |
233 ; CALLTARGETS: call longjmp | 233 ; CALLTARGETS: .long longjmp |
234 | 234 |
235 define i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) { | 235 define i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) { |
236 entry: | 236 entry: |
237 %env = inttoptr i32 %iptr_env to i8* | 237 %env = inttoptr i32 %iptr_env to i8* |
238 %i = call i32 @llvm.nacl.setjmp(i8* %env) | 238 %i = call i32 @llvm.nacl.setjmp(i8* %env) |
239 ret i32 %i_other | 239 ret i32 %i_other |
240 } | 240 } |
241 ; Don't consider setjmp side-effect free, so it's not eliminated if | 241 ; Don't consider setjmp side-effect free, so it's not eliminated if |
242 ; result unused. | 242 ; result unused. |
243 ; CHECKO2REM-LABEL: test_setjmp_unused | 243 ; CHECKO2REM-LABEL: test_setjmp_unused |
244 ; CHECKO2REM: call -4 | 244 ; CHECKO2REM: call -4 |
245 ; CALLTARGETS-LABEL: test_setjmp_unused | 245 ; CALLTARGETS-LABEL: test_setjmp_unused |
246 ; CALLTARGETS: call setjmp | 246 ; CALLTARGETS: .long setjmp |
247 | 247 |
248 define float @test_sqrt_float(float %x, i32 %iptr) { | 248 define float @test_sqrt_float(float %x, i32 %iptr) { |
249 entry: | 249 entry: |
250 %r = call float @llvm.sqrt.f32(float %x) | 250 %r = call float @llvm.sqrt.f32(float %x) |
251 %r2 = call float @llvm.sqrt.f32(float %r) | 251 %r2 = call float @llvm.sqrt.f32(float %r) |
252 %r3 = call float @llvm.sqrt.f32(float -0.0) | 252 %r3 = call float @llvm.sqrt.f32(float -0.0) |
253 %r4 = fadd float %r2, %r3 | 253 %r4 = fadd float %r2, %r3 |
254 ret float %r4 | 254 ret float %r4 |
255 } | 255 } |
256 ; CHECK-LABEL: test_sqrt_float | 256 ; CHECK-LABEL: test_sqrt_float |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 ; CHECK: mov {{.*}}, 0 | 444 ; CHECK: mov {{.*}}, 0 |
445 | 445 |
446 define i32 @test_popcount_32(i32 %x) { | 446 define i32 @test_popcount_32(i32 %x) { |
447 entry: | 447 entry: |
448 %r = call i32 @llvm.ctpop.i32(i32 %x) | 448 %r = call i32 @llvm.ctpop.i32(i32 %x) |
449 ret i32 %r | 449 ret i32 %r |
450 } | 450 } |
451 ; CHECK-LABEL: test_popcount_32 | 451 ; CHECK-LABEL: test_popcount_32 |
452 ; CHECK: call -4 | 452 ; CHECK: call -4 |
453 ; CALLTARGETS-LABEL: test_popcount_32 | 453 ; CALLTARGETS-LABEL: test_popcount_32 |
454 ; CALLTARGETS: call __popcountsi2 | 454 ; CALLTARGETS: .long __popcountsi2 |
455 | 455 |
456 define i64 @test_popcount_64(i64 %x) { | 456 define i64 @test_popcount_64(i64 %x) { |
457 entry: | 457 entry: |
458 %r = call i64 @llvm.ctpop.i64(i64 %x) | 458 %r = call i64 @llvm.ctpop.i64(i64 %x) |
459 ret i64 %r | 459 ret i64 %r |
460 } | 460 } |
461 ; CHECK-LABEL: test_popcount_64 | 461 ; CHECK-LABEL: test_popcount_64 |
462 ; CHECK: call -4 | 462 ; CHECK: call -4 |
463 ; __popcountdi2 only returns a 32-bit result, so clear the upper bits of | 463 ; __popcountdi2 only returns a 32-bit result, so clear the upper bits of |
464 ; the return value just in case. | 464 ; the return value just in case. |
465 ; CHECK: mov {{.*}}, 0 | 465 ; CHECK: mov {{.*}}, 0 |
466 ; CALLTARGETS-LABEL: test_popcount_64 | 466 ; CALLTARGETS-LABEL: test_popcount_64 |
467 ; CALLTARGETS: call __popcountdi2 | 467 ; CALLTARGETS: .long __popcountdi2 |
468 | 468 |
469 | 469 |
470 define i32 @test_popcount_64_ret_i32(i64 %x) { | 470 define i32 @test_popcount_64_ret_i32(i64 %x) { |
471 entry: | 471 entry: |
472 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x) | 472 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x) |
473 %r = trunc i64 %r_i64 to i32 | 473 %r = trunc i64 %r_i64 to i32 |
474 ret i32 %r | 474 ret i32 %r |
475 } | 475 } |
476 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out. | 476 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out. |
477 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32 | 477 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32 |
478 ; CHECKO2REM: call -4 | 478 ; CHECKO2REM: call -4 |
479 ; CHECKO2REM-NOT: mov {{.*}}, 0 | 479 ; CHECKO2REM-NOT: mov {{.*}}, 0 |
480 ; CALLTARGETS-LABEL: test_popcount_64_ret_i32 | 480 ; CALLTARGETS-LABEL: test_popcount_64_ret_i32 |
481 ; CALLTARGETS: call __popcountdi2 | 481 ; CALLTARGETS: .long __popcountdi2 |
482 | 482 |
483 define void @test_stacksave_noalloca() { | 483 define void @test_stacksave_noalloca() { |
484 entry: | 484 entry: |
485 %sp = call i8* @llvm.stacksave() | 485 %sp = call i8* @llvm.stacksave() |
486 call void @llvm.stackrestore(i8* %sp) | 486 call void @llvm.stackrestore(i8* %sp) |
487 ret void | 487 ret void |
488 } | 488 } |
489 ; CHECK-LABEL: test_stacksave_noalloca | 489 ; CHECK-LABEL: test_stacksave_noalloca |
490 ; CHECK: mov {{.*}}, esp | 490 ; CHECK: mov {{.*}}, esp |
491 ; CHECK: mov esp, {{.*}} | 491 ; CHECK: mov esp, {{.*}} |
(...skipping 25 matching lines...) Expand all Loading... |
517 | 517 |
518 call void @llvm.stackrestore(i8* %sp1) | 518 call void @llvm.stackrestore(i8* %sp1) |
519 ret void | 519 ret void |
520 } | 520 } |
521 ; CHECK-LABEL: test_stacksave_multiple | 521 ; CHECK-LABEL: test_stacksave_multiple |
522 ; At least 3 copies of esp, but probably more from having to do the allocas. | 522 ; At least 3 copies of esp, but probably more from having to do the allocas. |
523 ; CHECK: mov {{.*}}, esp | 523 ; CHECK: mov {{.*}}, esp |
524 ; CHECK: mov {{.*}}, esp | 524 ; CHECK: mov {{.*}}, esp |
525 ; CHECK: mov {{.*}}, esp | 525 ; CHECK: mov {{.*}}, esp |
526 ; CHECK: mov esp, {{.*}} | 526 ; CHECK: mov esp, {{.*}} |
OLD | NEW |