public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] i386: support micro-levels in target{, _clone} attrs [PR101696]
Date: Thu, 12 Aug 2021 07:51:34 -0700	[thread overview]
Message-ID: <CAMe9rOpdkD1KLjTwFPH7teEZFUbifNBWMnHLd+6DYc=rgv=3DA@mail.gmail.com> (raw)
In-Reply-To: <09e4b2bd-2055-f0f8-e339-b1aeeff5176a@suse.cz>

On Thu, Aug 12, 2021 at 7:39 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 8/12/21 4:25 PM, H.J. Lu wrote:
> > Please send out the v2 patch with the enclosed patch.  I added some tests.
>
> Thanks, there's patch which includes your changes.
>
> Martin

diff --git a/gcc/common/config/i386/i386-isas.h
b/gcc/common/config/i386/i386-isas.h
index 898c18f3dda..cd9523b8fbc 100644
--- a/gcc/common/config/i386/i386-isas.h
+++ b/gcc/common/config/i386/i386-isas.h
@@ -169,4 +169,8 @@ ISA_NAMES_TABLE_START
   ISA_NAMES_TABLE_ENTRY("aeskle", FEATURE_AESKLE, P_NONE, NULL)
   ISA_NAMES_TABLE_ENTRY("widekl", FEATURE_WIDEKL, P_NONE, "-mwidekl")
   ISA_NAMES_TABLE_ENTRY("avxvnni", FEATURE_AVXVNNI, P_NONE, "-mavxvnni")
+  ISA_NAMES_TABLE_ENTRY("x86-64", FEATURE_X86_64_BASELINE, P_NONE, NULL)
+  ISA_NAMES_TABLE_ENTRY("x86-64-v2", FEATURE_X86_64_V2, P_NONE, NULL)
+  ISA_NAMES_TABLE_ENTRY("x86-64-v3", FEATURE_X86_64_V3, P_NONE, NULL)
+  ISA_NAMES_TABLE_ENTRY("x86-64-v4", FEATURE_X86_64_V4, P_NONE, NULL)

If they have proper feature_priority, can you avoid

iff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 204e2903126..492873bb076 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -1904,8 +1904,24 @@ get_builtin_code_for_version (tree decl, tree
*predicate_list)
  return 0;
       new_target = TREE_TARGET_OPTION (target_node);
       gcc_assert (new_target);
-
-      if (new_target->arch_specified && new_target->arch > 0)
+      enum ix86_builtins builtin_fn = IX86_BUILTIN_CPU_IS;
+
+      /* Special case x86-64 micro-level architectures.  */
+      const char *arch_name = attrs_str + strlen ("arch=");
+      if (startswith (arch_name, "x86-64"))
+ {
+   arg_str = arch_name;
+   builtin_fn = IX86_BUILTIN_CPU_SUPPORTS;
+   if (strcmp (arch_name, "x86-64") == 0)
+     priority = P_X86_64_BASELINE;
+   else if (strcmp (arch_name, "x86-64-v2") == 0)
+     priority = P_X86_64_V2;
+   else if (strcmp (arch_name, "x86-64-v3") == 0)
+     priority = P_X86_64_V3;
+   else if (strcmp (arch_name, "x86-64-v4") == 0)
+     priority = P_X86_64_V4;
+ }

       if (predicate_list)
  {
-          predicate_decl = ix86_builtins [(int) IX86_BUILTIN_CPU_IS];
+   predicate_decl = ix86_builtins [(int) builtin_fn];

Is this required?

-- 
H.J.

  reply	other threads:[~2021-08-12 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 14:12 [PATCH] i386: support micro-levels in target{,_clone} " Martin Liška
2021-08-12 14:25 ` [PATCH] i386: support micro-levels in target{, _clone} " H.J. Lu
2021-08-12 14:39   ` [PATCH] i386: support micro-levels in target{,_clone} " Martin Liška
2021-08-12 14:51     ` H.J. Lu [this message]
2021-08-12 15:22       ` Martin Liška
2021-08-12 15:26         ` [PATCH] i386: support micro-levels in target{, _clone} " H.J. Lu
2021-08-12 15:31           ` [PATCH] i386: support micro-levels in target{,_clone} " Martin Liška
2021-08-12 17:35             ` [PATCH] i386: support micro-levels in target{, _clone} " H.J. Lu
2021-08-13  8:10               ` [PATCH] i386: support micro-levels in target{,_clone} " Martin Liška
2021-08-13 13:41                 ` [PATCH] i386: support micro-levels in target{, _clone} " H.J. Lu
2021-09-13 13:28                   ` [PATCH] i386: support micro-levels in target{,_clone} " Martin Liška
2021-09-13 14:36             ` [PATCH] i386: support micro-levels in target{, _clone} " Uros Bizjak

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='CAMe9rOpdkD1KLjTwFPH7teEZFUbifNBWMnHLd+6DYc=rgv=3DA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).