From: Uros Bizjak <ubizjak@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Remove __builtin_ia32_readeflags_u32/__builtin_ia32_writeeflags_u32 builtins for TARGET_64BIT (PR target/85511)
Date: Tue, 24 Apr 2018 16:31:00 -0000 [thread overview]
Message-ID: <CAFULd4ZuRKdNmi0jX8eP8wPUE8venO=aD5+h0bQ=89p8NGDQQw@mail.gmail.com> (raw)
In-Reply-To: <20180424125150.GY8577@tucnak>
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
prev parent reply other threads:[~2018-04-24 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 17:42 Jakub Jelinek
2018-04-24 16:31 ` Uros Bizjak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFULd4ZuRKdNmi0jX8eP8wPUE8venO=aD5+h0bQ=89p8NGDQQw@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).