Commit d4b17902 by Richard Henderson Committed by Richard Henderson

libitm: Don't add -mavx if the assembler doesn't support avx.

        * config/x86/x86_avx.cc: Remove #undef __AVX__ hack.  Tidy comments.
        * Makefile.am (x86_avx.lo): Only add -mavx if ARCH_X86_AVX.
        * configure.ac (ARCH_X86_AVX): New conditional.
        * Makefile.in, configure: Rebuild.

From-SVN: r181261
parent 992b0aa1
2011-11-10 Richard Henderson <rth@redhat.com>
* config/x86/x86_avx.cc: Remove #undef __AVX__ hack. Tidy comments.
* Makefile.am (x86_avx.lo): Only add -mavx if ARCH_X86_AVX.
* configure.ac (ARCH_X86_AVX): New conditional.
* Makefile.in, configure: Rebuild.
2011-11-09 Richard Henderson <rth@redhat.com> 2011-11-09 Richard Henderson <rth@redhat.com>
* acinclude.m4 (LIBITM_CHECK_AS_AVX): New. * acinclude.m4 (LIBITM_CHECK_AS_AVX): New.
......
...@@ -48,6 +48,8 @@ libitm_la_SOURCES = \ ...@@ -48,6 +48,8 @@ libitm_la_SOURCES = \
if ARCH_X86 if ARCH_X86
libitm_la_SOURCES += x86_sse.cc x86_avx.cc libitm_la_SOURCES += x86_sse.cc x86_avx.cc
x86_sse.lo : XCFLAGS += -msse x86_sse.lo : XCFLAGS += -msse
endif
if ARCH_X86_AVX
x86_avx.lo : XCFLAGS += -mavx x86_avx.lo : XCFLAGS += -mavx
endif endif
......
...@@ -1259,7 +1259,7 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ ...@@ -1259,7 +1259,7 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
vpath % $(strip $(search_path)) vpath % $(strip $(search_path))
@ARCH_X86_TRUE@x86_sse.lo : XCFLAGS += -msse @ARCH_X86_TRUE@x86_sse.lo : XCFLAGS += -msse
@ARCH_X86_TRUE@x86_avx.lo : XCFLAGS += -mavx @ARCH_X86_AVX_TRUE@x86_avx.lo : XCFLAGS += -mavx
all-local: $(STAMP_GENINSRC) all-local: $(STAMP_GENINSRC)
......
...@@ -24,24 +24,20 @@ ...@@ -24,24 +24,20 @@
#include "config.h" #include "config.h"
// ??? This is pretty gross, but we're going to frob types of the functions.
// Is this better or worse than just admitting we need to do this in pure
// assembly?
#ifndef HAVE_AS_AVX
#undef __AVX__
#endif
#include "libitm_i.h" #include "libitm_i.h"
#include "dispatch.h" #include "dispatch.h"
extern "C" { extern "C" {
#ifndef HAVE_AS_AVX #ifndef HAVE_AS_AVX
// If we don't have an AVX capable assembler, we didn't set -mavx on the
// command-line either, which means that libitm.h defined neither this type
// nor the functions in this file. Define the type and unconditionally
// wrap the file in extern "C" to make up for the lack of pre-declaration.
typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias)); typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias));
#endif #endif
// ??? Re-define the memcpy implementations so that we can frob the // Re-define the memcpy implementations so that we can frob the
// interface to deal with possibly missing AVX instruction set support. // interface to deal with possibly missing AVX instruction set support.
#ifdef HAVE_AS_AVX #ifdef HAVE_AS_AVX
...@@ -52,10 +48,10 @@ typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias)); ...@@ -52,10 +48,10 @@ typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias));
#else #else
/* Emit vmovaps (%rax),%ymm0. */ /* Emit vmovaps (%rax),%ymm0. */
#define RETURN(X) \ #define RETURN(X) \
asm volatile(".byte 0xc5,0xfc,0x28,0x00" : "=m"(X) : "a"(&X)); asm volatile(".byte 0xc5,0xfc,0x28,0x00" : "=m"(X) : "a"(&X))
/* Emit vmovaps %ymm0,(%rax); vzeroupper. */ /* Emit vmovaps %ymm0,(%rax); vzeroupper. */
#define STORE(X,Y) \ #define STORE(X,Y) \
asm volatile(".byte 0xc5,0xfc,0x29,0x00,0xc5,0xf8,0x77" : "=m"(X) : "a"(&X)); asm volatile(".byte 0xc5,0xfc,0x29,0x00,0xc5,0xf8,0x77" : "=m"(X) : "a"(&X))
#define OUTPUT(T) void #define OUTPUT(T) void
#define INPUT(T,X) #define INPUT(T,X)
#endif #endif
...@@ -92,4 +88,4 @@ _ITM_LM256 (const _ITM_TYPE_M256 *ptr) ...@@ -92,4 +88,4 @@ _ITM_LM256 (const _ITM_TYPE_M256 *ptr)
GTM::GTM_LB (ptr, sizeof (*ptr)); GTM::GTM_LB (ptr, sizeof (*ptr));
} }
} } // extern "C"
...@@ -603,6 +603,8 @@ LTLIBOBJS ...@@ -603,6 +603,8 @@ LTLIBOBJS
LIBOBJS LIBOBJS
ARCH_FUTEX_FALSE ARCH_FUTEX_FALSE
ARCH_FUTEX_TRUE ARCH_FUTEX_TRUE
ARCH_X86_AVX_FALSE
ARCH_X86_AVX_TRUE
ARCH_X86_FALSE ARCH_X86_FALSE
ARCH_X86_TRUE ARCH_X86_TRUE
link_itm link_itm
...@@ -11714,7 +11716,7 @@ else ...@@ -11714,7 +11716,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11717 "configure" #line 11719 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -11820,7 +11822,7 @@ else ...@@ -11820,7 +11822,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11823 "configure" #line 11825 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -17265,6 +17267,14 @@ else ...@@ -17265,6 +17267,14 @@ else
ARCH_X86_FALSE= ARCH_X86_FALSE=
fi fi
if test "$libitm_cv_as_avx" = yes; then
ARCH_X86_AVX_TRUE=
ARCH_X86_AVX_FALSE='#'
else
ARCH_X86_AVX_TRUE='#'
ARCH_X86_AVX_FALSE=
fi
if test $enable_linux_futex = yes; then if test $enable_linux_futex = yes; then
ARCH_FUTEX_TRUE= ARCH_FUTEX_TRUE=
ARCH_FUTEX_FALSE='#' ARCH_FUTEX_FALSE='#'
...@@ -17418,6 +17428,10 @@ if test -z "${ARCH_X86_TRUE}" && test -z "${ARCH_X86_FALSE}"; then ...@@ -17418,6 +17428,10 @@ if test -z "${ARCH_X86_TRUE}" && test -z "${ARCH_X86_FALSE}"; then
as_fn_error "conditional \"ARCH_X86\" was never defined. as_fn_error "conditional \"ARCH_X86\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${ARCH_X86_AVX_TRUE}" && test -z "${ARCH_X86_AVX_FALSE}"; then
as_fn_error "conditional \"ARCH_X86_AVX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ARCH_FUTEX_TRUE}" && test -z "${ARCH_FUTEX_FALSE}"; then if test -z "${ARCH_FUTEX_TRUE}" && test -z "${ARCH_FUTEX_FALSE}"; then
as_fn_error "conditional \"ARCH_FUTEX\" was never defined. as_fn_error "conditional \"ARCH_FUTEX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
......
...@@ -272,6 +272,7 @@ fi ...@@ -272,6 +272,7 @@ fi
AC_SUBST(link_itm) AC_SUBST(link_itm)
AM_CONDITIONAL([ARCH_X86], [test "$ARCH" = x86]) AM_CONDITIONAL([ARCH_X86], [test "$ARCH" = x86])
AM_CONDITIONAL([ARCH_X86_AVX], [test "$libitm_cv_as_avx" = yes])
AM_CONDITIONAL([ARCH_FUTEX], [test $enable_linux_futex = yes]) AM_CONDITIONAL([ARCH_FUTEX], [test $enable_linux_futex = yes])
AC_CONFIG_FILES(Makefile testsuite/Makefile libitm.spec) AC_CONFIG_FILES(Makefile testsuite/Makefile libitm.spec)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment