152
|
1 /* { dg-do compile } */
|
|
2 /* { dg-require-effective-target lp64 } */
|
|
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
|
|
4 /* { dg-options "-mdejagnu-cpu=power6 -maltivec -O2" } */
|
|
5
|
|
6 #include <altivec.h>
|
|
7
|
|
8 #pragma GCC target ("cpu=power6,altivec")
|
|
9 #ifdef _ARCH_PWR6
|
|
10 vector int
|
|
11 test1 (vector int a, vector int b)
|
|
12 {
|
|
13 return vec_add (a, b);
|
|
14 }
|
|
15 #else
|
|
16 #error failed power6 pragma target
|
|
17 #endif
|
|
18
|
|
19 #pragma GCC target ("cpu=power7")
|
|
20 /* Force a re-read of altivec.h with new cpu target. */
|
|
21 #undef _ALTIVEC_H
|
|
22 #include <altivec.h>
|
|
23 #ifdef _ARCH_PWR7
|
|
24 vector signed int
|
|
25 test2 (vector signed int a, vector signed int b)
|
|
26 {
|
|
27 return vec_sldw (a, b, 3);
|
|
28 }
|
|
29 #else
|
|
30 #error failed to set power7 pragma target
|
|
31 #endif
|
|
32
|
|
33 #pragma GCC target ("cpu=power8")
|
|
34 /* Force a re-read of altivec.h with new cpu target. */
|
|
35 #undef _ALTIVEC_H
|
|
36 #include <altivec.h>
|
|
37 #ifdef _ARCH_PWR8
|
|
38 vector int
|
|
39 test3 (vector int a, vector int b)
|
|
40 {
|
|
41 return vec_mergee (a, b);
|
|
42 }
|
|
43 typedef __attribute__((altivec(vector__))) long vec_t;
|
|
44 int
|
|
45 test3b (vec_t a, vec_t b)
|
|
46 {
|
|
47 return __builtin_vec_vcmpeq_p (2, a, b);
|
|
48 }
|
|
49 #else
|
|
50 #error failed to set power8 pragma target.
|
|
51 #endif
|
|
52
|