]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR target/116720] Fix test for valid mempair operands
authorJeff Law <jlaw@ventanamicro.com>
Sun, 29 Dec 2024 15:27:30 +0000 (08:27 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Sun, 2 Mar 2025 21:58:50 +0000 (14:58 -0700)
commitc1535f242f703d3142bef1ca7c31d1ee17633696
treec263f519816dc3919d89acce328ba6a5132363d8
parent04b5c8b90cd95611d99684282cc321f06a0b49c2
[PR target/116720] Fix test for valid mempair operands

So this BZ is a case where we incorrectly indicated that the operand array was
suitable for the t-head load/store pair instructions.

In particular there's a test which checks alignment, but that happens *before*
we know if the operands are going to be reversed.  So the routine reported the
operands are suitable.

At a later point the operands have been reversed into the proper order and we
realize the alignment test should have failed, resulting in the unrecognized
insn.

This fixes the code by moving the reversal check earlier and actually swapping
the local variables with the operands.  That in turn allows for simpler testing
of alignments, ordering, etc.

I've tested this on rv32 and rv64 in my tester.  I don't offhand know if the
patch from Filip that's been causing headaches for the RISC-V port has been
reverted/fixed.  So there's a nonzero chance the pre-commit CI tester will
fail.  I'll keep an eye on it and act appropriately.

PR target/116720
gcc/
* config/riscv/thead.cc (th_mempair_operands_p): Test for
aligned memory after swapping operands.  Simplify test for
first memory access as well.

gcc/testsuite/
* gcc.target/riscv/pr116720.c: New test.

(cherry picked from commit 0b06abe027a78681d29a5e91daa74bf8dba39826)
gcc/config/riscv/thead.cc
gcc/testsuite/gcc.target/riscv/pr116720.c [new file with mode: 0644]