Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/altivec-ld-1.c

raw
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" } */
5
6 #include <altivec.h>
7 #include <stdlib.h>
8
9 static __vector __int128 v;
10 static __vector __int128 *pv;
11
12 static __vector unsigned __int128 uv;
13 static __vector unsigned __int128 *puv;
14
15 static __int128 i128;
16 static __int128 *pi128;
17
18 static unsigned __int128 u128;
19 static unsigned __int128 *pu128;
20
21
22 void
23 doInitialization ()
24 {
25 v[0] = -1;
26 pv = &v;
27
28 uv[0] = 0xcafebabe;
29 puv = &uv;
30
31 i128 = 0xfabeabe;
32 pi128 = &i128;
33
34 u128 = 0xabefabe;
35 pu128 = &u128;
36 }
37
38 int
39 main (int argc, char *argv[])
40 {
41 __vector __int128 loaded_v;
42 __vector unsigned __int128 loaded_uv;
43
44 /* Usage:
45 * <Type> result = vec_ld (int index, __vector <Type> v)
46 * is equivalent to:
47 * result = v [index];
48 */
49 doInitialization ();
50 loaded_v = vec_ld (0, pv);
51 if (loaded_v[0] != -1)
52 abort ();
53
54 loaded_uv = vec_ld (0, puv);
55 if (loaded_uv[0] != 0xcafebabe)
56 abort ();
57
58 loaded_v = vec_ld (0, pi128);
59 if (loaded_v[0] != 0xfabeabe)
60 abort ();
61
62 loaded_uv = vec_ld (0, pu128);
63 if (loaded_uv[0] != 0xabefabe)
64 abort ();
65
66 return 0;
67 }