diff options
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp index d05d22a7164e..463ec41b94e9 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -435,6 +435,8 @@ public: bool trySelectCastFixedLengthToScalableVector(SDNode *N); bool trySelectCastScalableToFixedLengthVector(SDNode *N); + bool trySelectXAR(SDNode *N); + // Include the pieces autogenerated from the target description. #include "AArch64GenDAGISel.inc" @@ -4273,6 +4275,40 @@ bool AArch64DAGToDAGISel::trySelectCastScalableToFixedLengthVector(SDNode *N) { return true; } +bool AArch64DAGToDAGISel::trySelectXAR(SDNode *N) { + assert(N->getOpcode() == ISD::OR && "Expected OR instruction"); + + SDValue N0 = N->getOperand(0); + SDValue N1 = N->getOperand(1); + + if (N0->getOpcode() != AArch64ISD::VSHL || + N1->getOpcode() != AArch64ISD::VLSHR) + return false; + + if (N0->getOperand(0) != N1->getOperand(0) || + N1->getOperand(0)->getOpcode() != ISD::XOR) + return false; + + SDValue XOR = N0.getOperand(0); + SDValue R1 = XOR.getOperand(0); + SDValue R2 = XOR.getOperand(1); + + unsigned HsAmt = N0.getConstantOperandVal(1); + unsigned ShAmt = N1.getConstantOperandVal(1); + + SDLoc DL = SDLoc(N0.getOperand(1)); + SDValue Imm = CurDAG->getTargetConstant( + ShAmt, DL, N0.getOperand(1).getValueType(), false); + + if (ShAmt + HsAmt != 64) + return false; + + SDValue Ops[] = {R1, R2, Imm}; + CurDAG->SelectNodeTo(N, AArch64::XAR, N0.getValueType(), Ops); + + return true; +} + void AArch64DAGToDAGISel::Select(SDNode *Node) { // If we have a custom node, we already have selected! if (Node->isMachineOpcode()) { @@ -4336,6 +4372,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) { case ISD::OR: if (tryBitfieldInsertOp(Node)) return; + if (Subtarget->hasSHA3() && trySelectXAR(Node)) + return; break; case ISD::EXTRACT_SUBVECTOR: { |