Skip to content

Commit 8138775

Browse files
authored
[RISCV] Add VL and VTYPE to implicit uses on MC vector instructions that also use FRM (llvm#129130)
We accidentally overwote the VL, VTYPE uses from the base class on any instruction that also uses FRM. Not sure why the llvm-mca test changed cycle time.
1 parent 14170b1 commit 8138775

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoV.td

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,15 +1358,15 @@ defm VNCLIP_W : VNCLP_IV_V_X_I<"vnclip", 0b101111>;
13581358

13591359
let Predicates = [HasVInstructionsAnyF] in {
13601360
// Vector Single-Width Floating-Point Add/Subtract Instructions
1361-
let Uses = [FRM], mayRaiseFPException = true in {
1361+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
13621362
defm VFADD_V : VALU_FV_V_F<"vfadd", 0b000000>;
13631363
defm VFSUB_V : VALU_FV_V_F<"vfsub", 0b000010>;
13641364
defm VFRSUB_V : VALU_FV_F<"vfrsub", 0b100111>;
13651365
}
13661366

13671367
// Vector Widening Floating-Point Add/Subtract Instructions
13681368
let Constraints = "@earlyclobber $vd",
1369-
Uses = [FRM],
1369+
Uses = [FRM, VL, VTYPE],
13701370
mayRaiseFPException = true,
13711371
DestEEW = EEWSEWx2 in {
13721372
let RVVConstraint = WidenV in {
@@ -1381,23 +1381,23 @@ let RVVConstraint = WidenW in {
13811381
defm VFWADD_W : VWALU_FV_V_F<"vfwadd", 0b110100, "w">;
13821382
defm VFWSUB_W : VWALU_FV_V_F<"vfwsub", 0b110110, "w">;
13831383
} // RVVConstraint = WidenW
1384-
} // Constraints = "@earlyclobber $vd", Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
1384+
} // Constraints = "@earlyclobber $vd", Uses = [FRM, VL, VTYPE], mayRaiseFPException = true, DestEEW = EEWSEWx2
13851385

13861386
// Vector Single-Width Floating-Point Multiply/Divide Instructions
1387-
let Uses = [FRM], mayRaiseFPException = true in {
1387+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
13881388
defm VFMUL_V : VMUL_FV_V_F<"vfmul", 0b100100>;
13891389
defm VFDIV_V : VDIV_FV_V_F<"vfdiv", 0b100000>;
13901390
defm VFRDIV_V : VDIV_FV_F<"vfrdiv", 0b100001>;
13911391
}
13921392

13931393
// Vector Widening Floating-Point Multiply
13941394
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV,
1395-
Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
1395+
Uses = [FRM, VL, VTYPE], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
13961396
defm VFWMUL_V : VWMUL_FV_V_F<"vfwmul", 0b111000>;
1397-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
1397+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM, VL, VTYPE], mayRaiseFPException = true, DestEEW = EEWSEWx2
13981398

13991399
// Vector Single-Width Floating-Point Fused Multiply-Add Instructions
1400-
let Uses = [FRM], mayRaiseFPException = true in {
1400+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
14011401
defm VFMACC_V : VMAC_FV_V_F<"vfmacc", 0b101100>;
14021402
defm VFNMACC_V : VMAC_FV_V_F<"vfnmacc", 0b101101>;
14031403
defm VFMSAC_V : VMAC_FV_V_F<"vfmsac", 0b101110>;
@@ -1409,15 +1409,15 @@ defm VFNMSUB_V : VMAC_FV_V_F<"vfnmsub", 0b101011>;
14091409
}
14101410

14111411
// Vector Widening Floating-Point Fused Multiply-Add Instructions
1412-
let Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
1412+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
14131413
defm VFWMACC_V : VWMAC_FV_V_F<"vfwmacc", 0b111100>;
14141414
defm VFWNMACC_V : VWMAC_FV_V_F<"vfwnmacc", 0b111101>;
14151415
defm VFWMSAC_V : VWMAC_FV_V_F<"vfwmsac", 0b111110>;
14161416
defm VFWNMSAC_V : VWMAC_FV_V_F<"vfwnmsac", 0b111111>;
1417-
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM], mayRaiseFPException = true, DestEEW = EEWSEWx2
1417+
} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV, Uses = [FRM, VL, VTYPE], mayRaiseFPException = true, DestEEW = EEWSEWx2
14181418

