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
This commit is contained in:
Andreas Krebbel 2013-07-17 11:15:24 +00:00 committed by Andreas Krebbel
parent 1b2d0112c5
commit 167f68ede4
8 changed files with 83 additions and 15 deletions

View File

@ -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.

View File

@ -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. */

View File

@ -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)

View File

@ -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.

View File

@ -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)

View File

@ -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

36
libitm/configure vendored
View File

@ -17395,6 +17395,42 @@ fi
$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
;;
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

View File

@ -109,8 +109,8 @@ case "${target_cpu}" in
ARCH=x86
;;
s390|s390x)
XCFLAGS="${XCFLAGS} -mzarch -mhtm -Wa,-march=zEC12"
ARCH=s390
XCFLAGS="${XCFLAGS} -mzarch"
;;
*)