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]

[PATCH] Don't run link or runtime -mcpu=cell tests unless assembler supports cell (PR target/37812)


Hi!

Some old versions of gas don't support Cell insns.  I think it is safe to
assume that people who use -mcpu=cell do it only if their assembler supports
it (after all, that's what we do for all other insn extensions, until gcc
has builtin assembler support, gcc shouldn't workaround missing assembler
support by using .word or .long all the time).  But gcc's testcase should
run or link with -mcpu=cell only when it is supported.

The following patch fixes it.  There is no need for altivec_cell_check
to use lvlx insn everywhere, it is only needed in -mcpu=cell runtime tests.
The second and third changed file are to only run -mcpu=cell runtime/link tests
if assembler support is there.

Tested briefly on powerpc64-linux, additionally changed lvlx to lvl__x in
altivec_check.h (to get an expected FAIL on altivec-cell-8, to emulate
missing assembler support for lvlx) and in target-supports.exp (in that case
altivec-cell-8 was UNSUPPORTED and it didn't matter what altivec_check.h
contained).

Ok for trunk?

2008-11-03  Jakub Jelinek  <jakub@redhat.com>

	PR target/37812
	* gcc.target/powerpc/altivec_check.h (altivec_cell_check): Abort
	if __PPU__ isn't defined.
	* lib/target-supports.exp (check_effective_target_powerpc_ppu_ok):
	New.
	* gcc.target/powerpc/altivec-cell-8.c: Use powerpc_ppu_ok.

--- gcc/testsuite/gcc.target/powerpc/altivec_check.h.jj	2008-10-02 17:05:04.000000000 +0200
+++ gcc/testsuite/gcc.target/powerpc/altivec_check.h	2008-11-03 10:01:07.000000000 +0100
@@ -25,6 +25,7 @@ void altivec_check(void) {
 
 void altivec_cell_check (void)
 {
+#ifdef __PPU__
   /* Exit on systems without the Cell Altivec instructions.  */
   signal (SIGILL, sig_ill_handler);
 #ifdef __MACH__
@@ -35,4 +36,8 @@ void altivec_cell_check (void)
   asm volatile ("lvlx 0,0,0");
 #endif
   signal (SIGILL, SIG_DFL);
+#else
+  /* altivec_cell_check shouldn't be called without -mcpu=cell.  */
+  abort ();
+#endif
 }
--- gcc/testsuite/lib/target-supports.exp.jj	2008-10-01 18:56:53.000000000 +0200
+++ gcc/testsuite/lib/target-supports.exp	2008-11-03 10:22:28.000000000 +0100
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007
+#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008
 #    Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -1390,6 +1390,25 @@ proc check_effective_target_powerpc_alti
     }
 }
 
+# Return 1 if this is a PowerPC target supporting -mcpu=cell.
+
+proc check_effective_target_powerpc_ppu_ok { } {
+    if [check_effective_target_powerpc_altivec_ok] {
+	return [check_no_compiler_messages cell_asm_available object {
+	    int main (void) {
+#ifdef __MACH__
+		asm volatile ("lvlx v0,v0,v0");
+#else
+		asm volatile ("lvlx 0,0,0");
+#endif
+		return 0;
+	    }
+	}]
+    } else {
+	return 0
+    }
+}
+
 # Return 1 if this is a PowerPC target that supports SPU.
 
 proc check_effective_target_powerpc_spu { } {
--- gcc/testsuite/gcc.target/powerpc/altivec-cell-8.c.jj	2008-10-02 17:05:04.000000000 +0200
+++ gcc/testsuite/gcc.target/powerpc/altivec-cell-8.c	2008-11-03 10:28:19.000000000 +0100
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-require-effective-target powerpc_ppu_ok } */
 /* { dg-options "-O2 -maltivec -mabi=altivec -mcpu=cell" } */
 #include <altivec.h>
 #include <string.h>

	Jakub


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