[PATCH,testsuite] add powerpc_spe_ok effective target

Nathan Froyd froydnj@codesourcery.com
Tue Jan 13 19:02:00 GMT 2009


If we have a multilib that already specifies -mcpu=, then some of the
SPE-related tests in the testsuite lead to errors, because the multilib
-mcpu= is incompatible with the dg-options -mcpu=.  Fixed by adding an
effective target powerpc_spe_ok and using it where appropriate.

Tested on powerpc-none-eabi{,spe}.  OK to commit?

-Nathan

2009-01-13  Daniel Jacobowitz  <dan@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* lib/target-supports.exp (check_effective_target_powerpc_spe_ok):
	New function.
	* gcc.target/powerpc/20030218-1.c: Use powerpc_spe_ok and consistent
	CFLAGS.
	* gcc.target/powerpc/20030505.c: Likewise.
	* gcc.target/powerpc/20081204-1.c: Likewise.
	* gcc.target/powerpc/ppc-spe.c: Likewise.
	* gcc.target/powerpc/spe1.c: Likewise.
	* g++.dg/other/opaque-2.C: Likewise.
	* g++.dg/other/opaque-3.C: Likewise.

Index: gcc.target/powerpc/20030218-1.c
===================================================================
--- gcc.target/powerpc/20030218-1.c	(revision 143348)
+++ gcc.target/powerpc/20030218-1.c	(working copy)
@@ -1,5 +1,5 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
-/* { dg-options "-mspe=yes -mfloat-gprs=single" } */
+/* { dg-do compile { target powerpc_spe_ok } } */
+/* { dg-options "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single" } */
 
 /* Test vectors that can interconvert without a cast.  */
 
Index: gcc.target/powerpc/20030505.c
===================================================================
--- gcc.target/powerpc/20030505.c	(revision 143348)
+++ gcc.target/powerpc/20030505.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-W -mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single" } */
 
 #define __vector __attribute__((vector_size(8)))
Index: gcc.target/powerpc/20081204-1.c
===================================================================
--- gcc.target/powerpc/20081204-1.c	(revision 143348)
+++ gcc.target/powerpc/20081204-1.c	(working copy)
@@ -1,6 +1,6 @@
 /* Test for ICE arising from inconsistent use of TARGET_E500 versus
    TARGET_HARD_FLOAT && !TARGET_FPRS.  */
-/* { dg-do compile } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-mcpu=750 -mfloat-gprs=single" } */
 static int comp(const void *a,const void *b){
   return (*(float *)a<*(float *)b)-(*(float *)a>*(float *)b);
Index: gcc.target/powerpc/ppc-spe.c
===================================================================
--- gcc.target/powerpc/ppc-spe.c	(revision 143348)
+++ gcc.target/powerpc/ppc-spe.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single -O0" } */
 
 /* (Test with -O0 so we don't optimize any of them away).  */
Index: gcc.target/powerpc/spe1.c
===================================================================
--- gcc.target/powerpc/spe1.c	(revision 143348)
+++ gcc.target/powerpc/spe1.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single -O0" } */
 
 /* (Test with -O0 so we don't optimize any of them away).  */
Index: g++.dg/other/opaque-2.C
===================================================================
--- g++.dg/other/opaque-2.C	(revision 143348)
+++ g++.dg/other/opaque-2.C	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* powerpc*-*-linux*spe* } } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single" } */
 
 #define __vector __attribute__((vector_size(8)))
Index: g++.dg/other/opaque-3.C
===================================================================
--- g++.dg/other/opaque-3.C	(revision 143348)
+++ g++.dg/other/opaque-3.C	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* powerpc*-*-linux*spe* } } */
+/* { dg-do compile { target powerpc_spe_ok } } */
 /* { dg-options "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single" } */
 
 __ev64_opaque__ o;
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 143350)
+++ lib/target-supports.exp	(working copy)
@@ -1535,6 +1535,23 @@ proc check_effective_target_powerpc_spu 
     }
 }
 
+# Return 1 if this is a PowerPC target supporting -mspe (and with
+# no conflicting multilib options).
+
+proc check_effective_target_powerpc_spe_ok { } {
+    if { [istarget powerpc*-*-*] } {
+	return [check_no_compiler_messages powerpc_spe_ok object {
+	    #ifndef __SPE__
+	    #error not SPE
+	    #else
+	    int dummy;
+	    #endif
+	} "-mcpu=8540 -mspe -mabi=spe -mfloat-gprs=single"]
+    } else {
+	return 0
+    }
+}
+
 # Return 1 if this is a PowerPC target with SPE enabled.
 
 proc check_effective_target_powerpc_spe { } {



More information about the Gcc-patches mailing list