summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/s390/s390.c7
-rw-r--r--gcc/config/s390/s390.h3
-rw-r--r--libitm/ChangeLog9
-rw-r--r--libitm/acinclude.m411
-rw-r--r--libitm/config/s390/target.h23
-rw-r--r--libitm/configure36
-rw-r--r--libitm/configure.tgt2
8 files changed, 83 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b4f628753b4..60c176da0a9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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-16 Maciej W. Rozycki <macro@codesourcery.com>
* config/mips/mips.h (ISA_HAS_FP4): Correct formatting.
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 7ce0c30c883..ab4cc8bb269 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9771,11 +9771,8 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
if (icode == 0)
internal_error ("bad builtin fcode");
- if (!TARGET_ZEC12)
- error ("Transactional execution builtins require zEC12 or later\n");
-
- if (!TARGET_HTM && TARGET_ZEC12)
- error ("Transactional execution builtins not enabled (-mtx)\n");
+ if (!TARGET_HTM)
+ error ("Transactional execution builtins not enabled (-mhtm)\n");
/* Set a flag in the machine specific cfun part in order to support
saving/restoring of FPRs. */
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index d53fed7a6f2..bca18fe36f5 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -81,8 +81,7 @@ enum processor_flags
(TARGET_ZARCH && TARGET_CPU_Z196)
#define TARGET_ZEC12 \
(TARGET_ZARCH && TARGET_CPU_ZEC12)
-#define TARGET_HTM \
- (TARGET_ZARCH && TARGET_CPU_HTM && TARGET_OPT_HTM)
+#define TARGET_HTM (TARGET_OPT_HTM)
#define TARGET_AVOID_CMP_AND_BRANCH (s390_tune == PROCESSOR_2817_Z196)
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 6b8ac0be157..3e9a7067979 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
* acinclude.m4 (LIBITM_CHECK_AS_HTM): New.
diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4
index eacf8d45383..ca7e0a92118 100644
--- a/libitm/acinclude.m4
+++ b/libitm/acinclude.m4
@@ -135,6 +135,17 @@ powerpc*)
AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
fi
;;
+s390*)
+ AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -march=zEC12"
+ AC_TRY_COMPILE([], [asm("tbegin 0,0; tend");],
+ [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
+ CFLAGS="$save_CFLAGS"])
+ if test x$libitm_cv_as_htm = xyes; then
+ AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
+ fi
+ ;;
esac])
sinclude(../libtool.m4)
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
diff --git a/libitm/configure b/libitm/configure
index 7b3c0692e8f..21361b031ad 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -17399,6 +17399,42 @@ $as_echo "#define HAVE_AS_HTM 1" >>confdefs.h
fi
;;
+s390*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler supports HTM" >&5
+$as_echo_n "checking if the assembler supports HTM... " >&6; }
+if test "${libitm_cv_as_htm+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -march=zEC12"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+asm("tbegin 0,0; tend");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libitm_cv_as_htm=yes
+else
+ libitm_cv_as_htm=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_as_htm" >&5
+$as_echo "$libitm_cv_as_htm" >&6; }
+ if test x$libitm_cv_as_htm = xyes; then
+
+$as_echo "#define HAVE_AS_HTM 1" >>confdefs.h
+
+ fi
+ ;;
esac
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index d8f3ca52876..4dc2807cfe5 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -109,8 +109,8 @@ case "${target_cpu}" in
ARCH=x86
;;
s390|s390x)
+ XCFLAGS="${XCFLAGS} -mzarch -mhtm -Wa,-march=zEC12"
ARCH=s390
- XCFLAGS="${XCFLAGS} -mzarch"
;;
*)
OpenPOWER on IntegriCloud