Commit 5cd1af49 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/84335 (ICE on invalid code in copy_to_mode_reg, at explow.c:612)

	PR target/84335
	* config/i386/i386.c (ix86_init_mmx_sse_builtins): Pass
	OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2 instead of
	OPTION_MASK_ISA_AES as first argument to def_builtin_const
	for AES builtins.  Pass OPTION_MASK_ISA_PCLMUL | OPTION_MASK_ISA_SSE2
	instead of OPTION_MASK_ISA_PCLMUL as first argument to
	def_builtin_const for __builtin_ia32_pclmulqdq128 builtin.
	* config/i386/wmmintrin.h: If __SSE2__ is not defined, enable it
	temporarily for AES and PCLMUL builtins.

	* gcc.target/i386/pr84335.c: New test.

From-SVN: r257619
parent 204a7ecb
2018-02-13 Jakub Jelinek <jakub@redhat.com> 2018-02-13 Jakub Jelinek <jakub@redhat.com>
PR target/84335
* config/i386/i386.c (ix86_init_mmx_sse_builtins): Pass
OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2 instead of
OPTION_MASK_ISA_AES as first argument to def_builtin_const
for AES builtins. Pass OPTION_MASK_ISA_PCLMUL | OPTION_MASK_ISA_SSE2
instead of OPTION_MASK_ISA_PCLMUL as first argument to
def_builtin_const for __builtin_ia32_pclmulqdq128 builtin.
* config/i386/wmmintrin.h: If __SSE2__ is not defined, enable it
temporarily for AES and PCLMUL builtins.
PR tree-optimization/84339 PR tree-optimization/84339
* gimple-fold.c (get_range_strlen): Set *FLEXP to true when handling * gimple-fold.c (get_range_strlen): Set *FLEXP to true when handling
ARRAY_REF where first operand is array_at_struct_end_p COMPONENT_REF. ARRAY_REF where first operand is array_at_struct_end_p COMPONENT_REF.
......
...@@ -31282,21 +31282,28 @@ ix86_init_mmx_sse_builtins (void) ...@@ -31282,21 +31282,28 @@ ix86_init_mmx_sse_builtins (void)
VOID_FTYPE_UNSIGNED_UNSIGNED, IX86_BUILTIN_MWAIT); VOID_FTYPE_UNSIGNED_UNSIGNED, IX86_BUILTIN_MWAIT);
/* AES */ /* AES */
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesenc128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aesenc128",
V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENC128); V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENC128);
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesenclast128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aesenclast128",
V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENCLAST128); V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENCLAST128);
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesdec128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aesdec128",
V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDEC128); V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDEC128);
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesdeclast128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aesdeclast128",
V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDECLAST128); V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDECLAST128);
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aesimc128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aesimc128",
V2DI_FTYPE_V2DI, IX86_BUILTIN_AESIMC128); V2DI_FTYPE_V2DI, IX86_BUILTIN_AESIMC128);
def_builtin_const (OPTION_MASK_ISA_AES, "__builtin_ia32_aeskeygenassist128", def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_aeskeygenassist128",
V2DI_FTYPE_V2DI_INT, IX86_BUILTIN_AESKEYGENASSIST128); V2DI_FTYPE_V2DI_INT, IX86_BUILTIN_AESKEYGENASSIST128);
/* PCLMUL */ /* PCLMUL */
def_builtin_const (OPTION_MASK_ISA_PCLMUL, "__builtin_ia32_pclmulqdq128", def_builtin_const (OPTION_MASK_ISA_PCLMUL | OPTION_MASK_ISA_SSE2,
"__builtin_ia32_pclmulqdq128",
V2DI_FTYPE_V2DI_V2DI_INT, IX86_BUILTIN_PCLMULQDQ128); V2DI_FTYPE_V2DI_V2DI_INT, IX86_BUILTIN_PCLMULQDQ128);
/* RDRND */ /* RDRND */
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
/* AES */ /* AES */
#ifndef __AES__ #if !defined(__AES__) || !defined(__SSE2__)
#pragma GCC push_options #pragma GCC push_options
#pragma GCC target("aes") #pragma GCC target("aes,sse2")
#define __DISABLE_AES__ #define __DISABLE_AES__
#endif /* __AES__ */ #endif /* __AES__ */
...@@ -101,9 +101,9 @@ _mm_aeskeygenassist_si128 (__m128i __X, const int __C) ...@@ -101,9 +101,9 @@ _mm_aeskeygenassist_si128 (__m128i __X, const int __C)
/* PCLMUL */ /* PCLMUL */
#ifndef __PCLMUL__ #if !defined(__PCLMUL__) || !defined(__SSE2__)
#pragma GCC push_options #pragma GCC push_options
#pragma GCC target("pclmul") #pragma GCC target("pclmul,sse2")
#define __DISABLE_PCLMUL__ #define __DISABLE_PCLMUL__
#endif /* __PCLMUL__ */ #endif /* __PCLMUL__ */
......
2018-02-13 Jakub Jelinek <jakub@redhat.com> 2018-02-13 Jakub Jelinek <jakub@redhat.com>
PR target/84335
* gcc.target/i386/pr84335.c: New test.
PR tree-optimization/84339 PR tree-optimization/84339
* gcc.c-torture/execute/pr84339.c: New test. * gcc.c-torture/execute/pr84339.c: New test.
......
/* PR target/84335 */
/* { dg-do compile } */
/* { dg-options "-O2 -maes -mno-sse2" } */
typedef long long V __attribute__ ((__vector_size__ (16)));
V
foo (V *a, V *b)
{
return __builtin_ia32_aesenc128 (*a, *b); /* { dg-error "needs isa option" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment