From 28746a50fcda453ed3f590140e017da0263172fc Mon Sep 17 00:00:00 2001 From: Julia Koval Date: Wed, 11 Nov 2015 12:40:50 +0100 Subject: [PATCH] Fix target arch attribute for Skylake. gcc/ * config/i386/i386.c: Handle "skylake" and "skylake-avx512". gcc/testsuite/ * g++.dg/ext/mv16.C: New functions. From-SVN: r230153 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/i386.c | 6 +++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/ext/mv16.C | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13ed0d8256c..c621b1c4d75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-11-11 Julia Koval + + * config/i386/i386.c: Handle "skylake" and + "skylake-avx512". + 2015-11-11 Martin Liska * gimple-ssa-strength-reduction.c (create_phi_basis): diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9205d497f5a..2fab5ca6b21 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -36108,7 +36108,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/ChangeLog b/gcc/testsuite/ChangeLog index 59cae93a19b..7862991c67f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-11-11 Julia Koval + + * g++.dg/ext/mv16.C: New functions. + 2015-11-11 Richard Biener Jiong Wang diff --git a/gcc/testsuite/g++.dg/ext/mv16.C b/gcc/testsuite/g++.dg/ext/mv16.C index 8992bfc6fc1..a3a0fe804fd 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); -- 2.30.2