From: MITSUNARI Shigeo <[email protected]>
Changes since v6 (addressing Jeff Law's review):
- [1/2] Cost: the widened multiply is now emitted into a temporary
sequence and compared with seq_cost() against the classic mh != 0
sequence (mul_highpart_cost + extra_cost). It is used only when no
more expensive, so -Os and targets where it does not pay off fall back
to the sub/shift/add sequence.
- [1/2] Removed the literal 32; the transform is expressed in terms of
SIZE and GET_MODE_2XWIDER_MODE, and is no longer tied to 32-bit.
- [1/2] Use convert_to_mode instead of gen_lowpart for the truncation.
- [1/2] Reindented to GNU style (check_GNU_style.py clean). The wide
path is factored into a helper, expand_wide_mulh_udiv, so the classic
path is reached via goto and stays byte-identical to upstream.
- [2/2] Tests now match allocator-chosen registers with a generic regexp
and a back-reference; only ABI/ISA-mandated registers are fixed. The
redundant loop test bmi2-mulx-highpart-2.c is dropped (its checks are
already covered by the full-body match in -1.c).
- [2/2] i386.md is unchanged from v5.
MITSUNARI Shigeo (2):
expmed: Optimize 32-bit unsigned division by constants on 64-bit
targets
i386: Add BMI2 MULX pattern for highpart-only multiplication
gcc/config/i386/i386.md | 15 +++++
gcc/expmed.cc | 66 +++++++++++++++++++
.../gcc.target/i386/bmi2-mulx-highpart-1.c | 23 +++++++
gcc/testsuite/gcc.target/i386/mulq-highpart.c | 22 +++++++
4 files changed, 126 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/bmi2-mulx-highpart-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/mulq-highpart.c
--
2.43.0