Skip to content

Commit a577d59

Browse files
committed
[RISCV] Minor vector instruction tablegen cleanup. NFC
Use result_type for the IMPLICIT_DEF in masked vector patterns. This doesn't matter today because result_type and op_type are always the same. Use multiclass inheritance to reduce repeated code.
1 parent 6a1c3ef commit a577d59

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ class VPatBinarySDNode_XI<SDNode vop,
138138
xop_kind:$rs2,
139139
avl, sew)>;
140140

141-
multiclass VPatBinarySDNode_VV_VX<SDNode vop, string instruction_name>
142-
{
141+
multiclass VPatBinarySDNode_VV_VX<SDNode vop, string instruction_name> {
143142
foreach vti = AllIntegerVectors in {
144143
def : VPatBinarySDNode_VV<vop, instruction_name,
145144
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
@@ -153,15 +152,8 @@ multiclass VPatBinarySDNode_VV_VX<SDNode vop, string instruction_name>
153152

154153
multiclass VPatBinarySDNode_VV_VX_VI<SDNode vop, string instruction_name,
155154
Operand ImmType = simm5>
156-
{
155+
: VPatBinarySDNode_VV_VX<vop, instruction_name> {
157156
foreach vti = AllIntegerVectors in {
158-
def : VPatBinarySDNode_VV<vop, instruction_name,
159-
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
160-
vti.LMul, vti.AVL, vti.RegClass, vti.RegClass>;
161-
def : VPatBinarySDNode_XI<vop, instruction_name, "VX",
162-
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
163-
vti.LMul, vti.AVL, vti.RegClass, vti.RegClass,
164-
SplatPat, GPR>;
165157
def : VPatBinarySDNode_XI<vop, instruction_name, "VI",
166158
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
167159
vti.LMul, vti.AVL, vti.RegClass, vti.RegClass,

llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ multiclass VPatBinaryVL_VV<SDNode vop,
262262
(mask_type VMV0:$vm),
263263
VLOpFrag)),
264264
(!cast<Instruction>(instruction_name#"_VV_"# vlmul.MX#"_MASK")
265-
(op_type (IMPLICIT_DEF)),
265+
(result_type (IMPLICIT_DEF)),
266266
op_reg_class:$rs1,
267267
op_reg_class:$rs2,
268268
VMV0:$vm, GPR:$vl, sew)>;
@@ -295,7 +295,7 @@ multiclass VPatBinaryVL_XI<SDNode vop,
295295
(mask_type VMV0:$vm),
296296
VLOpFrag)),
297297
(!cast<Instruction>(instruction_name#_#suffix#_# vlmul.MX#"_MASK")
298-
(vop_type (IMPLICIT_DEF)),
298+
(result_type (IMPLICIT_DEF)),
299299
vop_reg_class:$rs1,
300300
xop_kind:$rs2,
301301
VMV0:$vm, GPR:$vl, sew)>;
@@ -314,15 +314,9 @@ multiclass VPatBinaryVL_VV_VX<SDNode vop, string instruction_name> {
314314
}
315315

316316
multiclass VPatBinaryVL_VV_VX_VI<SDNode vop, string instruction_name,
317-
Operand ImmType = simm5> {
317+
Operand ImmType = simm5>
318+
: VPatBinaryVL_VV_VX<vop, instruction_name> {
318319
foreach vti = AllIntegerVectors in {
319-
defm : VPatBinaryVL_VV<vop, instruction_name,
320-
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
321-
vti.LMul, vti.RegClass, vti.RegClass>;
322-
defm : VPatBinaryVL_XI<vop, instruction_name, "VX",
323-
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
324-
vti.LMul, vti.RegClass, vti.RegClass,
325-
SplatPat, GPR>;
326320
defm : VPatBinaryVL_XI<vop, instruction_name, "VI",
327321
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
328322
vti.LMul, vti.RegClass, vti.RegClass,

0 commit comments

Comments
 (0)