[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Wed Jan 26 23:50:49 PST 2005
Changes in directory llvm/lib/Target/Alpha:
AlphaISelPattern.cpp updated: 1.11 -> 1.12
AlphaInstrInfo.td updated: 1.7 -> 1.8
---
Log message:
int to float conversion and another setcc
---
Diffs of the changes: (+54 -32)
AlphaISelPattern.cpp | 70 +++++++++++++++++++++++++++++++++------------------
AlphaInstrInfo.td | 16 +++++------
2 files changed, 54 insertions(+), 32 deletions(-)
Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.11 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.12
--- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.11 Wed Jan 26 21:49:45 2005
+++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Thu Jan 27 01:50:35 2005
@@ -46,7 +46,7 @@
addRegisterClass(MVT::f64, Alpha::FPRCRegisterClass);
addRegisterClass(MVT::f32, Alpha::FPRCRegisterClass);
- setOperationAction(ISD::EXTLOAD , MVT::i1 , Expand); //Should this be Promote? Chris?
+ setOperationAction(ISD::EXTLOAD , MVT::i1 , Promote);
setOperationAction(ISD::ZEXTLOAD , MVT::i1 , Expand); //Should this be Promote? Chris?
setOperationAction(ISD::ZEXTLOAD , MVT::i32 , Expand);
@@ -62,10 +62,7 @@
computeRegisterProperties();
- // addLegalFPImmediate(+0.0); // FLD0
- // addLegalFPImmediate(+1.0); // FLD1
- // addLegalFPImmediate(-0.0); // FLD0/FCHS
- // addLegalFPImmediate(-1.0); // FLD1/FCHS
+ addLegalFPImmediate(+0.0); //F31
}
/// LowerArguments - This hook must be implemented to indicate how we should
@@ -209,13 +206,13 @@
case MVT::i8:
case MVT::i16:
case MVT::i32:
- // Promote the integer to 64 bits. If the input type is signed use a
- // sign extend, otherwise use a zero extend.
- if (Args[i].second->isSigned())
- Args[i].first = DAG.getNode(ISD::SIGN_EXTEND_INREG, MVT::i64, Args[i].first);
- else
- Args[i].first = DAG.getNode(ISD::ZERO_EXTEND_INREG, MVT::i64, Args[i].first);
- break;
+ // Promote the integer to 64 bits. If the input type is signed use a
+ // sign extend, otherwise use a zero extend.
+ if (Args[i].second->isSigned())
+ Args[i].first = DAG.getNode(ISD::SIGN_EXTEND_INREG, MVT::i64, Args[i].first);
+ else
+ Args[i].first = DAG.getNode(ISD::ZERO_EXTEND_INREG, MVT::i64, Args[i].first);
+ break;
case MVT::i64:
break;
case MVT::f64:
@@ -332,6 +329,17 @@
Node->dump();
assert(0 && "Node not handled!\n");
+ case ISD::ConstantFP:
+ if (ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(N)) {
+ if (CN->isExactlyValue(+0.0) ||
+ CN->isExactlyValue(-0.0)) {
+ BuildMI(BB, Alpha::CPYS, 2, Result).addReg(R31).addReg(R31);
+ } else {
+ abort();
+ }
+ }
+ return Result;
+
case ISD::FrameIndex:
Tmp1 = cast<FrameIndexSDNode>(N)->getIndex();
BuildMI(BB, Alpha::LDA, 2, Result).addImm(Tmp1 * 8).addReg(Alpha::R30);
@@ -363,6 +371,7 @@
case MVT::i16:
BuildMI(BB, Alpha::LDWU, 2, Result).addImm(0).addReg(Tmp1);
break;
+ case MVT::i1: //Treat i1 as i8 since there are problems otherwise
case MVT::i8:
BuildMI(BB, Alpha::LDBU, 2, Result).addImm(0).addReg(Tmp1);
break;
@@ -589,10 +598,18 @@
case ISD::SETUGT: Opc = isConst1 ? Alpha::CMPULTi : Alpha::CMPULT; dir = 2; break;
case ISD::SETULE: Opc = isConst2 ? Alpha::CMPULEi : Alpha::CMPULE; dir = 1; break;
case ISD::SETUGE: Opc = isConst1 ? Alpha::CMPULEi : Alpha::CMPULE; dir = 2; break;
- case ISD::SETNE:
- std::cerr << "Alpha does not have a setne.\n";
- abort();
- }
+ case ISD::SETNE: {//Handle this one special
+ //std::cerr << "Alpha does not have a setne.\n";
+ //abort();
+ Tmp1 = SelectExpr(N.getOperand(0));
+ Tmp2 = SelectExpr(N.getOperand(1));
+ Tmp3 = MakeReg(MVT::i64);
+ BuildMI(BB, Alpha::CMPEQ, 2, Tmp3).addReg(Tmp1).addReg(Tmp2);
+ //and invert
+ BuildMI(BB,Alpha::ORNOT, 2, Result).addReg(Alpha::R31).addReg(Tmp3);
+ return Result;
+ }
+ }
if (dir == 1) {
Tmp1 = SelectExpr(N.getOperand(0));
if (isConst2) {
@@ -796,14 +813,19 @@
BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2);
return Result;
-// case ISD::SINT_TO_FP:
-// MVT::ValueType DestTy = N.getValueType();
-// Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register
-// Tmp2 = MakeReg(DestTy);
-// Opc = DestTy == MVT::f64 ? ITOFT : ITOFS;
-// BuildMI(BB, Opc, 1, Tmp2).addReg(Tmp1);
-// Opc = DestTy == MVT::f64 ? CVTQT : CVTQS;
-// BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
+ case ISD::SINT_TO_FP:
+ {
+ MVT::ValueType DestTy = N.getValueType();
+ assert (N.getOperand(0).getValueType() == MVT::i64 && "only quads can be loaded from");
+ Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register
+ Tmp2 = MakeReg(DestTy);
+ Opc = DestTy == MVT::f64 ? Alpha::ITOFT : Alpha::ITOFS;
+ BuildMI(BB, Opc, 1, Tmp2).addReg(Tmp1);
+ Opc = DestTy == MVT::f64 ? Alpha::CVTQT : Alpha::CVTQS;
+ BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
+ return Result;
+ }
+
// // case ISD::UINT_TO_FP:
// case ISD::FP_TO_SINT:
Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td
diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.7 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.8
--- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.7 Wed Jan 26 21:49:45 2005
+++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Thu Jan 27 01:50:35 2005
@@ -322,6 +322,14 @@
def ITOFS : FPForm<0x14, 0x004, (ops FPRC:$RC, GPRC:$RA), "itofs $RA,$RC">; //Integer to floating move, S_floating
def ITOFT : FPForm<0x14, 0x024, (ops FPRC:$RC, GPRC:$RA), "itoft $RA,$RC">; //Integer to floating move, T_floating
+//CVTLQ F-P 17.010 Convert longword to quadword
+//CVTQL F-P 17.030 Convert quadword to longword
+def CVTQS : FPForm<0x16, 0x0BC, (ops FPRC:$RC, FPRC:$RA), "cvtqs $RA,$RC">; //Convert quadword to S_floating
+def CVTQT : FPForm<0x16, 0x0BE, (ops FPRC:$RC, FPRC:$RA), "cvtqt $RA,$RC">; //Convert quadword to T_floating
+//CVTST F-P 16.2AC Convert S_floating to T_floating
+//CVTTQ F-P 16.0AF Convert T_floating to quadword
+//CVTTS F-P 16.0AC Convert T_floating to S_floating
+
//S_floating : IEEE Single
//T_floating : IEEE Double
@@ -354,14 +362,6 @@
//CMPTLT F-P 16.0A6 Compare T_floating less than
//CMPTUN F-P 16.0A4 Compare T_floating unordered
-//CVTLQ F-P 17.010 Convert longword to quadword
-//CVTQL F-P 17.030 Convert quadword to longword
-//CVTQS F-P 16.0BC Convert quadword to S_floating
-//CVTQT F-P 16.0BE Convert quadword to T_floating
-//CVTST F-P 16.2AC Convert S_floating to T_floating
-//CVTTQ F-P 16.0AF Convert T_floating to quadword
-//CVTTS F-P 16.0AC Convert T_floating to S_floating
-
//FCMOVEQ F-P 17.02A FCMOVE if = zero
//FCMOVGE F-P 17.02D FCMOVE if >= zero
//FCMOVGT F-P 17.02F FCMOVE if > zero
More information about the llvm-commits
mailing list