mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Expand 64-bit logical shift right inline
llvm-svn: 85687
This commit is contained in:
parent
16ae289667
commit
ace75c4288
@ -332,7 +332,7 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
|
||||
}
|
||||
setOperationAction(ISD::SHL_PARTS, MVT::i32, Custom);
|
||||
setOperationAction(ISD::SRA_PARTS, MVT::i32, Custom);
|
||||
setOperationAction(ISD::SRL_PARTS, MVT::i32, Expand);
|
||||
setOperationAction(ISD::SRL_PARTS, MVT::i32, Custom);
|
||||
setOperationAction(ISD::SRL, MVT::i64, Custom);
|
||||
setOperationAction(ISD::SRA, MVT::i64, Custom);
|
||||
|
||||
@ -2108,8 +2108,10 @@ static SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG,
|
||||
SDValue ShOpHi = Op.getOperand(1);
|
||||
SDValue ShAmt = Op.getOperand(2);
|
||||
SDValue ARMCC;
|
||||
unsigned Opc = (Op.getOpcode() == ISD::SRA_PARTS) ? ISD::SRA : ISD::SRL;
|
||||
|
||||
assert(Op.getOpcode() == ISD::SRA_PARTS || Op.getOpcode() == ISD::SRL_PARTS);
|
||||
|
||||
assert(Op.getOpcode() == ISD::SRA_PARTS);
|
||||
SDValue RevShAmt = DAG.getNode(ISD::SUB, dl, MVT::i32,
|
||||
DAG.getConstant(VTBits, MVT::i32), ShAmt);
|
||||
SDValue Tmp1 = DAG.getNode(ISD::SRL, dl, VT, ShOpLo, ShAmt);
|
||||
@ -2117,12 +2119,12 @@ static SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG,
|
||||
DAG.getConstant(VTBits, MVT::i32));
|
||||
SDValue Tmp2 = DAG.getNode(ISD::SHL, dl, VT, ShOpHi, RevShAmt);
|
||||
SDValue FalseVal = DAG.getNode(ISD::OR, dl, VT, Tmp1, Tmp2);
|
||||
SDValue TrueVal = DAG.getNode(ISD::SRA, dl, VT, ShOpHi, ExtraShAmt);
|
||||
SDValue TrueVal = DAG.getNode(Opc, dl, VT, ShOpHi, ExtraShAmt);
|
||||
|
||||
SDValue CCR = DAG.getRegister(ARM::CPSR, MVT::i32);
|
||||
SDValue Cmp = getARMCmp(ExtraShAmt, DAG.getConstant(0, MVT::i32), ISD::SETGE,
|
||||
ARMCC, DAG, ST->isThumb1Only(), dl);
|
||||
SDValue Hi = DAG.getNode(ISD::SRA, dl, VT, ShOpHi, ShAmt);
|
||||
SDValue Hi = DAG.getNode(Opc, dl, VT, ShOpHi, ShAmt);
|
||||
SDValue Lo = DAG.getNode(ARMISD::CMOV, dl, VT, FalseVal, TrueVal, ARMCC,
|
||||
CCR, Cmp);
|
||||
|
||||
@ -2857,6 +2859,7 @@ SDValue ARMTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
|
||||
case ISD::SRL:
|
||||
case ISD::SRA: return LowerShift(Op.getNode(), DAG, Subtarget);
|
||||
case ISD::SHL_PARTS: return LowerShiftLeftParts(Op, DAG, Subtarget);
|
||||
case ISD::SRL_PARTS:
|
||||
case ISD::SRA_PARTS: return LowerShiftRightParts(Op, DAG, Subtarget);
|
||||
case ISD::VSETCC: return LowerVSETCC(Op, DAG);
|
||||
case ISD::BUILD_VECTOR: return LowerBUILD_VECTOR(Op, DAG);
|
||||
|
@ -27,7 +27,7 @@ define i32 @f2(i64 %x, i64 %y) {
|
||||
|
||||
define i32 @f3(i64 %x, i64 %y) {
|
||||
; CHECK: f3
|
||||
; CHECK: __lshrdi3
|
||||
; CHECK: movge r0, r1, lsr r2
|
||||
%a = lshr i64 %x, %y
|
||||
%b = trunc i64 %a to i32
|
||||
ret i32 %b
|
||||
|
Loading…
Reference in New Issue
Block a user