14191419
// Vector Floating-Point Square-Root Instruction
1420-
let Uses = [FRM], mayRaiseFPException = true in {
1420+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
14211421
defm VFSQRT_V : VSQR_FV_VS2<"vfsqrt.v", 0b010011, 0b00000>;
14221422
defm VFREC7_V : VRCP_FV_VS2<"vfrec7.v", 0b010011, 0b00101>;
14231423
}
@@ -1482,13 +1482,13 @@ def VFMV_V_F : RVInstVX<0b010111, OPFVF, (outs VR:$vd),
14821482

14831483
// Single-Width Floating-Point/Integer Type-Convert Instructions
14841484
let mayRaiseFPException = true in {
1485-
let Uses = [FRM] in {
1485+
let Uses = [FRM, VL, VTYPE] in {
14861486
defm VFCVT_XU_F_V : VCVTI_FV_VS2<"vfcvt.xu.f.v", 0b010010, 0b00000>;
14871487
defm VFCVT_X_F_V : VCVTI_FV_VS2<"vfcvt.x.f.v", 0b010010, 0b00001>;
14881488
}
14891489
defm VFCVT_RTZ_XU_F_V : VCVTI_FV_VS2<"vfcvt.rtz.xu.f.v", 0b010010, 0b00110>;
14901490
defm VFCVT_RTZ_X_F_V : VCVTI_FV_VS2<"vfcvt.rtz.x.f.v", 0b010010, 0b00111>;
1491-
let Uses = [FRM] in {
1491+
let Uses = [FRM, VL, VTYPE] in {
14921492
defm VFCVT_F_XU_V : VCVTF_IV_VS2<"vfcvt.f.xu.v", 0b010010, 0b00010>;
14931493
defm VFCVT_F_X_V : VCVTF_IV_VS2<"vfcvt.f.x.v", 0b010010, 0b00011>;
14941494
}
@@ -1497,7 +1497,7 @@ defm VFCVT_F_X_V : VCVTF_IV_VS2<"vfcvt.f.x.v", 0b010010, 0b00011>;
14971497
// Widening Floating-Point/Integer Type-Convert Instructions
14981498
let Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt,
14991499
mayRaiseFPException = true, DestEEW = EEWSEWx2 in {
1500-
let Uses = [FRM] in {
1500+
let Uses = [FRM, VL, VTYPE] in {
15011501
defm VFWCVT_XU_F_V : VWCVTI_FV_VS2<"vfwcvt.xu.f.v", 0b010010, 0b01000>;
15021502
defm VFWCVT_X_F_V : VWCVTI_FV_VS2<"vfwcvt.x.f.v", 0b010010, 0b01001>;
15031503
}
@@ -1510,13 +1510,13 @@ defm VFWCVT_F_F_V : VWCVTF_FV_VS2<"vfwcvt.f.f.v", 0b010010, 0b01100>;
15101510

15111511
// Narrowing Floating-Point/Integer Type-Convert Instructions
15121512
let Constraints = "@earlyclobber $vd", mayRaiseFPException = true in {
1513-
let Uses = [FRM] in {
1513+
let Uses = [FRM, VL, VTYPE] in {
15141514
defm VFNCVT_XU_F_W : VNCVTI_FV_VS2<"vfncvt.xu.f.w", 0b010010, 0b10000>;
15151515
defm VFNCVT_X_F_W : VNCVTI_FV_VS2<"vfncvt.x.f.w", 0b010010, 0b10001>;
15161516
}
15171517
defm VFNCVT_RTZ_XU_F_W : VNCVTI_FV_VS2<"vfncvt.rtz.xu.f.w", 0b010010, 0b10110>;
15181518
defm VFNCVT_RTZ_X_F_W : VNCVTI_FV_VS2<"vfncvt.rtz.x.f.w", 0b010010, 0b10111>;
1519-
let Uses = [FRM] in {
1519+
let Uses = [FRM, VL, VTYPE] in {
15201520
defm VFNCVT_F_XU_W : VNCVTF_IV_VS2<"vfncvt.f.xu.w", 0b010010, 0b10010>;
15211521
defm VFNCVT_F_X_W : VNCVTF_IV_VS2<"vfncvt.f.x.w", 0b010010, 0b10011>;
15221522
defm VFNCVT_F_F_W : VNCVTF_FV_VS2<"vfncvt.f.f.w", 0b010010, 0b10100>;
@@ -1554,7 +1554,7 @@ defm VWREDSUM : VWRED_IV_V<"vwredsum", 0b110001>;
15541554
let Predicates = [HasVInstructionsAnyF] in {
15551555
// Vector Single-Width Floating-Point Reduction Instructions
15561556
let RVVConstraint = NoConstraint, ElementsDependOn = EltDepsVLMask in {
1557-
let Uses = [FRM], mayRaiseFPException = true in {
1557+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
15581558
defm VFREDOSUM : VREDO_FV_V<"vfredosum", 0b000011>;
15591559
defm VFREDUSUM : VRED_FV_V<"vfredusum", 0b000001>;
15601560
}
@@ -1573,7 +1573,7 @@ let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint, ElementsDep
15731573
// This has the downside that the earlyclobber constraint is too coarse and
15741574
// will impose unnecessary restrictions by not allowing the destination to
15751575
// overlap with the first (wide) operand.
1576-
let Uses = [FRM], mayRaiseFPException = true in {
1576+
let Uses = [FRM, VL, VTYPE], mayRaiseFPException = true in {
15771577
defm VFWREDOSUM : VWREDO_FV_V<"vfwredosum", 0b110011>;
15781578
defm VFWREDUSUM : VWRED_FV_V<"vfwredusum", 0b110001>;
15791579
}

llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvector",
223223
}
224224

225225
let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvector",
226-
Uses = [FRM] in {
226+
Uses = [FRM, VL, VTYPE] in {
227227
def VFNRCLIP_XU_F_QF : CustomSiFiveVFNRCLIP<0b100010, OPFVF, "sf.vfnrclip.xu.f.qf">;
228228
def VFNRCLIP_X_F_QF : CustomSiFiveVFNRCLIP<0b100011, OPFVF, "sf.vfnrclip.x.f.qf">;
229229
}

llvm/lib/Target/RISCV/RISCVInstrInfoZvfbf.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ let Predicates = [HasStdExtZvfbfmin], Constraints = "@earlyclobber $vd",
2121
mayRaiseFPException = true in {
2222
let RVVConstraint = WidenCvt, DestEEW = EEWSEWx2 in
2323
defm VFWCVTBF16_F_F_V : VWCVTF_FV_VS2<"vfwcvtbf16.f.f.v", 0b010010, 0b01101>;
24-
let Uses = [FRM] in
24+
let Uses = [FRM, VL, VTYPE] 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,
30+
RVVConstraint = WidenV, Uses = [FRM, VL, VTYPE], mayRaiseFPException = true,
3131
DestEEW = EEWSEWx2 in {
3232
defm VFWMACCBF16_V : VWMAC_FV_V_F<"vfwmaccbf16", 0b111011>;
3333
}

llvm/test/tools/llvm-mca/RISCV/SiFiveP600/div.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ vfsqrt.v v8, v16
328328

329329
# CHECK: Iterations: 1
330330
# CHECK-NEXT: Instructions: 320
331-
# CHECK-NEXT: Total Cycles: 14397
331+
# CHECK-NEXT: Total Cycles: 14435
332332
# CHECK-NEXT: Total uOps: 320
333333

334334
# CHECK: Dispatch Width: 4

0 commit comments

Comments
 (0)