Skip to content

Commit e833ec0

Browse files
committed
[RISCV] Add a feature to indicate the whole register move won't trap on vill
This is a compromise of #114518. We may also add a new extension `Zvnotrapvmvnr` or whatever that doesn't add new instructions but these instructions won't trap on vill to fix this mistake. Not all of us want to pay for the mistake.
1 parent 1a44a53 commit e833ec0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,25 @@ def FeaturePredictableSelectIsExpensive
13811381
: SubtargetFeature<"predictable-select-expensive", "PredictableSelectIsExpensive", "true",
13821382
"Prefer likely predicted branches over selects">;
13831383

1384+
// This is not a feature that is documented in the RVV spec, but a result of
1385+
// messy change history of the whole register move.
1386+
//
1387+
// The whole register move should be designed as ignoring the vtype, but it was
1388+
// somehow constrained to specific microarchitecture and got a dependency of
1389+
// vtype. Because people didn't notice the impact of this mistake and the spec
1390+
// is very vague and self-contradictory in several places, many cores that are
1391+
// already on the market didn't implement the whole register move in the trapped
1392+
// way.
1393+
//
1394+
// This feature is used to indicate that the implementation won't trap on vill
1395+
// so that no extra vset(i)vl(i) is needed before the whole register move
1396+
// instructions.
1397+
//
1398+
// See #114518 for more details.
1399+
def FeatureNoTrappedWholeRegisterMove
1400+
: SubtargetFeature<"no-trapped-whole-register-move", "HasTrappedWholeRegisterMove", "false",
1401+
"The whole register move won't trap on vill">;
1402+
13841403
def TuneOptimizedZeroStrideLoad
13851404
: SubtargetFeature<"optimized-zero-stride-load", "HasOptimizedZeroStrideLoad",
13861405
"true", "Optimized (perform fewer memory operations)"

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ def SPACEMIT_X60 : RISCVProcessorModel<"spacemit-x60",
476476
FeatureStdExtZicond,
477477
FeatureStdExtZvfh,
478478
FeatureStdExtZvkt,
479-
FeatureStdExtZvl256b]),
479+
FeatureStdExtZvl256b,
480+
FeatureNoTrappedWholeRegisterMove]),
480481
[TuneDLenFactor2,
481482
TuneOptimizedNF2SegmentLoadStore,
482483
TuneOptimizedNF3SegmentLoadStore,

0 commit comments

Comments
 (0)