From 7a9970f02e8a873ee4ea5f7c09d62d1203a4dd22 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 27 Nov 2018 06:34:44 -0500 Subject: [PATCH] Update comments and cpu feature test --- TestPrograms/test_ppc_power9.cxx | 31 +++++++++++++++++-------------- darn.h | 10 +++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/TestPrograms/test_ppc_power9.cxx b/TestPrograms/test_ppc_power9.cxx index 82e1e755..38e87398 100644 --- a/TestPrograms/test_ppc_power9.cxx +++ b/TestPrograms/test_ppc_power9.cxx @@ -1,6 +1,20 @@ +// The problem we have here is, it appears only GCC 7.0 and above +// support Power9 builtins. Clang 7.0 has support for some (all?) +// assembly instructions but we don't see builtin support. We can't +// determine the state of XLC. Searching IBM's website for +// terms like 'darn' 'random number' is returning irrelevant hits. +// Searching with Google from the outside returns 0 hits. +// +// The support disconnect means we may report Power9 as unavailable +// and support DARN at the same time. We get into that state because +// we use inline asm to detect DARN availablity in the compiler. +// Also see cpu.cpp and the two query functions; and ppc_power9.cpp +// and the two probe functions. + #include int main(int argc, char* argv[]) { +#if 0 const unsigned char b = (unsigned char)argc; const unsigned int r = (0xf << 24) | (0x3 << 16) | (0xf << 8) | (0x3 << 0); #if defined(__clang__) @@ -10,23 +24,12 @@ int main(int argc, char* argv[]) #else int XXX[-1]; #endif +#endif -#if UINTPTR_MAX == 0xffffffffffffffffULL -# if defined(__clang__) - unsigned long long y = __builtin_altivec_darn(); -# elif defined(__GNUC__) - unsigned long long y = __builtin_darn(); -# else - int XXX[-1]; -# endif -#else -# if defined(__clang__) - unsigned int y = __builtin_altivec_darn_32(); -# elif defined(__GNUC__) +#if defined(__GNUC__) || defined(__IBM_GCC_ASM) unsigned int y = __builtin_darn_32(); -# else +#else int XXX[-1]; -# endif #endif return 0; diff --git a/darn.h b/darn.h index 613a9b0d..c56e07b6 100644 --- a/darn.h +++ b/darn.h @@ -2,11 +2,11 @@ // DARN requires POWER9/ISA 3.0. // At the moment only GCC 7.0 (and above) seems to support __builtin_darn() -// and __builtin_darn_32(). Clang 7.0 does not provide them. XLC is unknown, -// but there are no hits when searching IBM's site. To cover more platforms -// we provide GCC inline assembly like we do with RDRAND and RDSEED. -// Platforms that don't support GCC inline assembly or the builtin will fail -// the compile. Also see +// and __builtin_darn_32(). Clang 7.0 does not provide them, but it does +// support assembly instructions. XLC is unknown, but there are no hits when +// searching IBM's site. To cover more platforms we provide GCC inline +// assembly like we do with RDRAND and RDSEED. Platforms that don't support +// GCC inline assembly or the builtin will fail the compile. Also see // https://gcc.gnu.org/onlinedocs/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0.html /// \file darn.h