public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] Remove __builtin_ia32_readeflags_u32/__builtin_ia32_writeeflags_u32 builtins for TARGET_64BIT (PR target/85511)
  2018-04-24 17:42 [PATCH] Remove __builtin_ia32_readeflags_u32/__builtin_ia32_writeeflags_u32 builtins for TARGET_64BIT (PR target/85511) Jakub Jelinek
@ 2018-04-24 16:31 ` Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2018-04-24 16:31 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Tue, Apr 24, 2018 at 2:51 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> These two *_u32 builtins are defined also in -m64 mode, but share the
> builtin codes with the *_u64 ones and the expansion of them uses word_mode.
>
> The following patch just removes them, ia32intrin.h uses the u32 suffixed
> ones only when __x86_64__ is not defined, bootstrapped/regtested on
> x86_64-linux and i686-linux, ok for trunk?
>
> A variant would be to use separate IX86_BUILTIN_ codes for the 32-bit and
> 64-bit builtins and add separate expansion for them, but that looks like
> overkill to me, people should use __readeflags/__writeeflags anyway and
> those do the right thing.
>
> 2018-04-24  Jakub Jelinek  <jakub@redhat.com>
>
>         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.

OK.

Thanks,
Uros.

> --- gcc/config/i386/i386.c.jj   2018-04-24 09:37:36.029459208 +0200
> +++ gcc/config/i386/i386.c      2018-04-24 10:37:01.258882134 +0200
> @@ -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",
> --- gcc/testsuite/gcc.target/i386/pr85511.c.jj  2018-04-24 10:45:18.099260629 +0200
> +++ gcc/testsuite/gcc.target/i386/pr85511.c     2018-04-24 10:47:46.069374103 +0200
> @@ -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 } } } */
> +}
>
>         Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Remove __builtin_ia32_readeflags_u32/__builtin_ia32_writeeflags_u32 builtins for TARGET_64BIT (PR target/85511)
@ 2018-04-24 17:42 Jakub Jelinek
  2018-04-24 16:31 ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-04-24 17:42 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

Hi!

These two *_u32 builtins are defined also in -m64 mode, but share the
builtin codes with the *_u64 ones and the expansion of them uses word_mode.

The following patch just removes them, ia32intrin.h uses the u32 suffixed
ones only when __x86_64__ is not defined, bootstrapped/regtested on
x86_64-linux and i686-linux, ok for trunk?

A variant would be to use separate IX86_BUILTIN_ codes for the 32-bit and
64-bit builtins and add separate expansion for them, but that looks like
overkill to me, people should use __readeflags/__writeeflags anyway and
those do the right thing.

2018-04-24  Jakub Jelinek  <jakub@redhat.com>

	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.

--- gcc/config/i386/i386.c.jj	2018-04-24 09:37:36.029459208 +0200
+++ gcc/config/i386/i386.c	2018-04-24 10:37:01.258882134 +0200
@@ -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",
--- gcc/testsuite/gcc.target/i386/pr85511.c.jj	2018-04-24 10:45:18.099260629 +0200
+++ gcc/testsuite/gcc.target/i386/pr85511.c	2018-04-24 10:47:46.069374103 +0200
@@ -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 } } } */
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-24 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 17:42 [PATCH] Remove __builtin_ia32_readeflags_u32/__builtin_ia32_writeeflags_u32 builtins for TARGET_64BIT (PR target/85511) Jakub Jelinek
2018-04-24 16:31 ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).