]> git.ipfire.org Git - thirdparty/gcc.git/commit
x86: Allow TImode offsettable memory only with 8-bit constant
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 12 Apr 2024 22:42:12 +0000 (15:42 -0700)
committerH.J. Lu <(no_default)>
Mon, 15 Apr 2024 11:21:17 +0000 (04:21 -0700)
commita3281dd0f4b46c16ec1192ad411c0a96e6d086eb
treefb168726405fd91ad16a5269060bce39c65f6580
parent85002f8085c25bb3e74ab013581a74e7c7ae006b
x86: Allow TImode offsettable memory only with 8-bit constant

The x86 instruction size limit is 15 bytes.  If a NDD instruction has
a segment prefix byte, a 4-byte opcode prefix, a MODRM byte, a SIB byte,
a 4-byte displacement and a 4-byte immediate, adding an address size
prefix will exceed the size limit.  Change TImode ADD, AND, OR and XOR
to allow offsettable memory only with 8-bit signed integer constant,
which is encoded with a 1-byte immediate, if the address size prefix
is used.

gcc/

PR target/114696
* config/i386/i386.md (isa): Add apx_ndd_64.
(enabled): Likewise.
(*add<dwi>3_doubleword): Change rjO to r,ro,jO with 8-bit
signed integer constant and enable jO only for apx_ndd_64.
(*add<dwi>3_doubleword_cc_overflow_1): Likewise.
(*and<dwi>3_doubleword): Likewise.
(*<code><dwi>3_doubleword): Likewise.

gcc/testsuite/

PR target/114696
* gcc.target/i386/apx-ndd-x32-2a.c: New test.
* gcc.target/i386/apx-ndd-x32-2b.c: Likewise.
* gcc.target/i386/apx-ndd-x32-2c.c: Likewise.
* gcc.target/i386/apx-ndd-x32-2d.c: Likewise.
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/apx-ndd-x32-2a.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/apx-ndd-x32-2b.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/apx-ndd-x32-2c.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/apx-ndd-x32-2d.c [new file with mode: 0644]