This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR libc/12460: AVX audit test failures with gcc 4.6


The vzeroupper optimization in gcc 4.6 will add vzeroupper before function
return even if AVX isn't supported. Due to nature of special codes in AVX
audit tests, we can't use __builtin_ia32_vzeroupper in AVX audit tests.
This patch adds -mno-vzeroupper for those tests if needed.


H.J.
---
2011-02-02  H.J. Lu  <hongjiu.lu@intel.com>

	PR libc/12460
	* config.make.in (config-cflags-novzeroupper): New.

	* configure.in: Substitute libc_cv_cc_novzeroupper.
	* configure: Regenerated.

	* elf/Makefile (AVX-CFLAGS): New.
	(CFLAGS-tst-audit4.c): Replace -mavx with $(AVX-CFLAGS).
	(CFLAGS-tst-auditmod4a.c): Likewise.
	(CFLAGS-tst-auditmod4b.c): Likewise.
	(CFLAGS-tst-auditmod6b.c): Likewise.
	(CFLAGS-tst-auditmod6c.c): Likewise.
	(CFLAGS-tst-auditmod7b.c): Likewise.

	* sysdeps/i386/configure.in: Check -mno-vzeroupper.
	* sysdeps/i386/configure: Regenerated.

diff --git a/config.make.in b/config.make.in
index efffee4..3f6a698 100644
--- a/config.make.in
+++ b/config.make.in
@@ -36,6 +36,7 @@ asflags-cpu = @libc_cv_cc_submachine@
 
 config-cflags-sse4 = @libc_cv_cc_sse4@
 config-cflags-avx = @libc_cv_cc_avx@
+config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@
 config-asflags-i686 = @libc_cv_as_i686@
 
 defines = @DEFINES@
diff --git a/elf/Makefile b/elf/Makefile
index 0f37804..36ea9b8 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1181,10 +1181,14 @@ $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
 	cmp $@ tst-initorder.exp > /dev/null
 
 ifeq (yes,$(config-cflags-avx))
-CFLAGS-tst-audit4.c += -mavx
-CFLAGS-tst-auditmod4a.c += -mavx
-CFLAGS-tst-auditmod4b.c += -mavx
-CFLAGS-tst-auditmod6b.c += -mavx
-CFLAGS-tst-auditmod6c.c += -mavx
-CFLAGS-tst-auditmod7b.c += -mavx
+AVX-CFLAGS=-mavx
+ifeq (yes,$(config-cflags-novzeroupper))
+AVX-CFLAGS+=-mno-vzeroupper
+endif
+CFLAGS-tst-audit4.c += $(AVX-CFLAGS)
+CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
+CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
+CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
+CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
+CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
 endif
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in
index d8dd648..67fd1d7 100644
--- a/sysdeps/i386/configure.in
+++ b/sysdeps/i386/configure.in
@@ -66,3 +66,11 @@ fi])
 if test $libc_cv_cc_avx = yes; then
   AC_DEFINE(HAVE_AVX_SUPPORT)
 fi
+
+dnl Check if -mno-vzeroupper works.
+AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl
+if AC_TRY_COMMAND([${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null]); then
+  libc_cv_cc_novzeroupper=yes
+else
+  libc_cv_cc_novzeroupper=no
+fi])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]