[llvm] [RISCV] Separate doLocalPostpass into new pass and move to post vector regalloc (PR #88295)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 07:55:04 PDT 2024
dtcxzyw wrote:
@lukel97
After this patch, additional `vmv.v.v` instructions will be generated:
Godbolt: https://godbolt.org/z/z99oMq663
```
define <4 x i64> @func(<4 x i64> %0, <4 x i64> %1) nounwind {
entry:
%2 = mul <4 x i64> %0, <i64 -64, i64 -64, i64 -64, i64 -64>
%3 = sub <4 x i64> <i64 -16, i64 -16, i64 -16, i64 -16>, %1
%4 = icmp eq <4 x i64> %0, <i64 1, i64 1, i64 1, i64 1>
%5 = select <4 x i1> %4, <4 x i64> %3, <4 x i64> %2
ret <4 x i64> %5
}
```
Before:
```
func:
vsetivli zero, 4, e64, m2, ta, mu
vsll.vi v12, v8, 6
vmseq.vi v0, v8, 1
vrsub.vi v8, v12, 0
vrsub.vi v8, v10, -16, v0.t
ret
```
After:
```
func:
vsetivli zero, 4, e64, m2, ta, mu
vsll.vi v12, v8, 6
vrsub.vi v12, v12, 0
vmseq.vi v0, v8, 1
vrsub.vi v12, v10, -16, v0.t
vmv.v.v v8, v12
ret
```
See https://github.com/dtcxzyw/llvm-codegen-benchmark/commit/0b07efec1ade06addd3c5032d6c651b4c4123653 for more cases.
https://github.com/llvm/llvm-project/pull/88295
More information about the llvm-commits
mailing list