* 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
+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.
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
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)
#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
#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
GTM::GTM_LB (ptr, sizeof (*ptr));
}
-}
+} // extern "C"
LIBOBJS
ARCH_FUTEX_FALSE
ARCH_FUTEX_TRUE
+ARCH_X86_AVX_FALSE
+ARCH_X86_AVX_TRUE
ARCH_X86_FALSE
ARCH_X86_TRUE
link_itm
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
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
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='#'
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
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)