[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Apr 29 21:25:48 PDT 2005
Changes in directory llvm/lib/Target/X86:
X86ISelPattern.cpp updated: 1.109 -> 1.110
---
Log message:
Add support for FSIN/FCOS when unsafe math ops are enabled. Patch contributed by
Morten Ofstad!
---
Diffs of the changes: (+10 -0)
X86ISelPattern.cpp | 10 ++++++++++
1 files changed, 10 insertions(+)
Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.109 llvm/lib/Target/X86/X86ISelPattern.cpp:1.110
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.109 Thu Apr 28 17:07:18 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp Fri Apr 29 23:25:35 2005
@@ -24,6 +24,7 @@
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
+#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/ADT/Statistic.h"
#include <set>
@@ -64,6 +65,11 @@
setOperationAction(ISD::SEXTLOAD , MVT::i1 , Expand);
setOperationAction(ISD::SREM , MVT::f64 , Expand);
+ if (!UnsafeFPMath) {
+ setOperationAction(ISD::FSIN , MVT::f64 , Expand);
+ setOperationAction(ISD::FCOS , MVT::f64 , Expand);
+ }
+
// These should be promoted to a larger select which is supported.
/**/ setOperationAction(ISD::SELECT , MVT::i1 , Promote);
setOperationAction(ISD::SELECT , MVT::i8 , Promote);
@@ -1831,6 +1837,8 @@
case ISD::FABS:
case ISD::FNEG:
+ case ISD::FSIN:
+ case ISD::FCOS:
case ISD::FSQRT:
assert(N.getValueType()==MVT::f64 && "Illegal type for this operation");
Tmp1 = SelectExpr(Node->getOperand(0));
@@ -1839,6 +1847,8 @@
case ISD::FABS: BuildMI(BB, X86::FABS, 1, Result).addReg(Tmp1); break;
case ISD::FNEG: BuildMI(BB, X86::FCHS, 1, Result).addReg(Tmp1); break;
case ISD::FSQRT: BuildMI(BB, X86::FSQRT, 1, Result).addReg(Tmp1); break;
+ case ISD::FSIN: BuildMI(BB, X86::FSIN, 1, Result).addReg(Tmp1); break;
+ case ISD::FCOS: BuildMI(BB, X86::FCOS, 1, Result).addReg(Tmp1); break;
}
return Result;
More information about the llvm-commits
mailing list