public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix target arch attribute for skylake
@ 2015-11-10 11:54 Yulia Koval
  2015-11-10 12:13 ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Yulia Koval @ 2015-11-10 11:54 UTC (permalink / raw)
  To: GCC Patches; +Cc: Uros Bizjak, kirill.yukhin

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Hi,

This patch fixes the issue, when target(arch="haswell") function was
chosen instead of target(arch="skylake") on skylake. Ok for trunk?

gcc/
    * config/i386/i386.c: Handle "skylake" and
      "skylake-avx512".

gcc/testsuite/
    * g++.dg/ext/mv16.C: New functions.

Yulia

[-- Attachment #2: patch_skylake --]
[-- Type: application/octet-stream, Size: 1731 bytes --]

commit 81ff379849bfc51f91de2476f027faa097172659
Author: Julia Koval <julia.koval@intel.com>
Date:   Mon Nov 2 16:42:30 2015 +0300

    Skylake fix

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 66024e2..3f26c2f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -35852,7 +35852,11 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
 	      priority = P_PROC_AVX;
 	      break;
 	    case PROCESSOR_HASWELL:
-	      if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_ADX)
+	      if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AVX512VL)
+	        arg_str = "skylake-avx512";
+	      else if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_XSAVES)
+	        arg_str = "skylake";
+	      else if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_ADX)
 		arg_str = "broadwell";
 	      else
 		arg_str = "haswell";
diff --git a/gcc/testsuite/g++.dg/ext/mv16.C b/gcc/testsuite/g++.dg/ext/mv16.C
index 8992bfc..a3a0fe8 100644
--- a/gcc/testsuite/g++.dg/ext/mv16.C
+++ b/gcc/testsuite/g++.dg/ext/mv16.C
@@ -44,6 +44,18 @@ foo ()
   return 12;
 }
 
+int __attribute__ ((target("arch=broadwell"))) foo () {
+  return 13;
+}
+
+int __attribute__ ((target("arch=skylake"))) foo () {
+  return 14;
+}
+
+int __attribute__ ((target("arch=skylake-avx512"))) foo () {
+  return 15;
+}
+
 int main ()
 {
   int val = foo ();
@@ -58,6 +70,12 @@ int main ()
     assert (val == 9);
   else if (__builtin_cpu_is ("haswell"))
     assert (val == 12);
+  else if (__builtin_cpu_is ("broadwell"))
+    assert (val == 13);
+  else if (__builtin_cpu_is ("skylake"))
+    assert (val == 14);
+  else if (__builtin_cpu_is ("skylake-avx512"))
+    assert (val == 15);
   else
     assert (val == 0);
 

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

* Re: [PATCH] Fix target arch attribute for skylake
  2015-11-10 11:54 [PATCH] Fix target arch attribute for skylake Yulia Koval
@ 2015-11-10 12:13 ` Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2015-11-10 12:13 UTC (permalink / raw)
  To: Yulia Koval; +Cc: GCC Patches, Kirill Yukhin

On Tue, Nov 10, 2015 at 12:54 PM, Yulia Koval <vaalfreja@gmail.com> wrote:
> Hi,
>
> This patch fixes the issue, when target(arch="haswell") function was
> chosen instead of target(arch="skylake") on skylake. Ok for trunk?
>
> gcc/
>     * config/i386/i386.c: Handle "skylake" and
>       "skylake-avx512".
>
> gcc/testsuite/
>     * g++.dg/ext/mv16.C: New functions.

OK.

Thanks,
Uros.

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

end of thread, other threads:[~2015-11-10 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 11:54 [PATCH] Fix target arch attribute for skylake Yulia Koval
2015-11-10 12:13 ` 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).