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

Side by Side Diff: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll

Issue 384443003: Add scalar lowering for sqrt intrinsic. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: whitespace Created 6 years, 5 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/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s 3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM
5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
7 7
8 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 8 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
9 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 9 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
10 ; RUN: | FileCheck --check-prefix=DUMP %s 10 ; RUN: | FileCheck --check-prefix=DUMP %s
11 11
12 declare i8* @llvm.nacl.read.tp() 12 declare i8* @llvm.nacl.read.tp()
13 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 13 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
14 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 14 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
15 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) 15 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
16 declare void @llvm.nacl.longjmp(i8*, i32) 16 declare void @llvm.nacl.longjmp(i8*, i32)
17 declare i32 @llvm.nacl.setjmp(i8*) 17 declare i32 @llvm.nacl.setjmp(i8*)
18 declare float @llvm.sqrt.f32(float)
19 declare double @llvm.sqrt.f64(double)
18 declare void @llvm.trap() 20 declare void @llvm.trap()
19 21
20 define i32 @test_nacl_read_tp() { 22 define i32 @test_nacl_read_tp() {
21 entry: 23 entry:
22 %ptr = call i8* @llvm.nacl.read.tp() 24 %ptr = call i8* @llvm.nacl.read.tp()
23 %__1 = ptrtoint i8* %ptr to i32 25 %__1 = ptrtoint i8* %ptr to i32
24 ret i32 %__1 26 ret i32 %__1
25 } 27 }
26 ; CHECK-LABEL: test_nacl_read_tp 28 ; CHECK-LABEL: test_nacl_read_tp
27 ; CHECK: mov e{{.*}}, dword ptr gs:[0] 29 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 entry: 155 entry:
154 %env = inttoptr i32 %iptr_env to i8* 156 %env = inttoptr i32 %iptr_env to i8*
155 %i = call i32 @llvm.nacl.setjmp(i8* %env) 157 %i = call i32 @llvm.nacl.setjmp(i8* %env)
156 ret i32 %i_other 158 ret i32 %i_other
157 } 159 }
158 ; Don't consider setjmp side-effect free, so it's not eliminated if 160 ; Don't consider setjmp side-effect free, so it's not eliminated if
159 ; result unused. 161 ; result unused.
160 ; CHECKO2REM-LABEL: test_setjmp_unused 162 ; CHECKO2REM-LABEL: test_setjmp_unused
161 ; CHECKO2REM: call setjmp 163 ; CHECKO2REM: call setjmp
162 164
165 define float @test_sqrt_float(float %x, i32 %iptr) {
166 entry:
167 %r = call float @llvm.sqrt.f32(float %x)
168 %r2 = call float @llvm.sqrt.f32(float %r)
169 %r3 = call float @llvm.sqrt.f32(float -0.0)
170 %r4 = fadd float %r2, %r3
171 br label %next
172
173 next:
174 %__6 = inttoptr i32 %iptr to float*
175 %y = load float* %__6, align 4
176 %r5 = call float @llvm.sqrt.f32(float %y)
177 %r6 = fadd float %r4, %r5
178 ret float %r6
179 }
180 ; CHECK-LABEL: test_sqrt_float
181 ; CHECK: sqrtss xmm{{.*}}
182 ; CHECK: sqrtss xmm{{.*}}
183 ; CHECK: sqrtss xmm{{.*}}, dword ptr
184 ; CHECK-LABEL: .L{{.*}}next
185 ; We could fold the load and the sqrt into one operation, but the
186 ; current folding only handles load + arithmetic op. The sqrt inst
187 ; is considered an intrinsic call and not an arithmetic op.
188 ; CHECK: sqrtss xmm{{.*}}
189
190 define double @test_sqrt_double(double %x, i32 %iptr) {
191 entry:
192 %r = call double @llvm.sqrt.f64(double %x)
193 %r2 = call double @llvm.sqrt.f64(double %r)
194 %r3 = call double @llvm.sqrt.f64(double -0.0)
195 %r4 = fadd double %r2, %r3
196 br label %next
197
198 next:
199 %__6 = inttoptr i32 %iptr to double*
200 %y = load double* %__6, align 8
201 %r5 = call double @llvm.sqrt.f64(double %y)
202 %r6 = fadd double %r4, %r5
203 ret double %r6
204 }
205 ; CHECK-LABEL: test_sqrt_double
206 ; CHECK: sqrtsd xmm{{.*}}
207 ; CHECK: sqrtsd xmm{{.*}}
208 ; CHECK: sqrtsd xmm{{.*}}, qword ptr
209 ; CHECK-LABEL: .L{{.*}}next
210 ; CHECK: sqrtsd xmm{{.*}}
211
212 define float @test_sqrt_ignored(float %x, double %y) {
213 entry:
214 %ignored1 = call float @llvm.sqrt.f32(float %x)
215 %ignored2 = call double @llvm.sqrt.f64(double %y)
216 ret float 0.0
217 }
218 ; CHECKO2REM-LABEL: test_sqrt_ignored
219 ; CHECKO2REM-NOT: sqrtss
220 ; CHECKO2REM-NOT: sqrtsd
221
163 define i32 @test_trap(i32 %br) { 222 define i32 @test_trap(i32 %br) {
164 entry: 223 entry:
165 %r1 = icmp eq i32 %br, 0 224 %r1 = icmp eq i32 %br, 0
166 br i1 %r1, label %Zero, label %NonZero 225 br i1 %r1, label %Zero, label %NonZero
167 Zero: 226 Zero:
168 call void @llvm.trap() 227 call void @llvm.trap()
169 unreachable 228 unreachable
170 NonZero: 229 NonZero:
171 ret i32 1 230 ret i32 1
172 } 231 }
173 ; CHECK-LABEL: test_trap 232 ; CHECK-LABEL: test_trap
174 ; CHECK: ud2 233 ; CHECK: ud2
175 234
176 ; ERRORS-NOT: ICE translation error 235 ; ERRORS-NOT: ICE translation error
177 ; DUMP-NOT: SZ 236 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698