x32: Add addr32 prefix to VSIB address

Programming / Compilers / GCC - hjl [138bc75d-0d04-0410-961f-82ee72b054a4] - 14 March 2019 08:49 EDT

32-bit indices in VSIB address are sign-extended to 64 bits. In x32, when 32-bit indices are used as addresses, like in

vgatherdps %ymm7, 0(,%ymm9,1), %ymm6

32-bit indices, 0xf7fa3010, is sign-extended to 0xfffffffff7fa3010 which is invalid address. Add addr32 prefix to UNSPEC_VSIBADDR instructions for x32 if there is no base register nor symbol.

This fixes 175.vpr and 254.gap in SPEC CPU 2000 on x32 with

-Ofast -funroll-loops -march=haswell

gcc/

PR target/89523
- config/i386/i386.c (ix86_print_operand): Handle 'M' to add addr32 prefix to VSIB address for X32.
- config/i386/sse.md (*avx512pf_gatherpfsf_mask): Prepend "%M2" to opcode. (*avx512pf_gatherpfdf_mask): Likewise. (*avx512pf_scatterpfsf_mask): Likewise. (*avx512pf_scatterpfdf_mask): Likewise. (*avx2_gathersi): Prepend "%M3" to opcode. (*avx2_gathersi_2): Prepend "%M2" to opcode. (*avx2_gatherdi): Prepend "%M3" to opcode. (*avx2_gatherdi_2): Prepend "%M2" to opcode. (*avx2_gatherdi_3): Prepend "%M3" to opcode. (*avx2_gatherdi_4): Prepend "%M2" to opcode.` (*avx512f_gathersi): Prepend "%M4" to opcode. (*avx512f_gathersi_2): Prepend "%M3" to opcode. (*avx512f_gatherdi): Prepend "%M4" to opcode. (*avx512f_gatherdi_2): Prepend "%M3" to opcode. (*avx512f_scattersi): Prepend "%M0" to opcode. (*avx512f_scatterdi): Likewise.

gcc/testsuite/

PR target/89523
- gcc.target/i386/pr89523-1a.c: New test.
- gcc.target/i386/pr89523-1b.c: Likewise.
- gcc.target/i386/pr89523-2.c: Likewise.
- gcc.target/i386/pr89523-3.c: Likewise.
- gcc.target/i386/pr89523-4.c: Likewise.
- gcc.target/i386/pr89523-5.c: Likewise.
- gcc.target/i386/pr89523-6.c: Likewise.
- gcc.target/i386/pr89523-7.c: Likewise.
- gcc.target/i386/pr89523-8.c: Likewise.
- gcc.target/i386/pr89523-9.c: Likewise.

ee27daa7385 x32: Add addr32 prefix to VSIB address
gcc/ChangeLog | 23 +++++++++++++++
gcc/config/i386/i386.c | 21 ++++++++++++++
gcc/config/i386/sse.md | 46 +++++++++++++++---------------
gcc/testsuite/ChangeLog | 14 +++++++++
gcc/testsuite/gcc.target/i386/pr89523-1a.c | 24 ++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-1b.c | 7 +++++
gcc/testsuite/gcc.target/i386/pr89523-2.c | 37 ++++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-3.c | 36 +++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-4.c | 36 +++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-5.c | 39 +++++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-6.c | 38 ++++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-7.c | 42 +++++++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-8.c | 41 ++++++++++++++++++++++++++
gcc/testsuite/gcc.target/i386/pr89523-9.c | 30 +++++++++++++++++++
14 files changed, 411 insertions(+), 23 deletions(-)

Upstream: gcc.gnu.org


  • Share