@@ -92,6 +92,11 @@ def sew : RISCVOp {
92
92
let OperandType = "OPERAND_SEW";
93
93
}
94
94
95
+ // SEW for mask only instructions like vmand and vmsbf. Should always be 0.
96
+ def sew_mask : RISCVOp {
97
+ let OperandType = "OPERAND_SEW_MASK";
98
+ }
99
+
95
100
def vec_rm : RISCVOp {
96
101
let OperandType = "OPERAND_VEC_RM";
97
102
}
@@ -774,9 +779,10 @@ class GetVTypePredicates<VTypeInfo vti> {
774
779
}
775
780
776
781
class VPseudoUSLoadNoMask<VReg RetClass,
777
- int EEW> :
782
+ int EEW,
783
+ DAGOperand sewop = sew> :
778
784
Pseudo<(outs RetClass:$rd),
779
- (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, sew :$sew,
785
+ (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, sewop :$sew,
780
786
vec_policy:$policy), []>,
781
787
RISCVVPseudo,
782
788
RISCVVLE</*Masked*/0, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> {
@@ -922,9 +928,10 @@ class VPseudoILoadMask<VReg RetClass,
922
928
}
923
929
924
930
class VPseudoUSStoreNoMask<VReg StClass,
925
- int EEW> :
931
+ int EEW,
932
+ DAGOperand sewop = sew> :
926
933
Pseudo<(outs),
927
- (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, sew :$sew), []>,
934
+ (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, sewop :$sew), []>,
928
935
RISCVVPseudo,
929
936
RISCVVSE</*Masked*/0, /*Strided*/0, !logtwo(EEW), VLMul> {
930
937
let mayLoad = 0;
@@ -1008,7 +1015,7 @@ class VPseudoNullaryMask<VReg RegClass> :
1008
1015
// Nullary for pseudo instructions. They are expanded in
1009
1016
// RISCVExpandPseudoInsts pass.
1010
1017
class VPseudoNullaryPseudoM<string BaseInst> :
1011
- Pseudo<(outs VR:$rd), (ins AVL:$vl, sew :$sew), []>,
1018
+ Pseudo<(outs VR:$rd), (ins AVL:$vl, sew_mask :$sew), []>,
1012
1019
RISCVVPseudo {
1013
1020
let mayLoad = 0;
1014
1021
let mayStore = 0;
@@ -1045,7 +1052,7 @@ class VPseudoUnaryNoMaskNoPolicy<DAGOperand RetClass,
1045
1052
string Constraint = "",
1046
1053
bits<2> TargetConstraintType = 1> :
1047
1054
Pseudo<(outs RetClass:$rd),
1048
- (ins OpClass:$rs2, AVL:$vl, sew :$sew), []>,
1055
+ (ins OpClass:$rs2, AVL:$vl, sew_mask :$sew), []>,
1049
1056
RISCVVPseudo {
1050
1057
let mayLoad = 0;
1051
1058
let mayStore = 0;
@@ -1080,10 +1087,11 @@ class VPseudoUnaryNoMaskRoundingMode<DAGOperand RetClass,
1080
1087
class VPseudoUnaryMask<VReg RetClass,
1081
1088
VReg OpClass,
1082
1089
string Constraint = "",
1083
- bits<2> TargetConstraintType = 1> :
1090
+ bits<2> TargetConstraintType = 1,
1091
+ DAGOperand sewop = sew> :
1084
1092
Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd),
1085
1093
(ins GetVRegNoV0<RetClass>.R:$passthru, OpClass:$rs2,
1086
- VMaskOp:$vm, AVL:$vl, sew :$sew, vec_policy:$policy), []>,
1094
+ VMaskOp:$vm, AVL:$vl, sewop :$sew, vec_policy:$policy), []>,
1087
1095
RISCVVPseudo {
1088
1096
let mayLoad = 0;
1089
1097
let mayStore = 0;
@@ -1138,7 +1146,7 @@ class VPseudoUnaryMask_NoExcept<VReg RetClass,
1138
1146
1139
1147
class VPseudoUnaryNoMaskGPROut :
1140
1148
Pseudo<(outs GPR:$rd),
1141
- (ins VR:$rs2, AVL:$vl, sew :$sew), []>,
1149
+ (ins VR:$rs2, AVL:$vl, sew_mask :$sew), []>,
1142
1150
RISCVVPseudo {
1143
1151
let mayLoad = 0;
1144
1152
let mayStore = 0;
@@ -1149,7 +1157,7 @@ class VPseudoUnaryNoMaskGPROut :
1149
1157
1150
1158
class VPseudoUnaryMaskGPROut :
1151
1159
Pseudo<(outs GPR:$rd),
1152
- (ins VR:$rs1, VMaskOp:$vm, AVL:$vl, sew :$sew), []>,
1160
+ (ins VR:$rs1, VMaskOp:$vm, AVL:$vl, sew_mask :$sew), []>,
1153
1161
RISCVVPseudo {
1154
1162
let mayLoad = 0;
1155
1163
let mayStore = 0;
@@ -1177,9 +1185,10 @@ class VPseudoBinaryNoMask<VReg RetClass,
1177
1185
VReg Op1Class,
1178
1186
DAGOperand Op2Class,
1179
1187
string Constraint,
1180
- bits<2> TargetConstraintType = 1> :
1188
+ bits<2> TargetConstraintType = 1,
1189
+ DAGOperand sewop = sew> :
1181
1190
Pseudo<(outs RetClass:$rd),
1182
- (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, sew :$sew), []>,
1191
+ (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, sewop :$sew), []>,
1183
1192
RISCVVPseudo {
1184
1193
let mayLoad = 0;
1185
1194
let mayStore = 0;
@@ -1852,7 +1861,7 @@ multiclass VPseudoLoadMask {
1852
1861
defvar mx = mti.LMul.MX;
1853
1862
defvar WriteVLDM_MX = !cast<SchedWrite>("WriteVLDM_" # mx);
1854
1863
let VLMul = mti.LMul.value in {
1855
- def "_V_" # mti.BX : VPseudoUSLoadNoMask<VR, EEW=1>,
1864
+ def "_V_" # mti.BX : VPseudoUSLoadNoMask<VR, EEW=1, sewop=sew_mask >,
1856
1865
Sched<[WriteVLDM_MX, ReadVLDX]>;
1857
1866
}
1858
1867
}
@@ -1927,7 +1936,7 @@ multiclass VPseudoStoreMask {
1927
1936
defvar mx = mti.LMul.MX;
1928
1937
defvar WriteVSTM_MX = !cast<SchedWrite>("WriteVSTM_" # mx);
1929
1938
let VLMul = mti.LMul.value in {
1930
- def "_V_" # mti.BX : VPseudoUSStoreNoMask<VR, EEW=1>,
1939
+ def "_V_" # mti.BX : VPseudoUSStoreNoMask<VR, EEW=1, sewop=sew_mask >,
1931
1940
Sched<[WriteVSTM_MX, ReadVSTX]>;
1932
1941
}
1933
1942
}
@@ -2011,7 +2020,8 @@ multiclass VPseudoVSFS_M {
2011
2020
SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx,
2012
2021
forcePassthruRead=true>;
2013
2022
let ForceTailAgnostic = true in
2014
- def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMask<VR, VR, constraint>,
2023
+ def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMask<VR, VR, constraint,
2024
+ sewop = sew_mask>,
2015
2025
SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx,
2016
2026
forcePassthruRead=true>;
2017
2027
}
@@ -2269,7 +2279,7 @@ multiclass VPseudoVALU_MM<bit Commutable = 0> {
2269
2279
foreach m = MxList in {
2270
2280
defvar mx = m.MX;
2271
2281
let VLMul = m.value, isCommutable = Commutable in {
2272
- def "_MM_" # mx : VPseudoBinaryNoMask<VR, VR, VR, "">,
2282
+ def "_MM_" # mx : VPseudoBinaryNoMask<VR, VR, VR, "", sewop = sew_mask >,
2273
2283
SchedBinary<"WriteVMALUV", "ReadVMALUV", "ReadVMALUV", mx>;
2274
2284
}
2275
2285
}
0 commit comments