]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix INSN costing and more zicond tests
authorXiao Zeng <zengxiao@eswincomputing.com>
Fri, 29 Sep 2023 22:29:02 +0000 (16:29 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Fri, 29 Sep 2023 22:35:16 +0000 (16:35 -0600)
commit44efc743acc01354b6b9eb1939aedfdcc44e71f3
treeec6cc7dd7e73be9e820dd018ce529947e1f13768
parent4f1e5379fd77c744111672ab3d961cecb4826b80
Fix INSN costing and more zicond tests

So this ends up looking a lot like the bits that I had to revert several weeks
ago :-)

The core issue we have is given an INSN the generic code will cost the SET_SRC
and SET_DEST and sum them.  But that's far from ideal on a RISC target.

For a register destination, the cost can be determined be looking at just the
SET_SRC.  Which is precisely what this patch does.  When the outer code is an
INSN and we're presented with a SET we take one of two paths.

If the destination is a register, then we recurse just on the SET_SRC and we're
done.  Otherwise we fall back to the existing code which sums the cost of the
SET_SRC and SET_DEST.  That fallback path isn't great and probably could be
further improved (just costing SET_DEST in that case is probably quite
reasonable).

The difference between this version and the bits that slipped through by
accident several weeks ago is that old version mis-used the API due to a thinko
on my part.

This tightens up various zicond tests to avoid undesirable matching.

This has been tested on rv64gc -- the only difference it makes on the testsuite
is the new tests (included in this patch) flip from failing to passing.

Pushed to the trunk.

gcc/
* config/riscv/riscv.cc (riscv_rtx_costs): Better handle costing
SETs when the outer code is INSN.

gcc/testsuite
* gcc.target/riscv/zicond-primitiveSemantics_compare_imm.c: New test.
* gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_0_imm.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_imm_imm.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_imm_reg.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_reg_reg.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_reg.c: Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_0_imm.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_imm_imm.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_imm_reg.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_reg_reg.c:
Likewise.
* gcc.target/riscv/zicond-primitiveSemantics.c: Tighten expected regexp.
* gcc.target/riscv/zicond-primitiveSemantics_return_0_imm.c: Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_return_imm_imm.c: Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_return_imm_reg.c: Likewise.
* gcc.target/riscv/zicond-primitiveSemantics_return_reg_reg.c: Likewise.
* gcc.target/riscv/zicond-xor-01.c: Likewise.
17 files changed:
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics.c
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_imm.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_0_imm.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_imm_imm.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_imm_reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_imm_return_reg_reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_0_imm.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_imm_imm.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_imm_reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_compare_reg_return_reg_reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_return_0_imm.c
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_return_imm_imm.c
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_return_imm_reg.c
gcc/testsuite/gcc.target/riscv/zicond-primitiveSemantics_return_reg_reg.c
gcc/testsuite/gcc.target/riscv/zicond-xor-01.c