[llvm] [RISCV] Use vsetivli instead of `x0,x0` form to retain SEW/LMUL when AVL is imm (PR #169307)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 24 22:33:04 PST 2025
wangpc-pp wrote:
> If AVL is compile-time constant and VLMAX constraints are known to be met at compile-time, then using immediate form is fine. But if AVL is a run-time value (as when x0,x0 is usually being used) then should not use immediate form of AVL.
Thanks! This change only focuses on these cases with compile-time constant AVL.
It turns:
```asm
vsetivli a0, imm, ...
...
vsetvli x0, x0, ...
```
into
```asm
vsetivli a0, imm, ...
...
vsetivli x0, imm, ...
```
We can make it a tune feature or only do this conversion when `imm <=VLMAX`.
> The motivation for this change also doesn't make sense to me. High-performance architectures (e.g., supporting proposed Ovlt) will be expanding microops depending on vl later in pipeline regardless of vset form used.
This is an another topic and I think `Ovlt` doesn't answer(or suggest) how this can be done for OoO vector implementation.
https://github.com/llvm/llvm-project/pull/169307
More information about the llvm-commits
mailing list