On Mon, Feb 12, 2018 at 10:53 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > While the documentation only mentions AES resp. PCLMUL CPUIDs for these > intrinsics, they use and return V2DImode vectors and V2DImode is > only in VALID_SSE2_REG_MODE and VALID_AVX512VL_128_REG_MODE, so without > -msse2 we can't create registers with that mode. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? This isn't really backportable to older branches, unless > r256281 is backported too. > > 2018-02-12 Jakub Jelinek <ja...@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. > > * gcc.target/i386/pr84335.c: New test.
OK. Thanks, Uros. > --- gcc/config/i386/i386.c.jj 2018-02-09 06:44:38.737804246 +0100 > +++ gcc/config/i386/i386.c 2018-02-12 16:29:11.731233919 +0100 > @@ -31282,21 +31282,28 @@ ix86_init_mmx_sse_builtins (void) > VOID_FTYPE_UNSIGNED_UNSIGNED, IX86_BUILTIN_MWAIT); > > /* 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); > - 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); > - 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); > - 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); > - 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); > - 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); > > /* 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); > > /* RDRND */ > --- gcc/config/i386/wmmintrin.h.jj 2018-01-03 10:20:05.953535684 +0100 > +++ gcc/config/i386/wmmintrin.h 2018-02-12 16:25:32.526060590 +0100 > @@ -32,9 +32,9 @@ > > /* AES */ > > -#ifndef __AES__ > +#if !defined(__AES__) || !defined(__SSE2__) > #pragma GCC push_options > -#pragma GCC target("aes") > +#pragma GCC target("aes,sse2") > #define __DISABLE_AES__ > #endif /* __AES__ */ > > @@ -101,9 +101,9 @@ _mm_aeskeygenassist_si128 (__m128i __X, > > /* PCLMUL */ > > -#ifndef __PCLMUL__ > +#if !defined(__PCLMUL__) || !defined(__SSE2__) > #pragma GCC push_options > -#pragma GCC target("pclmul") > +#pragma GCC target("pclmul,sse2") > #define __DISABLE_PCLMUL__ > #endif /* __PCLMUL__ */ > > --- gcc/testsuite/gcc.target/i386/pr84335.c.jj 2018-02-12 16:37:55.304353911 > +0100 > +++ gcc/testsuite/gcc.target/i386/pr84335.c 2018-02-12 16:37:33.230351025 > +0100 > @@ -0,0 +1,10 @@ > +/* 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" } */ > +} > > Jakub