Commit 5bdf05c8 by Daniel Jacobowitz Committed by Nathan Froyd

altivec-consts.c: Run if vmx_hw, compile otherwise.

	* gcc.target/powerpc/altivec-consts.c: Run if vmx_hw, compile
	otherwise.  Do not check for AltiVec at runtime.
	* gcc.target/powerpc/altivec-varargs-1.c: Likewise.
	* gcc.target/powerpc/altivec-vec-merge.c: Likewise.
	* gcc.target/powerpc/altivec-1.c: Likewise.
	* gcc.target/powerpc/altivec-3.c: Likewise.
	* gcc.target/powerpc/altivec-10.c: Likewise.
	* gcc.target/powerpc/altivec-12.c: Likewise.
	* gcc.target/powerpc/altivec-24.c: Likewise.
	* gcc.target/powerpc/altivec-cell-2.c: Likewise.
	* gcc.target/powerpc/altivec-cell-3.c: Likewise.
	* gcc.target/powerpc/altivec-cell-4.c: Likewise.
	* gcc.target/powerpc/pr35907.c: Likewise.
	* gcc.target/powerpc/altivec-cell-8.c: Run if cell_hw, compile
	otherwise.  Do not check for Cell at runtime.
	* gcc.target/powerpc/altivec_check.h: Delete.

	* g++.dg/ext/altivec-2.C: Do not check for AltiVec at runtime.
	* g++.dg/ext/altivec-3.C: Run if vmx_hw, compile otherwise.  Do
	not check for AltiVec at runtime.
	* g++.dg/ext/altivec-cell-2.C: Likewise.
	* g++.dg/ext/altivec-cell-3.C: Likewise.
	* g++.dg/ext/altivec-cell-4.C: Likewise.
	* g++.dg/eh/simd-2.C: Only use -maltivec if vmx_hw.
	* g++.dg/eh/check-vect.h (sig_ill_handler): Remove AltiVec runtime
	check.
	* g++.dg/ext/altivec_check.h: Delete.

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>
Co-Authored-By: Nathan Froyd <froydnj@codesourcery.com>

