[llvm-branch-commits] [TableGen] Support HwMode registers in CompressInstEmitter (PR #203599)
Alexander Richardson via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 12 11:03:22 PDT 2026
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/203599
This patch introduces a small helper (HwModePredicates) in CodeGenHwModes
to resolve HwModeSelect records (like RegisterByHwMode/RegClassByHwMode)
using subtarget features.
If all the predicates ensure that a specific register class is selected
(or lack of all of them results in DefaultMode), we can correctly validate
compress patterns involving HwMode-dependent registers and types.
This allows using a single instruction for RVY C_ADDI4SPN/C_ADDI16SP
instead of having to duplicate it for both modes (which was the previous
approach).
Let me know if you think this complexity is worth adding or if I should
just use the duplicated instructions approach.
As you can probably tell, the `struct HwModePredicates` is fully AI
generated, but if this approach sounds good I'll clean it up and see if it
can be simplified futher.
Assisted-by: Gemini
More information about the llvm-branch-commits
mailing list