re PR target/37812 (Invalid mnemonic 'lvlx')
authorJakub Jelinek <jakub@redhat.com>
Mon, 3 Nov 2008 21:59:36 +0000 (22:59 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 3 Nov 2008 21:59:36 +0000 (22:59 +0100)
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.

From-SVN: r141564

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/altivec-cell-8.c
gcc/testsuite/gcc.target/powerpc/altivec_check.h
gcc/testsuite/lib/target-supports.exp

index 78e1ef6..4a9e418 100644 (file)
@@ -1,3 +1,12 @@
+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.
+
 2008-11-03  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.c-torture/execute/20081103-1.c: New test.
index 778cd11..12e13e0 100644 (file)
@@ -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>
index cadcd36..d966e23 100644 (file)
@@ -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
 }
index 3d118af..cc62a97 100644 (file)
@@ -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_altivec_ok { } {
     }
 }
 
+# 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 { } {