[PATCH] fix a test that has no checks
Sanjay Patel
spatel at rotateright.com
Wed Aug 6 09:41:50 PDT 2014
Hi chandlerc,
This test has no checks; it doesn't even pipe output to grep.
In an amazing display of architectural restraint, x86 doesn't have fneg instructions. :)
So check for the xor (and possibly sub) that are required to make fneg happen.
http://reviews.llvm.org/D4812
Files:
test/CodeGen/X86/vec_fneg.ll
Index: test/CodeGen/X86/vec_fneg.ll
===================================================================
--- test/CodeGen/X86/vec_fneg.ll
+++ test/CodeGen/X86/vec_fneg.ll
@@ -1,11 +1,23 @@
-; RUN: llc < %s -march=x86 -mattr=+sse2
+; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s
+; FNEG is defined as subtraction from -0.0.
+
+; This test verifies that we use an xor with a constant to flip the sign bits; no subtraction needed.
define <4 x float> @t1(<4 x float> %Q) {
- %tmp15 = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %Q
- ret <4 x float> %tmp15
+; CHECK-LABEL: t1:
+; CHECK: xorps {{.*}}LCPI0_0{{.*}}, %xmm0
+; CHECK-NEXT: retl
+ %tmp = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %Q
+ ret <4 x float> %tmp
}
+; This test verifies that we generate an FP subtraction because "0.0 - x" is not an fneg.
define <4 x float> @t2(<4 x float> %Q) {
- %tmp15 = fsub <4 x float> zeroinitializer, %Q
- ret <4 x float> %tmp15
+; CHECK-LABEL: t2:
+; CHECK: xorps %[[X:xmm[0-9]+]], %[[X]]
+; CHECK-NEXT: subps %xmm0, %[[X]]
+; CHECK-NEXT: movaps %[[X]], %xmm0
+; CHECK-NEXT: retl
+ %tmp = fsub <4 x float> zeroinitializer, %Q
+ ret <4 x float> %tmp
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4812.12239.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140806/3f27eae6/attachment.bin>
More information about the llvm-commits
mailing list