https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127442
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WONTFIX
CC| |kito at gcc dot gnu.org,
| |rdapp at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Blocks|120763 |
--- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Note the testcase in the PR is different than the testcase in
compiler-explorer. The former does not show the problem while the latter does.
Here's the testcase from godbolt:
struct S {
unsigned int a;
unsigned int b;
unsigned int c;
unsigned int d;
};
void clear_s(struct S *p) {
p->a = 0;
p->b = 0;
p->c = 0;
p->d = 0;
}
Yes, this was fixed by Monk & Kito in gcc-15. This patch in particular:
ommit 28751389a68e131e21fcaf8e3f661d76a2b4d0cc
Author: Monk Chiang <[email protected]>
Date: Tue Feb 4 15:29:17 2025 +0800
RISC-V: Fix wrong LMUL when only implict zve32f.
According to Section 3.4.2, Vector Register Grouping, in the RISC-V
Vector Specification, the rule for LMUL is LMUL >= SEW/ELEN
Changes since V2:
- Add check on vector-iterators.md
- Add one more testcase to check the VLS use correct mode.
gcc/ChangeLog:
* config/riscv/riscv-v.cc: Add restrict for insert LMUL.
* config/riscv/riscv-vector-builtins-types.def:
Use RVV_REQUIRE_ELEN_64 to check LMUL number.
* config/riscv/riscv-vector-switch.def: Likewise.
* config/riscv/vector-iterators.md: Check TARGET_VECTOR_ELEN_64
rather than "TARGET_MIN_VLEN > 32" for all iterator.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr111391-2.c: Update test.
* gcc.target/riscv/rvv/base/abi-14.c: Update test.
* gcc.target/riscv/rvv/base/abi-16.c: Update test.
* gcc.target/riscv/rvv/base/abi-18.c: Update test.
* gcc.target/riscv/rvv/base/vsetvl_zve32-1.c: New test.
* gcc.target/riscv/rvv/base/vsetvl_zve32-2.c: New test.
Co-authored-by: Kito Cheng <[email protected]>
The patch doesn't cherry-pick cleanly at all. Worst yet, it hits all the
annoying mode definition macros which are painful.
So, yes, it's a real bug and can cause problems in the real world. But I'm
inclined to live with it as backporting looks relatively dangerous.
Kito, feel free to reopen and backport if you're inclined.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120763
[Bug 120763] [meta-bug] Tracker for bugs to visit during weekly RISC-V meeting