diff options
author | Pan Li <pan2.li@intel.com> | 2023-05-04 17:11:18 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2023-05-05 22:51:19 +0800 |
commit | 0c1eaac3fd35eafedc8fb5638af30af0aea199d3 (patch) | |
tree | 358e8b4749f89726238cb0ceef09b9fdf808e6d1 /gcc/combine.cc | |
parent | 3365956d55a6484097ff40fb81acb2345322044c (diff) | |
download | gcc-0c1eaac3fd35eafedc8fb5638af30af0aea199d3.zip gcc-0c1eaac3fd35eafedc8fb5638af30af0aea199d3.tar.gz gcc-0c1eaac3fd35eafedc8fb5638af30af0aea199d3.tar.bz2 |
RISC-V: Legitimise the const0_rtx for RVV indexed load/store
This patch try to legitimise the const0_rtx (aka zero register)
as the base register for the RVV indexed load/store instructions
by allowing the const as the operand of the indexed RTL pattern.
Then the underlying combine pass will try to perform the const
propagation.
For example:
vint32m1_t
test_vluxei32_v_i32m1_shortcut (vuint32m1_t bindex, size_t vl)
{
return __riscv_vluxei32_v_i32m1 ((int32_t *)0, bindex, vl);
}
Before this patch:
li a5,0 <- can be eliminated.
vl1re32.v v1,0(a1)
vsetvli zero,a2,e32,m1,ta,ma
vluxei32.v v1,(a5),v1 <- can propagate the const 0 to a5 here.
vs1r.v v1,0(a0)
ret
After this patch:
test_vluxei32_v_i32m1_shortcut:
vl1re32.v v1,0(a1)
vsetvli zero,a2,e32,m1,ta,ma
vluxei32.v v1,(0),v1
vs1r.v v1,0(a0)
ret
As above, this patch allow you to propagaate the const 0 (aka zero
register) to the base register of the RVV indexed load in the combine
pass. This may benefit the underlying RVV auto-vectorization.
gcc/ChangeLog:
* config/riscv/vector.md: Allow const as the operand of RVV
indexed load/store.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c:
Adjust indexed load/store check condition.
Signed-off-by: Pan Li <pan2.li@intel.com>
Co-authored-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Diffstat (limited to 'gcc/combine.cc')
0 files changed, 0 insertions, 0 deletions