From c36b04c1461c2825f30760043fb216237d07ce39 Mon Sep 17 00:00:00 2001 From: Julia Koval Date: Thu, 15 Mar 2018 08:52:36 +0100 Subject: [PATCH] Add builtin_cpu for cannonlake and new isa features. gcc/ * config/i386/i386.c (F_AVX512VBMI2, F_GFNI, F_VPCLMULQDQ, F_AVX512VNNI, F_AVX512BITALG): New. gcc/testsuite/ * gcc.target/i386/builtin_target.c (check_intel_cpu_model): Add cannonlake. (check_features): Add avx512vbmi2, gfni, vpclmulqdq, avx512vnni, avx512bitalg. libgcc/ * config/i386/cpuinfo.c (get_available_features): Add FEATURE_AVX512VBMI2, FEATURE_GFNI, FEATURE_VPCLMULQDQ, FEATURE_AVX512VNNI, FEATURE_AVX512BITALG. * config/i386/cpuinfo.h (processor_features) Add FEATURE_AVX512VBMI2, FEATURE_GFNI, FEATURE_VPCLMULQDQ, FEATURE_AVX512VNNI, FEATURE_AVX512BITALG. From-SVN: r258551 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/i386.c | 12 +++++++++++- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/i386/builtin_target.c | 14 ++++++++++++++ libgcc/ChangeLog | 9 +++++++++ libgcc/config/i386/cpuinfo.c | 10 ++++++++++ libgcc/config/i386/cpuinfo.h | 7 ++++++- 7 files changed, 62 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea4b6640e24..b4dde6ea8b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-03-15 Julia Koval + + * config/i386/i386.c (F_AVX512VBMI2, F_GFNI, F_VPCLMULQDQ, + F_AVX512VNNI, F_AVX512BITALG): New. + 2018-03-14 John David Anglin PR target/83451 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a87e5d5ad79..1b57cc6c851 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -33086,6 +33086,11 @@ fold_builtin_cpu (tree fndecl, tree *args) F_AVX5124VNNIW, F_AVX5124FMAPS, F_AVX512VPOPCNTDQ, + F_AVX512VBMI2, + F_GFNI, + F_VPCLMULQDQ, + F_AVX512VNNI, + F_AVX512BITALG, F_MAX }; @@ -33210,7 +33215,12 @@ fold_builtin_cpu (tree fndecl, tree *args) {"avx512ifma",F_AVX512IFMA}, {"avx5124vnniw",F_AVX5124VNNIW}, {"avx5124fmaps",F_AVX5124FMAPS}, - {"avx512vpopcntdq",F_AVX512VPOPCNTDQ} + {"avx512vpopcntdq",F_AVX512VPOPCNTDQ}, + {"avx512vbmi2", F_AVX512VBMI2}, + {"gfni", F_GFNI}, + {"vpclmulqdq", F_VPCLMULQDQ}, + {"avx512vnni", F_AVX512VNNI}, + {"avx512bitalg", F_AVX512BITALG} }; tree __processor_model_type = build_processor_model_struct (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2da077edb1..4962ff5f407 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-03-15 Julia Koval + + * gcc.target/i386/builtin_target.c (check_intel_cpu_model): Add + cannonlake. + (check_features): Add avx512vbmi2, gfni, vpclmulqdq, avx512vnni, + avx512bitalg. + 2018-03-15 Jakub Jelinek PR c/84853 diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c b/gcc/testsuite/gcc.target/i386/builtin_target.c index 8fa97973ef8..869bd947529 100644 --- a/gcc/testsuite/gcc.target/i386/builtin_target.c +++ b/gcc/testsuite/gcc.target/i386/builtin_target.c @@ -103,6 +103,10 @@ check_intel_cpu_model (unsigned int family, unsigned int model, assert (__builtin_cpu_is ("corei7")); assert (__builtin_cpu_is ("skylake-avx512")); break; + case 0x66: + /* Cannon Lake. */ + assert (__builtin_cpu_is ("cannonlake")); + break; case 0x17: case 0x1d: /* Penryn. */ @@ -228,6 +232,16 @@ check_features (unsigned int ecx, unsigned int edx, assert (__builtin_cpu_supports ("avx512ifma")); if (ecx & bit_AVX512VBMI) assert (__builtin_cpu_supports ("avx512vbmi")); + if (ecx & bit_AVX512VBMI2) + assert (__builtin_cpu_supports ("avx512vbmi2")); + if (ecx & bit_GFNI) + assert (__builtin_cpu_supports ("gfni")); + if (ecx & bit_VPCLMULQDQ) + assert (__builtin_cpu_supports ("vpclmulqdq")); + if (ecx & bit_AVX512VNNI) + assert (__builtin_cpu_supports ("avx512vnni")); + if (ecx & bit_AVX512BITALG) + assert (__builtin_cpu_supports ("avx512bitalg")); if (ecx & bit_AVX512VPOPCNTDQ) assert (__builtin_cpu_supports ("avx512vpopcntdq")); if (edx & bit_AVX5124VNNIW) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 88641125942..40407abef7c 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2018-03-15 Julia Koval + + * config/i386/cpuinfo.c (get_available_features): Add + FEATURE_AVX512VBMI2, FEATURE_GFNI, FEATURE_VPCLMULQDQ, + FEATURE_AVX512VNNI, FEATURE_AVX512BITALG. + * config/i386/cpuinfo.h (processor_features): Add FEATURE_AVX512VBMI2, + FEATURE_GFNI, FEATURE_VPCLMULQDQ, FEATURE_AVX512VNNI, + FEATURE_AVX512BITALG. + 2018-03-14 Julia Koval * config/i386/cpuinfo.h (processor_subtypes): Split up icelake on diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c index a8821af704e..8a6eef59911 100644 --- a/libgcc/config/i386/cpuinfo.c +++ b/libgcc/config/i386/cpuinfo.c @@ -287,6 +287,16 @@ get_available_features (unsigned int ecx, unsigned int edx, features |= (1 << FEATURE_AVX512IFMA); if (ecx & bit_AVX512VBMI) features |= (1 << FEATURE_AVX512VBMI); + if (ecx & bit_AVX512VBMI2) + features |= (1 << FEATURE_AVX512VBMI2); + if (ecx & bit_GFNI) + features |= (1 << FEATURE_GFNI); + if (ecx & bit_VPCLMULQDQ) + features |= (1 << FEATURE_VPCLMULQDQ); + if (ecx & bit_AVX512VNNI) + features |= (1 << FEATURE_AVX512VNNI); + if (ecx & bit_AVX512BITALG) + features |= (1 << FEATURE_AVX512BITALG); if (ecx & bit_AVX512VPOPCNTDQ) features |= (1 << FEATURE_AVX512VPOPCNTDQ); if (edx & bit_AVX5124VNNIW) diff --git a/libgcc/config/i386/cpuinfo.h b/libgcc/config/i386/cpuinfo.h index 17e2abf2a00..371c8f60bb2 100644 --- a/libgcc/config/i386/cpuinfo.h +++ b/libgcc/config/i386/cpuinfo.h @@ -109,7 +109,12 @@ enum processor_features FEATURE_AVX512IFMA, FEATURE_AVX5124VNNIW, FEATURE_AVX5124FMAPS, - FEATURE_AVX512VPOPCNTDQ + FEATURE_AVX512VPOPCNTDQ, + FEATURE_AVX512VBMI2, + FEATURE_GFNI, + FEATURE_VPCLMULQDQ, + FEATURE_AVX512VNNI, + FEATURE_AVX512BITALG }; extern struct __processor_model -- 2.30.2