From d1573fe051974d73af613b1ccce5dcecc21ee94a Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Thu, 13 Dec 2018 18:04:11 +0000 Subject: [PATCH] target.h (htm_available): Add support for PPC_FEATURE2_HTM_NO_SUSPEND. libitm/ * config/powerpc/target.h (htm_available): Add support for PPC_FEATURE2_HTM_NO_SUSPEND. Use __builtin_cpu_supports if available. From-SVN: r267101 --- libitm/ChangeLog | 5 +++++ libitm/config/powerpc/target.h | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 93df02c04c4..bda0985b803 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,8 @@ +2018-12-13 Peter Bergner + + * config/powerpc/target.h (htm_available): Add support for + PPC_FEATURE2_HTM_NO_SUSPEND. Use __builtin_cpu_supports if available. + 2018-10-31 Joseph Myers PR bootstrap/82856 diff --git a/libitm/config/powerpc/target.h b/libitm/config/powerpc/target.h index 8288173f8a8..77652a6f61d 100644 --- a/libitm/config/powerpc/target.h +++ b/libitm/config/powerpc/target.h @@ -81,7 +81,20 @@ cpu_relax (void) static inline bool htm_available (void) { - return (getauxval (AT_HWCAP2) & PPC_FEATURE2_HAS_HTM) ? true : false; +#ifdef __BUILTIN_CPU_SUPPORTS__ + if (__builtin_cpu_supports ("htm-no-suspend") + || __builtin_cpu_supports ("htm")) + return true; +#else + unsigned long htm_flags = PPC_FEATURE2_HAS_HTM +#ifdef PPC_FEATURE2_HTM_NO_SUSPEND + | PPC_FEATURE2_HTM_NO_SUSPEND +#endif + | 0; + if (getauxval (AT_HWCAP2) & htm_flags) + return true; +#endif + return false; } static inline uint32_t -- 2.30.2