1 |
691 |
jeremybenn |
/* { dg-do compile { target { powerpc*-*-* } } } */
|
2 |
|
|
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
|
3 |
|
|
/* { dg-require-effective-target powerpc_vsx_ok } */
|
4 |
|
|
/* { dg-options "-O2 -mcpu=power7" } */
|
5 |
|
|
|
6 |
|
|
/* Test simple extract/insert/slat operations. Make sure all types are
|
7 |
|
|
supported with various options. */
|
8 |
|
|
|
9 |
|
|
#include <altivec.h>
|
10 |
|
|
|
11 |
|
|
double extract_df_0_reg (vector double p) { return vec_extract (p, 0); }
|
12 |
|
|
double extract_df_1_reg (vector double p) { return vec_extract (p, 1); }
|
13 |
|
|
double extract_df_n_reg (vector double p, int n) { return vec_extract (p, n); }
|
14 |
|
|
|
15 |
|
|
double extract_df_0_mem (vector double *p) { return vec_extract (*p, 0); }
|
16 |
|
|
double extract_df_1_mem (vector double *p) { return vec_extract (*p, 1); }
|
17 |
|
|
double extract_df_n_mem (vector double *p, int n) { return vec_extract (*p, n); }
|
18 |
|
|
|
19 |
|
|
vector double insert_df_0 (vector double p, double x) { return vec_insert (x, p, 0); }
|
20 |
|
|
vector double insert_df_1 (vector double p, double x) { return vec_insert (x, p, 1); }
|
21 |
|
|
vector double insert_df_n (vector double p, double x, int n) { return vec_insert (x, p, n); }
|
22 |
|
|
|
23 |
|
|
vector double splat_df_reg (double x) { return vec_splats (x); }
|
24 |
|
|
vector double splat_df_mem (double *x) { return vec_splats (*x); }
|
25 |
|
|
|
26 |
|
|
#ifdef _ARCH_PPC64
|
27 |
|
|
#define ll long
|
28 |
|
|
#else
|
29 |
|
|
#define ll long long
|
30 |
|
|
#endif
|
31 |
|
|
|
32 |
|
|
ll extract_di_0_reg (vector ll p) { return vec_extract (p, 0); }
|
33 |
|
|
ll extract_di_1_reg (vector ll p) { return vec_extract (p, 1); }
|
34 |
|
|
ll extract_di_n_reg (vector ll p, int n) { return vec_extract (p, n); }
|
35 |
|
|
|
36 |
|
|
ll extract_di_0_mem (vector ll *p) { return vec_extract (*p, 0); }
|
37 |
|
|
ll extract_di_1_mem (vector ll *p) { return vec_extract (*p, 1); }
|
38 |
|
|
ll extract_di_n_mem (vector ll *p, int n) { return vec_extract (*p, n); }
|
39 |
|
|
|
40 |
|
|
vector ll insert_di_0 (vector ll p, ll x) { return vec_insert (x, p, 0); }
|
41 |
|
|
vector ll insert_di_1 (vector ll p, ll x) { return vec_insert (x, p, 1); }
|
42 |
|
|
vector ll insert_di_n (vector ll p, ll x, int n) { return vec_insert (x, p, n); }
|
43 |
|
|
|
44 |
|
|
vector ll splat_di_reg (ll x) { return vec_splats (x); }
|
45 |
|
|
vector ll splat_di_mem (ll *x) { return vec_splats (*x); }
|
46 |
|
|
|
47 |
|
|
float extract_sf_0_reg (vector float p) { return vec_extract (p, 0); }
|
48 |
|
|
float extract_sf_3_reg (vector float p) { return vec_extract (p, 3); }
|
49 |
|
|
float extract_sf_n_reg (vector float p, int n) { return vec_extract (p, n); }
|
50 |
|
|
|
51 |
|
|
float extract_sf_0_mem (vector float *p) { return vec_extract (*p, 0); }
|
52 |
|
|
float extract_sf_3_mem (vector float *p) { return vec_extract (*p, 3); }
|
53 |
|
|
float extract_sf_n_mem (vector float *p, int n) { return vec_extract (*p, n); }
|
54 |
|
|
|
55 |
|
|
vector float insert_sf_0 (vector float p, float x) { return vec_insert (x, p, 0); }
|
56 |
|
|
vector float insert_sf_3 (vector float p, float x) { return vec_insert (x, p, 3); }
|
57 |
|
|
vector float insert_sf_n (vector float p, float x, int n) { return vec_insert (x, p, n); }
|
58 |
|
|
|
59 |
|
|
vector float splat_sf_reg (float x) { return vec_splats (x); }
|
60 |
|
|
vector float splat_sf_mem (float *x) { return vec_splats (*x); }
|
61 |
|
|
|
62 |
|
|
int extract_si_0_reg (vector int p) { return vec_extract (p, 0); }
|
63 |
|
|
int extract_si_3_reg (vector int p) { return vec_extract (p, 3); }
|
64 |
|
|
int extract_si_n_reg (vector int p, int n) { return vec_extract (p, n); }
|
65 |
|
|
|
66 |
|
|
int extract_si_0_mem (vector int *p) { return vec_extract (*p, 0); }
|
67 |
|
|
int extract_si_3_mem (vector int *p) { return vec_extract (*p, 3); }
|
68 |
|
|
int extract_si_n_mem (vector int *p, int n) { return vec_extract (*p, n); }
|
69 |
|
|
|
70 |
|
|
vector int insert_si_0 (vector int p, int x) { return vec_insert (x, p, 0); }
|
71 |
|
|
vector int insert_si_3 (vector int p, int x) { return vec_insert (x, p, 3); }
|
72 |
|
|
vector int insert_si_n (vector int p, int x, int n) { return vec_insert (x, p, n); }
|
73 |
|
|
|
74 |
|
|
vector int splat_si_reg (int x) { return vec_splats (x); }
|
75 |
|
|
vector int splat_si_mem (int *x) { return vec_splats (*x); }
|
76 |
|
|
|
77 |
|
|
unsigned int extract_usi_0_reg (vector unsigned int p) { return vec_extract (p, 0); }
|
78 |
|
|
unsigned int extract_usi_3_reg (vector unsigned int p) { return vec_extract (p, 3); }
|
79 |
|
|
unsigned int extract_usi_n_reg (vector unsigned int p, int n) { return vec_extract (p, n); }
|
80 |
|
|
|
81 |
|
|
unsigned int extract_usi_0_mem (vector unsigned int *p) { return vec_extract (*p, 0); }
|
82 |
|
|
unsigned int extract_usi_3_mem (vector unsigned int *p) { return vec_extract (*p, 3); }
|
83 |
|
|
unsigned int extract_usi_n_mem (vector unsigned int *p, int n) { return vec_extract (*p, n); }
|
84 |
|
|
|
85 |
|
|
vector unsigned int insert_usi_0 (vector unsigned int p, unsigned int x) { return vec_insert (x, p, 0); }
|
86 |
|
|
vector unsigned int insert_usi_3 (vector unsigned int p, unsigned int x) { return vec_insert (x, p, 3); }
|
87 |
|
|
vector unsigned int insert_usi_n (vector unsigned int p, unsigned int x, int n) { return vec_insert (x, p, n); }
|
88 |
|
|
|
89 |
|
|
vector unsigned int splat_usi_reg (unsigned int x) { return vec_splats (x); }
|
90 |
|
|
vector unsigned int splat_usi_mem (unsigned int *x) { return vec_splats (*x); }
|
91 |
|
|
|
92 |
|
|
short extract_hi_0_reg (vector short p) { return vec_extract (p, 0); }
|
93 |
|
|
short extract_hi_7_reg (vector short p) { return vec_extract (p, 7); }
|
94 |
|
|
short extract_hi_n_reg (vector short p, int n) { return vec_extract (p, n); }
|
95 |
|
|
|
96 |
|
|
short extract_hi_0_mem (vector short *p) { return vec_extract (*p, 0); }
|
97 |
|
|
short extract_hi_7_mem (vector short *p) { return vec_extract (*p, 7); }
|
98 |
|
|
short extract_hi_n_mem (vector short *p, int n) { return vec_extract (*p, n); }
|
99 |
|
|
|
100 |
|
|
vector short insert_hi_0 (vector short p, short x) { return vec_insert (x, p, 0); }
|
101 |
|
|
vector short insert_hi_7 (vector short p, short x) { return vec_insert (x, p, 7); }
|
102 |
|
|
vector short insert_hi_n (vector short p, short x, int n) { return vec_insert (x, p, n); }
|
103 |
|
|
|
104 |
|
|
vector short splat_hi_reg (short x) { return vec_splats (x); }
|
105 |
|
|
vector short splat_hi_mem (short *x) { return vec_splats (*x); }
|
106 |
|
|
|
107 |
|
|
unsigned short extract_uhi_0_reg (vector unsigned short p) { return vec_extract (p, 0); }
|
108 |
|
|
unsigned short extract_uhi_7_reg (vector unsigned short p) { return vec_extract (p, 7); }
|
109 |
|
|
unsigned short extract_uhi_n_reg (vector unsigned short p, int n) { return vec_extract (p, n); }
|
110 |
|
|
|
111 |
|
|
unsigned short extract_uhi_0_mem (vector unsigned short *p) { return vec_extract (*p, 0); }
|
112 |
|
|
unsigned short extract_uhi_7_mem (vector unsigned short *p) { return vec_extract (*p, 7); }
|
113 |
|
|
unsigned short extract_uhi_n_mem (vector unsigned short *p, int n) { return vec_extract (*p, n); }
|
114 |
|
|
|
115 |
|
|
vector unsigned short insert_uhi_0 (vector unsigned short p, unsigned short x) { return vec_insert (x, p, 0); }
|
116 |
|
|
vector unsigned short insert_uhi_7 (vector unsigned short p, unsigned short x) { return vec_insert (x, p, 7); }
|
117 |
|
|
vector unsigned short insert_uhi_n (vector unsigned short p, unsigned short x, int n) { return vec_insert (x, p, n); }
|
118 |
|
|
|
119 |
|
|
vector unsigned short splat_uhi_reg (unsigned short x) { return vec_splats (x); }
|
120 |
|
|
vector unsigned short splat_uhi_mem (unsigned short *x) { return vec_splats (*x); }
|
121 |
|
|
|
122 |
|
|
signed char extract_qi_0_reg (vector signed char p) { return vec_extract (p, 0); }
|
123 |
|
|
signed char extract_qi_1_reg5 (vector signed char p) { return vec_extract (p, 15); }
|
124 |
|
|
signed char extract_qi_n_reg (vector signed char p, int n) { return vec_extract (p, n); }
|
125 |
|
|
|
126 |
|
|
signed char extract_qi_0_mem (vector signed char *p) { return vec_extract (*p, 0); }
|
127 |
|
|
signed char extract_qi_1_mem5 (vector signed char *p) { return vec_extract (*p, 15); }
|
128 |
|
|
signed char extract_qi_n_mem (vector signed char *p, int n) { return vec_extract (*p, n); }
|
129 |
|
|
|
130 |
|
|
vector signed char insert_qi_0 (vector signed char p, signed char x) { return vec_insert (x, p, 0); }
|
131 |
|
|
vector signed char insert_qi_15 (vector signed char p, signed char x) { return vec_insert (x, p, 15); }
|
132 |
|
|
vector signed char insert_qi_n (vector signed char p, signed char x, int n) { return vec_insert (x, p, n); }
|
133 |
|
|
|
134 |
|
|
vector signed char splat_qi_reg (signed char x) { return vec_splats (x); }
|
135 |
|
|
vector signed char splat_qi_mem (signed char *x) { return vec_splats (*x); }
|
136 |
|
|
|
137 |
|
|
unsigned char extract_uqi_0_reg (vector unsigned char p) { return vec_extract (p, 0); }
|
138 |
|
|
unsigned char extract_uqi_1_reg5 (vector unsigned char p) { return vec_extract (p, 15); }
|
139 |
|
|
unsigned char extract_uqi_n_reg (vector unsigned char p, int n) { return vec_extract (p, n); }
|
140 |
|
|
|
141 |
|
|
unsigned char extract_uqi_0_mem (vector unsigned char *p) { return vec_extract (*p, 0); }
|
142 |
|
|
unsigned char extract_uqi_1_mem5 (vector unsigned char *p) { return vec_extract (*p, 15); }
|
143 |
|
|
unsigned char extract_uqi_n_mem (vector unsigned char *p, int n) { return vec_extract (*p, n); }
|
144 |
|
|
|
145 |
|
|
vector unsigned char insert_uqi_0 (vector unsigned char p, unsigned char x) { return vec_insert (x, p, 0); }
|
146 |
|
|
vector unsigned char insert_uqi_15 (vector unsigned char p, unsigned char x) { return vec_insert (x, p, 15); }
|
147 |
|
|
vector unsigned char insert_uqi_n (vector unsigned char p, unsigned char x, int n) { return vec_insert (x, p, n); }
|
148 |
|
|
|
149 |
|
|
vector unsigned char splat_uqi_reg (unsigned char x) { return vec_splats (x); }
|
150 |
|
|
vector unsigned char splat_uqi_mem (unsigned char *x) { return vec_splats (*x); }
|