Skip to content

Commit 5b29e16

Browse files
committed
[RISCV] Model dest EEW and fix peepholes not checking EEW
Previously for vector peepholes that fold based on VL, we checked if the VLMAX is the same as a proxy to check that the EEWs were the same. This only worked at LMUL >= 1 because the EMULs of the Src output and user's input had to be the same because the register classes needed to match. At fractional LMULs we would have incorrectly folded something like this: %x:vr = PseudoVADD_VV_MF4 $noreg, $noreg, $noreg, 4, 4 /* e16 */, 0 %y:vr = PseudoVMV_V_V_MF8 $noreg, %x, 4, 3 /* e8 */, 0 This models the EEW of the destination operands of vector instructions with a TSFlag, which is enough to fix the incorrect folding. There's some overlap with the TargetOverlapConstraintType and IsRVVWideningReduction. If we model the source operands as well we may be able to subsume them.
1 parent d613f17 commit 5b29e16

File tree

11 files changed

+125
-36
lines changed

11 files changed

+125
-36
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ enum {
129129

130130
ElementsDependOnMaskShift = ElementsDependOnVLShift + 1,
131131
ElementsDependOnMaskMask = 1ULL << ElementsDependOnMaskShift,
132+
133+
// Indicates the EEW of a vector instruction's destination operand.
134+
// 0 -> 1
135+
// 1 -> SEW
136+
// 2 -> SEW * 2
137+
// 3 -> SEW * 4
138+
DestEEWShift = ElementsDependOnMaskShift + 1,
139+
DestEEWMask = 3ULL << DestEEWShift,
132140
};
133141

134142
// Helper functions to read TSFlags.

llvm/lib/Target/RISCV/RISCVInstrFormats.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ def EltDepsNone : EltDeps<vl=0, mask=0>;
167167
def EltDepsVL : EltDeps<vl=1, mask=0>;
168168
def EltDepsVLMask : EltDeps<vl=1, mask=1>;
169169

170+
class EEW <bits<2> val> {
171+
bits<2> Value = val;
172+
}
173+
def EEW1 : EEW<0>;
174+
def EEWSEWx1 : EEW<1>;
175+
def EEWSEWx2 : EEW<2>;
176+
def EEWSEWx4 : EEW<3>;
177+
170178
class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
171179
list<dag> pattern, InstFormat format> : Instruction {
172180
let Namespace = "RISCV";
@@ -240,6 +248,10 @@ class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
240248
EltDeps ElementsDependOn = EltDepsNone;
241249
let TSFlags{23} = ElementsDependOn.VL;
242250
let TSFlags{24} = ElementsDependOn.Mask;
251+
252+
// Indicates the EEW of a vector instruction's destination operand.
253+
EEW DestEEW = EEWSEWx1;
254+
let TSFlags{26-25} = DestEEW.Value;
243255
}
244256

245257
class RVInst<dag outs, dag ins, string opcodestr, string argstr,

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,3 +4006,15 @@ unsigned RISCV::getRVVMCOpcode(unsigned RVVPseudoOpcode) {
40064006
return 0;
40074007
return RVV->BaseInstr;
40084008
}
4009+
4010+
unsigned RISCV::getDestEEW(const MCInstrDesc &Desc, unsigned Log2SEW) {
4011+
unsigned DestEEW =
4012+
(Desc.TSFlags & RISCVII::DestEEWMask) >> RISCVII::DestEEWShift;
4013+
// EEW = 1
4014+
if (DestEEW == 0)
4015+
return 1;
4016+
// EEW = SEW * n
4017+
unsigned Scaled = Log2SEW + (DestEEW - 1);
4018+
assert(Scaled >= 3 && Scaled <= 6);
4019+
return Scaled;
4020+
}

