From 3b5e1089fedddec6d8299ba1800705b65c574d32 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 2 Dec 2017 08:37:50 +0100 Subject: [PATCH] i386-protos.h (standard_sse_constant_opcode): Change last argument to rtx pointer. * config/i386/i386-protos.h (standard_sse_constant_opcode): Change last argument to rtx pointer. * config/i386/i386.c (standard_sse_constant_opcode): Replace X argument with OPERANDS. For AVX+ 128-bit VEX encoded instructions over 256-bit or 512-bit. If setting EXT_REX_SSE_REG_P, use EVEX encoded insn depending on the chosen ISAs. * config/i386/i386.md (*movxi_internal_avx512f, *movoi_internal_avx, *movti_internal, *movdi_internal, *movsi_internal, *movtf_internal, *movdf_internal, *movsf_internal): Adjust standard_sse_constant_opcode callers. * config/i386/sse.md (mov_internal): Likewise. * config/i386/mmx.md (*mov_internal): Likewise. From-SVN: r255352 --- gcc/ChangeLog | 15 ++++++++ gcc/config/i386/i386-protos.h | 2 +- gcc/config/i386/i386.c | 71 +++++++++++++++++++++++------------ gcc/config/i386/i386.md | 16 ++++---- gcc/config/i386/mmx.md | 2 +- gcc/config/i386/sse.md | 2 +- 6 files changed, 72 insertions(+), 36 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a13fcef293d..de7335efa40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2017-12-02 Jakub Jelinek + + * config/i386/i386-protos.h (standard_sse_constant_opcode): Change + last argument to rtx pointer. + * config/i386/i386.c (standard_sse_constant_opcode): Replace X argument + with OPERANDS. For AVX+ 128-bit VEX encoded instructions over 256-bit + or 512-bit. If setting EXT_REX_SSE_REG_P, use EVEX encoded insn + depending on the chosen ISAs. + * config/i386/i386.md (*movxi_internal_avx512f, *movoi_internal_avx, + *movti_internal, *movdi_internal, *movsi_internal, *movtf_internal, + *movdf_internal, *movsf_internal): Adjust standard_sse_constant_opcode + callers. + * config/i386/sse.md (mov_internal): Likewise. + * config/i386/mmx.md (*mov_internal): Likewise. + 2017-12-01 Segher Boessenkool * doc/invoke.texi (-dp): Say that instruction cost is printed as well. diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index bb6f4a53e72..f5755f0d363 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -52,7 +52,7 @@ extern int standard_80387_constant_p (rtx); extern const char *standard_80387_constant_opcode (rtx); extern rtx standard_80387_constant_rtx (int); extern int standard_sse_constant_p (rtx, machine_mode); -extern const char *standard_sse_constant_opcode (rtx_insn *, rtx); +extern const char *standard_sse_constant_opcode (rtx_insn *, rtx *); extern bool ix86_standard_x87sse_constant_load_p (const rtx_insn *, rtx); extern bool symbolic_reference_mentioned_p (rtx); extern bool extended_reg_mentioned_p (rtx); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 57c09c43ec9..5638eea7636 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -10380,12 +10380,13 @@ standard_sse_constant_p (rtx x, machine_mode pred_mode) } /* Return the opcode of the special instruction to be used to load - the constant X. */ + the constant operands[1] into operands[0]. */ const char * -standard_sse_constant_opcode (rtx_insn *insn, rtx x) +standard_sse_constant_opcode (rtx_insn *insn, rtx *operands) { machine_mode mode; + rtx x = operands[1]; gcc_assert (TARGET_SSE); @@ -10395,34 +10396,51 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx x) { switch (get_attr_mode (insn)) { + case MODE_TI: + if (!EXT_REX_SSE_REG_P (operands[0])) + return "%vpxor\t%0, %d0"; + /* FALLTHRU */ case MODE_XI: - return "vpxord\t%g0, %g0, %g0"; case MODE_OI: - return (TARGET_AVX512VL - ? "vpxord\t%x0, %x0, %x0" - : "vpxor\t%x0, %x0, %x0"); - case MODE_TI: - return (TARGET_AVX512VL - ? "vpxord\t%x0, %x0, %x0" - : "%vpxor\t%0, %d0"); + if (EXT_REX_SSE_REG_P (operands[0])) + return (TARGET_AVX512VL + ? "vpxord\t%x0, %x0, %x0" + : "vpxord\t%g0, %g0, %g0"); + return "vpxor\t%x0, %x0, %x0"; + case MODE_V2DF: + if (!EXT_REX_SSE_REG_P (operands[0])) + return "%vxorpd\t%0, %d0"; + /* FALLTHRU */ case MODE_V8DF: - return (TARGET_AVX512DQ - ? "vxorpd\t%g0, %g0, %g0" - : "vpxorq\t%g0, %g0, %g0"); case MODE_V4DF: - return "vxorpd\t%x0, %x0, %x0"; - case MODE_V2DF: - return "%vxorpd\t%0, %d0"; + if (!EXT_REX_SSE_REG_P (operands[0])) + return "vxorpd\t%x0, %x0, %x0"; + else if (TARGET_AVX512DQ) + return (TARGET_AVX512VL + ? "vxorpd\t%x0, %x0, %x0" + : "vxorpd\t%g0, %g0, %g0"); + else + return (TARGET_AVX512VL + ? "vpxorq\t%x0, %x0, %x0" + : "vpxorq\t%g0, %g0, %g0"); + case MODE_V4SF: + if (!EXT_REX_SSE_REG_P (operands[0])) + return "%vxorps\t%0, %d0"; + /* FALLTHRU */ case MODE_V16SF: - return (TARGET_AVX512DQ - ? "vxorps\t%g0, %g0, %g0" - : "vpxord\t%g0, %g0, %g0"); case MODE_V8SF: - return "vxorps\t%x0, %x0, %x0"; - case MODE_V4SF: - return "%vxorps\t%0, %d0"; + if (!EXT_REX_SSE_REG_P (operands[0])) + return "vxorps\t%x0, %x0, %x0"; + else if (TARGET_AVX512DQ) + return (TARGET_AVX512VL + ? "vxorps\t%x0, %x0, %x0" + : "vxorps\t%g0, %g0, %g0"); + else + return (TARGET_AVX512VL + ? "vpxord\t%x0, %x0, %x0" + : "vpxord\t%g0, %g0, %g0"); default: gcc_unreachable (); @@ -10449,11 +10467,14 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx x) case MODE_V2DF: case MODE_V4SF: gcc_assert (TARGET_SSE2); - return (TARGET_AVX512F - ? "vpternlogd\t{$0xFF, %0, %0, %0|%0, %0, %0, 0xFF}" - : TARGET_AVX + if (!EXT_REX_SSE_REG_P (operands[0])) + return (TARGET_AVX ? "vpcmpeqd\t%0, %0, %0" : "pcmpeqd\t%0, %0"); + else if (TARGET_AVX512VL) + return "vpternlogd\t{$0xFF, %0, %0, %0|%0, %0, %0, 0xFF}"; + else + return "vpternlogd\t{$0xFF, %g0, %g0, %g0|%g0, %g0, %g0, 0xFF}"; default: gcc_unreachable (); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b4d73dbfd0d..c6ab79a42ac 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2044,7 +2044,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: if (misaligned_operand (operands[0], XImode) @@ -2071,7 +2071,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: if (misaligned_operand (operands[0], OImode) @@ -2131,7 +2131,7 @@ return "#"; case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: /* TDmode values are passed as TImode on the stack. Moving them @@ -2243,7 +2243,7 @@ return "movq\t{%1, %0|%0, %1}"; case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: switch (get_attr_mode (insn)) @@ -2456,7 +2456,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_MSKMOV: return "kmovd\t{%1, %0|%0, %1}"; @@ -3327,7 +3327,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: /* Handle misaligned load/store since we @@ -3504,7 +3504,7 @@ return "mov{q}\t{%1, %0|%0, %1}"; case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: switch (get_attr_mode (insn)) @@ -3698,7 +3698,7 @@ return "mov{l}\t{%1, %0|%0, %1}"; case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: switch (get_attr_mode (insn)) diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index b3f3633e964..da60d21a32c 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -112,7 +112,7 @@ return "movdq2q\t{%1, %0|%0, %1}"; case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: switch (get_attr_mode (insn)) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 0eaede45fe2..1f785b7577c 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -923,7 +923,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - return standard_sse_constant_opcode (insn, operands[1]); + return standard_sse_constant_opcode (insn, operands); case TYPE_SSEMOV: /* There is no evex-encoded vmov* for sizes smaller than 64-bytes -- 2.30.2