[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Wed Nov 30 09:12:38 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.218 -> 1.219
---
Log message:
At long last, you can say that f32 isn't supported for setcc
---
Diffs of the changes: (+28 -1)
LegalizeDAG.cpp | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.218 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.219
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.218 Wed Nov 30 00:43:03 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Nov 30 11:12:26 2005
@@ -1438,10 +1438,37 @@
default:
assert(0 && "Cannot handle this action for SETCC yet!");
break;
- case TargetLowering::Promote:
+ case TargetLowering::Promote: {
+ // First step, figure out the appropriate operation to use.
+ // Allow SETCC to not be supported for all legal data types
+ // Mostly this targets FP
+ MVT::ValueType NewInTy = Node->getOperand(0).getValueType();
+ MVT::ValueType OldVT = NewInTy;
+
+ // Scan for the appropriate larger type to use.
+ while (1) {
+ NewInTy = (MVT::ValueType)(NewInTy+1);
+
+ assert(MVT::isInteger(NewInTy) == MVT::isInteger(OldVT) &&
+ "Fell off of the edge of the integer world");
+ assert(MVT::isFloatingPoint(NewInTy) == MVT::isFloatingPoint(OldVT) &&
+ "Fell off of the edge of the floating point world");
+
+ // If the target supports SETCC of this type, use it.
+ if (TLI.getOperationAction(ISD::SETCC, NewInTy) == TargetLowering::Legal)
+ break;
+ }
+ if (MVT::isInteger(NewInTy))
+ assert(0 && "Cannot promote Legal Integer SETCC yet");
+ else {
+ Tmp1 = DAG.getNode(ISD::FP_EXTEND, NewInTy, Tmp1);
+ Tmp2 = DAG.getNode(ISD::FP_EXTEND, NewInTy, Tmp2);
+ }
+
Result = DAG.getNode(ISD::SETCC, Node->getValueType(0), Tmp1, Tmp2,
Node->getOperand(2));
break;
+ }
case TargetLowering::Legal:
if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1))
Result = DAG.getNode(ISD::SETCC, Node->getValueType(0), Tmp1, Tmp2,
More information about the llvm-commits
mailing list