-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Refactor tablegen classes to push common values down to VPseudoBinaryM. NFC #126339
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
Conversation
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
…doBinaryM. NFC Move the class next to its only users.
@llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesMove VPseudoBinaryM ajacent to its only users. Full diff: https://github.com/llvm/llvm-project/pull/126339.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 268bfe70673a2a..fe85d4b074c87c 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -2136,23 +2136,6 @@ multiclass VPseudoBinaryRoundingMode<VReg RetClass,
}
-multiclass VPseudoBinaryM<VReg RetClass,
- VReg Op1Class,
- DAGOperand Op2Class,
- LMULInfo MInfo,
- string Constraint = "",
- bits<2> TargetConstraintType = 1,
- bit Commutable = 0> {
- let VLMul = MInfo.value, isCommutable = Commutable in {
- def "_" # MInfo.MX : VPseudoBinaryNoMask<RetClass, Op1Class, Op2Class,
- Constraint, TargetConstraintType>;
- let ForceTailAgnostic = true in
- def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMOutMask<RetClass, Op1Class,
- Op2Class, Constraint, TargetConstraintType>,
- RISCVMaskedPseudo<MaskIdx=3>;
- }
-}
-
multiclass VPseudoBinaryEmul<VReg RetClass,
VReg Op1Class,
DAGOperand Op2Class,
@@ -2633,28 +2616,35 @@ multiclass PseudoVEXT_VF8 {
// lowest-numbered part of the source register group".
// With LMUL<=1 the source and dest occupy a single register so any overlap
// is in the lowest-numbered part.
-multiclass VPseudoBinaryM_VV<LMULInfo m, bits<2> TargetConstraintType = 1,
- bit Commutable = 0> {
- defm _VV : VPseudoBinaryM<VR, m.vrclass, m.vrclass, m,
+multiclass VPseudoBinaryM<DAGOperand Op2Class, LMULInfo m, bit Commutable = 0> {
+ let VLMul = m.value, isCommutable = Commutable in {
+ def "_" # m.MX :
+ VPseudoBinaryNoMask<VR, m.vrclass, Op2Class,
+ !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""),
+ TargetConstraintType = 2>;
+ let ForceTailAgnostic = true in
+ def "_" # m.MX # "_MASK" :
+ VPseudoBinaryMOutMask<VR, m.vrclass, Op2Class,
!if(!ge(m.octuple, 16), "@earlyclobber $rd", ""),
- TargetConstraintType, Commutable=Commutable>;
+ TargetConstraintType = 2>,
+ RISCVMaskedPseudo<MaskIdx=3>;
+ }
}
-multiclass VPseudoBinaryM_VX<LMULInfo m, bits<2> TargetConstraintType = 1> {
- defm "_VX" :
- VPseudoBinaryM<VR, m.vrclass, GPR, m,
- !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>;
+multiclass VPseudoBinaryM_VV<LMULInfo m, bit Commutable = 0> {
+ defm _VV : VPseudoBinaryM<m.vrclass, m, Commutable=Commutable>;
}
-multiclass VPseudoBinaryM_VF<LMULInfo m, FPR_Info f, bits<2> TargetConstraintType = 1> {
- defm "_V" # f.FX :
- VPseudoBinaryM<VR, m.vrclass, f.fprclass, m,
- !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>;
+multiclass VPseudoBinaryM_VX<LMULInfo m> {
+ defm _VX : VPseudoBinaryM<GPR, m>;
}
-multiclass VPseudoBinaryM_VI<LMULInfo m, bits<2> TargetConstraintType = 1> {
- defm _VI : VPseudoBinaryM<VR, m.vrclass, simm5, m,
- !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>;
+multiclass VPseudoBinaryM_VF<LMULInfo m, FPR_Info f> {
+ defm "_V" # f.FX : VPseudoBinaryM<f.fprclass, m>;
+}
+
+multiclass VPseudoBinaryM_VI<LMULInfo m> {
+ defm _VI : VPseudoBinaryM<simm5, m>;
}
multiclass VPseudoVGTR_VV_VX_VI {
@@ -3397,11 +3387,11 @@ multiclass VPseudoVWMAC_VV_VF_BF_RM {
multiclass VPseudoVCMPM_VV_VX_VI<bit Commutable = 0> {
foreach m = MxList in {
defvar mx = m.MX;
- defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2, Commutable=Commutable>,
+ defm "" : VPseudoBinaryM_VV<m, Commutable=Commutable>,
SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>;
- defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VX<m>,
SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>;
- defm "" : VPseudoBinaryM_VI<m, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VI<m>,
SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>;
}
}
@@ -3409,22 +3399,32 @@ multiclass VPseudoVCMPM_VV_VX_VI<bit Commutable = 0> {
multiclass VPseudoVCMPM_VV_VX {
foreach m = MxList in {
defvar mx = m.MX;
- defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VV<m>,
SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>;
- defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VX<m>,
+ SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>;
+ }
+}
+
+multiclass VPseudoVCMPM_VX_VI {
+ foreach m = MxList in {
+ defvar mx = m.MX;
+ defm "" : VPseudoBinaryM_VX<m>,
SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>;
+ defm "" : VPseudoBinaryM_VI<m>,
+ SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>;
}
}
multiclass VPseudoVCMPM_VV_VF {
foreach m = MxListF in {
- defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VV<m>,
SchedBinary<"WriteVFCmpV", "ReadVFCmpV", "ReadVFCmpV", m.MX>;
}
foreach f = FPList in {
foreach m = f.MxList in {
- defm "" : VPseudoBinaryM_VF<m, f, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VF<m, f>,
SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>;
}
}
@@ -3433,22 +3433,12 @@ multiclass VPseudoVCMPM_VV_VF {
multiclass VPseudoVCMPM_VF {
foreach f = FPList in {
foreach m = f.MxList in {
- defm "" : VPseudoBinaryM_VF<m, f, TargetConstraintType=2>,
+ defm "" : VPseudoBinaryM_VF<m, f>,
SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>;
}
}
}
-multiclass VPseudoVCMPM_VX_VI {
- foreach m = MxList in {
- defvar mx = m.MX;
- defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>,
- SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>;
- defm "" : VPseudoBinaryM_VI<m, TargetConstraintType=2>,
- SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>;
- }
-}
-
multiclass VPseudoVRED_VS {
foreach m = MxList in {
defvar mx = m.MX;
|
wangpc-pp
approved these changes
Feb 8, 2025
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.
LGTM.
Icohedron
pushed a commit
to Icohedron/llvm-project
that referenced
this pull request
Feb 11, 2025
…doBinaryM. NFC (llvm#126339) Move VPseudoBinaryM ajacent to its only users.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Move VPseudoBinaryM ajacent to its only users.