diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:17:49 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:17:49 +0000 |
commit | b78e214274d397407b6167a293b7cd7c3b526dde (patch) | |
tree | 6ed4e3fee5507750a6480568b56bea7582f7fb1a /lib/Target | |
parent | 1394db0eebe36d7154dfc36b4bed0b435a62b397 (diff) | |
download | external_llvm-b78e214274d397407b6167a293b7cd7c3b526dde.zip external_llvm-b78e214274d397407b6167a293b7cd7c3b526dde.tar.gz external_llvm-b78e214274d397407b6167a293b7cd7c3b526dde.tar.bz2 |
Custom lower SIGN_EXTEND
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.cpp | 15 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index d609a31..df8072c 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -85,6 +85,7 @@ MSP430TargetLowering::MSP430TargetLowering(MSP430TargetMachine &tm) : setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); setOperationAction(ISD::SELECT, MVT::i8, Custom); setOperationAction(ISD::SELECT, MVT::i16, Custom); + setOperationAction(ISD::SIGN_EXTEND, MVT::i16, Custom); // FIXME: Implement efficiently multiplication by a constant setOperationAction(ISD::MUL, MVT::i16, Expand); @@ -107,6 +108,7 @@ SDValue MSP430TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { case ISD::SETCC: return LowerSETCC(Op, DAG); case ISD::BRCOND: return LowerBRCOND(Op, DAG); case ISD::SELECT: return LowerSELECT(Op, DAG); + case ISD::SIGN_EXTEND: return LowerSIGN_EXTEND(Op, DAG); default: assert(0 && "unimplemented operand"); return SDValue(); @@ -592,6 +594,19 @@ SDValue MSP430TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) { return DAG.getNode(MSP430ISD::SELECT, dl, VTs, &Ops[0], Ops.size()); } +SDValue MSP430TargetLowering::LowerSIGN_EXTEND(SDValue Op, + SelectionDAG &DAG) { + SDValue Val = Op.getOperand(0); + MVT VT = Op.getValueType(); + DebugLoc dl = Op.getDebugLoc(); + + assert(VT == MVT::i16 && "Only support i16 for now!"); + + return DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, VT, + DAG.getNode(ISD::ANY_EXTEND, dl, VT, Val), + DAG.getValueType(Val.getValueType())); +} + const char *MSP430TargetLowering::getTargetNodeName(unsigned Opcode) const { switch (Opcode) { default: return NULL; diff --git a/lib/Target/MSP430/MSP430ISelLowering.h b/lib/Target/MSP430/MSP430ISelLowering.h index d440ca2..32c990d 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.h +++ b/lib/Target/MSP430/MSP430ISelLowering.h @@ -86,6 +86,7 @@ namespace llvm { SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG); SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG); SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG); + SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG); SDValue LowerCCCCallTo(SDValue Op, SelectionDAG &DAG, unsigned CC); |