From: Jakub Jelinek Date: Tue, 24 Apr 2018 16:42:59 +0000 (+0200) Subject: re PR target/85511 ([X86] Using __builtin_ia32_writeeflags_u32 in 64-bit mode causes... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8ac3359dc7c105b7f1edcf866517d3d273303c5;p=gcc.git re PR target/85511 ([X86] Using __builtin_ia32_writeeflags_u32 in 64-bit mode causes internal compiler error) PR target/85511 * config/i386/i386.c (ix86_init_mmx_sse_builtins): Don't define __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 if TARGET_64BIT. * gcc.target/i386/pr85511.c: New test. From-SVN: r259609 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e43a931c192..299206492a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2018-04-24 Jakub Jelinek + PR target/85511 + * config/i386/i386.c (ix86_init_mmx_sse_builtins): Don't define + __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 + if TARGET_64BIT. + PR target/85503 * config/rs6000/rs6000-p8swap.c (const_load_sequence_p): Punt if const_vector is not CONST_VECTOR or SYMBOL_REF for a constant pool diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fada22bba70..a3c3870d4f4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -31934,14 +31934,20 @@ ix86_init_mmx_sse_builtins (void) IX86_BUILTIN_SBB64); /* Read/write FLAGS. */ - def_builtin (0, "__builtin_ia32_readeflags_u32", - UNSIGNED_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS); - def_builtin (OPTION_MASK_ISA_64BIT, "__builtin_ia32_readeflags_u64", - UINT64_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS); - def_builtin (0, "__builtin_ia32_writeeflags_u32", - VOID_FTYPE_UNSIGNED, IX86_BUILTIN_WRITE_FLAGS); - def_builtin (OPTION_MASK_ISA_64BIT, "__builtin_ia32_writeeflags_u64", - VOID_FTYPE_UINT64, IX86_BUILTIN_WRITE_FLAGS); + if (TARGET_64BIT) + { + def_builtin (OPTION_MASK_ISA_64BIT, "__builtin_ia32_readeflags_u64", + UINT64_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS); + def_builtin (OPTION_MASK_ISA_64BIT, "__builtin_ia32_writeeflags_u64", + VOID_FTYPE_UINT64, IX86_BUILTIN_WRITE_FLAGS); + } + else + { + def_builtin (0, "__builtin_ia32_readeflags_u32", + UNSIGNED_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS); + def_builtin (0, "__builtin_ia32_writeeflags_u32", + VOID_FTYPE_UNSIGNED, IX86_BUILTIN_WRITE_FLAGS); + } /* CLFLUSHOPT. */ def_builtin (OPTION_MASK_ISA_CLFLUSHOPT, "__builtin_ia32_clflushopt", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c1c0be9e91..12fd465de84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-04-24 Jakub Jelinek + PR target/85511 + * gcc.target/i386/pr85511.c: New test. + PR target/85503 * g++.dg/ext/pr85503.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr85511.c b/gcc/testsuite/gcc.target/i386/pr85511.c new file mode 100644 index 00000000000..a082a5eaf01 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85511.c @@ -0,0 +1,15 @@ +/* PR target/85511 */ +/* { dg-do compile } */ +/* { dg-options "-Wimplicit-function-declaration" } */ + +unsigned int +foo (void) +{ + return __builtin_ia32_readeflags_u32 (); /* { dg-warning "implicit declaration of function" "" { target { ! ia32 } } } */ +} + +void +bar (unsigned int x) +{ + __builtin_ia32_writeeflags_u32 (x); /* { dg-warning "implicit declaration of function" "" { target { ! ia32 } } } */ +}