1 |
282 |
jeremybenn |
/* Definitions of Synergistic Processing Unit (SPU). */
|
2 |
|
|
/* Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is free software; you can redistribute it and/or modify it under
|
5 |
|
|
the terms of the GNU General Public License as published by the Free
|
6 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
7 |
|
|
any later version.
|
8 |
|
|
|
9 |
|
|
This file is distributed in the hope that it will be useful, but WITHOUT
|
10 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
11 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12 |
|
|
for more details.
|
13 |
|
|
|
14 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
15 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
16 |
|
|
3.1, as published by the Free Software Foundation.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License and
|
19 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
20 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
21 |
|
|
<http://www.gnu.org/licenses/>. */
|
22 |
|
|
|
23 |
|
|
#ifndef _SPU_INTERNALS_H
|
24 |
|
|
#define _SPU_INTERNALS_H
|
25 |
|
|
|
26 |
|
|
/* For a typical GCC implementation, the vector keyword is defined here
|
27 |
|
|
* as a macro. If this macro conflicts with user code the user needs to
|
28 |
|
|
* undefine it. An extended GCC implementation may implement this
|
29 |
|
|
* keyword differently, such that it never conflicts, and will define
|
30 |
|
|
* the macro __VECTOR_KEYWORD_SUPPORTED__. */
|
31 |
|
|
#ifndef __VECTOR_KEYWORD_SUPPORTED__
|
32 |
|
|
#define vector __vector
|
33 |
|
|
#endif
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/* The spu specific instruction macros, si_*(), correspond 1-1 with
|
37 |
|
|
* SPU instructions in the ISA. The arguments are the same with the
|
38 |
|
|
* following exceptions:
|
39 |
|
|
* - any instruction which both reads and writes rt will have an
|
40 |
|
|
* extra parameter in the macro.
|
41 |
|
|
* - instructions which append zero to the immediate field assume
|
42 |
|
|
* the value given in a macro already has the zeroes appended.
|
43 |
|
|
* - integer/float convert functions expect a value from 0 to 127,
|
44 |
|
|
* i.e., the bias is added by the compiler.
|
45 |
|
|
*
|
46 |
|
|
* Parameters named 'imm' accept an integer literal.
|
47 |
|
|
* Parameters named 'r[abcdt]' accept a qword argument.
|
48 |
|
|
* Parameters named 'scalar' accept a scalar argument.
|
49 |
|
|
*/
|
50 |
|
|
|
51 |
|
|
#define qword __vector signed char
|
52 |
|
|
|
53 |
|
|
#define si_lqd(ra,imm) __builtin_si_lqd(ra,imm)
|
54 |
|
|
#define si_lqx(ra,rb) __builtin_si_lqx(ra,rb)
|
55 |
|
|
#define si_lqa(imm) __builtin_si_lqa(imm)
|
56 |
|
|
#define si_lqr(imm) __builtin_si_lqr(imm)
|
57 |
|
|
#define si_stqd(rt,ra,imm) __builtin_si_stqd(rt,ra,imm)
|
58 |
|
|
#define si_stqx(rt,ra,rb) __builtin_si_stqx(rt,ra,rb)
|
59 |
|
|
#define si_stqa(rt,imm) __builtin_si_stqa(rt,imm)
|
60 |
|
|
#define si_stqr(rt,imm) __builtin_si_stqr(rt,imm)
|
61 |
|
|
#define si_cbd(ra,imm) __builtin_si_cbd(ra,imm)
|
62 |
|
|
#define si_cbx(ra,rb) __builtin_si_cbx(ra,rb)
|
63 |
|
|
#define si_chd(ra,imm) __builtin_si_chd(ra,imm)
|
64 |
|
|
#define si_chx(ra,rb) __builtin_si_chx(ra,rb)
|
65 |
|
|
#define si_cwd(ra,imm) __builtin_si_cwd(ra,imm)
|
66 |
|
|
#define si_cwx(ra,rb) __builtin_si_cwx(ra,rb)
|
67 |
|
|
#define si_cdd(ra,imm) __builtin_si_cdd(ra,imm)
|
68 |
|
|
#define si_cdx(ra,rb) __builtin_si_cdx(ra,rb)
|
69 |
|
|
#define si_ilh(imm) __builtin_si_ilh(imm)
|
70 |
|
|
#define si_ilhu(imm) __builtin_si_ilhu(imm)
|
71 |
|
|
#define si_il(imm) __builtin_si_il(imm)
|
72 |
|
|
#define si_ila(imm) __builtin_si_ila(imm)
|
73 |
|
|
#define si_iohl(ra,imm) __builtin_si_iohl(ra,imm)
|
74 |
|
|
#define si_fsmbi(imm) __builtin_si_fsmbi(imm)
|
75 |
|
|
#define si_ah(ra,rb) __builtin_si_ah(ra,rb)
|
76 |
|
|
#define si_ahi(ra,imm) __builtin_si_ahi(ra,imm)
|
77 |
|
|
#define si_a(ra,rb) __builtin_si_a(ra,rb)
|
78 |
|
|
#define si_ai(ra,imm) __builtin_si_ai(ra,imm)
|
79 |
|
|
#define si_addx(ra,rb,rt) __builtin_si_addx(ra,rb,rt)
|
80 |
|
|
#define si_cg(ra,rb) __builtin_si_cg(ra,rb)
|
81 |
|
|
#define si_cgx(ra,rb,rt) __builtin_si_cgx(ra,rb,rt)
|
82 |
|
|
#define si_sfh(ra,rb) __builtin_si_sfh(ra,rb)
|
83 |
|
|
#define si_sfhi(imm,ra) __builtin_si_sfhi(imm,ra)
|
84 |
|
|
#define si_sf(ra,rb) __builtin_si_sf(ra,rb)
|
85 |
|
|
#define si_sfi(ra,imm) __builtin_si_sfi(ra,imm)
|
86 |
|
|
#define si_sfx(ra,rb,rt) __builtin_si_sfx(ra,rb,rt)
|
87 |
|
|
#define si_bg(ra,rb) __builtin_si_bg(ra,rb)
|
88 |
|
|
#define si_bgx(ra,rb,rt) __builtin_si_bgx(ra,rb,rt)
|
89 |
|
|
#define si_mpy(ra,rb) __builtin_si_mpy(ra,rb)
|
90 |
|
|
#define si_mpyu(ra,rb) __builtin_si_mpyu(ra,rb)
|
91 |
|
|
#define si_mpyi(ra,imm) __builtin_si_mpyi(ra,imm)
|
92 |
|
|
#define si_mpyui(ra,imm) __builtin_si_mpyui(ra,imm)
|
93 |
|
|
#define si_mpya(ra,rb,rc) __builtin_si_mpya(ra,rb,rc)
|
94 |
|
|
#define si_mpyh(ra,rb) __builtin_si_mpyh(ra,rb)
|
95 |
|
|
#define si_mpys(ra,rb) __builtin_si_mpys(ra,rb)
|
96 |
|
|
#define si_mpyhh(ra,rb) __builtin_si_mpyhh(ra,rb)
|
97 |
|
|
#define si_mpyhhu(ra,rb) __builtin_si_mpyhhu(ra,rb)
|
98 |
|
|
#define si_mpyhha(ra,rb,rc) __builtin_si_mpyhha(ra,rb,rc)
|
99 |
|
|
#define si_mpyhhau(ra,rb,rc) __builtin_si_mpyhhau(ra,rb,rc)
|
100 |
|
|
#define si_clz(ra) __builtin_si_clz(ra)
|
101 |
|
|
#define si_cntb(ra) __builtin_si_cntb(ra)
|
102 |
|
|
#define si_fsmb(ra) __builtin_si_fsmb(ra)
|
103 |
|
|
#define si_fsmh(ra) __builtin_si_fsmh(ra)
|
104 |
|
|
#define si_fsm(ra) __builtin_si_fsm(ra)
|
105 |
|
|
#define si_gbb(ra) __builtin_si_gbb(ra)
|
106 |
|
|
#define si_gbh(ra) __builtin_si_gbh(ra)
|
107 |
|
|
#define si_gb(ra) __builtin_si_gb(ra)
|
108 |
|
|
#define si_avgb(ra,rb) __builtin_si_avgb(ra,rb)
|
109 |
|
|
#define si_absdb(ra,rb) __builtin_si_absdb(ra,rb)
|
110 |
|
|
#define si_sumb(ra,rb) __builtin_si_sumb(ra,rb)
|
111 |
|
|
#define si_xsbh(ra) __builtin_si_xsbh(ra)
|
112 |
|
|
#define si_xshw(ra) __builtin_si_xshw(ra)
|
113 |
|
|
#define si_xswd(ra) __builtin_si_xswd(ra)
|
114 |
|
|
#define si_and(ra,rb) __builtin_si_and(ra,rb)
|
115 |
|
|
#define si_andc(ra,rb) __builtin_si_andc(ra,rb)
|
116 |
|
|
#define si_andbi(ra,imm) __builtin_si_andbi(ra,imm)
|
117 |
|
|
#define si_andhi(ra,imm) __builtin_si_andhi(ra,imm)
|
118 |
|
|
#define si_andi(ra,imm) __builtin_si_andi(ra,imm)
|
119 |
|
|
#define si_or(ra,rb) __builtin_si_or(ra,rb)
|
120 |
|
|
#define si_orc(ra,rb) __builtin_si_orc(ra,rb)
|
121 |
|
|
#define si_orbi(ra,imm) __builtin_si_orbi(ra,imm)
|
122 |
|
|
#define si_orhi(ra,imm) __builtin_si_orhi(ra,imm)
|
123 |
|
|
#define si_ori(ra,imm) __builtin_si_ori(ra,imm)
|
124 |
|
|
#define si_orx(ra) __builtin_si_orx(ra)
|
125 |
|
|
#define si_xor(ra,rb) __builtin_si_xor(ra,rb)
|
126 |
|
|
#define si_xorbi(ra,imm) __builtin_si_xorbi(ra,imm)
|
127 |
|
|
#define si_xorhi(ra,imm) __builtin_si_xorhi(ra,imm)
|
128 |
|
|
#define si_xori(ra,imm) __builtin_si_xori(ra,imm)
|
129 |
|
|
#define si_nand(ra,rb) __builtin_si_nand(ra,rb)
|
130 |
|
|
#define si_nor(ra,rb) __builtin_si_nor(ra,rb)
|
131 |
|
|
#define si_eqv(ra,rb) __builtin_si_eqv(ra,rb)
|
132 |
|
|
#define si_selb(ra,rb,rc) __builtin_si_selb(ra,rb,rc)
|
133 |
|
|
#define si_shufb(ra,rb,rc) __builtin_si_shufb(ra,rb,rc)
|
134 |
|
|
#define si_shlh(ra,rb) __builtin_si_shlh(ra,rb)
|
135 |
|
|
#define si_shlhi(ra,imm) __builtin_si_shlhi(ra,imm)
|
136 |
|
|
#define si_shl(ra,rb) __builtin_si_shl(ra,rb)
|
137 |
|
|
#define si_shli(ra,imm) __builtin_si_shli(ra,imm)
|
138 |
|
|
#define si_shlqbi(ra,rb) __builtin_si_shlqbi(ra,rb)
|
139 |
|
|
#define si_shlqbii(ra,imm) __builtin_si_shlqbii(ra,imm)
|
140 |
|
|
#define si_shlqby(ra,rb) __builtin_si_shlqby(ra,rb)
|
141 |
|
|
#define si_shlqbyi(ra,imm) __builtin_si_shlqbyi(ra,imm)
|
142 |
|
|
#define si_shlqbybi(ra,rb) __builtin_si_shlqbybi(ra,rb)
|
143 |
|
|
#define si_roth(ra,rb) __builtin_si_roth(ra,rb)
|
144 |
|
|
#define si_rothi(ra,imm) __builtin_si_rothi(ra,imm)
|
145 |
|
|
#define si_rot(ra,rb) __builtin_si_rot(ra,rb)
|
146 |
|
|
#define si_roti(ra,imm) __builtin_si_roti(ra,imm)
|
147 |
|
|
#define si_rotqby(ra,rb) __builtin_si_rotqby(ra,rb)
|
148 |
|
|
#define si_rotqbyi(ra,imm) __builtin_si_rotqbyi(ra,imm)
|
149 |
|
|
#define si_rotqbybi(ra,rb) __builtin_si_rotqbybi(ra,rb)
|
150 |
|
|
#define si_rotqbi(ra,rb) __builtin_si_rotqbi(ra,rb)
|
151 |
|
|
#define si_rotqbii(ra,imm) __builtin_si_rotqbii(ra,imm)
|
152 |
|
|
#define si_rothm(ra,rb) __builtin_si_rothm(ra,rb)
|
153 |
|
|
#define si_rothmi(ra,imm) __builtin_si_rothmi(ra,imm)
|
154 |
|
|
#define si_rotm(ra,rb) __builtin_si_rotm(ra,rb)
|
155 |
|
|
#define si_rotmi(ra,imm) __builtin_si_rotmi(ra,imm)
|
156 |
|
|
#define si_rotqmby(ra,rb) __builtin_si_rotqmby(ra,rb)
|
157 |
|
|
#define si_rotqmbyi(ra,imm) __builtin_si_rotqmbyi(ra,imm)
|
158 |
|
|
#define si_rotqmbi(ra,rb) __builtin_si_rotqmbi(ra,rb)
|
159 |
|
|
#define si_rotqmbii(ra,imm) __builtin_si_rotqmbii(ra,imm)
|
160 |
|
|
#define si_rotqmbybi(ra,rb) __builtin_si_rotqmbybi(ra,rb)
|
161 |
|
|
#define si_rotmah(ra,rb) __builtin_si_rotmah(ra,rb)
|
162 |
|
|
#define si_rotmahi(ra,imm) __builtin_si_rotmahi(ra,imm)
|
163 |
|
|
#define si_rotma(ra,rb) __builtin_si_rotma(ra,rb)
|
164 |
|
|
#define si_rotmai(ra,imm) __builtin_si_rotmai(ra,imm)
|
165 |
|
|
#define si_heq(ra,rb) __builtin_si_heq(ra,rb)
|
166 |
|
|
#define si_heqi(ra,imm) __builtin_si_heqi(ra,imm)
|
167 |
|
|
#define si_hgt(ra,rb) __builtin_si_hgt(ra,rb)
|
168 |
|
|
#define si_hgti(ra,imm) __builtin_si_hgti(ra,imm)
|
169 |
|
|
#define si_hlgt(ra,rb) __builtin_si_hlgt(ra,rb)
|
170 |
|
|
#define si_hlgti(ra,imm) __builtin_si_hlgti(ra,imm)
|
171 |
|
|
#define si_ceqb(ra,rb) __builtin_si_ceqb(ra,rb)
|
172 |
|
|
#define si_ceqbi(ra,imm) __builtin_si_ceqbi(ra,imm)
|
173 |
|
|
#define si_ceqh(ra,rb) __builtin_si_ceqh(ra,rb)
|
174 |
|
|
#define si_ceqhi(ra,imm) __builtin_si_ceqhi(ra,imm)
|
175 |
|
|
#define si_ceq(ra,rb) __builtin_si_ceq(ra,rb)
|
176 |
|
|
#define si_ceqi(ra,imm) __builtin_si_ceqi(ra,imm)
|
177 |
|
|
#define si_cgtb(ra,rb) __builtin_si_cgtb(ra,rb)
|
178 |
|
|
#define si_cgtbi(ra,imm) __builtin_si_cgtbi(ra,imm)
|
179 |
|
|
#define si_cgth(ra,rb) __builtin_si_cgth(ra,rb)
|
180 |
|
|
#define si_cgthi(ra,imm) __builtin_si_cgthi(ra,imm)
|
181 |
|
|
#define si_cgt(ra,rb) __builtin_si_cgt(ra,rb)
|
182 |
|
|
#define si_cgti(ra,imm) __builtin_si_cgti(ra,imm)
|
183 |
|
|
#define si_clgtb(ra,rb) __builtin_si_clgtb(ra,rb)
|
184 |
|
|
#define si_clgtbi(ra,imm) __builtin_si_clgtbi(ra,imm)
|
185 |
|
|
#define si_clgth(ra,rb) __builtin_si_clgth(ra,rb)
|
186 |
|
|
#define si_clgthi(ra,imm) __builtin_si_clgthi(ra,imm)
|
187 |
|
|
#define si_clgt(ra,rb) __builtin_si_clgt(ra,rb)
|
188 |
|
|
#define si_clgti(ra,imm) __builtin_si_clgti(ra,imm)
|
189 |
|
|
#define si_bisled(ra) __builtin_si_bisled(ra,0)
|
190 |
|
|
#define si_bisledd(ra) __builtin_si_bisledd(ra,0)
|
191 |
|
|
#define si_bislede(ra) __builtin_si_bislede(ra,0)
|
192 |
|
|
#define si_fa(ra,rb) __builtin_si_fa(ra,rb)
|
193 |
|
|
#define si_dfa(ra,rb) __builtin_si_dfa(ra,rb)
|
194 |
|
|
#define si_fs(ra,rb) __builtin_si_fs(ra,rb)
|
195 |
|
|
#define si_dfs(ra,rb) __builtin_si_dfs(ra,rb)
|
196 |
|
|
#define si_fm(ra,rb) __builtin_si_fm(ra,rb)
|
197 |
|
|
#define si_dfm(ra,rb) __builtin_si_dfm(ra,rb)
|
198 |
|
|
#define si_fma(ra,rb,rc) __builtin_si_fma(ra,rb,rc)
|
199 |
|
|
#define si_dfma(ra,rb,rc) __builtin_si_dfma(ra,rb,rc)
|
200 |
|
|
#define si_dfnma(ra,rb,rc) __builtin_si_dfnma(ra,rb,rc)
|
201 |
|
|
#define si_fnms(ra,rb,rc) __builtin_si_fnms(ra,rb,rc)
|
202 |
|
|
#define si_dfnms(ra,rb,rc) __builtin_si_dfnms(ra,rb,rc)
|
203 |
|
|
#define si_fms(ra,rb,rc) __builtin_si_fms(ra,rb,rc)
|
204 |
|
|
#define si_dfms(ra,rb,rc) __builtin_si_dfms(ra,rb,rc)
|
205 |
|
|
#define si_frest(ra) __builtin_si_frest(ra)
|
206 |
|
|
#define si_frsqest(ra) __builtin_si_frsqest(ra)
|
207 |
|
|
#define si_fi(ra,rb) __builtin_si_fi(ra,rb)
|
208 |
|
|
#define si_csflt(ra,imm) __builtin_si_csflt(ra,imm)
|
209 |
|
|
#define si_cflts(ra,imm) __builtin_si_cflts(ra,imm)
|
210 |
|
|
#define si_cuflt(ra,imm) __builtin_si_cuflt(ra,imm)
|
211 |
|
|
#define si_cfltu(ra,imm) __builtin_si_cfltu(ra,imm)
|
212 |
|
|
#define si_frds(ra) __builtin_si_frds(ra)
|
213 |
|
|
#define si_fesd(ra) __builtin_si_fesd(ra)
|
214 |
|
|
#define si_fceq(ra,rb) __builtin_si_fceq(ra,rb)
|
215 |
|
|
#define si_fcmeq(ra,rb) __builtin_si_fcmeq(ra,rb)
|
216 |
|
|
#define si_fcgt(ra,rb) __builtin_si_fcgt(ra,rb)
|
217 |
|
|
#define si_fcmgt(ra,rb) __builtin_si_fcmgt(ra,rb)
|
218 |
|
|
#define si_stop(imm) __builtin_si_stop(imm)
|
219 |
|
|
#define si_stopd(ra,rb,rc) __builtin_si_stopd(ra,rb,rc)
|
220 |
|
|
#define si_lnop() __builtin_si_lnop()
|
221 |
|
|
#define si_nop() __builtin_si_nop()
|
222 |
|
|
#define si_sync() __builtin_si_sync()
|
223 |
|
|
#define si_syncc() __builtin_si_syncc()
|
224 |
|
|
#define si_dsync() __builtin_si_dsync()
|
225 |
|
|
#define si_mfspr(imm) __builtin_si_mfspr(imm)
|
226 |
|
|
#define si_mtspr(imm,ra) __builtin_si_mtspr(imm,ra)
|
227 |
|
|
#define si_fscrrd() __builtin_si_fscrrd()
|
228 |
|
|
#define si_fscrwr(ra) __builtin_si_fscrwr(ra)
|
229 |
|
|
#define si_rdch(imm) __builtin_si_rdch(imm)
|
230 |
|
|
#define si_rchcnt(imm) __builtin_si_rchcnt(imm)
|
231 |
|
|
#define si_wrch(imm,ra) __builtin_si_wrch(imm,ra)
|
232 |
|
|
|
233 |
|
|
/* celledp only instructions */
|
234 |
|
|
#ifdef __SPU_EDP__
|
235 |
|
|
#define si_dfceq(ra,rb) __builtin_si_dfceq(ra,rb)
|
236 |
|
|
#define si_dfcmeq(ra,rb) __builtin_si_dfcmeq(ra,rb)
|
237 |
|
|
#define si_dfcgt(ra,rb) __builtin_si_dfcgt(ra,rb)
|
238 |
|
|
#define si_dfcmgt(ra,rb) __builtin_si_dfcmgt(ra,rb)
|
239 |
|
|
#define si_dftsv(ra,imm) __builtin_si_dftsv(ra,imm)
|
240 |
|
|
#endif /* __SPU_EDP__ */
|
241 |
|
|
|
242 |
|
|
#define si_from_char(scalar) __builtin_si_from_char(scalar)
|
243 |
|
|
#define si_from_uchar(scalar) __builtin_si_from_uchar(scalar)
|
244 |
|
|
#define si_from_short(scalar) __builtin_si_from_short(scalar)
|
245 |
|
|
#define si_from_ushort(scalar) __builtin_si_from_ushort(scalar)
|
246 |
|
|
#define si_from_int(scalar) __builtin_si_from_int(scalar)
|
247 |
|
|
#define si_from_uint(scalar) __builtin_si_from_uint(scalar)
|
248 |
|
|
#define si_from_llong(scalar) __builtin_si_from_long(scalar)
|
249 |
|
|
#define si_from_ullong(scalar) __builtin_si_from_ulong(scalar)
|
250 |
|
|
#define si_from_float(scalar) __builtin_si_from_float(scalar)
|
251 |
|
|
#define si_from_double(scalar) __builtin_si_from_double(scalar)
|
252 |
|
|
#define si_from_ptr(scalar) __builtin_si_from_ptr(scalar)
|
253 |
|
|
|
254 |
|
|
#define si_to_char(ra) __builtin_si_to_char(ra)
|
255 |
|
|
#define si_to_uchar(ra) __builtin_si_to_uchar(ra)
|
256 |
|
|
#define si_to_short(ra) __builtin_si_to_short(ra)
|
257 |
|
|
#define si_to_ushort(ra) __builtin_si_to_ushort(ra)
|
258 |
|
|
#define si_to_int(ra) __builtin_si_to_int(ra)
|
259 |
|
|
#define si_to_uint(ra) __builtin_si_to_uint(ra)
|
260 |
|
|
#define si_to_llong(ra) __builtin_si_to_long(ra)
|
261 |
|
|
#define si_to_ullong(ra) __builtin_si_to_ulong(ra)
|
262 |
|
|
#define si_to_float(ra) __builtin_si_to_float(ra)
|
263 |
|
|
#define si_to_double(ra) __builtin_si_to_double(ra)
|
264 |
|
|
#define si_to_ptr(ra) __builtin_si_to_ptr(ra)
|
265 |
|
|
|
266 |
|
|
#define __align_hint(ptr,base,offset) __builtin_spu_align_hint(ptr,base,offset)
|
267 |
|
|
|
268 |
|
|
/* generic spu_* intrinsics */
|
269 |
|
|
|
270 |
|
|
#define spu_splats(scalar) __builtin_spu_splats(scalar)
|
271 |
|
|
#define spu_convtf(ra,imm) __builtin_spu_convtf(ra,imm)
|
272 |
|
|
#define spu_convts(ra,imm) __builtin_spu_convts(ra,imm)
|
273 |
|
|
#define spu_convtu(ra,imm) __builtin_spu_convtu(ra,imm)
|
274 |
|
|
#define spu_extend(ra) __builtin_spu_extend(ra)
|
275 |
|
|
#define spu_roundtf(ra) __builtin_spu_roundtf(ra)
|
276 |
|
|
#define spu_add(ra,rb) __builtin_spu_add(ra,rb)
|
277 |
|
|
#define spu_addx(ra,rb,rt) __builtin_spu_addx(ra,rb,rt)
|
278 |
|
|
#define spu_genc(ra,rb) __builtin_spu_genc(ra,rb)
|
279 |
|
|
#define spu_gencx(ra,rb,rt) __builtin_spu_gencx(ra,rb,rt)
|
280 |
|
|
#define spu_madd(ra,rb,rc) __builtin_spu_madd(ra,rb,rc)
|
281 |
|
|
#define spu_nmadd(ra,rb,rc) __builtin_spu_nmadd(ra,rb,rc)
|
282 |
|
|
#define spu_mhhadd(ra,rb,rc) __builtin_spu_mhhadd(ra,rb,rc)
|
283 |
|
|
#define spu_msub(ra,rb,rc) __builtin_spu_msub(ra,rb,rc)
|
284 |
|
|
#define spu_mul(ra,rb) __builtin_spu_mul(ra,rb)
|
285 |
|
|
#define spu_mulh(ra,rb) __builtin_spu_mulh(ra,rb)
|
286 |
|
|
#define spu_mule(ra,rb) __builtin_spu_mule(ra,rb)
|
287 |
|
|
#define spu_mulo(ra,rb) __builtin_spu_mulo(ra,rb)
|
288 |
|
|
#define spu_mulsr(ra,rb) __builtin_spu_mulsr(ra,rb)
|
289 |
|
|
#define spu_nmsub(ra,rb,rc) __builtin_spu_nmsub(ra,rb,rc)
|
290 |
|
|
#define spu_sub(ra,rb) __builtin_spu_sub(ra,rb)
|
291 |
|
|
#define spu_subx(ra,rb,rt) __builtin_spu_subx(ra,rb,rt)
|
292 |
|
|
#define spu_genb(ra,rb) __builtin_spu_genb(ra,rb)
|
293 |
|
|
#define spu_genbx(ra,rb,rt) __builtin_spu_genbx(ra,rb,rt)
|
294 |
|
|
#define spu_absd(ra,rb) __builtin_spu_absd(ra,rb)
|
295 |
|
|
#define spu_avg(ra,rb) __builtin_spu_avg(ra,rb)
|
296 |
|
|
#define spu_sumb(ra,rb) __builtin_spu_sumb(ra,rb)
|
297 |
|
|
#define spu_bisled(ra) __builtin_spu_bisled(ra, 0)
|
298 |
|
|
#define spu_bisled_d(ra) __builtin_spu_bisled_d(ra, 0)
|
299 |
|
|
#define spu_bisled_e(ra) __builtin_spu_bisled_e(ra, 0)
|
300 |
|
|
#define spu_cmpabseq(ra,rb) __builtin_spu_cmpabseq(ra,rb)
|
301 |
|
|
#define spu_cmpabsgt(ra,rb) __builtin_spu_cmpabsgt(ra,rb)
|
302 |
|
|
#define spu_cmpeq(ra,rb) __builtin_spu_cmpeq(ra,rb)
|
303 |
|
|
#define spu_cmpgt(ra,rb) __builtin_spu_cmpgt(ra,rb)
|
304 |
|
|
#define spu_testsv(ra,imm) __builtin_spu_testsv(ra,imm)
|
305 |
|
|
#define spu_hcmpeq(ra,rb) __builtin_spu_hcmpeq(ra,rb)
|
306 |
|
|
#define spu_hcmpgt(ra,rb) __builtin_spu_hcmpgt(ra,rb)
|
307 |
|
|
#define spu_cntb(ra) __builtin_spu_cntb(ra)
|
308 |
|
|
#define spu_cntlz(ra) __builtin_spu_cntlz(ra)
|
309 |
|
|
#define spu_gather(ra) __builtin_spu_gather(ra)
|
310 |
|
|
#define spu_maskb(ra) __builtin_spu_maskb(ra)
|
311 |
|
|
#define spu_maskh(ra) __builtin_spu_maskh(ra)
|
312 |
|
|
#define spu_maskw(ra) __builtin_spu_maskw(ra)
|
313 |
|
|
#define spu_sel(ra,rb,rc) __builtin_spu_sel(ra,rb,rc)
|
314 |
|
|
#define spu_shuffle(ra,rb,rc) __builtin_spu_shuffle(ra,rb,rc)
|
315 |
|
|
#define spu_and(ra,rb) __builtin_spu_and(ra,rb)
|
316 |
|
|
#define spu_andc(ra,rb) __builtin_spu_andc(ra,rb)
|
317 |
|
|
#define spu_eqv(ra,rb) __builtin_spu_eqv(ra,rb)
|
318 |
|
|
#define spu_nand(ra,rb) __builtin_spu_nand(ra,rb)
|
319 |
|
|
#define spu_nor(ra,rb) __builtin_spu_nor(ra,rb)
|
320 |
|
|
#define spu_or(ra,rb) __builtin_spu_or(ra,rb)
|
321 |
|
|
#define spu_orc(ra,rb) __builtin_spu_orc(ra,rb)
|
322 |
|
|
#define spu_orx(ra) __builtin_spu_orx(ra)
|
323 |
|
|
#define spu_xor(ra,rb) __builtin_spu_xor(ra,rb)
|
324 |
|
|
#define spu_rl(ra,rb) __builtin_spu_rl(ra,rb)
|
325 |
|
|
#define spu_rlqw(ra,count) __builtin_spu_rlqw(ra,count)
|
326 |
|
|
#define spu_rlqwbyte(ra,count) __builtin_spu_rlqwbyte(ra,count)
|
327 |
|
|
#define spu_rlqwbytebc(ra,count) __builtin_spu_rlqwbytebc(ra,count)
|
328 |
|
|
#define spu_rlmask(ra,rb) __builtin_spu_rlmask(ra,rb)
|
329 |
|
|
#define spu_rlmaska(ra,rb) __builtin_spu_rlmaska(ra,rb)
|
330 |
|
|
#define spu_rlmaskqw(ra,rb) __builtin_spu_rlmaskqw(ra,rb)
|
331 |
|
|
#define spu_rlmaskqwbyte(ra,rb) __builtin_spu_rlmaskqwbyte(ra,rb)
|
332 |
|
|
#define spu_rlmaskqwbytebc(ra,rb) __builtin_spu_rlmaskqwbytebc(ra,rb)
|
333 |
|
|
#define spu_sl(ra,rb) __builtin_spu_sl(ra,rb)
|
334 |
|
|
#define spu_slqw(ra,rb) __builtin_spu_slqw(ra,rb)
|
335 |
|
|
#define spu_slqwbyte(ra,rb) __builtin_spu_slqwbyte(ra,rb)
|
336 |
|
|
#define spu_slqwbytebc(ra,rb) __builtin_spu_slqwbytebc(ra,rb)
|
337 |
|
|
#define spu_sr(ra,rb) __builtin_spu_sr(ra,rb)
|
338 |
|
|
#define spu_sra(ra,rb) __builtin_spu_sra(ra,rb)
|
339 |
|
|
#define spu_srqw(ra,rb) __builtin_spu_srqw(ra,rb)
|
340 |
|
|
#define spu_srqwbyte(ra,rb) __builtin_spu_srqwbyte(ra,rb)
|
341 |
|
|
#define spu_srqwbytebc(ra,rb) __builtin_spu_srqwbytebc(ra,rb)
|
342 |
|
|
#define spu_extract(ra,pos) __builtin_spu_extract(ra,pos)
|
343 |
|
|
#define spu_insert(scalar,ra,pos) __builtin_spu_insert(scalar,ra,pos)
|
344 |
|
|
#define spu_promote(scalar,pos) __builtin_spu_promote(scalar,pos)
|
345 |
|
|
|
346 |
|
|
#ifdef __cplusplus
|
347 |
|
|
extern "C" {
|
348 |
|
|
#endif
|
349 |
|
|
|
350 |
|
|
/* The type checking for some of these won't be accurate but they need
|
351 |
|
|
* to be defines because of the immediate values. */
|
352 |
|
|
#define spu_idisable() __builtin_spu_idisable()
|
353 |
|
|
#define spu_ienable() __builtin_spu_ienable()
|
354 |
|
|
#define spu_mfspr(imm) si_to_uint(si_mfspr((imm)))
|
355 |
|
|
#define spu_mtspr(imm, ra) si_mtspr((imm),si_from_uint (ra))
|
356 |
|
|
#define spu_mffpscr() ((vec_uint4)si_fscrrd())
|
357 |
|
|
#define spu_mtfpscr(a) si_fscrwr((qword)a)
|
358 |
|
|
#define spu_dsync() si_dsync()
|
359 |
|
|
#define spu_stop(imm) si_stop(imm)
|
360 |
|
|
#define spu_sync() si_sync()
|
361 |
|
|
#define spu_sync_c() si_syncc()
|
362 |
|
|
#define spu_readch(imm) si_to_uint(si_rdch((imm)))
|
363 |
|
|
#define spu_readchqw(imm) ((vec_uint4)si_rdch((imm)))
|
364 |
|
|
#define spu_readchcnt(imm) si_to_uint(si_rchcnt((imm)))
|
365 |
|
|
#define spu_writech(imm, ra) si_wrch((imm), si_from_uint(ra))
|
366 |
|
|
#define spu_writechqw(imm, ra) si_wrch((imm), (qword)(ra))
|
367 |
|
|
|
368 |
|
|
/* The following functions are static and always_inline to make sure
|
369 |
|
|
* they don't show up in object files which they aren't used in. */
|
370 |
|
|
|
371 |
|
|
static __inline__ vec_float4 spu_re (vec_float4 ra) __attribute__((__always_inline__));
|
372 |
|
|
static __inline__ vec_float4 spu_rsqrte (vec_float4 ra) __attribute__((__always_inline__));
|
373 |
|
|
|
374 |
|
|
static __inline__ vec_float4
|
375 |
|
|
spu_re (vec_float4 ra)
|
376 |
|
|
{
|
377 |
|
|
return (vec_float4) si_fi ((qword) (ra), si_frest ((qword) (ra)));
|
378 |
|
|
}
|
379 |
|
|
static __inline__ vec_float4
|
380 |
|
|
spu_rsqrte (vec_float4 ra)
|
381 |
|
|
{
|
382 |
|
|
return (vec_float4) si_fi ((qword) (ra), si_frsqest ((qword) (ra)));
|
383 |
|
|
}
|
384 |
|
|
|
385 |
|
|
/* composite intrinsics */
|
386 |
|
|
static __inline__ void spu_mfcdma32(volatile void *ls, unsigned int ea, unsigned int size, unsigned int tagid, unsigned int cmd) __attribute__((__always_inline__));
|
387 |
|
|
static __inline__ void spu_mfcdma64(volatile void *ls, unsigned int eahi, unsigned int ealow, unsigned int size, unsigned int tagid, unsigned int cmd) __attribute__((__always_inline__));
|
388 |
|
|
static __inline__ unsigned int spu_mfcstat(unsigned int type) __attribute__((__always_inline__));
|
389 |
|
|
|
390 |
|
|
static __inline__ void
|
391 |
|
|
spu_mfcdma32(volatile void *ls, unsigned int ea, unsigned int size, unsigned int tagid, unsigned int cmd)
|
392 |
|
|
{
|
393 |
|
|
si_wrch(MFC_LSA,si_from_ptr(ls));
|
394 |
|
|
si_wrch(MFC_EAL,si_from_uint(ea));
|
395 |
|
|
si_wrch(MFC_Size,si_from_uint(size));
|
396 |
|
|
si_wrch(MFC_TagID,si_from_uint(tagid));
|
397 |
|
|
si_wrch(MFC_Cmd,si_from_uint(cmd));
|
398 |
|
|
}
|
399 |
|
|
static __inline__ void
|
400 |
|
|
spu_mfcdma64(volatile void *ls, unsigned int eahi, unsigned int ealow, unsigned int size, unsigned int tagid, unsigned int cmd)
|
401 |
|
|
{
|
402 |
|
|
si_wrch(MFC_LSA,si_from_ptr(ls));
|
403 |
|
|
si_wrch(MFC_EAH,si_from_uint(eahi));
|
404 |
|
|
si_wrch(MFC_EAL,si_from_uint(ealow));
|
405 |
|
|
si_wrch(MFC_Size,si_from_uint(size));
|
406 |
|
|
si_wrch(MFC_TagID,si_from_uint(tagid));
|
407 |
|
|
si_wrch(MFC_Cmd,si_from_uint(cmd));
|
408 |
|
|
}
|
409 |
|
|
static __inline__ unsigned int
|
410 |
|
|
spu_mfcstat(unsigned int type)
|
411 |
|
|
{
|
412 |
|
|
si_wrch(MFC_WrTagUpdate,si_from_uint(type));
|
413 |
|
|
return si_to_uint(si_rdch(MFC_RdTagStat));
|
414 |
|
|
}
|
415 |
|
|
#ifdef __cplusplus
|
416 |
|
|
|
417 |
|
|
}
|
418 |
|
|
#endif /* __cplusplus */
|
419 |
|
|
|
420 |
|
|
#endif /* SPUINTRIN_H */
|
421 |
|
|
|