@@ -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
}
@@ -781,9 +786,10 @@ class GetVTypePredicates<VTypeInfo vti> {
781
786
}
782
787
783
788
class VPseudoUSLoadNoMask<VReg RetClass,
784
- int EEW> :
789
+ int EEW,
790
+ DAGOperand sewop = sew> :
785
791
Pseudo<(outs RetClass:$rd),
786
- (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, sew :$sew,
792
+ (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, sewop :$sew,
787
793
vec_policy:$policy), []>,
788
794
RISCVVPseudo,
789
795
RISCVVLE</*Masked*/0, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> {
@@ -929,9 +935,10 @@ class VPseudoILoadMask<VReg RetClass,
929
935
}
930
936
931
937
class VPseudoUSStoreNoMask<VReg StClass,
932
- int EEW> :
938
+ int EEW,
939
+ DAGOperand sewop = sew> :
933
940
Pseudo<(outs),
934
- (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, sew :$sew), []>,
941
+ (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, sewop :$sew), []>,
935
942
RISCVVPseudo,
936
943
RISCVVSE</*Masked*/0, /*Strided*/0, !logtwo(EEW), VLMul> {
937
944
let mayLoad = 0;
@@ -1015,7 +1022,7 @@ class VPseudoNullaryMask<VReg RegClass> :
1015
1022
// Nullary for pseudo instructions. They are expanded in
1016
1023
// RISCVExpandPseudoInsts pass.
1017
1024
class VPseudoNullaryPseudoM<string BaseInst> :
1018
- Pseudo<(outs VR:$rd), (ins AVL:$vl, sew :$sew), []>,
1025
+ Pseudo<(outs VR:$rd), (ins AVL:$vl, sew_mask :$sew), []>,
1019
1026
RISCVVPseudo {
1020
1027
let mayLoad = 0;
1021
1028
let mayStore = 0;
@@ -1052,7 +1059,7 @@ class VPseudoUnaryNoMaskNoPolicy<DAGOperand RetClass,
1052
1059
string Constraint = "",
1053
1060
bits<2> TargetConstraintType = 1> :
1054
1061
Pseudo<(outs RetClass:$rd),
1055
- (ins OpClass:$rs2, AVL:$vl, sew :$sew), []>,
1062
+ (ins OpClass:$rs2, AVL:$vl, sew_mask :$sew), []>,
1056
1063
RISCVVPseudo {
1057
1064
let mayLoad = 0;
1058
1065
let mayStore = 0;
@@ -1087,10 +1094,11 @@ class VPseudoUnaryNoMaskRoundingMode<DAGOperand RetClass,
1087
1094
class VPseudoUnaryMask<VReg RetClass,
1088
1095
VReg OpClass,
1089
1096
string Constraint = "",
1090
- bits<2> TargetConstraintType = 1> :
1097
+ bits<2> TargetConstraintType = 1,
1098
+ DAGOperand sewop = sew> :
1091
1099
Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd),
1092
1100
(ins GetVRegNoV0<RetClass>.R:$passthru, OpClass:$rs2,
1093
- VMaskOp:$vm, AVL:$vl, sew :$sew, vec_policy:$policy), []>,
1101
+ VMaskOp:$vm, AVL:$vl, sewop :$sew, vec_policy:$policy), []>,
1094
1102
RISCVVPseudo {
1095
1103
let mayLoad = 0;
1096
1104
let mayStore = 0;
@@ -1145,7 +1153,7 @@ class VPseudoUnaryMask_NoExcept<VReg RetClass,
1145
1153
1146
1154
class VPseudoUnaryNoMaskGPROut :
1147
1155
Pseudo<(outs GPR:$rd),
1148
- (ins VR:$rs2, AVL:$vl, sew :$sew), []>,
1156
+ (ins VR:$rs2, AVL:$vl, sew_mask :$sew), []>,
1149
1157
RISCVVPseudo {
1150
1158
let mayLoad = 0;
1151
1159
let mayStore = 0;
@@ -1156,7 +1164,7 @@ class VPseudoUnaryNoMaskGPROut :
1156
1164
1157
1165
class VPseudoUnaryMaskGPROut :
1158
1166
Pseudo<(outs GPR:$rd),
1159
- (ins VR:$rs1, VMaskOp:$vm, AVL:$vl, sew :$sew), []>,
1167
+ (ins VR:$rs1, VMaskOp:$vm, AVL:$vl, sew_mask :$sew), []>,
1160
1168
RISCVVPseudo {
1161
1169
let mayLoad = 0;
1162
1170
let mayStore = 0;
@@ -1184,9 +1192,10 @@ class VPseudoBinaryNoMask<VReg RetClass,
1184
1192
VReg Op1Class,
1185
1193
DAGOperand Op2Class,
1186
1194
string Constraint,
1187
- bits<2> TargetConstraintType = 1> :
1195
+ bits<2> TargetConstraintType = 1,
1196
+ DAGOperand sewop = sew> :
1188
1197
Pseudo<(outs RetClass:$rd),
1189
- (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, sew :$sew), []>,
1198
+ (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, sewop :$sew), []>,
1190
1199
RISCVVPseudo {
1191
1200
let mayLoad = 0;
1192
1201
let mayStore = 0;
@@ -1859,7 +1868,7 @@ multiclass VPseudoLoadMask {
1859
1868
defvar mx = mti.LMul.MX;
1860
1869
defvar WriteVLDM_MX = !cast<SchedWrite>("WriteVLDM_" # mx);
1861
1870
let VLMul = mti.LMul.value in {
1862
- def "_V_" # mti.BX : VPseudoUSLoadNoMask<VR, EEW=1>,
1871
+ def "_V_" # mti.BX : VPseudoUSLoadNoMask<VR, EEW=1, sewop=sew_mask >,
1863
1872
Sched<[WriteVLDM_MX, ReadVLDX]>;
1864
1873
}
1865
1874
}
@@ -1934,7 +1943,7 @@ multiclass VPseudoStoreMask {
1934
1943
defvar mx = mti.LMul.MX;
1935
1944
defvar WriteVSTM_MX = !cast<SchedWrite>("WriteVSTM_" # mx);
1936
1945
let VLMul = mti.LMul.value in {
1937
- def "_V_" # mti.BX : VPseudoUSStoreNoMask<VR, EEW=1>,
1946
+ def "_V_" # mti.BX : VPseudoUSStoreNoMask<VR, EEW=1, sewop=sew_mask >,
1938
1947
Sched<[WriteVSTM_MX, ReadVSTX]>;
1939
1948
}
1940
1949
}
@@ -2018,7 +2027,8 @@ multiclass VPseudoVSFS_M {
2018
2027
SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx,
2019
2028
forcePassthruRead=true>;
2020
2029
let ForceTailAgnostic = true in
2021
- def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMask<VR, VR, constraint>,
2030
+ def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMask<VR, VR, constraint,
2031
+ sewop = sew_mask>,
2022
2032
SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx,
2023
2033
forcePassthruRead=true>;
2024
2034
}
@@ -2275,7 +2285,7 @@ multiclass VPseudoBinaryV_VI_RM<Operand ImmType, LMULInfo m, string Constraint =
2275
2285
multiclass VPseudoVALU_MM<bit Commutable = 0> {
2276
2286
foreach mti = AllMasks in {
2277
2287
let VLMul = mti.LMul.value, isCommutable = Commutable in {
2278
- def "_MM_" # mti.BX : VPseudoBinaryNoMask<VR, VR, VR, "">,
2288
+ def "_MM_" # mti.BX : VPseudoBinaryNoMask<VR, VR, VR, "", sewop = sew_mask >,
2279
2289
SchedBinary<"WriteVMALUV", "ReadVMALUV", "ReadVMALUV", mti.LMul.MX>;
2280
2290
}
2281
2291
}
0 commit comments