-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[PowerPC] Intrinsics and tests for dmr insert/extract #135653
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11146,6 +11146,116 @@ SDValue PPCTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, | |
| return DAG.getMergeValues(RetOps, dl); | ||
| } | ||
|
|
||
| case Intrinsic::ppc_mma_dmxxextfdmr512: { | ||
| assert(Subtarget.isISAFuture() && "dmxxextfdmr512 requires ISA Future"); | ||
| auto *Idx = dyn_cast<ConstantSDNode>(Op.getOperand(2)); | ||
| assert(Idx && (Idx->getSExtValue() == 0 || Idx->getSExtValue() == 1) && | ||
| "Specify P of 0 or 1 for lower or upper 512 bytes"); | ||
| unsigned HiLo = Idx->getSExtValue(); | ||
| unsigned Opcode; | ||
| unsigned Subx; | ||
| if (HiLo == 0) { | ||
| Opcode = PPC::DMXXEXTFDMR512; | ||
| Subx = PPC::sub_wacc_lo; | ||
| } else { | ||
| Opcode = PPC::DMXXEXTFDMR512_HI; | ||
| Subx = PPC::sub_wacc_hi; | ||
| } | ||
| SDValue Subreg( | ||
| DAG.getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, MVT::v512i1, | ||
| Op.getOperand(1), | ||
| DAG.getTargetConstant(Subx, dl, MVT::i32)), | ||
| 0); | ||
| EVT ReturnTypes[] = {MVT::v256i1, MVT::v256i1}; | ||
| return SDValue(DAG.getMachineNode(Opcode, dl, ReturnTypes, Subreg), 0); | ||
| } | ||
|
|
||
| case Intrinsic::ppc_mma_dmxxextfdmr256: { | ||
| assert(Subtarget.isISAFuture() && "dmxxextfdmr256 requires ISA Future"); | ||
| auto *Idx = dyn_cast<ConstantSDNode>(Op.getOperand(2)); | ||
| assert(Idx && (Idx->getSExtValue() >= 0 || Idx->getSExtValue() <= 3) && | ||
| "Specify a dmr row pair 0-3"); | ||
| unsigned IdxVal = Idx->getSExtValue(); | ||
| unsigned Subx; | ||
| switch (IdxVal) { | ||
| case 0: | ||
| Subx = PPC::sub_dmrrowp0; | ||
| break; | ||
| case 1: | ||
| Subx = PPC::sub_dmrrowp1; | ||
| break; | ||
| case 2: | ||
| Subx = PPC::sub_wacc_hi_then_sub_dmrrowp0; | ||
| break; | ||
| case 3: | ||
| Subx = PPC::sub_wacc_hi_then_sub_dmrrowp1; | ||
| break; | ||
| } | ||
| SDValue Subreg( | ||
| DAG.getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, MVT::v256i1, | ||
| Op.getOperand(1), | ||
| DAG.getTargetConstant(Subx, dl, MVT::i32)), | ||
| 0); | ||
| SDValue P = DAG.getTargetConstant(IdxVal, dl, MVT::i32); | ||
| return SDValue( | ||
| DAG.getMachineNode(PPC::DMXXEXTFDMR256, dl, MVT::v256i1, {Subreg, P}), | ||
| 0); | ||
| } | ||
|
|
||
| case Intrinsic::ppc_mma_dmxxinstdmr512: { | ||
| assert(Subtarget.isISAFuture() && "dmxxinstdmr512 requires ISA Future"); | ||
| auto *Idx = dyn_cast<ConstantSDNode>(Op.getOperand(4)); | ||
| assert(Idx && (Idx->getSExtValue() == 0 || Idx->getSExtValue() == 1) && | ||
| "Specify P of 0 or 1 for lower or upper 512 bytes"); | ||
| unsigned HiLo = Idx->getSExtValue(); | ||
| unsigned Opcode; | ||
| unsigned Subx; | ||
| if (HiLo == 0) { | ||
| Opcode = PPC::DMXXINSTDMR512; | ||
| Subx = PPC::sub_wacc_lo; | ||
| } else { | ||
| Opcode = PPC::DMXXINSTDMR512_HI; | ||
| Subx = PPC::sub_wacc_hi; | ||
| } | ||
| SDValue Ops[] = {Op.getOperand(2), Op.getOperand(3)}; | ||
| SDValue Wacc = SDValue(DAG.getMachineNode(Opcode, dl, MVT::v512i1, Ops), 0); | ||
| SDValue SubReg = DAG.getTargetConstant(Subx, dl, MVT::i32); | ||
| return SDValue(DAG.getMachineNode(PPC::INSERT_SUBREG, dl, MVT::v1024i1, | ||
| Op.getOperand(1), Wacc, SubReg), | ||
| 0); | ||
| } | ||
|
|
||
| case Intrinsic::ppc_mma_dmxxinstdmr256: { | ||
| assert(Subtarget.isISAFuture() && "dmxxinstdmr256 requires ISA Future"); | ||
| auto *Idx = dyn_cast<ConstantSDNode>(Op.getOperand(3)); | ||
| assert(Idx && (Idx->getSExtValue() >= 0 || Idx->getSExtValue() <= 3) && | ||
| "Specify a dmr row pair 0-3"); | ||
| unsigned IdxVal = Idx->getSExtValue(); | ||
| unsigned Subx; | ||
| switch (IdxVal) { | ||
| case 0: | ||
| Subx = PPC::sub_dmrrowp0; | ||
| break; | ||
| case 1: | ||
| Subx = PPC::sub_dmrrowp1; | ||
| break; | ||
| case 2: | ||
| Subx = PPC::sub_wacc_hi_then_sub_dmrrowp0; | ||
| break; | ||
| case 3: | ||
| Subx = PPC::sub_wacc_hi_then_sub_dmrrowp1; | ||
| break; | ||
| } | ||
| SDValue SubReg = DAG.getTargetConstant(Subx, dl, MVT::i32); | ||
| SDValue P = DAG.getTargetConstant(IdxVal, dl, MVT::i32); | ||
| SDValue Ops[] = {Op.getOperand(2), P}; | ||
| SDValue DMRRowp = SDValue( | ||
| DAG.getMachineNode(PPC::DMXXINSTDMR256, dl, MVT::v256i1, Ops), 0); | ||
| return SDValue(DAG.getMachineNode(PPC::INSERT_SUBREG, dl, MVT::v1024i1, | ||
| Op.getOperand(1), DMRRowp, SubReg), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as Intrinsic::ppc_mma_dmxxinstdmr512. |
||
| 0); | ||
| } | ||
|
|
||
| case Intrinsic::ppc_mma_xxmfacc: | ||
| case Intrinsic::ppc_mma_xxmtacc: { | ||
| // Allow pre-isa-future subtargets to lower as normal. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Op.getOperand(1) is the 1024i1 operand which can be technically just the output but since it is used here by INSERT_SUBREG, then it was added as an input type in the int_ppc_mma_dmxxinstdmr512 intrinsic definition. Could we just create an IMPLICIT_DEF 1024i1 here instead as it seems we only care about its RegClass and remove 1024i1 from the input list of int_ppc_mma_dmxxinstdmr512?
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.
We want to be able to insert both the top half and bottom half of the same object. Without an input parameter for the object, we would create two different objects when we set the upper and lower halves, with no obvious way to put them together.