gcc/ChangeLog:
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / altivec-ld-1.c
blobd70f90cedcdc56a2408090d4c70a04c796ea904b
1 /* { dg-do run { target powerpc*-*-* } } */
2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-require-effective-target int128 } */
4 /* { dg-options "-maltivec -O0 -Wall -Wno-deprecated" } */
6 #include <altivec.h>
7 #include <stdlib.h>
9 static __vector __int128 v;
10 static __vector __int128 *pv;
12 static __vector unsigned __int128 uv;
13 static __vector unsigned __int128 *puv;
15 static __int128 i128;
16 static __int128 *pi128;
18 static unsigned __int128 u128;
19 static unsigned __int128 *pu128;
22 void
23 doInitialization ()
25 v[0] = -1;
26 pv = &v;
28 uv[0] = 0xcafebabe;
29 puv = &uv;
31 i128 = 0xfabeabe;
32 pi128 = &i128;
34 u128 = 0xabefabe;
35 pu128 = &u128;
38 int
39 main (int argc, char *argv[])
41 __vector __int128 loaded_v;
42 __vector unsigned __int128 loaded_uv;
44 /* Usage:
45 * <Type> result = vec_ld (int index, __vector <Type> v)
46 * is equivalent to:
47 * result = v [index];
49 doInitialization ();
50 loaded_v = vec_ld (0, pv);
51 if (loaded_v[0] != -1)
52 abort ();
54 loaded_uv = vec_ld (0, puv);
55 if (loaded_uv[0] != 0xcafebabe)
56 abort ();
58 loaded_v = vec_ld (0, pi128);
59 if (loaded_v[0] != 0xfabeabe)
60 abort ();
62 loaded_uv = vec_ld (0, pu128);
63 if (loaded_uv[0] != 0xabefabe)
64 abort ();
66 return 0;