summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-06 21:19:16 +0000
committerChris Lattner <sabre@nondot.org>2005-01-06 21:19:16 +0000
commitae154820769f81e8b1071779d58aa72a3b03614b (patch)
treec6198e17b10c631e479a7bd498e3d1b744c06f15 /llvm/lib
parent9eef99ef433f26f675f7745ee4cb801a292489be (diff)
downloadbcm5719-llvm-ae154820769f81e8b1071779d58aa72a3b03614b.tar.gz
bcm5719-llvm-ae154820769f81e8b1071779d58aa72a3b03614b.zip
Codegen -1 and -0.0 more efficiently. This implements CodeGen/X86/negatize_zero.ll
llvm-svn: 19313
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelSimple.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelSimple.cpp b/llvm/lib/Target/X86/X86ISelSimple.cpp
index 5e6fd2fbd2d..4aeab3e5184 100644
--- a/llvm/lib/Target/X86/X86ISelSimple.cpp
+++ b/llvm/lib/Target/X86/X86ISelSimple.cpp
@@ -560,8 +560,15 @@ void X86ISel::copyConstantToRegister(MachineBasicBlock *MBB,
BuildMI(*MBB, IP, X86::FLD0, 0, R);
else if (CFP->isExactlyValue(+1.0))
BuildMI(*MBB, IP, X86::FLD1, 0, R);
- else { // FIXME: PI, other native values
- // FIXME: Could handle -1.0 with FLD1/FCHS
+ else if (CFP->isExactlyValue(-0.0)) {
+ unsigned Tmp = makeAnotherReg(Type::DoubleTy);
+ BuildMI(*MBB, IP, X86::FLD0, 0, Tmp);
+ BuildMI(*MBB, IP, X86::FCHS, 1, R).addReg(Tmp);
+ } else if (CFP->isExactlyValue(-1.0)) {
+ unsigned Tmp = makeAnotherReg(Type::DoubleTy);
+ BuildMI(*MBB, IP, X86::FLD1, 0, Tmp);
+ BuildMI(*MBB, IP, X86::FCHS, 1, R).addReg(Tmp);
+ } else { // FIXME: PI, other native values
// FIXME: 2*PI -> LDPI + FADD
// Otherwise we need to spill the constant to memory.
OpenPOWER on IntegriCloud