[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / altivec-cell-4.c
blobc694691d475913268b9f752f19c6af56184b8e15
1 /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
2 /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
3 /* { dg-require-effective-target powerpc_altivec_ok } */
4 /* { dg-options "-maltivec" } */
6 /* Test the vec_splats and vec_promote VMX intrinsics. */
7 #include <altivec.h>
9 extern void abort (void);
11 vector int a[] = {{0, 0, 0, 0}, {1,0,0,0}, {1,2,0,0},{1,2,3,0},{1,2,3,4},{5,2,3,4},{5,6,3,4}};
12 vector int c = {0,6,3,4};
13 vector int d = {0,0,3,4};
14 int main1(int t) __attribute__((noinline));
15 int main1(int t)
17 int i;
18 vector int b = vec_splats(0);
19 for(i = 0;i<sizeof(a)/sizeof(a[0])-1;i++)
21 if (__builtin_memcmp (&b, &a[i], sizeof(vector int)))
22 abort ();
23 b = vec_insert(i+1, b, i);
25 if (__builtin_memcmp (&b, &a[i], sizeof(vector int)))
26 abort ();
28 b = vec_insert(0, b, 0);
29 if (__builtin_memcmp (&b, &c, sizeof(vector int)))
30 abort ();
32 b = vec_insert(0, b, 1);
33 if (__builtin_memcmp (&b, &d, sizeof(vector int)))
34 abort ();
36 return 0;
39 int main(void)
41 return main1 (0);