This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[testsuite] Clear hardware capabilities for gcc.dg/vect/vect-simd-clone-*.c


The new gcc.dg/vect/vect-simd-clone-*.c tests were FAILing on Solaris
10+/x86 with Sun as:

FAIL: gcc.dg/vect/vect-simd-clone-1.c execution test

ld.so.1: vect-simd-clone-1.exe: fatal: vect-simd-clone-1.exe: hardware capability (CA_SUNW_HW_2) unsupported: 0x40  [ 0x40 ]

As can be seen in <sys/auxv_386.h>, this is:

#define AV2_386_AVX2            0x00040 /* Intel AVX2 insns */

Since the tests check for avx2 support at runtime, we need the same
solution as in gcc.target/i386: clear the hardware capabilities when
linking the executable.

Tested on i386-pc-solaris2.10 and x86_64-unknown-linux-gnu, installed on
mainline.

	Rainer


2014-01-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/vect/vect.exp: Add clearcap_ldflags to DEFAULT_VECTCFLAGS
	if supported.

# HG changeset patch
# Parent 17f8dc18e3a0f24a1c47b85f98782124de4c1b60
Clear hardware capabilities for gcc.dg/vect/vect-simd-clone-*.c

diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -41,6 +41,28 @@ if ![check_vect_support_and_set_flags] {
 # These flags are used for all targets.
 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" "-fno-common"
 
+# If the linker used understands -M <mapfile>, pass it to clear hardware
+# capabilities set by the Sun assembler.
+# Try mapfile syntax v2 first which is the only way to clear hwcap_2 flags.
+set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcapv2.map"
+
+if ![check_no_compiler_messages mapfilev2 executable {
+    int main (void) { return 0; }
+} $clearcap_ldflags ] {
+    # If this doesn't work, fall back to the less capable v1 syntax.
+    set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcap.map"
+
+    if ![check_no_compiler_messages mapfile executable {
+	int main (void) { return 0; }
+    } $clearcap_ldflags ] {
+	unset clearcap_ldflags
+    }
+}
+
+if [info exists clearcap_ldflags] {
+    lappend DEFAULT_VECTCFLAGS $clearcap_ldflags
+}
+
 # Initialize `dg'.
 dg-init
 
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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