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
This commit is contained in:
Richard Henderson 2011-11-10 09:09:04 -08:00 committed by Richard Henderson
parent 992b0aa1cf
commit d4b179020b
6 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,10 @@
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>
* acinclude.m4 (LIBITM_CHECK_AS_AVX): New.

View File

@ -48,6 +48,8 @@ libitm_la_SOURCES = \
if ARCH_X86
libitm_la_SOURCES += x86_sse.cc x86_avx.cc
x86_sse.lo : XCFLAGS += -msse
endif
if ARCH_X86_AVX
x86_avx.lo : XCFLAGS += -mavx
endif

View File

@ -1259,7 +1259,7 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
vpath % $(strip $(search_path))
@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)

View File

@ -24,24 +24,20 @@
#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 "dispatch.h"
extern "C" {
#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));
#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.
#ifdef HAVE_AS_AVX
@ -52,10 +48,10 @@ typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias));
#else
/* Emit vmovaps (%rax),%ymm0. */
#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. */
#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 INPUT(T,X)
#endif
@ -92,4 +88,4 @@ _ITM_LM256 (const _ITM_TYPE_M256 *ptr)
GTM::GTM_LB (ptr, sizeof (*ptr));
}
}
} // extern "C"

18
libitm/configure vendored
View File

@ -603,6 +603,8 @@ LTLIBOBJS
LIBOBJS
ARCH_FUTEX_FALSE
ARCH_FUTEX_TRUE
ARCH_X86_AVX_FALSE
ARCH_X86_AVX_TRUE
ARCH_X86_FALSE
ARCH_X86_TRUE
link_itm
@ -11714,7 +11716,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11717 "configure"
#line 11719 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11820,7 +11822,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11823 "configure"
#line 11825 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17265,6 +17267,14 @@ else
ARCH_X86_FALSE=
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
ARCH_FUTEX_TRUE=
ARCH_FUTEX_FALSE='#'
@ -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.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
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
as_fn_error "conditional \"ARCH_FUTEX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -272,6 +272,7 @@ fi
AC_SUBST(link_itm)
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])
AC_CONFIG_FILES(Makefile testsuite/Makefile libitm.spec)