mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
More Neon clean-up: avoid the need for custom-lowering vld/st-lane intrinsics
by creating TargetConstants during instruction selection instead of during legalization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84042 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -392,8 +392,6 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
|
||||
|
||||
// We want to custom lower some of our intrinsics.
|
||||
setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
|
||||
setOperationAction(ISD::INTRINSIC_W_CHAIN, MVT::Other, Custom);
|
||||
setOperationAction(ISD::INTRINSIC_VOID, MVT::Other, Custom);
|
||||
|
||||
setOperationAction(ISD::SETCC, MVT::i32, Expand);
|
||||
setOperationAction(ISD::SETCC, MVT::f32, Expand);
|
||||
@@ -1369,56 +1367,6 @@ SDValue ARMTargetLowering::LowerGLOBAL_OFFSET_TABLE(SDValue Op,
|
||||
return DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
|
||||
}
|
||||
|
||||
static SDValue LowerNeonVLDLaneIntrinsic(SDValue Op, SelectionDAG &DAG,
|
||||
unsigned NumVecs) {
|
||||
// Change the lane number operand to be a TargetConstant; otherwise it
|
||||
// will be legalized into a register.
|
||||
SDNode *Node = Op.getNode();
|
||||
ConstantSDNode *Lane = dyn_cast<ConstantSDNode>(Node->getOperand(NumVecs+3));
|
||||
if (!Lane) {
|
||||
assert(false && "vld lane number must be a constant");
|
||||
return SDValue();
|
||||
}
|
||||
SmallVector<SDValue, 8> Ops(Node->op_begin(), Node->op_end());
|
||||
Ops[NumVecs+3] = DAG.getTargetConstant(Lane->getZExtValue(), MVT::i32);
|
||||
return DAG.UpdateNodeOperands(Op, &Ops[0], Ops.size());
|
||||
}
|
||||
|
||||
static SDValue LowerNeonVSTLaneIntrinsic(SDValue Op, SelectionDAG &DAG,
|
||||
unsigned NumVecs) {
|
||||
// Change the lane number operand to be a TargetConstant; otherwise it
|
||||
// will be legalized into a register.
|
||||
SDNode *Node = Op.getNode();
|
||||
ConstantSDNode *Lane = dyn_cast<ConstantSDNode>(Node->getOperand(NumVecs+3));
|
||||
if (!Lane) {
|
||||
assert(false && "vst lane number must be a constant");
|
||||
return SDValue();
|
||||
}
|
||||
SmallVector<SDValue, 8> Ops(Node->op_begin(), Node->op_end());
|
||||
Ops[NumVecs+3] = DAG.getTargetConstant(Lane->getZExtValue(), MVT::i32);
|
||||
return DAG.UpdateNodeOperands(Op, &Ops[0], Ops.size());
|
||||
}
|
||||
|
||||
SDValue
|
||||
ARMTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) {
|
||||
unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(1))->getZExtValue();
|
||||
switch (IntNo) {
|
||||
case Intrinsic::arm_neon_vld2lane:
|
||||
return LowerNeonVLDLaneIntrinsic(Op, DAG, 2);
|
||||
case Intrinsic::arm_neon_vld3lane:
|
||||
return LowerNeonVLDLaneIntrinsic(Op, DAG, 3);
|
||||
case Intrinsic::arm_neon_vld4lane:
|
||||
return LowerNeonVLDLaneIntrinsic(Op, DAG, 4);
|
||||
case Intrinsic::arm_neon_vst2lane:
|
||||
return LowerNeonVSTLaneIntrinsic(Op, DAG, 2);
|
||||
case Intrinsic::arm_neon_vst3lane:
|
||||
return LowerNeonVSTLaneIntrinsic(Op, DAG, 3);
|
||||
case Intrinsic::arm_neon_vst4lane:
|
||||
return LowerNeonVSTLaneIntrinsic(Op, DAG, 4);
|
||||
default: return SDValue(); // Don't custom lower most intrinsics.
|
||||
}
|
||||
}
|
||||
|
||||
SDValue
|
||||
ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
|
||||
unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
|
||||
@@ -2802,8 +2750,6 @@ SDValue ARMTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
|
||||
case ISD::RETURNADDR: break;
|
||||
case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG);
|
||||
case ISD::GLOBAL_OFFSET_TABLE: return LowerGLOBAL_OFFSET_TABLE(Op, DAG);
|
||||
case ISD::INTRINSIC_VOID:
|
||||
case ISD::INTRINSIC_W_CHAIN: return LowerINTRINSIC_W_CHAIN(Op, DAG);
|
||||
case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG);
|
||||
case ISD::BIT_CONVERT: return ExpandBIT_CONVERT(Op.getNode(), DAG);
|
||||
case ISD::SHL:
|
||||
|
||||
Reference in New Issue
Block a user