diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 9d2eb7f03083..f479466e8f0c 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -11074,11 +11074,17 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, == (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4)) && (isa & (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4)) != 0) isa |= (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4); - if ((bisa & OPTION_MASK_ISA_MMX) && !TARGET_MMX && TARGET_MMX_WITH_SSE) + + if ((bisa & OPTION_MASK_ISA_MMX) + && !TARGET_MMX + && TARGET_MMX_WITH_SSE + /* NB: __builtin_ia32_maskmovq also requires MMX. */ + && fcode != IX86_BUILTIN_MASKMOVQ) { bisa &= ~OPTION_MASK_ISA_MMX; bisa |= OPTION_MASK_ISA_SSE2; } + if ((bisa & isa) != bisa || (bisa2 & isa2) != bisa2) { bool add_abi_p = bisa & OPTION_MASK_ISA_64BIT; diff --git a/gcc/testsuite/gcc.target/i386/pr97140.c b/gcc/testsuite/gcc.target/i386/pr97140.c new file mode 100644 index 000000000000..edb39d916ea6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97140.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -mno-mmx -Wno-psabi" } */ + +typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__)); +typedef char __v8qi __attribute__ ((__vector_size__ (8))); +void +_mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P) +{ + __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P); /* { dg-error "needs isa option -msse -m3dnowa -mmmx" } */ +}