llvm/lib/Target/RISCV/RISCVInstrInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ std::optional<unsigned> getVectorLowDemandedScalarBits(uint16_t Opcode,
354354
// Returns the MC opcode of RVV pseudo instruction.
355355
unsigned getRVVMCOpcode(unsigned RVVPseudoOpcode);
356356

357+
// For a (non-pseudo) RVV instruction \p Desc and the given \p Log2SEW, returns
358+
// the EEW of the destination operand.
359+
unsigned getDestEEW(const MCInstrDesc &Desc, unsigned Log2SEW);
360+
357361
// Special immediate for AVL operand of V pseudo instructions to indicate VLMax.
358362
static constexpr int64_t VLMaxSentinel = -1LL;
359363

llvm/lib/Target/RISCV/RISCVInstrInfoV.td

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def : InstAlias<"vneg.v $vd, $vs", (VRSUB_VX VR:$vd, VR:$vs, X0, zero_reg)>;
11041104
// The destination vector register group cannot overlap a source vector
11051105
// register group of a different element width (including the mask register
11061106
// if masked), otherwise an illegal instruction exception is raised.
1107-
let Constraints = "@earlyclobber $vd" in {
1107+
let Constraints = "@earlyclobber $vd", DestEEW = EEWSEWx2 in {
11081108
let RVVConstraint = WidenV in {
11091109
defm VWADDU_V : VALU_MV_V_X<"vwaddu", 0b110000, "v">;
11101110
defm VWSUBU_V : VALU_MV_V_X<"vwsubu", 0b110010, "v">;
@@ -1121,7 +1121,7 @@ defm VWSUBU_W : VALU_MV_V_X<"vwsubu", 0b110110, "w">;
11211121
defm VWADD_W : VALU_MV_V_X<"vwadd", 0b110101, "w">;
11221122
defm VWSUB_W : VALU_MV_V_X<"vwsub", 0b110111, "w">;
11231123
} // RVVConstraint = WidenW
1124-
} // Constraints = "@earlyclobber $vd"
1124+
} // Constraints = "@earlyclobber $vd", DestEEW = EEWSEWx2
11251125

11261126
def : InstAlias<"vwcvt.x.x.v $vd, $vs$vm",
11271127
(VWADD_VX VR:$vd, VR:$vs, X0, VMaskOp:$vm)>;
@@ -1147,10 +1147,11 @@ defm VMADC_V : VALUm_IV_V_X_I<"vmadc", 0b010001>;
11471147
defm VMADC_V : VALUNoVm_IV_V_X_I<"vmadc", 0b010001>;
11481148
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint
11491149
defm VSBC_V : VALUm_IV_V_X<"vsbc", 0b010010>;
1150-
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint in {
1150+
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint,
1151+
DestEEW = EEW1 in {
11511152
defm VMSBC_V : VALUm_IV_V_X<"vmsbc", 0b010011>;
11521153
defm VMSBC_V : VALUNoVm_IV_V_X<"vmsbc", 0b010011>;
1153-
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint
1154+
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, DestEEW = EEW1
11541155

11551156
// Vector Bitwise Logical Instructions
11561157
defm VAND_V : VALU_IV_V_X_I<"vand", 0b001001>;
@@ -1183,7 +1184,7 @@ def : InstAlias<"vncvt.x.x.w $vd, $vs",
11831184
(VNSRL_WX VR:$vd, VR:$vs, X0, zero_reg)>;
11841185

11851186
// Vector Integer Comparison Instructions
1186-
let RVVConstraint = NoConstraint in {
1187+
let RVVConstraint = NoConstraint, DestEEW = EEW1 in {
11871188
defm VMSEQ_V : VCMP_IV_V_X_I<"vmseq", 0b011000>;
11881189
defm VMSNE_V : VCMP_IV_V_X_I<"vmsne", 0b011001>;
11891190
defm VMSLTU_V : VCMP_IV_V_X<"vmsltu", 0b011010>;
@@ -1192,7 +1193,7 @@ defm VMSLEU_V : VCMP_IV_V_X_I<"vmsleu", 0b011100>;
11921193
defm VMSLE_V : VCMP_IV_V_X_I<"vmsle", 0b011101>;
11931194
defm VMSGTU_V : VCMP_IV_X_I<"vmsgtu", 0b011110>;
11941195
defm VMSGT_V : VCMP_IV_X_I<"vmsgt", 0b011111>;
1195-
} // RVVConstraint = NoConstraint
1196+
} // RVVConstraint = NoConstraint, DestEEW = EEW1
11961197

11971198
def : InstAlias<"vmsgtu.vv $vd, $va, $vb$vm",
11981199
(VMSLTU_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>;
@@ -1204,7 +1205,7 @@ def : InstAlias<"vmsge.vv $vd, $va, $vb$vm",
12041205
(VMSLE_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>;
12051206

12061207
let isCodeGenOnly = 0, isAsmParserOnly = 1, hasSideEffects = 0, mayLoad = 0,
1207-
mayStore = 0 in {
1208+
mayStore = 0, DestEEW = EEW1 in {
12081209
// For unsigned comparisons we need to special case 0 immediate to maintain
12091210
// the always true/false semantics we would invert if we just decremented the
12101211
// immediate like we do for signed. To match the GNU assembler we will use
@@ -1227,7 +1228,7 @@ def PseudoVMSLT_VI : Pseudo<(outs VR:$vd),
12271228
}
12281229

12291230
let isCodeGenOnly = 0, isAsmParserOnly = 1, hasSideEffects = 0, mayLoad = 0,
1230-
mayStore = 0 in {
1231+
mayStore = 0, DestEEW = EEW1 in {
12311232
def PseudoVMSGEU_VX : Pseudo<(outs VR:$vd),
12321233
(ins VR:$vs2, GPR:$rs1),
12331234
[], "vmsgeu.vx", "$vd, $vs2, $rs1">;
@@ -1267,11 +1268,12 @@ defm VREMU_V : VDIV_MV_V_X<"vremu", 0b100010>;
12671268
defm VREM_V : VDIV_MV_V_X<"vrem", 0b100011>;
12681269

12691270
// Vector Widening Integer Multiply Instructions
1270-
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in {
1271+
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV,
1272+
DestEEW = EEWSEWx2 in {
12711273
defm VWMUL_V : VWMUL_MV_V_X<"vwmul", 0b111011>;
12721274
defm VWMULU_V : VWMUL_MV_V_X<"vwmulu", 0b111000>;
12731275
defm VWMULSU_V : VWMUL_MV_V_X<"vwmulsu", 0b111010>;
1274-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV
1276+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, DestEEW = EEWSEWx2
12751277

12761278
// Vector Single-Width Integer Multiply-Add Instructions
12771279
defm VMACC_V : VMAC_MV_V_X<"vmacc", 0b101101>;
@@ -1280,10 +1282,12 @@ defm VMADD_V : VMAC_MV_V_X<"vmadd", 0b101001>;
12801282
defm VNMSUB_V : VMAC_MV_V_X<"vnmsub", 0b101011>;
12811283

12821284
// Vector Widening Integer Multiply-Add Instructions
1285+
let DestEEW = EEWSEWx2 in {
12831286
defm VWMACCU_V : VWMAC_MV_V_X<"vwmaccu", 0b111100>;
12841287
defm VWMACC_V : VWMAC_MV_V_X<"vwmacc", 0b111101>;
12851288
defm VWMACCSU_V : VWMAC_MV_V_X<"vwmaccsu", 0b111111>;
12861289
defm VWMACCUS_V : VWMAC_MV_X<"vwmaccus", 0b111110>;
1290+
} // DestEEW = EEWSEWx2
12871291

12881292
// Vector Integer Merge Instructions
12891293
defm VMERGE_V : VMRG_IV_V_X_I<"vmerge", 0b010111>;
@@ -1342,7 +1346,8 @@ defm VFRSUB_V : VALU_FV_F<"vfrsub", 0b100111>;
13421346
// Vector Widening Floating-Point Add/Subtract Instructions
13431347
let Constraints = "@earlyclobber $vd",
13441348
Uses = [FRM],
1345-
mayRaiseFPException = true in {
1349+
mayRaiseFPException = true,
1350+
DestEEW = EEWSEWx2 in {
13461351
let RVVConstraint = WidenV in {
13471352
defm VFWADD_V : VWALU_FV_V_F<"vfwadd", 0b110000, "v">;
13481353
defm VFWSUB_V : VWALU_FV_V_F<"vfwsub", 0b110010, "v">;
@@ -1355,7 +1360,7 @@ let RVVConstraint = WidenW in {
13551360
defm VFWADD_W : VWALU_FV_V_F<"vfwadd", 0b110100, "w">;
13561361
defm VFWSUB_W : VWALU_FV_V_F<"vfwsub", 0b110110, "w">;
13571362
} // RVVConstraint = WidenW
1358-
} // Constraints = "@earlyclobber $vd", Uses = [FRM], mayRaiseFPException = true
1363+
} // Constraints = "@earlyclobber $vd", Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
13591364

13601365
// Vector Single-Width Floating-Point Multiply/Divide Instructions
13611366
let Uses = [FRM], mayRaiseFPException = true in {
@@ -1366,9 +1371,9 @@ defm VFRDIV_V : VDIV_FV_F<"vfrdiv", 0b100001>;
13661371

13671372
// Vector Widening Floating-Point Multiply
13681373
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV,
1369-
Uses = [FRM], mayRaiseFPException = true in {
1374+
Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
13701375
defm VFWMUL_V : VWMUL_FV_V_F<"vfwmul", 0b111000>;
1371-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true
1376+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
13721377

13731378
// Vector Single-Width Floating-Point Fused Multiply-Add Instructions
13741379
let Uses = [FRM], mayRaiseFPException = true in {
@@ -1383,12 +1388,12 @@ defm VFNMSUB_V : VMAC_FV_V_F<"vfnmsub", 0b101011>;
13831388
}
13841389

13851390
// Vector Widening Floating-Point Fused Multiply-Add Instructions
1386-
let Uses = [FRM], mayRaiseFPException = true in {
1391+
let Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
13871392
defm VFWMACC_V : VWMAC_FV_V_F<"vfwmacc", 0b111100>;
13881393
defm VFWNMACC_V : VWMAC_FV_V_F<"vfwnmacc", 0b111101>;
13891394
defm VFWMSAC_V : VWMAC_FV_V_F<"vfwmsac", 0b111110>;
13901395
defm VFWNMSAC_V : VWMAC_FV_V_F<"vfwnmsac", 0b111111>;
1391-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true
1396+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
13921397

13931398
// Vector Floating-Point Square-Root Instruction
13941399
let Uses = [FRM], mayRaiseFPException = true in {
@@ -1420,14 +1425,14 @@ def : InstAlias<"vfabs.v $vd, $vs",
14201425
(VFSGNJX_VV VR:$vd, VR:$vs, VR:$vs, zero_reg)>;
14211426

14221427
// Vector Floating-Point Compare Instructions
1423-
let RVVConstraint = NoConstraint, mayRaiseFPException = true in {
1428+
let RVVConstraint = NoConstraint, mayRaiseFPException = true, DestEEW = EEW1 in {
14241429
defm VMFEQ_V : VCMP_FV_V_F<"vmfeq", 0b011000>;
14251430
defm VMFNE_V : VCMP_FV_V_F<"vmfne", 0b011100>;
14261431
defm VMFLT_V : VCMP_FV_V_F<"vmflt", 0b011011>;
14271432
defm VMFLE_V : VCMP_FV_V_F<"vmfle", 0b011001>;
14281433
defm VMFGT_V : VCMP_FV_F<"vmfgt", 0b011101>;
14291434
defm VMFGE_V : VCMP_FV_F<"vmfge", 0b011111>;
1430-
} // RVVConstraint = NoConstraint, mayRaiseFPException = true
1435+
} // RVVConstraint = NoConstraint, mayRaiseFPException = true, DestEEW = EEW1
14311436

14321437
def : InstAlias<"vmfgt.vv $vd, $va, $vb$vm",
14331438
(VMFLT_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>;
@@ -1471,7 +1476,7 @@ defm VFCVT_F_X_V : VCVTF_IV_VS2<"vfcvt.f.x.v", 0b010010, 0b00011>;
14711476

14721477
// Widening Floating-Point/Integer Type-Convert Instructions
14731478
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt,
1474-
mayRaiseFPException = true in {
1479+
mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
14751480
let Uses = [FRM] in {
14761481
defm VFWCVT_XU_F_V : VWCVTI_FV_VS2<"vfwcvt.xu.f.v", 0b010010, 0b01000>;
14771482
defm VFWCVT_X_F_V : VWCVTI_FV_VS2<"vfwcvt.x.f.v", 0b010010, 0b01001>;
@@ -1481,7 +1486,7 @@ defm VFWCVT_RTZ_X_F_V : VWCVTI_FV_VS2<"vfwcvt.rtz.x.f.v", 0b010010, 0b01111>;
14811486
defm VFWCVT_F_XU_V : VWCVTF_IV_VS2<"vfwcvt.f.xu.v", 0b010010, 0b01010>;
14821487
defm VFWCVT_F_X_V : VWCVTF_IV_VS2<"vfwcvt.f.x.v", 0b010010, 0b01011>;
14831488
defm VFWCVT_F_F_V : VWCVTF_FV_VS2<"vfwcvt.f.f.v", 0b010010, 0b01100>;
1484-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt
1489+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt, DestEEW = EEWSEWx2
14851490

14861491
// Narrowing Floating-Point/Integer Type-Convert Instructions
14871492
let Constraints = "@earlyclobber $vd", mayRaiseFPException = true in {
@@ -1515,14 +1520,14 @@ defm VREDXOR : VRED_MV_V<"vredxor", 0b000011>;
15151520
} // RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask
15161521

15171522
// Vector Widening Integer Reduction Instructions
1518-
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask in {
1523+
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask, DestEEW = EEWSEWx2 in {
15191524
// Set earlyclobber for following instructions for second and mask operands.
15201525
// This has the downside that the earlyclobber constraint is too coarse and
15211526
// will impose unnecessary restrictions by not allowing the destination to
15221527
// overlap with the first (wide) operand.
15231528
defm VWREDSUMU : VWRED_IV_V<"vwredsumu", 0b110000>;
15241529
defm VWREDSUM : VWRED_IV_V<"vwredsum", 0b110001>;
1525-
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask
1530+
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask, DestEEW = EEWSEWx2
15261531

15271532
} // Predicates = [HasVInstructions]
15281533

@@ -1543,7 +1548,7 @@ def : InstAlias<"vfredsum.vs $vd, $vs2, $vs1$vm",
15431548
(VFREDUSUM_VS VR:$vd, VR:$vs2, VR:$vs1, VMaskOp:$vm), 0>;
15441549

15451550
// Vector Widening Floating-Point Reduction Instructions
1546-
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask in {
1551+
let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask, DestEEW = EEWSEWx2 in {
15471552
// Set earlyclobber for following instructions for second and mask operands.
15481553
// This has the downside that the earlyclobber constraint is too coarse and
15491554
// will impose unnecessary restrictions by not allowing the destination to
@@ -1552,15 +1557,15 @@ let Uses = [FRM], mayRaiseFPException = true in {
15521557
defm VFWREDOSUM : VWREDO_FV_V<"vfwredosum", 0b110011>;
15531558
defm VFWREDUSUM : VWRED_FV_V<"vfwredusum", 0b110001>;
15541559
}
1555-
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask
1560+
} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask, DestEEW = EEWSEWx2
15561561

15571562
def : InstAlias<"vfwredsum.vs $vd, $vs2, $vs1$vm",
15581563
(VFWREDUSUM_VS VR:$vd, VR:$vs2, VR:$vs1, VMaskOp:$vm), 0>;
15591564
} // Predicates = [HasVInstructionsAnyF]
15601565

15611566
let Predicates = [HasVInstructions] in {
15621567
// Vector Mask-Register Logical Instructions
1563-
let RVVConstraint = NoConstraint in {
1568+
let RVVConstraint = NoConstraint, DestEEW = EEW1 in {
15641569
defm VMAND_M : VMALU_MV_Mask<"vmand", 0b011001, "m">;
15651570
defm VMNAND_M : VMALU_MV_Mask<"vmnand", 0b011101, "m">;
15661571
defm VMANDN_M : VMALU_MV_Mask<"vmandn", 0b011000, "m">;
@@ -1607,12 +1612,14 @@ def : InstAlias<"vpopc.m $vd, $vs2$vm",
16071612

16081613
let Constraints = "@earlyclobber $vd", RVVConstraint = Iota, ElementsDependOn = EltDepsVLMask in {
16091614

1615+
let DestEEW = EEW1 in {
16101616
// vmsbf.m set-before-first mask bit
16111617
defm VMSBF_M : VMSFS_MV_V<"vmsbf.m", 0b010100, 0b00001>;
16121618
// vmsif.m set-including-first mask bit
16131619
defm VMSIF_M : VMSFS_MV_V<"vmsif.m", 0b010100, 0b00011>;
16141620
// vmsof.m set-only-first mask bit
16151621
defm VMSOF_M : VMSFS_MV_V<"vmsof.m", 0b010100, 0b00010>;
1622+
} // DestEEW = EEW1
16161623
// Vector Iota Instruction
16171624
defm VIOTA_M : VIOTA_MV_V<"viota.m", 0b010100, 0b10000>;
16181625

llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,24 @@ let Predicates = [HasVendorXSfvcp], mayLoad = 0, mayStore = 0,
201201
defm FVW : CustomSiFiveVCIX<"fvw", VCIX_XVW, VR, VR, FPR32>, Sched<[]>;
202202
}
203203

204-
let Predicates = [HasVendorXSfvqmaccdod], DecoderNamespace = "XSfvqmaccdod" in {
204+
let Predicates = [HasVendorXSfvqmaccdod], DecoderNamespace = "XSfvqmaccdod",
205+
DestEEW = EEWSEWx4 in {
205206
def VQMACCU_2x8x2 : CustomSiFiveVMACC<0b101100, OPMVV, "sf.vqmaccu.2x8x2">;
206207
def VQMACC_2x8x2 : CustomSiFiveVMACC<0b101101, OPMVV, "sf.vqmacc.2x8x2">;
207208
def VQMACCUS_2x8x2 : CustomSiFiveVMACC<0b101110, OPMVV, "sf.vqmaccus.2x8x2">;
208209
def VQMACCSU_2x8x2 : CustomSiFiveVMACC<0b101111, OPMVV, "sf.vqmaccsu.2x8x2">;
209210
}
210211

211-
let Predicates = [HasVendorXSfvqmaccqoq], DecoderNamespace = "XSfvqmaccqoq" in {
212+
let Predicates = [HasVendorXSfvqmaccqoq], DecoderNamespace = "XSfvqmaccqoq",
213+
DestEEW = EEWSEWx4 in {
212214
def VQMACCU_4x8x4 : CustomSiFiveVMACC<0b111100, OPMVV, "sf.vqmaccu.4x8x4">;
213215
def VQMACC_4x8x4 : CustomSiFiveVMACC<0b111101, OPMVV, "sf.vqmacc.4x8x4">;
214216
def VQMACCUS_4x8x4 : CustomSiFiveVMACC<0b111110, OPMVV, "sf.vqmaccus.4x8x4">;
215217
def VQMACCSU_4x8x4 : CustomSiFiveVMACC<0b111111, OPMVV, "sf.vqmaccsu.4x8x4">;
216218
}
217219

218-
let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvfwmaccqqq" in {
220+
let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvfwmaccqqq",
221+
DestEEW = EEWSEWx2 in {
219222
def VFWMACC_4x4x4 : CustomSiFiveVMACC<0b111100, OPFVV, "sf.vfwmacc.4x4x4">;
220223
}
221224

llvm/lib/Target/RISCV/RISCVInstrInfoZvfbf.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919

2020
let Predicates = [HasStdExtZvfbfmin], Constraints = "@earlyclobber $vd",
2121
mayRaiseFPException = true in {
22-
let RVVConstraint = WidenCvt in
22+
let RVVConstraint = WidenCvt, DestEEW = EEWSEWx2 in
2323
defm VFWCVTBF16_F_F_V : VWCVTF_FV_VS2<"vfwcvtbf16.f.f.v", 0b010010, 0b01101>;
2424
let Uses = [FRM] in
2525
defm VFNCVTBF16_F_F_W : VNCVTF_FV_VS2<"vfncvtbf16.f.f.w", 0b010010, 0b11101>;
2626
}
2727

2828
let Predicates = [HasStdExtZvfbfwma],
2929
Constraints = "@earlyclobber $vd_wb, $vd = $vd_wb",
30-
RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true in {
30+
RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true,
31+
DestEEW = EEWSEWx2 in {
3132
defm VFWMACCBF16_V : VWMAC_FV_V_F<"vfwmaccbf16", 0b111011>;
3233
}

llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ let Predicates = [HasStdExtZvbb] in {
123123
def VCLZ_V : VALUVs2<0b010010, 0b01100, OPMVV, "vclz.v">;
124124
def VCPOP_V : VALUVs2<0b010010, 0b01110, OPMVV, "vcpop.v">;
125125
def VCTZ_V : VALUVs2<0b010010, 0b01101, OPMVV, "vctz.v">;
126-
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in
126+
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV,
127+
DestEEW = EEWSEWx2 in
127128
defm VWSLL_V : VSHT_IV_V_X_I<"vwsll", 0b110101>;
128129
} // Predicates = [HasStdExtZvbb]
129130

0 commit comments

Comments
 (0)