diff options
author | Juzhe-Zhong <juzhe.zhong@rivai.ai> | 2023-10-11 17:54:44 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-10-11 18:51:12 +0800 |
commit | f6c5e247b2913f0a7b3be986fe96afbed29c1d5e (patch) | |
tree | c7e43254b46471ee9d1ce70505cc5305f0140e04 /libgcc | |
parent | d1e5566685ac9bf8271ccf39d69e81e7ba9ae70d (diff) | |
download | gcc-f6c5e247b2913f0a7b3be986fe96afbed29c1d5e.zip gcc-f6c5e247b2913f0a7b3be986fe96afbed29c1d5e.tar.gz gcc-f6c5e247b2913f0a7b3be986fe96afbed29c1d5e.tar.bz2 |
RISC-V: Fix incorrect index(offset) of gather/scatter
I suddenly discovered I made a mistake that was lucky un-exposed.
https://godbolt.org/z/c3jzrh7or
GCC is using 32 bit index offset:
vsll.vi v1,v1,2
vsetvli zero,a5,e32,m1,ta,ma
vluxei32.v v1,(a1),v1
This is wrong since v1 may overflow 32bit after vsll.vi.
After this patch:
vsext.vf2 v8,v4
vsll.vi v8,v8,2
vluxei64.v v8,(a1),v8
Same as Clang.
Regression passed. Ok for trunk ?
gcc/ChangeLog:
* config/riscv/autovec.md: Fix index bug.
* config/riscv/riscv-protos.h (gather_scatter_valid_offset_mode_p): New function.
* config/riscv/riscv-v.cc (expand_gather_scatter): Fix index bug.
(gather_scatter_valid_offset_mode_p): New function.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/gather-scatter/offset_extend-1.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions