build_long_mul_partials splits both operands into halves before forming
the four partial products, regardless of what is known about them. An
operand provably within the half width still gets a shift and two
partial products against a high half that is zero.

1/2 reuses the recognizer's fits test so such an operand contributes
literal zeros instead. 2/2 is a no-functional-change tidy-up of the
result.

Only targets that cannot form the narrow high part reach this lowering.

Bootstrapped and regtested on AArch64, x86-64 and ARM.
Regtested on AVR.


Konstantinos Eleftheriou (1):
  widening_mul: Factor the long-mul operand split into a helper

Philipp Tomsich (1):
  widening_mul: Emit zero high-half partials for operands that fit
    [PR127042]

 gcc/testsuite/gcc.target/arm/pr127042.c      | 23 ++++++
 gcc/testsuite/gcc.target/avr/mmcu/pr127042.c | 22 ++++++
 gcc/tree-ssa-math-opts.cc                    | 76 +++++++++++++-------
 3 files changed, 97 insertions(+), 24 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/arm/pr127042.c
 create mode 100644 gcc/testsuite/gcc.target/avr/mmcu/pr127042.c

-- 
2.55.0

Reply via email to