aboutsummaryrefslogtreecommitdiff
path: root/gcc/ccmp.h
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2024-01-22 10:49:05 +0800
committerPan Li <pan2.li@intel.com>2024-01-22 15:01:15 +0800
commita618b3c65745a6992ced4df60c186241c2da6eae (patch)
tree226dadb87b330c3f74aa427e076d435962622397 /gcc/ccmp.h
parent46a664dd59ec6c1121914d6857d6edb94501c517 (diff)
downloadgcc-a618b3c65745a6992ced4df60c186241c2da6eae.zip
gcc-a618b3c65745a6992ced4df60c186241c2da6eae.tar.gz
gcc-a618b3c65745a6992ced4df60c186241c2da6eae.tar.bz2
RISC-V: Fix vfirst/vmsbf/vmsif/vmsof ratio attributes
vfirst/vmsbf/vmsif/vmsof instructions are supposed to demand ratio instead of demanding sew_lmul. But my previous typo makes VSETVL PASS miss honor the risc-v v spec. Consider this following simple case: int foo4 (void * in, void * out) { vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4); v = __riscv_vadd_vv_i32m1 (v, v, 4); vbool32_t mask = __riscv_vreinterpret_v_i32m1_b32(v); mask = __riscv_vmsof_m_b32(mask, 4); return __riscv_vfirst_m_b32(mask, 4); } Before this patch: foo4: vsetivli zero,4,e32,m1,ta,ma vle32.v v1,0(a0) vadd.vv v1,v1,v1 vsetvli zero,zero,e8,mf4,ta,ma ----> redundant. vmsof.m v2,v1 vfirst.m a0,v2 ret After this patch: foo4: vsetivli zero,4,e32,m1,ta,ma vle32.v v1,0(a0) vadd.vv v1,v1,v1 vmsof.m v2,v1 vfirst.m a0,v2 ret Confirm RVV spec and Clang, this patch makes VSETVL PASS match the correct behavior. Tested on both RV32/RV64, no regression. gcc/ChangeLog: * config/riscv/vector.md: Fix vfirst/vmsbf/vmsof ratio attributes. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/attribute-1.c: New test.
Diffstat (limited to 'gcc/ccmp.h')
0 files changed, 0 insertions, 0 deletions