]> git.ipfire.org Git - thirdparty/gcc.git/commit
[APX NDD] Support APX NDD for left shift insns
authorHongyu Wang <hongyu.wang@intel.com>
Wed, 25 Oct 2023 07:07:29 +0000 (15:07 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Thu, 7 Dec 2023 01:31:14 +0000 (09:31 +0800)
commit03655cd427b9d8e3b06c950255332eb988b0ade1
treeda2e38ecf188a52b594ddae42d225e64c760572f
parentc95f67b8966dff4f7b22e794e410c5aa7490877a
[APX NDD] Support APX NDD for left shift insns

For left shift, there is an optimization TARGET_DOUBLE_WITH_ADD that shl
1 can be optimized to add. As NDD form of add requires src operand to
be register since NDD cannot take 2 memory src, we currently just keep
using NDD form shift instead of add.

The optimization TARGET_SHIFT1 will try to remove constant 1 to use shorter
opcode, but under NDD assembler will automatically use it whether $1 exist
or not, so do not involve NDD with it.

The doubleword insns for left shift calls ix86_expand_ashl, which assume
all shift related pattern has same operand[0] and operand[1]. For these pattern
we will support them in a standalone patch.

gcc/ChangeLog:

* config/i386/i386.md (*ashl<mode>3_1): Extend with new
alternatives to support NDD, limit the new alternative to
generate sal only, and adjust output template for NDD.
(*ashlsi3_1_zext): Likewise.
(*ashlhi3_1): Likewise.
(*ashlqi3_1): Likewise.
(*ashl<mode>3_cmp): Likewise.
(*ashlsi3_cmp_zext): Likewise, and use nonimmediate_operand for
operands[1] to accept memory input for NDD alternative.
(*ashl<mode>3_cconly): Likewise.
(*ashl<dwi>3_doubleword_highpart): Adjust codegen for NDD.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-ndd.c: Add tests for sal.
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/apx-ndd.c