Update comments and cpu feature test

This commit is contained in:
Jeffrey Walton 2018-11-27 06:34:44 -05:00
parent d41085e907
commit 7a9970f02e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 22 additions and 19 deletions

View File

@ -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 <altivec.h>
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;

10
darn.h
View File

@ -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