summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/fp-in-intregs.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-27 17:42:27 +0000
committerChris Lattner <sabre@nondot.org>2008-01-27 17:42:27 +0000
commit3bd39d4ca89804e97c93b039f6c2933f514c165c (patch)
treecd7a724754e525a6f5dbaebd96905710c907b6fe /test/CodeGen/X86/fp-in-intregs.ll
parentf6b935d8e696f221eeb0578aa3da7cc143f80049 (diff)
downloadllvm-3bd39d4ca89804e97c93b039f6c2933f514c165c.tar.gz
llvm-3bd39d4ca89804e97c93b039f6c2933f514c165c.tar.bz2
llvm-3bd39d4ca89804e97c93b039f6c2933f514c165c.tar.xz
Implement some dag combines that allow doing fneg/fabs/fcopysign in integer
registers if used by a bitconvert or using a bitconvert. This allows us to avoid constant pool loads and use cheaper integer instructions when the values come from or end up in integer regs anyway. For example, we now compile CodeGen/X86/fp-in-intregs.ll to: _test1: movl $2147483648, %eax xorl 4(%esp), %eax ret _test2: movl $1065353216, %eax orl 4(%esp), %eax andl $3212836864, %eax ret Instead of: _test1: movss 4(%esp), %xmm0 xorps LCPI2_0, %xmm0 movd %xmm0, %eax ret _test2: movss 4(%esp), %xmm0 andps LCPI3_0, %xmm0 movss LCPI3_1, %xmm1 andps LCPI3_2, %xmm1 orps %xmm0, %xmm1 movd %xmm1, %eax ret bitconverts can happen due to various calling conventions that require fp values to passed in integer regs in some cases, e.g. when returning a complex. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/fp-in-intregs.ll')
-rw-r--r--test/CodeGen/X86/fp-in-intregs.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/X86/fp-in-intregs.ll b/test/CodeGen/X86/fp-in-intregs.ll
new file mode 100644
index 0000000000..1e3ea8918d
--- /dev/null
+++ b/test/CodeGen/X86/fp-in-intregs.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | not egrep {\(\(xor\|and\)ps\|movd\)}
+
+; These operations should be done in integer registers, eliminating constant
+; pool loads, movd's etc.
+
+define i32 @test1(float %x) nounwind {
+entry:
+ %tmp2 = sub float -0.000000e+00, %x ; <float> [#uses=1]
+ %tmp210 = bitcast float %tmp2 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp210
+}
+
+define i32 @test2(float %x) nounwind {
+entry:
+ %tmp2 = tail call float @copysignf( float 1.000000e+00, float %x ) nounwind readnone ; <float> [#uses=1]
+ %tmp210 = bitcast float %tmp2 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp210
+}
+
+declare float @copysignf(float, float) nounwind readnone
+