aboutsummaryrefslogtreecommitdiff
path: root/libitm/config
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2013-07-17 11:15:24 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2013-07-17 11:15:24 +0000
commit167f68ede42b2bb0bf287769951c5a6aca3e7281 (patch)
tree7c128616f0a4ca4d09f410d31fee5de4433fc49c /libitm/config
parent1b2d0112c5dd2d847aaa4e6bf529fc74e78158fb (diff)
downloadgcc-167f68ede42b2bb0bf287769951c5a6aca3e7281.zip
gcc-167f68ede42b2bb0bf287769951c5a6aca3e7281.tar.gz
gcc-167f68ede42b2bb0bf287769951c5a6aca3e7281.tar.bz2
s390.c: (s390_expand_builtin): Allow -mhtm to be enabled without -march=zEC12.
2013-07-17 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * config/s390/s390.c: (s390_expand_builtin): Allow -mhtm to be enabled without -march=zEC12. * config/s390/s390.h (TARGET_HTM): Do not require EC12 machine flags to be set. 2013-07-17 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * acinclude.m4: Add htm asm check for s390. * configure.tgt: Add -mhtm and -Wa,-march=zEC12 to the options. * configure: Regenerate. * config/s390/target.h: Remove __HTM__ check. (htm_available): Call getauxval to get hwcaps and check whether HTM is available or not. From-SVN: r201004
Diffstat (limited to 'libitm/config')
-rw-r--r--libitm/config/s390/target.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
index 580606f..17228f8 100644
--- a/libitm/config/s390/target.h
+++ b/libitm/config/s390/target.h
@@ -22,11 +22,9 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-
-#include <htmintrin.h>
-
-/* Number of retries for transient failures. */
-#define _HTM_ITM_RETRIES 10
+#ifdef HAVE_SYS_AUXV_H
+#include <sys/auxv.h>
+#endif
namespace GTM HIDDEN {
@@ -58,13 +56,24 @@ cpu_relax (void)
__asm volatile ("" : : : "memory");
}
-#ifdef __HTM__
+
+// Use HTM if it is supported by the system.
+// See gtm_thread::begin_transaction for how these functions are used.
+#if defined (__linux__) \
+ && defined (HAVE_AS_HTM) \
+ && defined (HAVE_GETAUXVAL) \
+ && defined (HWCAP_S390_TE)
+
+#include <htmintrin.h>
+
+/* Number of retries for transient failures. */
+#define _HTM_ITM_RETRIES 10
#define USE_HTM_FASTPATH
static inline bool
htm_available ()
{
- return true;
+ return (getauxval (AT_HWCAP) & HWCAP_S390_TE) ? true : false;
}
static inline uint32_t