summaryrefslogtreecommitdiff
path: root/libitm/config
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-17 11:15:24 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-17 11:15:24 +0000
commitee2dbc39f2ae6d2265e6b00a8637902e231eeda7 (patch)
tree7c128616f0a4ca4d09f410d31fee5de4433fc49c /libitm/config
parent670aa33b36edda5e407444eec223ab1f99d57734 (diff)
downloadgcc-ee2dbc39f2ae6d2265e6b00a8637902e231eeda7.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201004 138bc75d-0d04-0410-961f-82ee72b054a4
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 580606f0270..17228f844dd 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