This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, rs6000] Add support to __builtin_cpu_supports() for two new HWCAP2 bits
- From: Peter Bergner <bergner at vnet dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>
- Date: Mon, 26 Jun 2017 22:33:48 -0500
- Subject: [PATCH, rs6000] Add support to __builtin_cpu_supports() for two new HWCAP2 bits
- Authentication-results: sourceware.org; auth=none
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");
}