From-SVN: r143350
parent 425a0a4d
2009-01-13 Daniel Jacobowitz <dan@codesourcery.com>
Nathan Froyd <froydnj@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* gcc.target/powerpc/altivec-consts.c: Run if vmx_hw, compile
otherwise. Do not check for AltiVec at runtime.
* gcc.target/powerpc/altivec-varargs-1.c: Likewise.
* gcc.target/powerpc/altivec-vec-merge.c: Likewise.
* gcc.target/powerpc/altivec-1.c: Likewise.
* gcc.target/powerpc/altivec-3.c: Likewise.
* gcc.target/powerpc/altivec-10.c: Likewise.
* gcc.target/powerpc/altivec-12.c: Likewise.
* gcc.target/powerpc/altivec-24.c: Likewise.
* gcc.target/powerpc/altivec-cell-2.c: Likewise.
* gcc.target/powerpc/altivec-cell-3.c: Likewise.
* gcc.target/powerpc/altivec-cell-4.c: Likewise.
* gcc.target/powerpc/pr35907.c: Likewise.
* gcc.target/powerpc/altivec-cell-8.c: Run if cell_hw, compile
otherwise. Do not check for Cell at runtime.
* gcc.target/powerpc/altivec_check.h: Delete.
* g++.dg/ext/altivec-2.C: Do not check for AltiVec at runtime.
* g++.dg/ext/altivec-3.C: Run if vmx_hw, compile otherwise. Do
not check for AltiVec at runtime.
* g++.dg/ext/altivec-cell-2.C: Likewise.
* g++.dg/ext/altivec-cell-3.C: Likewise.
* g++.dg/ext/altivec-cell-4.C: Likewise.
* g++.dg/eh/simd-2.C: Only use -maltivec if vmx_hw.
* g++.dg/eh/check-vect.h (sig_ill_handler): Remove AltiVec runtime
check.
* g++.dg/ext/altivec_check.h: Delete.
2009-01-13 Nathan Froyd <froydnj@codesourcery.com> 2009-01-13 Nathan Froyd <froydnj@codesourcery.com>
* gcc.target/powerpc/altivec-macros.c: Require a powerpc_altivec_ok * gcc.target/powerpc/altivec-macros.c: Require a powerpc_altivec_ok
......
...@@ -13,10 +13,7 @@ sig_ill_handler (int sig) ...@@ -13,10 +13,7 @@ sig_ill_handler (int sig)
void check_vect (void) void check_vect (void)
{ {
signal(SIGILL, sig_ill_handler); signal(SIGILL, sig_ill_handler);
#if defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) || defined(powerpc) #if defined(__i386__) || defined(__x86_64__)
/* Altivec instruction, 'vor %v0,%v0,%v0'. */
asm volatile (".long 0x10000484");
#elif defined(__i386__) || defined(__x86_64__)
/* SSE2 instruction: movsd %xmm0,%xmm0 */ /* SSE2 instruction: movsd %xmm0,%xmm0 */
asm volatile (".byte 0xf2,0x0f,0x10,0xc0"); asm volatile (".byte 0xf2,0x0f,0x10,0xc0");
#elif defined(__sparc__) #elif defined(__sparc__)
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
// { dg-options "-O" } // { dg-options "-O" }
// { dg-options "-O -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } // { dg-options "-O -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
// { dg-options "-O -w" { target powerpc*-*-* } } // { dg-options "-O -w" { target powerpc*-*-* } }
// { dg-options "-O -w -maltivec" { target { powerpc*-*-linux* && powerpc_altivec_ok } } } // { dg-options "-O -w -maltivec" { target { powerpc*-*-* && vmx_hw } } }
// { dg-options "-O -w -maltivec" { target { powerpc*-*-darwin* && powerpc_altivec_ok } } }
// { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "*" } { "" } }
// { dg-do run } // { dg-do run }
#include "check-vect.h" #include "check-vect.h"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
arguments. */ arguments. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
int main (int argc, const char * argv[]) int main (int argc, const char * argv[])
{ {
...@@ -15,8 +14,6 @@ int main (int argc, const char * argv[]) ...@@ -15,8 +14,6 @@ int main (int argc, const char * argv[])
vector float v; vector float v;
const vector float cv = (vector float){1.0, 2.0, 3.0, 4.0}; const vector float cv = (vector float){1.0, 2.0, 3.0, 4.0};
altivec_check ();
vec_dst(&cv, i, 0); vec_dst(&cv, i, 0);
v = vec_ld(0, &cv); v = vec_ld(0, &cv);
v = vec_lde(0, &cf); v = vec_lde(0, &cf);
......
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
...@@ -10,7 +11,6 @@ ...@@ -10,7 +11,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
#define CHECK_INVARIANT(expr) \ #define CHECK_INVARIANT(expr) \
if (!(expr)) { \ if (!(expr)) { \
...@@ -132,7 +132,6 @@ void main1(void) ...@@ -132,7 +132,6 @@ void main1(void)
int main(void) int main(void)
{ {
altivec_check();
main1(); main1();
return 0; return 0;
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_extract VMX intrinsics. */ /* Test the vec_extract VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern "C" void abort (void); extern "C" void abort (void);
...@@ -137,6 +137,5 @@ int main1(void) ...@@ -137,6 +137,5 @@ int main1(void)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (); return main1 ();
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_splats and vec_promote VMX intrinsics. */ /* Test the vec_splats and vec_promote VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern "C" void abort (void); extern "C" void abort (void);
...@@ -33,6 +33,5 @@ int main1(int t) ...@@ -33,6 +33,5 @@ int main1(int t)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (0); return main1 (0);
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_splats and vec_promote VMX intrinsics. */ /* Test the vec_splats and vec_promote VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern "C" void abort (void); extern "C" void abort (void);
...@@ -38,6 +38,5 @@ int main1(int t) ...@@ -38,6 +38,5 @@ int main1(int t)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (0); return main1 (0);
} }
/* A runtime check for AltiVec capability. */
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
#include <signal.h>
extern
#ifdef __cplusplus
"C"
#endif
void exit(int);
void
sig_ill_handler (int sig)
{
exit (0);
}
void altivec_check(void) {
/* Exit on systems without AltiVec. */
signal (SIGILL, sig_ill_handler);
#ifdef __MACH__
asm volatile ("vor v0,v0,v0");
#else
asm volatile ("vor 0,0,0");
#endif
signal (SIGILL, SIG_DFL);
}
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Program to test PowerPC AltiVec instructions. */ /* Program to test PowerPC AltiVec instructions. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
...@@ -24,8 +24,6 @@ vector float f, g, h; ...@@ -24,8 +24,6 @@ vector float f, g, h;
int main () int main ()
{ {
altivec_check(); /* Exits if AltiVec not supported */
k = vec_add (a1, a2); k = vec_add (a1, a2);
if (!vec_all_eq (addi, k)) if (!vec_all_eq (addi, k))
abort (); abort ();
......
/* { dg-do compile { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */ /* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
#include <altivec.h> #include <altivec.h>
#include <signal.h>
#include "altivec_check.h" extern void exit (int);
extern void abort (void);
typedef union typedef union
{ {
...@@ -72,8 +73,6 @@ check_cmple() ...@@ -72,8 +73,6 @@ check_cmple()
int int
main() main()
{ {
altivec_check ();
check_cmple (); check_cmple ();
check_vec_all_num (); check_vec_all_num ();
exit (0); exit (0);
......
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Program to test PowerPC AltiVec instructions. */ /* Program to test PowerPC AltiVec instructions. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
#define CHECK_IF(E) if(!(E)) abort() #define CHECK_IF(E) if(!(E)) abort()
...@@ -26,9 +26,6 @@ vector float f, g, h; ...@@ -26,9 +26,6 @@ vector float f, g, h;
int main () int main ()
{ {
altivec_check(); /* Exit if AltiVec not available. */
k = vec_add (a1, a2); k = vec_add (a1, a2);
CHECK_IF (vec_all_eq (addi, k)); CHECK_IF (vec_all_eq (addi, k));
CHECK_IF (vec_all_ge (addi, k)); CHECK_IF (vec_all_ge (addi, k));
......
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
...@@ -28,7 +28,6 @@ int verify (void) ...@@ -28,7 +28,6 @@ int verify (void)
int main (void) int main (void)
{ {
altivec_check (); /* Exit if hardware doesn't support AltiVec. */
initialize (MAGIC_NUMBER); initialize (MAGIC_NUMBER);
verify (); verify ();
return 0; return 0;
......
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
#include "altivec_check.h" extern void exit (int);
extern void abort (void);
typedef int int4 __attribute__ ((vector_size (16))); typedef int int4 __attribute__ ((vector_size (16)));
typedef float float4 __attribute__ ((vector_size (16))); typedef float float4 __attribute__ ((vector_size (16)));
...@@ -73,7 +75,6 @@ main1 () ...@@ -73,7 +75,6 @@ main1 ()
int int
main () main ()
{ {
altivec_check ();
main1 (); main1 ();
exit (0); exit (0);
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_extract VMX intrinsics. */ /* Test the vec_extract VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
...@@ -137,6 +137,5 @@ int main1(void) ...@@ -137,6 +137,5 @@ int main1(void)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (); return main1 ();
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_splats and vec_promote VMX intrinsics. */ /* Test the vec_splats and vec_promote VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
...@@ -33,6 +33,5 @@ int main1(int t) ...@@ -33,6 +33,5 @@ int main1(int t)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (0); return main1 (0);
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */ /* { dg-options "-maltivec" } */
/* Test the vec_splats and vec_promote VMX intrinsics. */ /* Test the vec_splats and vec_promote VMX intrinsics. */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
...@@ -38,6 +38,5 @@ int main1(int t) ...@@ -38,6 +38,5 @@ int main1(int t)
int main(void) int main(void)
{ {
altivec_check(); /* Exits if AltiVec not supported */
return main1 (0); return main1 (0);
} }
/* { dg-do run } */ /* { dg-do run { target { powerpc*-*-* && cell_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! cell_hw } } } } */
/* { dg-require-effective-target powerpc_ppu_ok } */ /* { dg-require-effective-target powerpc_ppu_ok } */
/* { dg-options "-O2 -maltivec -mabi=altivec -mcpu=cell" } */ /* { dg-options "-O2 -maltivec -mabi=altivec -mcpu=cell" } */
#include <altivec.h> #include <altivec.h>
#include <string.h> #include <string.h>
#include "altivec_check.h"
extern void abort (void);
typedef short int sint16; typedef short int sint16;
typedef signed char int8; typedef signed char int8;
...@@ -51,6 +53,5 @@ return 0; ...@@ -51,6 +53,5 @@ return 0;
int main(void) int main(void)
{ {
altivec_cell_check ();
return main1(); return main1();
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -mabi=altivec -O2" } */ /* { dg-options "-maltivec -mabi=altivec -O2" } */
/* Check that "easy" AltiVec constants are correctly synthesized. */ /* Check that "easy" AltiVec constants are correctly synthesized. */
#include "altivec_check.h"
extern void abort (void); extern void abort (void);
typedef __attribute__ ((vector_size (16))) unsigned char v16qi; typedef __attribute__ ((vector_size (16))) unsigned char v16qi;
...@@ -283,8 +282,6 @@ void v4si_vspltisw_neg_addself () ...@@ -283,8 +282,6 @@ void v4si_vspltisw_neg_addself ()
int main () int main ()
{ {
altivec_check (); /* Exit if hardware doesn't support AltiVec. */
v16qi_vspltisb (); v16qi_vspltisb ();
v16qi_vspltisb_neg (); v16qi_vspltisb_neg ();
v16qi_vspltisb_addself (); v16qi_vspltisb_addself ();
......
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */ /* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
#include <stdarg.h> #include <stdarg.h>
#include <signal.h>
#include "altivec_check.h" extern void exit (int);
extern void abort (void);
#define vector __attribute__((vector_size (16))) #define vector __attribute__((vector_size (16)))
...@@ -77,8 +78,5 @@ int main1(void) ...@@ -77,8 +78,5 @@ int main1(void)
int main (void) int main (void)
{ {
/* Exit on systems without AltiVec. */
altivec_check ();
return main1 (); return main1 ();
} }
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -O2" } */ /* { dg-options "-maltivec -O2" } */
#include <altivec.h> #include <altivec.h>
#include "altivec_check.h"
int printf(const char * , ...); int printf(const char * , ...);
extern void abort(); extern void abort();
...@@ -600,7 +600,6 @@ int main(int argc, char **argv) ...@@ -600,7 +600,6 @@ int main(int argc, char **argv)
{ {
char toto[32] __attribute__((aligned(16))); char toto[32] __attribute__((aligned(16)));
altivec_check (); /* Exit if hardware doesn't support AltiVec. */
foo(toto, toto, 0, 0); foo(toto, toto, 0, 0);
return 0; return 0;
} }
/* A runtime check for AltiVec capability. */
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
#include <signal.h>
extern void exit (int);
extern void abort (void);
void
sig_ill_handler (int sig)
{
exit (0);
}
void altivec_check(void) {
/* Exit on systems without AltiVec. */
signal (SIGILL, sig_ill_handler);
#ifdef __MACH__
asm volatile ("vor v0,v0,v0");
#else
asm volatile ("vor 0,0,0");
#endif
signal (SIGILL, SIG_DFL);
}
void altivec_cell_check (void)
{
#ifdef __PPU__
/* Exit on systems without the Cell Altivec instructions. */
signal (SIGILL, sig_ill_handler);
#ifdef __MACH__
asm volatile ("vor v0,v0,v0");
asm volatile ("lvlx v0,r0,r0");
#else
asm volatile ("vor 0,0,0");
asm volatile ("lvlx 0,0,0");
#endif
signal (SIGILL, SIG_DFL);
#else
/* altivec_cell_check shouldn't be called without -mcpu=cell. */
abort ();
#endif
}
/* PR target/35907 */ /* PR target/35907 */
/* { dg-do run { target powerpc*-*-* } } */ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-O2 -maltivec" } */ /* { dg-options "-O2 -maltivec" } */
#include "altivec_check.h"
#define vector __attribute__((vector_size (16))) #define vector __attribute__((vector_size (16)))
union union
{ {
...@@ -53,7 +52,6 @@ test (void) ...@@ -53,7 +52,6 @@ test (void)
int int
main () main ()
{ {
altivec_check ();
test (); test ();
return 0; return 0;
} }
...@@ -905,6 +905,40 @@ proc check_vmx_hw_available { } { ...@@ -905,6 +905,40 @@ proc check_vmx_hw_available { } {
}] }]
} }
# Return 1 if the target supports executing AltiVec and Cell PPU
# instructions, 0 otherwise. Cache the result.
proc check_effective_target_cell_hw { } {
return [check_cached_effective_target cell_hw_available {
# Some simulators are known to not support VMX and PPU instructions.
if { [istarget powerpc-*-eabi*] } {
expr 0
} else {
# Most targets don't require special flags for this test
# case, but Darwin and AIX do.
if { [istarget *-*-darwin*]
|| [istarget *-*-aix*] } {
set options "-maltivec -mcpu=cell"
} else {
set options "-mcpu=cell"
}
check_runtime_nocache cell_hw_available {
int main()
{
#ifdef __MACH__
asm volatile ("vor v0,v0,v0");
asm volatile ("lvlx v0,r0,r0");
#else
asm volatile ("vor 0,0,0");
asm volatile ("lvlx 0,0,0");
#endif
return 0;
}
} $options
}
}]
}
# Return 1 if the target supports executing 64-bit instructions, 0 # Return 1 if the target supports executing 64-bit instructions, 0
# otherwise. Cache the result. # otherwise. Cache the result.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment