Skip to content

Commit 1937a36

Browse files
authored
[RISCV] Add @earlyclobber to SiFive custom matrix multiply instruction. (#124060)
All of these have a constraint that vd and vs1 cannot overlap. Some of them have an additional widening constraint for vs2. We should use earlyclobber to protect this. This is unlikely to be an issue in practice due to the instrinsic being ternary so vd is also a source. The intrinsic has a different type for this source than the other sources. You would have to do something crazy to get the register allocator to overlap the registers.
1 parent 4bd0440 commit 1937a36

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,28 +374,28 @@ multiclass VPseudoVC_XVW<LMULInfo m, DAGOperand RS1Class,
374374
}
375375
}
376376

377-
multiclass VPseudoSiFiveVMACC<string mx, VReg vd_type, VReg vs2_type,
378-
string Constraint = ""> {
377+
multiclass VPseudoSiFiveVMACC<string mx, VReg vd_type, VReg vs2_type> {
379378
def "Pseudo" # NAME # "_" # mx
380-
: VPseudoTernaryNoMaskWithPolicy<vd_type, V_M1.vrclass, vs2_type, Constraint>;
379+
: VPseudoTernaryNoMaskWithPolicy<vd_type, V_M1.vrclass, vs2_type,
380+
"@earlyclobber $rd">;
381381
}
382382

383-
multiclass VPseudoSiFiveVQMACCDOD<string Constraint = ""> {
383+
multiclass VPseudoSiFiveVQMACCDOD {
384384
foreach m = MxListVF8 in
385385
let VLMul = m.value in
386-
defm NAME : VPseudoSiFiveVMACC<m.MX, m.vrclass, m.vrclass, Constraint>;
386+
defm NAME : VPseudoSiFiveVMACC<m.MX, m.vrclass, m.vrclass>;
387387
}
388388

389-
multiclass VPseudoSiFiveVQMACCQOQ<string Constraint = ""> {
389+
multiclass VPseudoSiFiveVQMACCQOQ {
390390
foreach m = [V_MF2, V_M1, V_M2, V_M4] in
391391
let VLMul = m.value in
392-
defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
392+
defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass>;
393393
}
394394

395-
multiclass VPseudoSiFiveVFWMACC<string Constraint = ""> {
395+
multiclass VPseudoSiFiveVFWMACC {
396396
foreach m = MxListVF2 in
397397
let VLMul = m.value in
398-
defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
398+
defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass>;
399399
}
400400

401401
multiclass VPseudoSiFiveVFNRCLIP<string Constraint = "@earlyclobber $rd"> {

0 commit comments

Comments
 (0)