-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[AArch64] Add lowering for NEON saturating shift intrinsics #171485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -4561,7 +4561,8 @@ static SDValue lowerADDSUBO_CARRY(SDValue Op, SelectionDAG &DAG, | |||||||
| } | ||||||||
|
|
||||||||
| static SDValue lowerIntNeonIntrinsic(SDValue Op, unsigned Opcode, | ||||||||
| SelectionDAG &DAG) { | ||||||||
| SelectionDAG &DAG, | ||||||||
| bool IsLastInt = false) { | ||||||||
| SDLoc DL(Op); | ||||||||
| auto getFloatVT = [](EVT VT) { | ||||||||
| assert((VT == MVT::i32 || VT == MVT::i64) && "Unexpected VT"); | ||||||||
|
|
@@ -4570,11 +4571,18 @@ static SDValue lowerIntNeonIntrinsic(SDValue Op, unsigned Opcode, | |||||||
| auto bitcastToFloat = [&](SDValue Val) { | ||||||||
| return DAG.getBitcast(getFloatVT(Val.getValueType()), Val); | ||||||||
| }; | ||||||||
|
|
||||||||
| const unsigned NumOps = Op.getNumOperands(); | ||||||||
| const unsigned LastOpIdx = NumOps - 1; | ||||||||
| SmallVector<SDValue, 2> NewOps; | ||||||||
| NewOps.reserve(Op.getNumOperands() - 1); | ||||||||
| NewOps.reserve(NumOps - 1); | ||||||||
|
|
||||||||
| for (unsigned I = 1, E = Op.getNumOperands(); I < E; ++I) | ||||||||
| // Skip first operand as it is intrinsic ID. | ||||||||
| for (unsigned I = 1, E = LastOpIdx; I < E; ++I) | ||||||||
| NewOps.push_back(bitcastToFloat(Op.getOperand(I))); | ||||||||
| SDValue LastOp = IsLastInt ? Op.getOperand(LastOpIdx) | ||||||||
| : bitcastToFloat(Op.getOperand(LastOpIdx)); | ||||||||
|
||||||||
| : bitcastToFloat(Op.getOperand(LastOpIdx)); | |
| SDValue LastOp = Op.getOperand(LastOpIdx); | |
| LastOp = isa<ConstantSDNode>(LastOp) ? LastOp : bitcastToFloat(LastOp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks that makes way more sense !
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1035,9 +1035,12 @@ def AArch64uqsub: SDNode<"AArch64ISD::UQSUB", SDTFPBinOp>; | |
| def AArch64sqdmull: SDNode<"AArch64ISD::SQDMULL", | ||
| SDTypeProfile<1, 2, [ SDTCisSameAs<1, 2>, | ||
| SDTCisFP<0>, SDTCisFP<1>]>>; | ||
|
|
||
| //def Aarch64softf32tobf16v8: SDNode<"AArch64ISD::", SDTFPRoundOp>; | ||
|
|
||
| def AArch64sqshrun: SDNode<"AArch64ISD::SQSHRUN", SDTFPTruncRoundOp>; | ||
| def AArch64sqrshrun: SDNode<"AArch64ISD::SQRSHRUN", SDTFPTruncRoundOp>; | ||
| def AArch64sqshrn: SDNode<"AArch64ISD::SQSHRN", SDTFPTruncRoundOp>; | ||
| def AArch64uqshrn: SDNode<"AArch64ISD::UQSHRN", SDTFPTruncRoundOp>; | ||
| def AArch64sqrshrn: SDNode<"AArch64ISD::SQRSHRN", SDTFPTruncRoundOp>; | ||
| def AArch64uqrshrn: SDNode<"AArch64ISD::UQRSHRN", SDTFPTruncRoundOp>; | ||
| // Vector immediate ops | ||
| def AArch64bici: SDNode<"AArch64ISD::BICi", SDT_AArch64vecimm>; | ||
| def AArch64orri: SDNode<"AArch64ISD::ORRi", SDT_AArch64vecimm>; | ||
|
|
@@ -8902,15 +8905,15 @@ def : Pat<(i32 (int_aarch64_neon_facgt (f16 FPR16:$Rn), (f16 FPR16:$Rm))), | |
| defm SHL : SIMDScalarLShiftD< 0, 0b01010, "shl", AArch64vshl>; | ||
| defm SLI : SIMDScalarLShiftDTied<1, 0b01010, "sli", AArch64vsli>; | ||
| defm SQRSHRN : SIMDScalarRShiftBHS< 0, 0b10011, "sqrshrn", | ||
| int_aarch64_neon_sqrshrn>; | ||
| AArch64sqrshrn>; | ||
|
||
| defm SQRSHRUN : SIMDScalarRShiftBHS< 1, 0b10001, "sqrshrun", | ||
| int_aarch64_neon_sqrshrun>; | ||
| AArch64sqrshrun>; | ||
| defm SQSHLU : SIMDScalarLShiftBHSD<1, 0b01100, "sqshlu", AArch64sqshlui>; | ||
| defm SQSHL : SIMDScalarLShiftBHSD<0, 0b01110, "sqshl", AArch64sqshli>; | ||
| defm SQSHRN : SIMDScalarRShiftBHS< 0, 0b10010, "sqshrn", | ||
| int_aarch64_neon_sqshrn>; | ||
| AArch64sqshrn>; | ||
| defm SQSHRUN : SIMDScalarRShiftBHS< 1, 0b10000, "sqshrun", | ||
| int_aarch64_neon_sqshrun>; | ||
| AArch64sqshrun>; | ||
| defm SRI : SIMDScalarRShiftDTied< 1, 0b01000, "sri", AArch64vsri>; | ||
| defm SRSHR : SIMDScalarRShiftD< 0, 0b00100, "srshr", AArch64srshri>; | ||
| defm SRSRA : SIMDScalarRShiftDTied< 0, 0b00110, "srsra", | ||
|
|
@@ -8921,10 +8924,10 @@ defm SSRA : SIMDScalarRShiftDTied< 0, 0b00010, "ssra", | |
| TriOpFrag<(add_and_or_is_add node:$LHS, | ||
| (AArch64vashr node:$MHS, node:$RHS))>>; | ||
| defm UQRSHRN : SIMDScalarRShiftBHS< 1, 0b10011, "uqrshrn", | ||
| int_aarch64_neon_uqrshrn>; | ||
| AArch64uqrshrn>; | ||
| defm UQSHL : SIMDScalarLShiftBHSD<1, 0b01110, "uqshl", AArch64uqshli>; | ||
| defm UQSHRN : SIMDScalarRShiftBHS< 1, 0b10010, "uqshrn", | ||
| int_aarch64_neon_uqshrn>; | ||
| AArch64uqshrn>; | ||
| defm URSHR : SIMDScalarRShiftD< 1, 0b00100, "urshr", AArch64urshri>; | ||
| defm URSRA : SIMDScalarRShiftDTied< 1, 0b00110, "ursra", | ||
| TriOpFrag<(add node:$LHS, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrote this whole part in the end