OSDN Git Service

abaf56f2770bb4ff011020e89c64c7eef0ad3bc8
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / powerpc / altivec-cell-3.c
1 /* { dg-do run { target powerpc*-*-* } } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-options "-maltivec" } */
4 /* Test the vec_splats and vec_promote VMX intrinsics.  */
5 #include <altivec.h>
6 #include "altivec_check.h"
7     
8 extern void abort (void);
9         
10 vector int a = {0, 0, 0, 0};
11 int main1(int t) __attribute__((noinline));
12 int main1(int t)
13
14   int i;
15   vector int b = vec_splats(0);
16   if (__builtin_memcmp (&a, &b, sizeof(vector int)))
17     abort ();
18   
19   b = vec_splats(t);
20   if (__builtin_memcmp (&a, &b, sizeof(vector int)))
21     abort ();
22   
23   b = vec_promote(0, 1);
24   if (vec_extract (b, 1) != 0)
25     abort ();
26   
27   b = vec_promote(t, t);
28   if (vec_extract (b, t) != 0)
29     abort ();
30   
31   return 0;
32
33     
34 int main(void)
35
36   altivec_check();  /* Exits if AltiVec not supported */
37   return main1 (0);
38 }