On 11/8/22 12:54, Philipp Tomsich wrote:
If-conversion is turning '(a >= 0) ? b : 0' into a branchless sequence
not a5,a0
srai a5,a5,63
and a0,a1,a5
missing the opportunity to combine the NOT and AND into an ANDN.
This adds a define_split to help the combiner reassociate the NOT with
the AND.
gcc/ChangeLog:
* config/riscv/bitmanip.md: New define_split.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbb-srai-andn.c: New test.
OK.
FWIW, combine can be pretty sneaky in manipulating the result of a scc
style insn. I've seen a port with pages and pages of special patterns
to match what simplify_if_then_else would do.
Jeff