[llvm] r326735 - [x86] auto-generate full checks for fabs tests
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 5 11:11:21 PST 2018
Author: spatel
Date: Mon Mar 5 11:11:20 2018
New Revision: 326735
URL: http://llvm.org/viewvc/llvm-project?rev=326735&view=rev
Log:
[x86] auto-generate full checks for fabs tests
Also, change the x86-64 test to optimized and remove the
unnecessary platform specification from the RUN lines..
Modified:
llvm/trunk/test/CodeGen/X86/fabs.ll
Modified: llvm/trunk/test/CodeGen/X86/fabs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fabs.ll?rev=326735&r1=326734&r2=326735&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fabs.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fabs.ll Mon Mar 5 11:11:20 2018
@@ -1,54 +1,98 @@
-; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
-; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse2,-sse3,-sse | FileCheck %s
-; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=UNSAFE
-; RUN: llc < %s -mtriple=x86_64-apple-macosx -O0 | FileCheck %s --check-prefix=NOOPT
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=X87
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=X87UNSAFE
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
declare float @fabsf(float)
-
declare x86_fp80 @fabsl(x86_fp80)
-; CHECK-LABEL: test1:
-; UNSAFE-LABEL: test1:
-; NOOPT-LABEL: test1:
define float @test1(float %X) {
- %Y = call float @fabsf(float %X) readnone
- ret float %Y
+; X87-LABEL: test1:
+; X87: # %bb.0:
+; X87-NEXT: flds {{[0-9]+}}(%esp)
+; X87-NEXT: fabs
+; X87-NEXT: retl
+;
+; X87UNSAFE-LABEL: test1:
+; X87UNSAFE: # %bb.0:
+; X87UNSAFE-NEXT: flds {{[0-9]+}}(%esp)
+; X87UNSAFE-NEXT: fabs
+; X87UNSAFE-NEXT: retl
+;
+; X64-LABEL: test1:
+; X64: # %bb.0:
+; X64-NEXT: andps {{.*}}(%rip), %xmm0
+; X64-NEXT: retq
+ %Y = call float @fabsf(float %X) readnone
+ ret float %Y
}
-; CHECK: {{^[ \t]+fabs$}}
-; UNSAFE: {{^[ \t]+fabs$}}
-
-; CHECK-NOT: fabs
-; UNSAFE-NOT: fabs
-; NOOPT-NOT: fabsf
-; CHECK-LABEL: test2:
-; UNSAFE-LABEL: test2:
-; NOOPT-LABEL: test2:
define double @test2(double %X) {
- %Y = fcmp oge double %X, -0.0
- %Z = fsub double -0.0, %X
- %Q = select i1 %Y, double %X, double %Z
- ret double %Q
+; X87-LABEL: test2:
+; X87: # %bb.0:
+; X87-NEXT: fldl {{[0-9]+}}(%esp)
+; X87-NEXT: fldz
+; X87-NEXT: fchs
+; X87-NEXT: fxch %st(1)
+; X87-NEXT: fucom %st(1)
+; X87-NEXT: fstp %st(1)
+; X87-NEXT: fnstsw %ax
+; X87-NEXT: # kill: def $ah killed $ah killed $ax
+; X87-NEXT: sahf
+; X87-NEXT: fld %st(0)
+; X87-NEXT: fchs
+; X87-NEXT: jae .LBB1_2
+; X87-NEXT: # %bb.1:
+; X87-NEXT: fstp %st(1)
+; X87-NEXT: fldz
+; X87-NEXT: .LBB1_2:
+; X87-NEXT: fstp %st(0)
+; X87-NEXT: retl
+;
+; X87UNSAFE-LABEL: test2:
+; X87UNSAFE: # %bb.0:
+; X87UNSAFE-NEXT: fldl {{[0-9]+}}(%esp)
+; X87UNSAFE-NEXT: fabs
+; X87UNSAFE-NEXT: retl
+;
+; X64-LABEL: test2:
+; X64: # %bb.0:
+; X64-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
+; X64-NEXT: movapd %xmm1, %xmm2
+; X64-NEXT: unpcklpd {{.*#+}} xmm2 = xmm2[0],xmm1[0]
+; X64-NEXT: xorpd %xmm0, %xmm2
+; X64-NEXT: cmplesd %xmm0, %xmm1
+; X64-NEXT: movapd %xmm1, %xmm3
+; X64-NEXT: andnpd %xmm2, %xmm3
+; X64-NEXT: andpd %xmm0, %xmm1
+; X64-NEXT: orpd %xmm3, %xmm1
+; X64-NEXT: movapd %xmm1, %xmm0
+; X64-NEXT: retq
+ %Y = fcmp oge double %X, -0.0
+ %Z = fsub double -0.0, %X
+ %Q = select i1 %Y, double %X, double %Z
+ ret double %Q
}
-; fabs is not used here.
-; CHECK-NOT: fabs
-; NOOPT-NOT: fabs
-
-; UNSAFE: {{^[ \t]+fabs$}}
-
-; UNSAFE-NOT: fabs
-; CHECK-LABEL: test3:
-; UNSAFE-LABEL: test3:
-; NOOPT-LABEL: test3:
define x86_fp80 @test3(x86_fp80 %X) {
- %Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
- ret x86_fp80 %Y
+; X87-LABEL: test3:
+; X87: # %bb.0:
+; X87-NEXT: fldt {{[0-9]+}}(%esp)
+; X87-NEXT: fabs
+; X87-NEXT: retl
+;
+; X87UNSAFE-LABEL: test3:
+; X87UNSAFE: # %bb.0:
+; X87UNSAFE-NEXT: fldt {{[0-9]+}}(%esp)
+; X87UNSAFE-NEXT: fabs
+; X87UNSAFE-NEXT: retl
+;
+; X64-LABEL: test3:
+; X64: # %bb.0:
+; X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; X64-NEXT: fabs
+; X64-NEXT: retq
+ %Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
+ ret x86_fp80 %Y
}
-; CHECK: {{^[ \t]+fabs$}}
-; UNSAFE: {{^[ \t]+fabs$}}
-; NOOPT: {{^[ \t]+fabs$}}
-; CHECK-NOT: fabs
-; UNSAFE-NOT: fabs
-; NOOPT-NOT: fabs
More information about the llvm-commits
mailing list