diff options
author | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-17 11:15:24 +0000 |
---|---|---|
committer | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-17 11:15:24 +0000 |
commit | ee2dbc39f2ae6d2265e6b00a8637902e231eeda7 (patch) | |
tree | 7c128616f0a4ca4d09f410d31fee5de4433fc49c /libitm | |
parent | 670aa33b36edda5e407444eec223ab1f99d57734 (diff) | |
download | gcc-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')
-rw-r--r-- | libitm/ChangeLog | 9 | ||||
-rw-r--r-- | libitm/acinclude.m4 | 11 | ||||
-rw-r--r-- | libitm/config/s390/target.h | 23 | ||||
-rw-r--r-- | libitm/configure | 36 | ||||
-rw-r--r-- | libitm/configure.tgt | 2 |
5 files changed, 73 insertions, 8 deletions
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" ;; *) |