]> git.ipfire.org Git - thirdparty/gcc.git/commit
[RISC-V][PR target/116308] Fix generation of initial RTL for atomics
authorJeff Law <jlaw@ventanamicro.com>
Sat, 18 Jan 2025 20:44:33 +0000 (13:44 -0700)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 9 Apr 2025 14:03:06 +0000 (22:03 +0800)
commitf3ac41f84249d10a1685c73d67e5d071902fcc4c
tree65b5b18d5eda0bc21d418e78bcb34e239a9d9f45
parent47b509fef536455d59aeb7b8e97851099c6b29a5
[RISC-V][PR target/116308] Fix generation of initial RTL for atomics

While this wasn't originally marked as a regression, it almost certainly is
given that older versions of GCC would have used libatomic and would not have
ICE'd on this code.

Basically this is another case where we directly used simplify_gen_subreg when
we should have used gen_lowpart.

When I fixed a similar bug a while back I noted the code in question as needing
another looksie.  I think at that time my brain saw the mixed modes (SI & QI)
and locked up.  But the QI stuff is just the shift count, not some deeper
issue.  So fixing is trivial.

We just replace the simplify_gen_subreg with a gen_lowpart and get on with our
lives.

Tested on rv64 and rv32 in my tester.  Waiting on pre-commit testing for final
verdict.

PR target/116308
gcc/
* config/riscv/riscv.cc (riscv_lshift_subword): Use gen_lowpart
rather than simplify_gen_subreg.

gcc/testsuite/

* gcc.target/riscv/pr116308.c: New test.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/pr116308.c [new file with mode: 0644]