aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2023-11-25 16:24:32 +0800
committerPan Li <pan2.li@intel.com>2023-11-27 16:10:58 +0800
commite02772344815e505c8c146ce48b1427dc9e9d190 (patch)
treeaa6fdc29ca69ede7e2ab90ecf8c00a443611477a /libcpp
parent006e90e13441c3716b40616282b200a0ef689376 (diff)
downloadgcc-e02772344815e505c8c146ce48b1427dc9e9d190.zip
gcc-e02772344815e505c8c146ce48b1427dc9e9d190.tar.gz
gcc-e02772344815e505c8c146ce48b1427dc9e9d190.tar.bz2
RISC-V: Remove incorrect function gate gather_scatter_valid_offset_mode_p
Come back to review the codes of gather/scatter, notice gather_scatter_valid_offset_mode_p looks odd. gather_scatter_valid_offset_mode_p is supposed to block vluxei64/vsuxei64 in RV32 system. However, it failed to do that since it is passing data_mode instead of index mode: riscv_vector::gather_scatter_valid_offset_mode_p (<RATIO2:MODE>mode) It should be RATIO2I instead of RATIO2. So we have this following iterators which already can block the this situation: (define_mode_iterator RATIO8I [ RVVM1QI RVVM2HI RVVM4SI (RVVM8DI "TARGET_VECTOR_ELEN_64 && TARGET_64BIT") ]) We can see TARGET_64BIT to block EEW64 index mode on RV32 system. So, gather_scatter_valid_offset_mode_p is no longer needed. After remove it, I find due to incorrect gather_scatter_valid_offset_mode_p. We failed to vectorize such case in RV32 in the past: void __attribute__ ((noinline, noclone)) \ f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ { \ for (int i = 0; i < 128; ++i) \ if (cond[i]) \ dest[i] += src[indices[i]]; \ } T (int64_t, 8) TEST_ALL (TEST_LOOP) https://godbolt.org/z/T3ara3fM3 Checked compiler explorer, we can see GCC failed to vectorize it but Clang can vectorize it. So adapt the tests checking vectorization cases from 8 -> 11. Confirm we have same behavior as Clang now. Tested on zvl128/zvl256/zvl512/zvl1024 no regression. Note this is not an optimization patch, it's buggy codes fix patch. gcc/ChangeLog: * config/riscv/autovec.md (mask_len_gather_load<RATIO1:mode><RATIO1:mode>): Remove gather_scatter_valid_offset_mode_p. (mask_len_gather_load<mode><mode>): Ditto. (mask_len_scatter_store<RATIO1:mode><RATIO1:mode>): Ditto. (mask_len_scatter_store<mode><mode>): Ditto. * config/riscv/predicates.md (const_1_or_8_operand): New predicate. (vector_gs_scale_operand_64): Remove. * config/riscv/riscv-protos.h (gather_scatter_valid_offset_mode_p): Remove. * config/riscv/riscv-v.cc (expand_gather_scatter): Refine code. (gather_scatter_valid_offset_mode_p): Remove. * config/riscv/vector-iterators.md: Fix iterator bugs. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-1.c: Adapt test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-10.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-11.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-2.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-3.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-4.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-5.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-6.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-7.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-8.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-9.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-1.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-10.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-2.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-3.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-4.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-5.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-6.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-7.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-8.c: Ditto. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-9.c: Ditto.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions