diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-04-14 05:48:50 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-04-14 05:48:50 +0000 |
commit | d9f88da7b329c54ccb0d2ebd3b3a4b0e4b1e2b06 (patch) | |
tree | 200bdbe117d29cb45f322e55b1c762e1b47c6ec9 /lib/Target/Sparc | |
parent | 1f098af3648f7714dd0501f8ba97601e99471806 (diff) | |
download | external_llvm-d9f88da7b329c54ccb0d2ebd3b3a4b0e4b1e2b06.zip external_llvm-d9f88da7b329c54ccb0d2ebd3b3a4b0e4b1e2b06.tar.gz external_llvm-d9f88da7b329c54ccb0d2ebd3b3a4b0e4b1e2b06.tar.bz2 |
Use i32 for all SPARC shift amounts, even in 64-bit mode.
Test case by llvm-stress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r-- | lib/Target/Sparc/SparcISelLowering.cpp | 4 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcISelLowering.h | 1 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcInstr64Bit.td | 2 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcInstrFormats.td | 8 |
4 files changed, 8 insertions, 7 deletions
diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index 198d194..49d68c7 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/lib/Target/Sparc/SparcISelLowering.cpp @@ -1415,7 +1415,7 @@ SDValue SparcTargetLowering::makeAddress(SDValue Op, SelectionDAG &DAG) const { case CodeModel::Medium: { // abs44. SDValue H44 = makeHiLoPair(Op, SPII::MO_H44, SPII::MO_M44, DAG); - H44 = DAG.getNode(ISD::SHL, DL, VT, H44, DAG.getIntPtrConstant(12)); + H44 = DAG.getNode(ISD::SHL, DL, VT, H44, DAG.getConstant(12, MVT::i32)); SDValue L44 = withTargetFlags(Op, SPII::MO_L44, DAG); L44 = DAG.getNode(SPISD::Lo, DL, VT, L44); return DAG.getNode(ISD::ADD, DL, VT, H44, L44); @@ -1423,7 +1423,7 @@ SDValue SparcTargetLowering::makeAddress(SDValue Op, SelectionDAG &DAG) const { case CodeModel::Large: { // abs64. SDValue Hi = makeHiLoPair(Op, SPII::MO_HH, SPII::MO_HM, DAG); - Hi = DAG.getNode(ISD::SHL, DL, VT, Hi, DAG.getIntPtrConstant(32)); + Hi = DAG.getNode(ISD::SHL, DL, VT, Hi, DAG.getConstant(32, MVT::i32)); SDValue Lo = makeHiLoPair(Op, SPII::MO_HI, SPII::MO_LO, DAG); return DAG.getNode(ISD::ADD, DL, VT, Hi, Lo); } diff --git a/lib/Target/Sparc/SparcISelLowering.h b/lib/Target/Sparc/SparcISelLowering.h index 21c1831..fd706be 100644 --- a/lib/Target/Sparc/SparcISelLowering.h +++ b/lib/Target/Sparc/SparcISelLowering.h @@ -71,6 +71,7 @@ namespace llvm { getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + virtual MVT getScalarShiftAmountTy(EVT LHSTy) const { return MVT::i32; } virtual SDValue LowerFormalArguments(SDValue Chain, diff --git a/lib/Target/Sparc/SparcInstr64Bit.td b/lib/Target/Sparc/SparcInstr64Bit.td index 70e55e6..e2da70a 100644 --- a/lib/Target/Sparc/SparcInstr64Bit.td +++ b/lib/Target/Sparc/SparcInstr64Bit.td @@ -133,7 +133,7 @@ def HM10 : SDNodeXForm<imm, [{ return CurDAG->getTargetConstant(Val, MVT::i32); }]>; def : Pat<(i64 imm:$val), - (ORrr (SLLXri (ORri (SETHIi (HH22 $val)), (HM10 $val)), (i64 32)), + (ORrr (SLLXri (ORri (SETHIi (HH22 $val)), (HM10 $val)), (i32 32)), (ORri (SETHIi (HI22 $val)), (LO10 $val)))>, Requires<[Is64Bit]>; diff --git a/lib/Target/Sparc/SparcInstrFormats.td b/lib/Target/Sparc/SparcInstrFormats.td index f101856..e7fde08 100644 --- a/lib/Target/Sparc/SparcInstrFormats.td +++ b/lib/Target/Sparc/SparcInstrFormats.td @@ -142,10 +142,10 @@ class F3_Si<bits<2> opVal, bits<6> op3val, bit xVal, dag outs, dag ins, // Define rr and ri shift instructions with patterns. multiclass F3_S<string OpcStr, bits<6> Op3Val, bit XVal, SDNode OpNode, ValueType VT, RegisterClass RC> { - def rr : F3_Sr<2, Op3Val, XVal, (outs RC:$rd), (ins RC:$rs, RC:$rs2), + def rr : F3_Sr<2, Op3Val, XVal, (outs RC:$rd), (ins RC:$rs, IntRegs:$rs2), !strconcat(OpcStr, " $rs, $rs2, $rd"), - [(set VT:$rd, (OpNode VT:$rs, VT:$rs2))]>; - def ri : F3_Si<2, Op3Val, XVal, (outs RC:$rd), (ins RC:$rs, unknown:$shcnt), + [(set VT:$rd, (OpNode VT:$rs, i32:$rs2))]>; + def ri : F3_Si<2, Op3Val, XVal, (outs RC:$rd), (ins RC:$rs, i32imm:$shcnt), !strconcat(OpcStr, " $rs, $shcnt, $rd"), - [(set VT:$rd, (OpNode VT:$rs, (VT imm:$shcnt)))]>; + [(set VT:$rd, (OpNode VT:$rs, (i32 imm:$shcnt)))]>; } |