]> gcc.gnu.org Git - gcc.git/commitdiff
libitm: Don't add -mavx if the assembler doesn't support avx.
authorRichard Henderson <rth@redhat.com>
Thu, 10 Nov 2011 17:09:04 +0000 (09:09 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 10 Nov 2011 17:09:04 +0000 (09:09 -0800)
        * 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

libitm/ChangeLog
libitm/Makefile.am
libitm/Makefile.in
libitm/config/x86/x86_avx.cc
libitm/configure
libitm/configure.ac

index 8aeb589bfed817534413d67bfe01417712361932..4fb699e4acbd9561acc7aebe70f8025a8452d044 100644 (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.
index 45789866b4f216997e4860d97d430cbcb5dd4fd4..b4674a572fce2633fe106596a6039d753f112bf3 100644 (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
 
index 8816580fb65c8ea108cfb530a3d56151ff8faa98..74261463ebfbf9a578443de6157d4e4743fde009 100644 (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)
 
index cd20fe25cdc9acf409f2d30f0aa3af50f9089590..6a5e297116bcf0c1487a483ae4d3a5ec8263e859 100644 (file)
 
 #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"
index b30ced11548504602398b7e0647925356cdd9a50..c0317ccfc4d74e3d2bcc21829a648d97650607ab 100644 (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
index 7de5cbeed912283ba399ec040bde099bb74b0289..672b71279e381efc086b13e6daf74c9f7e986095 100644 (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)
This page took 0.090775 seconds and 5 git commands to generate.