]> git.ipfire.org Git - thirdparty/gcc.git/commit
[committed] [RISC-V] Fix bug in condition canonicalization for zicond
authorJeff Law <jlaw@ventanamicro.com>
Tue, 8 Aug 2023 21:32:38 +0000 (15:32 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Tue, 8 Aug 2023 21:37:34 +0000 (15:37 -0600)
commit20659be04c2749f9f47b085f1789eee0d145fb36
treefc1ec1ef9127df505df4630d18ca336b1c2031fd
parenta263152643bbecaf02d68dfd8d5792e77f356154
[committed] [RISC-V] Fix bug in condition canonicalization for zicond

Vineet's glibc build triggered an ICE building glibc with the latest zicond
bits.  It's a minor issue in the canonicalization of the condition.

When we need to canonicalize the condition we use an SCC insn to handle the
primary comparison with the output going into a temporary with the final value
of 0/1 which we can then use in a zicond instruction.

The mode of the newly generated temporary was taken from mode of the final
destination.  That's simply wrong.  The mode of the condition needs to be
word_mode.

This patch fixes that minor problem and adds a suitable testcase.

gcc/
* config/riscv/riscv.cc (riscv_expand_conditional_move): Use word_mode
for the temporary when canonicalizing the condition.

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