Tulio added support for two new AT_HWCAP2 bits to GLIBC which have been
recently added to the kernel:

  https://www.sourceware.org/ml/libc-alpha/2017-06/msg00069.html

This patch adds support for them to the __builtin_cpu_supports() builtin
function so we can test for them.

Tested on powerpc64le-linux with no regressions.  Is this ok for trunk?

Peter

gcc/
        * config/rs6000/ppc-auxv.h (PPC_FEATURE2_DARN): New define.
        (PPC_FEATURE2_SCV): Likewise.
        * config/rs6000/rs6000.c (cpu_supports_info): Use them.

gcc/testsuite/
        * gcc.target/powerpc/cpu-builtin-1.c (darn, scv): Add tests.

Index: gcc/config/rs6000/ppc-auxv.h
===================================================================
--- gcc/config/rs6000/ppc-auxv.h        (revision 249611)
+++ gcc/config/rs6000/ppc-auxv.h        (working copy)
@@ -89,6 +89,8 @@
 #define PPC_FEATURE2_HTM_NOSC       0x01000000
 #define PPC_FEATURE2_ARCH_3_00      0x00800000
 #define PPC_FEATURE2_HAS_IEEE128    0x00400000
+#define PPC_FEATURE2_DARN           0x00200000
+#define PPC_FEATURE2_SCV            0x00100000
 
 
 /* Thread Control Block (TCB) offsets of the AT_PLATFORM, AT_HWCAP and
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 249611)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -379,7 +379,9 @@ static const struct
   { "tar",             PPC_FEATURE2_HAS_TAR,           1 },
   { "vcrypto",         PPC_FEATURE2_HAS_VEC_CRYPTO,    1 },
   { "arch_3_00",       PPC_FEATURE2_ARCH_3_00,         1 },
-  { "ieee128",         PPC_FEATURE2_HAS_IEEE128,       1 }
+  { "ieee128",         PPC_FEATURE2_HAS_IEEE128,       1 },
+  { "darn",            PPC_FEATURE2_DARN,              1 },
+  { "scv",             PPC_FEATURE2_SCV,               1 }
 };
 
 /* On PowerPC, we have a limited number of target clones that we care about
Index: gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c    (revision 249611)
+++ gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c    (working copy)
@@ -62,4 +62,6 @@ use_cpu_supports_builtins (unsigned int
   p[35] = __builtin_cpu_supports ("ucache");
   p[36] = __builtin_cpu_supports ("vcrypto");
   p[37] = __builtin_cpu_supports ("vsx");
+  p[38] = __builtin_cpu_supports ("darn");
+  p[39] = __builtin_cpu_supports ("scv");
 }

Reply via email to