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

Unified Diff: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll

Issue 1022573004: Subzero: Add fabs intrinsic support. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/assembler_ia32.cpp ('k') | tests_lit/reader_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
diff --git a/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll b/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
index 124fa2e18e0e64fd0fedd0734aae537b52e0f1ff..10301bc847d38ab14785ae4ca0ffb851f173081a 100644
--- a/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
+++ b/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
@@ -25,6 +25,9 @@ declare void @llvm.nacl.longjmp(i8*, i32)
declare i32 @llvm.nacl.setjmp(i8*)
declare float @llvm.sqrt.f32(float)
declare double @llvm.sqrt.f64(double)
+declare float @llvm.fabs.f32(float)
+declare double @llvm.fabs.f64(double)
+declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
declare void @llvm.trap()
declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
@@ -268,6 +271,63 @@ entry:
; CHECKO2REM-NOT: sqrtss
; CHECKO2REM-NOT: sqrtsd
+define float @test_fabs_float(float %x) {
+entry:
+ %r = call float @llvm.fabs.f32(float %x)
+ %r2 = call float @llvm.fabs.f32(float %r)
+ %r3 = call float @llvm.fabs.f32(float -0.0)
+ %r4 = fadd float %r2, %r3
+ ret float %r4
+}
+; CHECK-LABEL: test_fabs_float
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+
+define double @test_fabs_double(double %x) {
+entry:
+ %r = call double @llvm.fabs.f64(double %x)
+ %r2 = call double @llvm.fabs.f64(double %r)
+ %r3 = call double @llvm.fabs.f64(double -0.0)
+ %r4 = fadd double %r2, %r3
+ ret double %r4
+}
+; CHECK-LABEL: test_fabs_double
+; CHECK: pcmpeqd
+; CHECK: psrlq
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrlq
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrlq
+; CHECK: pand
+
+define <4 x float> @test_fabs_v4f32(<4 x float> %x) {
+entry:
+ %r = call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
+ %r2 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %r)
+ %r3 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef)
+ %r4 = fadd <4 x float> %r2, %r3
+ ret <4 x float> %r4
+}
+; CHECK-LABEL: test_fabs_v4f32
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+; CHECK: pcmpeqd
+; CHECK: psrld
+; CHECK: pand
+
define i32 @test_trap(i32 %br) {
entry:
%r1 = icmp eq i32 %br, 0
« no previous file with comments | « src/assembler_ia32.cpp ('k') | tests_lit/reader_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698