On 2/14/25 4:27 AM, Robin Dapp wrote:
Hi,
this patch adds two bridge patterns for combine in order to fix the
widen-complicate tests that regressed since GCC 14.
They key is to allow combination with a ephemeral binary-operation insn
that widens its first operand. This can subsequently be combined two
a double-widening insn. If the combination doesn't happen we fall back
to the original non-combined two insns. We have been doing the same
thing for multiply-add patterns for a while.
There are still remaining tests of a similar kind that fail. The issue
there is indeed that combine (now) lacks the capability to continue in
cases where there is no apparent local progress but two or three
seemingly no-progress combinations would help us get a better "global" result.
late_combine cannot rescue us here either because it only performs a
propagation if the source can be propagated into all its uses which is
not the case here. What we might need to do is create internal functions
for those widening operations and combine/simplify at gimple-level already.
I have done testing on rv64gcv_zvl512b but on an older local commit.
Curious what the CI has to say about it now.
Regards
Robin
gcc/ChangeLog:
* config/riscv/autovec-opt.md
(*single_widen_first_<any_widen_binop:optab><any_extend:su><mode>):
New combine "bridge" pattern.
LGTM. CI says it fixed [cond]widen_complicate-2 across the board. I
don't think we ever filed a bug on this. I'll push it momentarily.
I think I've seen similar case so the scalar side and didn't even ponder
if we could use a bridge to get where we wanted to go. Definitely worth
remembering.
Jeff