]> git.ipfire.org Git - thirdparty/gcc.git/commit
[APX NDD] Support Intel APX NDD for legacy add insn
authorKong Lingling <lingling.kong@intel.com>
Wed, 14 Dec 2022 02:10:19 +0000 (10:10 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Thu, 7 Dec 2023 01:31:13 +0000 (09:31 +0800)
commite21b2caf6da7efbc87e7140e5472538c2349721c
treea119ec1bc5cbc8b3ff5cfe387e32ede0874053f4
parent08b7462d3ad8e5acd941b7c777c5b26b4064d686
[APX NDD] Support Intel APX NDD for legacy add insn

APX NDD provides an extra destination register operand for several gpr
related legacy insns, so a new alternative can be adopted to operand1
with "r" constraint.

This first patch supports NDD for add instruction, and keeps to use lea
when all operands are registers since lea have shorter encoding. For
add operations containing mem NDD will be adopted to save an extra move.

In legacy x86 binary operation expand it will force operands[0] and
operands[1] to be the same so add a helper function to allow NDD form
pattern that operands[0] and operands[1] can be different.

gcc/ChangeLog:

* config/i386/i386-expand.cc (ix86_fixup_binary_operands): Add
new use_ndd flag to check whether ndd can be used for this binop
and adjust operand emit.
(ix86_binary_operator_ok): Likewise.
(ix86_expand_binary_operator): Likewise, and void postreload
expand generate lea pattern when use_ndd is explicit parsed.
* config/i386/i386-options.cc (ix86_option_override_internal):
Prohibit apx subfeatures when not in 64bit mode.
* config/i386/i386-protos.h (ix86_binary_operator_ok):
Add use_ndd flag.
(ix86_fixup_binary_operand): Likewise.
(ix86_expand_binary_operand): Likewise.
* config/i386/i386.md (*add<mode>_1): Extend with new alternatives
to support NDD, and adjust output template.
(*addhi_1): Likewise.
(*addqi_1): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-ndd.c: New test.
gcc/config/i386/i386-expand.cc
gcc/config/i386/i386-options.cc
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/apx-ndd.c [new file with mode: 0644]