Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1 | /*===---- altivec.h - Standard header for type generic math ---------------===*\ |
| 2 | * |
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | * of this software and associated documentation files (the "Software"), to deal |
| 5 | * in the Software without restriction, including without limitation the rights |
| 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | * copies of the Software, and to permit persons to whom the Software is |
| 8 | * furnished to do so, subject to the following conditions: |
| 9 | * |
| 10 | * The above copyright notice and this permission notice shall be included in |
| 11 | * all copies or substantial portions of the Software. |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | * THE SOFTWARE. |
| 20 | * |
| 21 | \*===----------------------------------------------------------------------===*/ |
| 22 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 23 | // TODO: add functions for 'vector bool ..' and 'vector pixel' argument types according to |
| 24 | // the 'AltiVec Technology Programming Interface Manual' |
| 25 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 26 | #ifndef __ALTIVEC_H |
| 27 | #define __ALTIVEC_H |
| 28 | |
| 29 | #ifndef __ALTIVEC__ |
| 30 | #error "AltiVec support not enabled" |
| 31 | #endif |
| 32 | |
| 33 | /* constants for mapping CR6 bits to predicate result. */ |
| 34 | |
| 35 | #define __CR6_EQ 0 |
| 36 | #define __CR6_EQ_REV 1 |
| 37 | #define __CR6_LT 2 |
| 38 | #define __CR6_LT_REV 3 |
| 39 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 40 | #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) |
| 41 | |
| 42 | static vector signed char __ATTRS_o_ai |
| 43 | vec_perm(vector signed char a, vector signed char b, vector unsigned char c); |
| 44 | |
| 45 | static vector unsigned char __ATTRS_o_ai |
| 46 | vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c); |
| 47 | |
| 48 | static vector short __ATTRS_o_ai |
| 49 | vec_perm(vector short a, vector short b, vector unsigned char c); |
| 50 | |
| 51 | static vector unsigned short __ATTRS_o_ai |
| 52 | vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c); |
| 53 | |
| 54 | static vector int __ATTRS_o_ai |
| 55 | vec_perm(vector int a, vector int b, vector unsigned char c); |
| 56 | |
| 57 | static vector unsigned int __ATTRS_o_ai |
| 58 | vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c); |
| 59 | |
| 60 | static vector float __ATTRS_o_ai |
| 61 | vec_perm(vector float a, vector float b, vector unsigned char c); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 62 | |
| 63 | /* vec_abs */ |
| 64 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 65 | #define __builtin_altivec_abs_v16qi vec_abs |
| 66 | #define __builtin_altivec_abs_v8hi vec_abs |
| 67 | #define __builtin_altivec_abs_v4si vec_abs |
| 68 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 69 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 70 | vec_abs(vector signed char a) |
| 71 | { |
| 72 | return __builtin_altivec_vmaxsb(a, -a); |
| 73 | } |
| 74 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 75 | static vector signed short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 76 | vec_abs(vector signed short a) |
| 77 | { |
| 78 | return __builtin_altivec_vmaxsh(a, -a); |
| 79 | } |
| 80 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 81 | static vector signed int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 82 | vec_abs(vector signed int a) |
| 83 | { |
| 84 | return __builtin_altivec_vmaxsw(a, -a); |
| 85 | } |
| 86 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 87 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 88 | vec_abs(vector float a) |
| 89 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 90 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)(0x7FFFFFFF); |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 91 | return (vector float)res; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | /* vec_abss */ |
| 95 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 96 | #define __builtin_altivec_abss_v16qi vec_abss |
| 97 | #define __builtin_altivec_abss_v8hi vec_abss |
| 98 | #define __builtin_altivec_abss_v4si vec_abss |
| 99 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 100 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 101 | vec_abss(vector signed char a) |
| 102 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 103 | return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs((vector signed char)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 106 | static vector signed short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 107 | vec_abss(vector signed short a) |
| 108 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 109 | return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs((vector signed short)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 112 | static vector signed int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 113 | vec_abss(vector signed int a) |
| 114 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 115 | return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws((vector signed int)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | /* vec_add */ |
| 119 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 120 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 121 | vec_add(vector signed char a, vector signed char b) |
| 122 | { |
| 123 | return a + b; |
| 124 | } |
| 125 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 126 | static vector signed char __ATTRS_o_ai |
| 127 | vec_add(vector bool char a, vector signed char b) |
| 128 | { |
| 129 | return (vector signed char)a + b; |
| 130 | } |
| 131 | |
| 132 | static vector signed char __ATTRS_o_ai |
| 133 | vec_add(vector signed char a, vector bool char b) |
| 134 | { |
| 135 | return a + (vector signed char)b; |
| 136 | } |
| 137 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 138 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 139 | vec_add(vector unsigned char a, vector unsigned char b) |
| 140 | { |
| 141 | return a + b; |
| 142 | } |
| 143 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 144 | static vector unsigned char __ATTRS_o_ai |
| 145 | vec_add(vector bool char a, vector unsigned char b) |
| 146 | { |
| 147 | return (vector unsigned char)a + b; |
| 148 | } |
| 149 | |
| 150 | static vector unsigned char __ATTRS_o_ai |
| 151 | vec_add(vector unsigned char a, vector bool char b) |
| 152 | { |
| 153 | return a + (vector unsigned char)b; |
| 154 | } |
| 155 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 156 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 157 | vec_add(vector short a, vector short b) |
| 158 | { |
| 159 | return a + b; |
| 160 | } |
| 161 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 162 | static vector short __ATTRS_o_ai |
| 163 | vec_add(vector bool short a, vector short b) |
| 164 | { |
| 165 | return (vector short)a + b; |
| 166 | } |
| 167 | |
| 168 | static vector short __ATTRS_o_ai |
| 169 | vec_add(vector short a, vector bool short b) |
| 170 | { |
| 171 | return a + (vector short)b; |
| 172 | } |
| 173 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 174 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 175 | vec_add(vector unsigned short a, vector unsigned short b) |
| 176 | { |
| 177 | return a + b; |
| 178 | } |
| 179 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 180 | static vector unsigned short __ATTRS_o_ai |
| 181 | vec_add(vector bool short a, vector unsigned short b) |
| 182 | { |
| 183 | return (vector unsigned short)a + b; |
| 184 | } |
| 185 | |
| 186 | static vector unsigned short __ATTRS_o_ai |
| 187 | vec_add(vector unsigned short a, vector bool short b) |
| 188 | { |
| 189 | return a + (vector unsigned short)b; |
| 190 | } |
| 191 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 192 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 193 | vec_add(vector int a, vector int b) |
| 194 | { |
| 195 | return a + b; |
| 196 | } |
| 197 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 198 | static vector int __ATTRS_o_ai |
| 199 | vec_add(vector bool int a, vector int b) |
| 200 | { |
| 201 | return (vector int)a + b; |
| 202 | } |
| 203 | |
| 204 | static vector int __ATTRS_o_ai |
| 205 | vec_add(vector int a, vector bool int b) |
| 206 | { |
| 207 | return a + (vector int)b; |
| 208 | } |
| 209 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 210 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 211 | vec_add(vector unsigned int a, vector unsigned int b) |
| 212 | { |
| 213 | return a + b; |
| 214 | } |
| 215 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 216 | static vector unsigned int __ATTRS_o_ai |
| 217 | vec_add(vector bool int a, vector unsigned int b) |
| 218 | { |
| 219 | return (vector unsigned int)a + b; |
| 220 | } |
| 221 | |
| 222 | static vector unsigned int __ATTRS_o_ai |
| 223 | vec_add(vector unsigned int a, vector bool int b) |
| 224 | { |
| 225 | return a + (vector unsigned int)b; |
| 226 | } |
| 227 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 228 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 229 | vec_add(vector float a, vector float b) |
| 230 | { |
| 231 | return a + b; |
| 232 | } |
| 233 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 234 | /* vec_vaddubm */ |
| 235 | |
| 236 | #define __builtin_altivec_vaddubm vec_vaddubm |
| 237 | |
| 238 | static vector signed char __ATTRS_o_ai |
| 239 | vec_vaddubm(vector signed char a, vector signed char b) |
| 240 | { |
| 241 | return a + b; |
| 242 | } |
| 243 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 244 | static vector signed char __ATTRS_o_ai |
| 245 | vec_vaddubm(vector bool char a, vector signed char b) |
| 246 | { |
| 247 | return (vector signed char)a + b; |
| 248 | } |
| 249 | |
| 250 | static vector signed char __ATTRS_o_ai |
| 251 | vec_vaddubm(vector signed char a, vector bool char b) |
| 252 | { |
| 253 | return a + (vector signed char)b; |
| 254 | } |
| 255 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 256 | static vector unsigned char __ATTRS_o_ai |
| 257 | vec_vaddubm(vector unsigned char a, vector unsigned char b) |
| 258 | { |
| 259 | return a + b; |
| 260 | } |
| 261 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 262 | static vector unsigned char __ATTRS_o_ai |
| 263 | vec_vaddubm(vector bool char a, vector unsigned char b) |
| 264 | { |
| 265 | return (vector unsigned char)a + b; |
| 266 | } |
| 267 | |
| 268 | static vector unsigned char __ATTRS_o_ai |
| 269 | vec_vaddubm(vector unsigned char a, vector bool char b) |
| 270 | { |
| 271 | return a + (vector unsigned char)b; |
| 272 | } |
| 273 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 274 | /* vec_vadduhm */ |
| 275 | |
| 276 | #define __builtin_altivec_vadduhm vec_vadduhm |
| 277 | |
| 278 | static vector short __ATTRS_o_ai |
| 279 | vec_vadduhm(vector short a, vector short b) |
| 280 | { |
| 281 | return a + b; |
| 282 | } |
| 283 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 284 | static vector short __ATTRS_o_ai |
| 285 | vec_vadduhm(vector bool short a, vector short b) |
| 286 | { |
| 287 | return (vector short)a + b; |
| 288 | } |
| 289 | |
| 290 | static vector short __ATTRS_o_ai |
| 291 | vec_vadduhm(vector short a, vector bool short b) |
| 292 | { |
| 293 | return a + (vector short)b; |
| 294 | } |
| 295 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 296 | static vector unsigned short __ATTRS_o_ai |
| 297 | vec_vadduhm(vector unsigned short a, vector unsigned short b) |
| 298 | { |
| 299 | return a + b; |
| 300 | } |
| 301 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 302 | static vector unsigned short __ATTRS_o_ai |
| 303 | vec_vadduhm(vector bool short a, vector unsigned short b) |
| 304 | { |
| 305 | return (vector unsigned short)a + b; |
| 306 | } |
| 307 | |
| 308 | static vector unsigned short __ATTRS_o_ai |
| 309 | vec_vadduhm(vector unsigned short a, vector bool short b) |
| 310 | { |
| 311 | return a + (vector unsigned short)b; |
| 312 | } |
| 313 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 314 | /* vec_vadduwm */ |
| 315 | |
| 316 | #define __builtin_altivec_vadduwm vec_vadduwm |
| 317 | |
| 318 | static vector int __ATTRS_o_ai |
| 319 | vec_vadduwm(vector int a, vector int b) |
| 320 | { |
| 321 | return a + b; |
| 322 | } |
| 323 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 324 | static vector int __ATTRS_o_ai |
| 325 | vec_vadduwm(vector bool int a, vector int b) |
| 326 | { |
| 327 | return (vector int)a + b; |
| 328 | } |
| 329 | |
| 330 | static vector int __ATTRS_o_ai |
| 331 | vec_vadduwm(vector int a, vector bool int b) |
| 332 | { |
| 333 | return a + (vector int)b; |
| 334 | } |
| 335 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 336 | static vector unsigned int __ATTRS_o_ai |
| 337 | vec_vadduwm(vector unsigned int a, vector unsigned int b) |
| 338 | { |
| 339 | return a + b; |
| 340 | } |
| 341 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 342 | static vector unsigned int __ATTRS_o_ai |
| 343 | vec_vadduwm(vector bool int a, vector unsigned int b) |
| 344 | { |
| 345 | return (vector unsigned int)a + b; |
| 346 | } |
| 347 | |
| 348 | static vector unsigned int __ATTRS_o_ai |
| 349 | vec_vadduwm(vector unsigned int a, vector bool int b) |
| 350 | { |
| 351 | return a + (vector unsigned int)b; |
| 352 | } |
| 353 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 354 | /* vec_vaddfp */ |
| 355 | |
| 356 | #define __builtin_altivec_vaddfp vec_vaddfp |
| 357 | |
| 358 | static vector float __attribute__((__always_inline__)) |
| 359 | vec_vaddfp(vector float a, vector float b) |
| 360 | { |
| 361 | return a + b; |
| 362 | } |
| 363 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 364 | /* vec_addc */ |
| 365 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 366 | static vector unsigned int __attribute__((__always_inline__)) |
| 367 | vec_addc(vector unsigned int a, vector unsigned int b) |
| 368 | { |
| 369 | return __builtin_altivec_vaddcuw(a, b); |
| 370 | } |
| 371 | |
| 372 | /* vec_vaddcuw */ |
| 373 | |
| 374 | static vector unsigned int __attribute__((__always_inline__)) |
| 375 | vec_vaddcuw(vector unsigned int a, vector unsigned int b) |
| 376 | { |
| 377 | return __builtin_altivec_vaddcuw(a, b); |
| 378 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 379 | |
| 380 | /* vec_adds */ |
| 381 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 382 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 383 | vec_adds(vector signed char a, vector signed char b) |
| 384 | { |
| 385 | return __builtin_altivec_vaddsbs(a, b); |
| 386 | } |
| 387 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 388 | static vector signed char __ATTRS_o_ai |
| 389 | vec_adds(vector bool char a, vector signed char b) |
| 390 | { |
| 391 | return __builtin_altivec_vaddsbs((vector signed char)a, b); |
| 392 | } |
| 393 | |
| 394 | static vector signed char __ATTRS_o_ai |
| 395 | vec_adds(vector signed char a, vector bool char b) |
| 396 | { |
| 397 | return __builtin_altivec_vaddsbs(a, (vector signed char)b); |
| 398 | } |
| 399 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 400 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 401 | vec_adds(vector unsigned char a, vector unsigned char b) |
| 402 | { |
| 403 | return __builtin_altivec_vaddubs(a, b); |
| 404 | } |
| 405 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 406 | static vector unsigned char __ATTRS_o_ai |
| 407 | vec_adds(vector bool char a, vector unsigned char b) |
| 408 | { |
| 409 | return __builtin_altivec_vaddubs((vector unsigned char)a, b); |
| 410 | } |
| 411 | |
| 412 | static vector unsigned char __ATTRS_o_ai |
| 413 | vec_adds(vector unsigned char a, vector bool char b) |
| 414 | { |
| 415 | return __builtin_altivec_vaddubs(a, (vector unsigned char)b); |
| 416 | } |
| 417 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 418 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 419 | vec_adds(vector short a, vector short b) |
| 420 | { |
| 421 | return __builtin_altivec_vaddshs(a, b); |
| 422 | } |
| 423 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 424 | static vector short __ATTRS_o_ai |
| 425 | vec_adds(vector bool short a, vector short b) |
| 426 | { |
| 427 | return __builtin_altivec_vaddshs((vector short)a, b); |
| 428 | } |
| 429 | |
| 430 | static vector short __ATTRS_o_ai |
| 431 | vec_adds(vector short a, vector bool short b) |
| 432 | { |
| 433 | return __builtin_altivec_vaddshs(a, (vector short)b); |
| 434 | } |
| 435 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 436 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 437 | vec_adds(vector unsigned short a, vector unsigned short b) |
| 438 | { |
| 439 | return __builtin_altivec_vadduhs(a, b); |
| 440 | } |
| 441 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 442 | static vector unsigned short __ATTRS_o_ai |
| 443 | vec_adds(vector bool short a, vector unsigned short b) |
| 444 | { |
| 445 | return __builtin_altivec_vadduhs((vector unsigned short)a, b); |
| 446 | } |
| 447 | |
| 448 | static vector unsigned short __ATTRS_o_ai |
| 449 | vec_adds(vector unsigned short a, vector bool short b) |
| 450 | { |
| 451 | return __builtin_altivec_vadduhs(a, (vector unsigned short)b); |
| 452 | } |
| 453 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 454 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 455 | vec_adds(vector int a, vector int b) |
| 456 | { |
| 457 | return __builtin_altivec_vaddsws(a, b); |
| 458 | } |
| 459 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 460 | static vector int __ATTRS_o_ai |
| 461 | vec_adds(vector bool int a, vector int b) |
| 462 | { |
| 463 | return __builtin_altivec_vaddsws((vector int)a, b); |
| 464 | } |
| 465 | |
| 466 | static vector int __ATTRS_o_ai |
| 467 | vec_adds(vector int a, vector bool int b) |
| 468 | { |
| 469 | return __builtin_altivec_vaddsws(a, (vector int)b); |
| 470 | } |
| 471 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 472 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 473 | vec_adds(vector unsigned int a, vector unsigned int b) |
| 474 | { |
| 475 | return __builtin_altivec_vadduws(a, b); |
| 476 | } |
| 477 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 478 | static vector unsigned int __ATTRS_o_ai |
| 479 | vec_adds(vector bool int a, vector unsigned int b) |
| 480 | { |
| 481 | return __builtin_altivec_vadduws((vector unsigned int)a, b); |
| 482 | } |
| 483 | |
| 484 | static vector unsigned int __ATTRS_o_ai |
| 485 | vec_adds(vector unsigned int a, vector bool int b) |
| 486 | { |
| 487 | return __builtin_altivec_vadduws(a, (vector unsigned int)b); |
| 488 | } |
| 489 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 490 | /* vec_vaddsbs */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 491 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 492 | static vector signed char __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 493 | vec_vaddsbs(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 494 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 495 | return __builtin_altivec_vaddsbs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 496 | } |
| 497 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 498 | static vector signed char __ATTRS_o_ai |
| 499 | vec_vaddsbs(vector bool char a, vector signed char b) |
| 500 | { |
| 501 | return __builtin_altivec_vaddsbs((vector signed char)a, b); |
| 502 | } |
| 503 | |
| 504 | static vector signed char __ATTRS_o_ai |
| 505 | vec_vaddsbs(vector signed char a, vector bool char b) |
| 506 | { |
| 507 | return __builtin_altivec_vaddsbs(a, (vector signed char)b); |
| 508 | } |
| 509 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 510 | /* vec_vaddubs */ |
| 511 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 512 | static vector unsigned char __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 513 | vec_vaddubs(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 514 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 515 | return __builtin_altivec_vaddubs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 516 | } |
| 517 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 518 | static vector unsigned char __ATTRS_o_ai |
| 519 | vec_vaddubs(vector bool char a, vector unsigned char b) |
| 520 | { |
| 521 | return __builtin_altivec_vaddubs((vector unsigned char)a, b); |
| 522 | } |
| 523 | |
| 524 | static vector unsigned char __ATTRS_o_ai |
| 525 | vec_vaddubs(vector unsigned char a, vector bool char b) |
| 526 | { |
| 527 | return __builtin_altivec_vaddubs(a, (vector unsigned char)b); |
| 528 | } |
| 529 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 530 | /* vec_vaddshs */ |
| 531 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 532 | static vector short __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 533 | vec_vaddshs(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 534 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 535 | return __builtin_altivec_vaddshs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 538 | static vector short __ATTRS_o_ai |
| 539 | vec_vaddshs(vector bool short a, vector short b) |
| 540 | { |
| 541 | return __builtin_altivec_vaddshs((vector short)a, b); |
| 542 | } |
| 543 | |
| 544 | static vector short __ATTRS_o_ai |
| 545 | vec_vaddshs(vector short a, vector bool short b) |
| 546 | { |
| 547 | return __builtin_altivec_vaddshs(a, (vector short)b); |
| 548 | } |
| 549 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 550 | /* vec_vadduhs */ |
| 551 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 552 | static vector unsigned short __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 553 | vec_vadduhs(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 554 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 555 | return __builtin_altivec_vadduhs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 556 | } |
| 557 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 558 | static vector unsigned short __ATTRS_o_ai |
| 559 | vec_vadduhs(vector bool short a, vector unsigned short b) |
| 560 | { |
| 561 | return __builtin_altivec_vadduhs((vector unsigned short)a, b); |
| 562 | } |
| 563 | |
| 564 | static vector unsigned short __ATTRS_o_ai |
| 565 | vec_vadduhs(vector unsigned short a, vector bool short b) |
| 566 | { |
| 567 | return __builtin_altivec_vadduhs(a, (vector unsigned short)b); |
| 568 | } |
| 569 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 570 | /* vec_vaddsws */ |
| 571 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 572 | static vector int __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 573 | vec_vaddsws(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 574 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 575 | return __builtin_altivec_vaddsws(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 576 | } |
| 577 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 578 | static vector int __ATTRS_o_ai |
| 579 | vec_vaddsws(vector bool int a, vector int b) |
| 580 | { |
| 581 | return __builtin_altivec_vaddsws((vector int)a, b); |
| 582 | } |
| 583 | |
| 584 | static vector int __ATTRS_o_ai |
| 585 | vec_vaddsws(vector int a, vector bool int b) |
| 586 | { |
| 587 | return __builtin_altivec_vaddsws(a, (vector int)b); |
| 588 | } |
| 589 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 590 | /* vec_vadduws */ |
| 591 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 592 | static vector unsigned int __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 593 | vec_vadduws(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 594 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 595 | return __builtin_altivec_vadduws(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 596 | } |
| 597 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 598 | static vector unsigned int __ATTRS_o_ai |
| 599 | vec_vadduws(vector bool int a, vector unsigned int b) |
| 600 | { |
| 601 | return __builtin_altivec_vadduws((vector unsigned int)a, b); |
| 602 | } |
| 603 | |
| 604 | static vector unsigned int __ATTRS_o_ai |
| 605 | vec_vadduws(vector unsigned int a, vector bool int b) |
| 606 | { |
| 607 | return __builtin_altivec_vadduws(a, (vector unsigned int)b); |
| 608 | } |
| 609 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 610 | /* vec_and */ |
| 611 | |
| 612 | #define __builtin_altivec_vand vec_and |
| 613 | |
| 614 | static vector signed char __ATTRS_o_ai |
| 615 | vec_and(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 616 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 617 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 618 | } |
| 619 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 620 | static vector signed char __ATTRS_o_ai |
| 621 | vec_and(vector bool char a, vector signed char b) |
| 622 | { |
| 623 | return (vector signed char)a & b; |
| 624 | } |
| 625 | |
| 626 | static vector signed char __ATTRS_o_ai |
| 627 | vec_and(vector signed char a, vector bool char b) |
| 628 | { |
| 629 | return a & (vector signed char)b; |
| 630 | } |
| 631 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 632 | static vector unsigned char __ATTRS_o_ai |
| 633 | vec_and(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 634 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 635 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 636 | } |
| 637 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 638 | static vector unsigned char __ATTRS_o_ai |
| 639 | vec_and(vector bool char a, vector unsigned char b) |
| 640 | { |
| 641 | return (vector unsigned char)a & b; |
| 642 | } |
| 643 | |
| 644 | static vector unsigned char __ATTRS_o_ai |
| 645 | vec_and(vector unsigned char a, vector bool char b) |
| 646 | { |
| 647 | return a & (vector unsigned char)b; |
| 648 | } |
| 649 | |
| 650 | static vector bool char __ATTRS_o_ai |
| 651 | vec_and(vector bool char a, vector bool char b) |
| 652 | { |
| 653 | return a & b; |
| 654 | } |
| 655 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 656 | static vector short __ATTRS_o_ai |
| 657 | vec_and(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 658 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 659 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 660 | } |
| 661 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 662 | static vector short __ATTRS_o_ai |
| 663 | vec_and(vector bool short a, vector short b) |
| 664 | { |
| 665 | return (vector short)a & b; |
| 666 | } |
| 667 | |
| 668 | static vector short __ATTRS_o_ai |
| 669 | vec_and(vector short a, vector bool short b) |
| 670 | { |
| 671 | return a & (vector short)b; |
| 672 | } |
| 673 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 674 | static vector unsigned short __ATTRS_o_ai |
| 675 | vec_and(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 676 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 677 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 678 | } |
| 679 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 680 | static vector unsigned short __ATTRS_o_ai |
| 681 | vec_and(vector bool short a, vector unsigned short b) |
| 682 | { |
| 683 | return (vector unsigned short)a & b; |
| 684 | } |
| 685 | |
| 686 | static vector unsigned short __ATTRS_o_ai |
| 687 | vec_and(vector unsigned short a, vector bool short b) |
| 688 | { |
| 689 | return a & (vector unsigned short)b; |
| 690 | } |
| 691 | |
| 692 | static vector bool short __ATTRS_o_ai |
| 693 | vec_and(vector bool short a, vector bool short b) |
| 694 | { |
| 695 | return a & b; |
| 696 | } |
| 697 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 698 | static vector int __ATTRS_o_ai |
| 699 | vec_and(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 700 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 701 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 702 | } |
| 703 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 704 | static vector int __ATTRS_o_ai |
| 705 | vec_and(vector bool int a, vector int b) |
| 706 | { |
| 707 | return (vector int)a & b; |
| 708 | } |
| 709 | |
| 710 | static vector int __ATTRS_o_ai |
| 711 | vec_and(vector int a, vector bool int b) |
| 712 | { |
| 713 | return a & (vector int)b; |
| 714 | } |
| 715 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 716 | static vector unsigned int __ATTRS_o_ai |
| 717 | vec_and(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 718 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 719 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 720 | } |
| 721 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 722 | static vector unsigned int __ATTRS_o_ai |
| 723 | vec_and(vector bool int a, vector unsigned int b) |
| 724 | { |
| 725 | return (vector unsigned int)a & b; |
| 726 | } |
| 727 | |
| 728 | static vector unsigned int __ATTRS_o_ai |
| 729 | vec_and(vector unsigned int a, vector bool int b) |
| 730 | { |
| 731 | return a & (vector unsigned int)b; |
| 732 | } |
| 733 | |
| 734 | static vector bool int __ATTRS_o_ai |
| 735 | vec_and(vector bool int a, vector bool int b) |
| 736 | { |
| 737 | return a & b; |
| 738 | } |
| 739 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 740 | static vector float __ATTRS_o_ai |
| 741 | vec_and(vector float a, vector float b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 742 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 743 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 744 | return (vector float)res; |
| 745 | } |
| 746 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 747 | static vector float __ATTRS_o_ai |
| 748 | vec_and(vector bool int a, vector float b) |
| 749 | { |
| 750 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 751 | return (vector float)res; |
| 752 | } |
| 753 | |
| 754 | static vector float __ATTRS_o_ai |
| 755 | vec_and(vector float a, vector bool int b) |
| 756 | { |
| 757 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 758 | return (vector float)res; |
| 759 | } |
| 760 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 761 | /* vec_vand */ |
| 762 | |
| 763 | static vector signed char __ATTRS_o_ai |
| 764 | vec_vand(vector signed char a, vector signed char b) |
| 765 | { |
| 766 | return a & b; |
| 767 | } |
| 768 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 769 | static vector signed char __ATTRS_o_ai |
| 770 | vec_vand(vector bool char a, vector signed char b) |
| 771 | { |
| 772 | return (vector signed char)a & b; |
| 773 | } |
| 774 | |
| 775 | static vector signed char __ATTRS_o_ai |
| 776 | vec_vand(vector signed char a, vector bool char b) |
| 777 | { |
| 778 | return a & (vector signed char)b; |
| 779 | } |
| 780 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 781 | static vector unsigned char __ATTRS_o_ai |
| 782 | vec_vand(vector unsigned char a, vector unsigned char b) |
| 783 | { |
| 784 | return a & b; |
| 785 | } |
| 786 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 787 | static vector unsigned char __ATTRS_o_ai |
| 788 | vec_vand(vector bool char a, vector unsigned char b) |
| 789 | { |
| 790 | return (vector unsigned char)a & b; |
| 791 | } |
| 792 | |
| 793 | static vector unsigned char __ATTRS_o_ai |
| 794 | vec_vand(vector unsigned char a, vector bool char b) |
| 795 | { |
| 796 | return a & (vector unsigned char)b; |
| 797 | } |
| 798 | |
| 799 | static vector bool char __ATTRS_o_ai |
| 800 | vec_vand(vector bool char a, vector bool char b) |
| 801 | { |
| 802 | return a & b; |
| 803 | } |
| 804 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 805 | static vector short __ATTRS_o_ai |
| 806 | vec_vand(vector short a, vector short b) |
| 807 | { |
| 808 | return a & b; |
| 809 | } |
| 810 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 811 | static vector short __ATTRS_o_ai |
| 812 | vec_vand(vector bool short a, vector short b) |
| 813 | { |
| 814 | return (vector short)a & b; |
| 815 | } |
| 816 | |
| 817 | static vector short __ATTRS_o_ai |
| 818 | vec_vand(vector short a, vector bool short b) |
| 819 | { |
| 820 | return a & (vector short)b; |
| 821 | } |
| 822 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 823 | static vector unsigned short __ATTRS_o_ai |
| 824 | vec_vand(vector unsigned short a, vector unsigned short b) |
| 825 | { |
| 826 | return a & b; |
| 827 | } |
| 828 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 829 | static vector unsigned short __ATTRS_o_ai |
| 830 | vec_vand(vector bool short a, vector unsigned short b) |
| 831 | { |
| 832 | return (vector unsigned short)a & b; |
| 833 | } |
| 834 | |
| 835 | static vector unsigned short __ATTRS_o_ai |
| 836 | vec_vand(vector unsigned short a, vector bool short b) |
| 837 | { |
| 838 | return a & (vector unsigned short)b; |
| 839 | } |
| 840 | |
| 841 | static vector bool short __ATTRS_o_ai |
| 842 | vec_vand(vector bool short a, vector bool short b) |
| 843 | { |
| 844 | return a & b; |
| 845 | } |
| 846 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 847 | static vector int __ATTRS_o_ai |
| 848 | vec_vand(vector int a, vector int b) |
| 849 | { |
| 850 | return a & b; |
| 851 | } |
| 852 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 853 | static vector int __ATTRS_o_ai |
| 854 | vec_vand(vector bool int a, vector int b) |
| 855 | { |
| 856 | return (vector int)a & b; |
| 857 | } |
| 858 | |
| 859 | static vector int __ATTRS_o_ai |
| 860 | vec_vand(vector int a, vector bool int b) |
| 861 | { |
| 862 | return a & (vector int)b; |
| 863 | } |
| 864 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 865 | static vector unsigned int __ATTRS_o_ai |
| 866 | vec_vand(vector unsigned int a, vector unsigned int b) |
| 867 | { |
| 868 | return a & b; |
| 869 | } |
| 870 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 871 | static vector unsigned int __ATTRS_o_ai |
| 872 | vec_vand(vector bool int a, vector unsigned int b) |
| 873 | { |
| 874 | return (vector unsigned int)a & b; |
| 875 | } |
| 876 | |
| 877 | static vector unsigned int __ATTRS_o_ai |
| 878 | vec_vand(vector unsigned int a, vector bool int b) |
| 879 | { |
| 880 | return a & (vector unsigned int)b; |
| 881 | } |
| 882 | |
| 883 | static vector bool int __ATTRS_o_ai |
| 884 | vec_vand(vector bool int a, vector bool int b) |
| 885 | { |
| 886 | return a & b; |
| 887 | } |
| 888 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 889 | static vector float __ATTRS_o_ai |
| 890 | vec_vand(vector float a, vector float b) |
| 891 | { |
| 892 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 893 | return (vector float)res; |
| 894 | } |
| 895 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 896 | static vector float __ATTRS_o_ai |
| 897 | vec_vand(vector bool int a, vector float b) |
| 898 | { |
| 899 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 900 | return (vector float)res; |
| 901 | } |
| 902 | |
| 903 | static vector float __ATTRS_o_ai |
| 904 | vec_vand(vector float a, vector bool int b) |
| 905 | { |
| 906 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 907 | return (vector float)res; |
| 908 | } |
| 909 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 910 | /* vec_andc */ |
| 911 | |
| 912 | #define __builtin_altivec_vandc vec_andc |
| 913 | |
| 914 | static vector signed char __ATTRS_o_ai |
| 915 | vec_andc(vector signed char a, vector signed char b) |
| 916 | { |
| 917 | return a & ~b; |
| 918 | } |
| 919 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 920 | static vector signed char __ATTRS_o_ai |
| 921 | vec_andc(vector bool char a, vector signed char b) |
| 922 | { |
| 923 | return (vector signed char)a & ~b; |
| 924 | } |
| 925 | |
| 926 | static vector signed char __ATTRS_o_ai |
| 927 | vec_andc(vector signed char a, vector bool char b) |
| 928 | { |
| 929 | return a & ~(vector signed char)b; |
| 930 | } |
| 931 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 932 | static vector unsigned char __ATTRS_o_ai |
| 933 | vec_andc(vector unsigned char a, vector unsigned char b) |
| 934 | { |
| 935 | return a & ~b; |
| 936 | } |
| 937 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 938 | static vector unsigned char __ATTRS_o_ai |
| 939 | vec_andc(vector bool char a, vector unsigned char b) |
| 940 | { |
| 941 | return (vector unsigned char)a & ~b; |
| 942 | } |
| 943 | |
| 944 | static vector unsigned char __ATTRS_o_ai |
| 945 | vec_andc(vector unsigned char a, vector bool char b) |
| 946 | { |
| 947 | return a & ~(vector unsigned char)b; |
| 948 | } |
| 949 | |
| 950 | static vector bool char __ATTRS_o_ai |
| 951 | vec_andc(vector bool char a, vector bool char b) |
| 952 | { |
| 953 | return a & ~b; |
| 954 | } |
| 955 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 956 | static vector short __ATTRS_o_ai |
| 957 | vec_andc(vector short a, vector short b) |
| 958 | { |
| 959 | return a & ~b; |
| 960 | } |
| 961 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 962 | static vector short __ATTRS_o_ai |
| 963 | vec_andc(vector bool short a, vector short b) |
| 964 | { |
| 965 | return (vector short)a & ~b; |
| 966 | } |
| 967 | |
| 968 | static vector short __ATTRS_o_ai |
| 969 | vec_andc(vector short a, vector bool short b) |
| 970 | { |
| 971 | return a & ~(vector short)b; |
| 972 | } |
| 973 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 974 | static vector unsigned short __ATTRS_o_ai |
| 975 | vec_andc(vector unsigned short a, vector unsigned short b) |
| 976 | { |
| 977 | return a & ~b; |
| 978 | } |
| 979 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 980 | static vector unsigned short __ATTRS_o_ai |
| 981 | vec_andc(vector bool short a, vector unsigned short b) |
| 982 | { |
| 983 | return (vector unsigned short)a & ~b; |
| 984 | } |
| 985 | |
| 986 | static vector unsigned short __ATTRS_o_ai |
| 987 | vec_andc(vector unsigned short a, vector bool short b) |
| 988 | { |
| 989 | return a & ~(vector unsigned short)b; |
| 990 | } |
| 991 | |
| 992 | static vector bool short __ATTRS_o_ai |
| 993 | vec_andc(vector bool short a, vector bool short b) |
| 994 | { |
| 995 | return a & ~b; |
| 996 | } |
| 997 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 998 | static vector int __ATTRS_o_ai |
| 999 | vec_andc(vector int a, vector int b) |
| 1000 | { |
| 1001 | return a & ~b; |
| 1002 | } |
| 1003 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1004 | static vector int __ATTRS_o_ai |
| 1005 | vec_andc(vector bool int a, vector int b) |
| 1006 | { |
| 1007 | return (vector int)a & ~b; |
| 1008 | } |
| 1009 | |
| 1010 | static vector int __ATTRS_o_ai |
| 1011 | vec_andc(vector int a, vector bool int b) |
| 1012 | { |
| 1013 | return a & ~(vector int)b; |
| 1014 | } |
| 1015 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1016 | static vector unsigned int __ATTRS_o_ai |
| 1017 | vec_andc(vector unsigned int a, vector unsigned int b) |
| 1018 | { |
| 1019 | return a & ~b; |
| 1020 | } |
| 1021 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1022 | static vector unsigned int __ATTRS_o_ai |
| 1023 | vec_andc(vector bool int a, vector unsigned int b) |
| 1024 | { |
| 1025 | return (vector unsigned int)a & ~b; |
| 1026 | } |
| 1027 | |
| 1028 | static vector unsigned int __ATTRS_o_ai |
| 1029 | vec_andc(vector unsigned int a, vector bool int b) |
| 1030 | { |
| 1031 | return a & ~(vector unsigned int)b; |
| 1032 | } |
| 1033 | |
| 1034 | static vector bool int __ATTRS_o_ai |
| 1035 | vec_andc(vector bool int a, vector bool int b) |
| 1036 | { |
| 1037 | return a & ~b; |
| 1038 | } |
| 1039 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1040 | static vector float __ATTRS_o_ai |
| 1041 | vec_andc(vector float a, vector float b) |
| 1042 | { |
| 1043 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1044 | return (vector float)res; |
| 1045 | } |
| 1046 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1047 | static vector float __ATTRS_o_ai |
| 1048 | vec_andc(vector bool int a, vector float b) |
| 1049 | { |
| 1050 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1051 | return (vector float)res; |
| 1052 | } |
| 1053 | |
| 1054 | static vector float __ATTRS_o_ai |
| 1055 | vec_andc(vector float a, vector bool int b) |
| 1056 | { |
| 1057 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1058 | return (vector float)res; |
| 1059 | } |
| 1060 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1061 | /* vec_vandc */ |
| 1062 | |
| 1063 | static vector signed char __ATTRS_o_ai |
| 1064 | vec_vandc(vector signed char a, vector signed char b) |
| 1065 | { |
| 1066 | return a & ~b; |
| 1067 | } |
| 1068 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1069 | static vector signed char __ATTRS_o_ai |
| 1070 | vec_vandc(vector bool char a, vector signed char b) |
| 1071 | { |
| 1072 | return (vector signed char)a & ~b; |
| 1073 | } |
| 1074 | |
| 1075 | static vector signed char __ATTRS_o_ai |
| 1076 | vec_vandc(vector signed char a, vector bool char b) |
| 1077 | { |
| 1078 | return a & ~(vector signed char)b; |
| 1079 | } |
| 1080 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1081 | static vector unsigned char __ATTRS_o_ai |
| 1082 | vec_vandc(vector unsigned char a, vector unsigned char b) |
| 1083 | { |
| 1084 | return a & ~b; |
| 1085 | } |
| 1086 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1087 | static vector unsigned char __ATTRS_o_ai |
| 1088 | vec_vandc(vector bool char a, vector unsigned char b) |
| 1089 | { |
| 1090 | return (vector unsigned char)a & ~b; |
| 1091 | } |
| 1092 | |
| 1093 | static vector unsigned char __ATTRS_o_ai |
| 1094 | vec_vandc(vector unsigned char a, vector bool char b) |
| 1095 | { |
| 1096 | return a & ~(vector unsigned char)b; |
| 1097 | } |
| 1098 | |
| 1099 | static vector bool char __ATTRS_o_ai |
| 1100 | vec_vandc(vector bool char a, vector bool char b) |
| 1101 | { |
| 1102 | return a & ~b; |
| 1103 | } |
| 1104 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1105 | static vector short __ATTRS_o_ai |
| 1106 | vec_vandc(vector short a, vector short b) |
| 1107 | { |
| 1108 | return a & ~b; |
| 1109 | } |
| 1110 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1111 | static vector short __ATTRS_o_ai |
| 1112 | vec_vandc(vector bool short a, vector short b) |
| 1113 | { |
| 1114 | return (vector short)a & ~b; |
| 1115 | } |
| 1116 | |
| 1117 | static vector short __ATTRS_o_ai |
| 1118 | vec_vandc(vector short a, vector bool short b) |
| 1119 | { |
| 1120 | return a & ~(vector short)b; |
| 1121 | } |
| 1122 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1123 | static vector unsigned short __ATTRS_o_ai |
| 1124 | vec_vandc(vector unsigned short a, vector unsigned short b) |
| 1125 | { |
| 1126 | return a & ~b; |
| 1127 | } |
| 1128 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1129 | static vector unsigned short __ATTRS_o_ai |
| 1130 | vec_vandc(vector bool short a, vector unsigned short b) |
| 1131 | { |
| 1132 | return (vector unsigned short)a & ~b; |
| 1133 | } |
| 1134 | |
| 1135 | static vector unsigned short __ATTRS_o_ai |
| 1136 | vec_vandc(vector unsigned short a, vector bool short b) |
| 1137 | { |
| 1138 | return a & ~(vector unsigned short)b; |
| 1139 | } |
| 1140 | |
| 1141 | static vector bool short __ATTRS_o_ai |
| 1142 | vec_vandc(vector bool short a, vector bool short b) |
| 1143 | { |
| 1144 | return a & ~b; |
| 1145 | } |
| 1146 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1147 | static vector int __ATTRS_o_ai |
| 1148 | vec_vandc(vector int a, vector int b) |
| 1149 | { |
| 1150 | return a & ~b; |
| 1151 | } |
| 1152 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1153 | static vector int __ATTRS_o_ai |
| 1154 | vec_vandc(vector bool int a, vector int b) |
| 1155 | { |
| 1156 | return (vector int)a & ~b; |
| 1157 | } |
| 1158 | |
| 1159 | static vector int __ATTRS_o_ai |
| 1160 | vec_vandc(vector int a, vector bool int b) |
| 1161 | { |
| 1162 | return a & ~(vector int)b; |
| 1163 | } |
| 1164 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1165 | static vector unsigned int __ATTRS_o_ai |
| 1166 | vec_vandc(vector unsigned int a, vector unsigned int b) |
| 1167 | { |
| 1168 | return a & ~b; |
| 1169 | } |
| 1170 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1171 | static vector unsigned int __ATTRS_o_ai |
| 1172 | vec_vandc(vector bool int a, vector unsigned int b) |
| 1173 | { |
| 1174 | return (vector unsigned int)a & ~b; |
| 1175 | } |
| 1176 | |
| 1177 | static vector unsigned int __ATTRS_o_ai |
| 1178 | vec_vandc(vector unsigned int a, vector bool int b) |
| 1179 | { |
| 1180 | return a & ~(vector unsigned int)b; |
| 1181 | } |
| 1182 | |
| 1183 | static vector bool int __ATTRS_o_ai |
| 1184 | vec_vandc(vector bool int a, vector bool int b) |
| 1185 | { |
| 1186 | return a & ~b; |
| 1187 | } |
| 1188 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1189 | static vector float __ATTRS_o_ai |
| 1190 | vec_vandc(vector float a, vector float b) |
| 1191 | { |
| 1192 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1193 | return (vector float)res; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1194 | } |
| 1195 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1196 | static vector float __ATTRS_o_ai |
| 1197 | vec_vandc(vector bool int a, vector float b) |
| 1198 | { |
| 1199 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1200 | return (vector float)res; |
| 1201 | } |
| 1202 | |
| 1203 | static vector float __ATTRS_o_ai |
| 1204 | vec_vandc(vector float a, vector bool int b) |
| 1205 | { |
| 1206 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1207 | return (vector float)res; |
| 1208 | } |
| 1209 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1210 | /* vec_avg */ |
| 1211 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1212 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1213 | vec_avg(vector signed char a, vector signed char b) |
| 1214 | { |
| 1215 | return __builtin_altivec_vavgsb(a, b); |
| 1216 | } |
| 1217 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1218 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1219 | vec_avg(vector unsigned char a, vector unsigned char b) |
| 1220 | { |
| 1221 | return __builtin_altivec_vavgub(a, b); |
| 1222 | } |
| 1223 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1224 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1225 | vec_avg(vector short a, vector short b) |
| 1226 | { |
| 1227 | return __builtin_altivec_vavgsh(a, b); |
| 1228 | } |
| 1229 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1230 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1231 | vec_avg(vector unsigned short a, vector unsigned short b) |
| 1232 | { |
| 1233 | return __builtin_altivec_vavguh(a, b); |
| 1234 | } |
| 1235 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1236 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1237 | vec_avg(vector int a, vector int b) |
| 1238 | { |
| 1239 | return __builtin_altivec_vavgsw(a, b); |
| 1240 | } |
| 1241 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1242 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1243 | vec_avg(vector unsigned int a, vector unsigned int b) |
| 1244 | { |
| 1245 | return __builtin_altivec_vavguw(a, b); |
| 1246 | } |
| 1247 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1248 | /* vec_vavgsb */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1249 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1250 | static vector signed char __attribute__((__always_inline__)) |
| 1251 | vec_vavgsb(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1252 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1253 | return __builtin_altivec_vavgsb(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1254 | } |
| 1255 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1256 | /* vec_vavgub */ |
| 1257 | |
| 1258 | static vector unsigned char __attribute__((__always_inline__)) |
| 1259 | vec_vavgub(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1260 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1261 | return __builtin_altivec_vavgub(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1262 | } |
| 1263 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1264 | /* vec_vavgsh */ |
| 1265 | |
| 1266 | static vector short __attribute__((__always_inline__)) |
| 1267 | vec_vavgsh(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1268 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1269 | return __builtin_altivec_vavgsh(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1270 | } |
| 1271 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1272 | /* vec_vavguh */ |
| 1273 | |
| 1274 | static vector unsigned short __attribute__((__always_inline__)) |
| 1275 | vec_vavguh(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1276 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1277 | return __builtin_altivec_vavguh(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1278 | } |
| 1279 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1280 | /* vec_vavgsw */ |
| 1281 | |
| 1282 | static vector int __attribute__((__always_inline__)) |
| 1283 | vec_vavgsw(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1284 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1285 | return __builtin_altivec_vavgsw(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1286 | } |
| 1287 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1288 | /* vec_vavguw */ |
| 1289 | |
| 1290 | static vector unsigned int __attribute__((__always_inline__)) |
| 1291 | vec_vavguw(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1292 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1293 | return __builtin_altivec_vavguw(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1294 | } |
| 1295 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1296 | /* vec_ceil */ |
| 1297 | |
| 1298 | static vector float __attribute__((__always_inline__)) |
| 1299 | vec_ceil(vector float a) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1300 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1301 | return __builtin_altivec_vrfip(a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1302 | } |
| 1303 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1304 | /* vec_vrfip */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1305 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1306 | static vector float __attribute__((__always_inline__)) |
| 1307 | vec_vrfip(vector float a) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1308 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1309 | return __builtin_altivec_vrfip(a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1310 | } |
| 1311 | |
| 1312 | /* vec_cmpb */ |
| 1313 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1314 | static vector int __attribute__((__always_inline__)) |
| 1315 | vec_cmpb(vector float a, vector float b) |
| 1316 | { |
| 1317 | return __builtin_altivec_vcmpbfp(a, b); |
| 1318 | } |
| 1319 | |
| 1320 | /* vec_vcmpbfp */ |
| 1321 | |
| 1322 | static vector int __attribute__((__always_inline__)) |
| 1323 | vec_vcmpbfp(vector float a, vector float b) |
| 1324 | { |
| 1325 | return __builtin_altivec_vcmpbfp(a, b); |
| 1326 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1327 | |
| 1328 | /* vec_cmpeq */ |
| 1329 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1330 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1331 | vec_cmpeq(vector signed char a, vector signed char b) |
| 1332 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1333 | return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1334 | } |
| 1335 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1336 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1337 | vec_cmpeq(vector unsigned char a, vector unsigned char b) |
| 1338 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1339 | return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1340 | } |
| 1341 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1342 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1343 | vec_cmpeq(vector short a, vector short b) |
| 1344 | { |
| 1345 | return __builtin_altivec_vcmpequh(a, b); |
| 1346 | } |
| 1347 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1348 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1349 | vec_cmpeq(vector unsigned short a, vector unsigned short b) |
| 1350 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1351 | return __builtin_altivec_vcmpequh((vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1352 | } |
| 1353 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1354 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1355 | vec_cmpeq(vector int a, vector int b) |
| 1356 | { |
| 1357 | return __builtin_altivec_vcmpequw(a, b); |
| 1358 | } |
| 1359 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1360 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1361 | vec_cmpeq(vector unsigned int a, vector unsigned int b) |
| 1362 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1363 | return __builtin_altivec_vcmpequw((vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1364 | } |
| 1365 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1366 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1367 | vec_cmpeq(vector float a, vector float b) |
| 1368 | { |
| 1369 | return __builtin_altivec_vcmpeqfp(a, b); |
| 1370 | } |
| 1371 | |
| 1372 | /* vec_cmpge */ |
| 1373 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1374 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1375 | vec_cmpge(vector float a, vector float b) |
| 1376 | { |
| 1377 | return __builtin_altivec_vcmpgefp(a, b); |
| 1378 | } |
| 1379 | |
| 1380 | /* vec_vcmpgefp */ |
| 1381 | |
| 1382 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1383 | vec_vcmpgefp(vector float a, vector float b) |
| 1384 | { |
| 1385 | return __builtin_altivec_vcmpgefp(a, b); |
| 1386 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1387 | |
| 1388 | /* vec_cmpgt */ |
| 1389 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1390 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1391 | vec_cmpgt(vector signed char a, vector signed char b) |
| 1392 | { |
| 1393 | return __builtin_altivec_vcmpgtsb(a, b); |
| 1394 | } |
| 1395 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1396 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1397 | vec_cmpgt(vector unsigned char a, vector unsigned char b) |
| 1398 | { |
| 1399 | return __builtin_altivec_vcmpgtub(a, b); |
| 1400 | } |
| 1401 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1402 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1403 | vec_cmpgt(vector short a, vector short b) |
| 1404 | { |
| 1405 | return __builtin_altivec_vcmpgtsh(a, b); |
| 1406 | } |
| 1407 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1408 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1409 | vec_cmpgt(vector unsigned short a, vector unsigned short b) |
| 1410 | { |
| 1411 | return __builtin_altivec_vcmpgtuh(a, b); |
| 1412 | } |
| 1413 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1414 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1415 | vec_cmpgt(vector int a, vector int b) |
| 1416 | { |
| 1417 | return __builtin_altivec_vcmpgtsw(a, b); |
| 1418 | } |
| 1419 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1420 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1421 | vec_cmpgt(vector unsigned int a, vector unsigned int b) |
| 1422 | { |
| 1423 | return __builtin_altivec_vcmpgtuw(a, b); |
| 1424 | } |
| 1425 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1426 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1427 | vec_cmpgt(vector float a, vector float b) |
| 1428 | { |
| 1429 | return __builtin_altivec_vcmpgtfp(a, b); |
| 1430 | } |
| 1431 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1432 | /* vec_vcmpgtsb */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1433 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1434 | static vector /*bool*/ char __attribute__((__always_inline__)) |
| 1435 | vec_vcmpgtsb(vector signed char a, vector signed char b) |
| 1436 | { |
| 1437 | return __builtin_altivec_vcmpgtsb(a, b); |
| 1438 | } |
| 1439 | |
| 1440 | /* vec_vcmpgtub */ |
| 1441 | |
| 1442 | static vector /*bool*/ char __attribute__((__always_inline__)) |
| 1443 | vec_vcmpgtub(vector unsigned char a, vector unsigned char b) |
| 1444 | { |
| 1445 | return __builtin_altivec_vcmpgtub(a, b); |
| 1446 | } |
| 1447 | |
| 1448 | /* vec_vcmpgtsh */ |
| 1449 | |
| 1450 | static vector /*bool*/ short __attribute__((__always_inline__)) |
| 1451 | vec_vcmpgtsh(vector short a, vector short b) |
| 1452 | { |
| 1453 | return __builtin_altivec_vcmpgtsh(a, b); |
| 1454 | } |
| 1455 | |
| 1456 | /* vec_vcmpgtuh */ |
| 1457 | |
| 1458 | static vector /*bool*/ short __attribute__((__always_inline__)) |
| 1459 | vec_vcmpgtuh(vector unsigned short a, vector unsigned short b) |
| 1460 | { |
| 1461 | return __builtin_altivec_vcmpgtuh(a, b); |
| 1462 | } |
| 1463 | |
| 1464 | /* vec_vcmpgtsw */ |
| 1465 | |
| 1466 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1467 | vec_vcmpgtsw(vector int a, vector int b) |
| 1468 | { |
| 1469 | return __builtin_altivec_vcmpgtsw(a, b); |
| 1470 | } |
| 1471 | |
| 1472 | /* vec_vcmpgtuw */ |
| 1473 | |
| 1474 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1475 | vec_vcmpgtuw(vector unsigned int a, vector unsigned int b) |
| 1476 | { |
| 1477 | return __builtin_altivec_vcmpgtuw(a, b); |
| 1478 | } |
| 1479 | |
| 1480 | /* vec_vcmpgtfp */ |
| 1481 | |
| 1482 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1483 | vec_vcmpgtfp(vector float a, vector float b) |
| 1484 | { |
| 1485 | return __builtin_altivec_vcmpgtfp(a, b); |
| 1486 | } |
| 1487 | |
| 1488 | /* vec_cmple */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1489 | |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1490 | static vector /*bool*/ int __attribute__((__always_inline__)) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1491 | vec_cmple(vector float a, vector float b) |
| 1492 | { |
| 1493 | return __builtin_altivec_vcmpgefp(b, a); |
| 1494 | } |
| 1495 | |
| 1496 | /* vec_cmplt */ |
| 1497 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1498 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1499 | vec_cmplt(vector signed char a, vector signed char b) |
| 1500 | { |
| 1501 | return __builtin_altivec_vcmpgtsb(b, a); |
| 1502 | } |
| 1503 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1504 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1505 | vec_cmplt(vector unsigned char a, vector unsigned char b) |
| 1506 | { |
| 1507 | return __builtin_altivec_vcmpgtub(b, a); |
| 1508 | } |
| 1509 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1510 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1511 | vec_cmplt(vector short a, vector short b) |
| 1512 | { |
| 1513 | return __builtin_altivec_vcmpgtsh(b, a); |
| 1514 | } |
| 1515 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1516 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1517 | vec_cmplt(vector unsigned short a, vector unsigned short b) |
| 1518 | { |
| 1519 | return __builtin_altivec_vcmpgtuh(b, a); |
| 1520 | } |
| 1521 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1522 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1523 | vec_cmplt(vector int a, vector int b) |
| 1524 | { |
| 1525 | return __builtin_altivec_vcmpgtsw(b, a); |
| 1526 | } |
| 1527 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1528 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1529 | vec_cmplt(vector unsigned int a, vector unsigned int b) |
| 1530 | { |
| 1531 | return __builtin_altivec_vcmpgtuw(b, a); |
| 1532 | } |
| 1533 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1534 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1535 | vec_cmplt(vector float a, vector float b) |
| 1536 | { |
| 1537 | return __builtin_altivec_vcmpgtfp(b, a); |
| 1538 | } |
| 1539 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1540 | /* vec_ctf */ |
| 1541 | |
| 1542 | static vector float __ATTRS_o_ai |
| 1543 | vec_ctf(vector int a, int b) |
| 1544 | { |
| 1545 | return __builtin_altivec_vcfsx(a, b); |
| 1546 | } |
| 1547 | |
| 1548 | static vector float __ATTRS_o_ai |
| 1549 | vec_ctf(vector unsigned int a, int b) |
| 1550 | { |
| 1551 | return __builtin_altivec_vcfux((vector int)a, b); |
| 1552 | } |
| 1553 | |
| 1554 | /* vec_vcfsx */ |
| 1555 | |
| 1556 | static vector float __attribute__((__always_inline__)) |
| 1557 | vec_vcfsx(vector int a, int b) |
| 1558 | { |
| 1559 | return __builtin_altivec_vcfsx(a, b); |
| 1560 | } |
| 1561 | |
| 1562 | /* vec_vcfux */ |
| 1563 | |
| 1564 | static vector float __attribute__((__always_inline__)) |
| 1565 | vec_vcfux(vector unsigned int a, int b) |
| 1566 | { |
| 1567 | return __builtin_altivec_vcfux((vector int)a, b); |
| 1568 | } |
| 1569 | |
| 1570 | /* vec_cts */ |
| 1571 | |
| 1572 | static vector int __attribute__((__always_inline__)) |
| 1573 | vec_cts(vector float a, int b) |
| 1574 | { |
| 1575 | return __builtin_altivec_vctsxs(a, b); |
| 1576 | } |
| 1577 | |
| 1578 | /* vec_vctsxs */ |
| 1579 | |
| 1580 | static vector int __attribute__((__always_inline__)) |
| 1581 | vec_vctsxs(vector float a, int b) |
| 1582 | { |
| 1583 | return __builtin_altivec_vctsxs(a, b); |
| 1584 | } |
| 1585 | |
| 1586 | /* vec_ctu */ |
| 1587 | |
| 1588 | static vector unsigned int __attribute__((__always_inline__)) |
| 1589 | vec_ctu(vector float a, int b) |
| 1590 | { |
| 1591 | return __builtin_altivec_vctuxs(a, b); |
| 1592 | } |
| 1593 | |
| 1594 | /* vec_vctuxs */ |
| 1595 | |
| 1596 | static vector unsigned int __attribute__((__always_inline__)) |
| 1597 | vec_vctuxs(vector float a, int b) |
| 1598 | { |
| 1599 | return __builtin_altivec_vctuxs(a, b); |
| 1600 | } |
| 1601 | |
| 1602 | /* vec_dss */ |
| 1603 | |
| 1604 | static void __attribute__((__always_inline__)) |
| 1605 | vec_dss(int a) |
| 1606 | { |
| 1607 | __builtin_altivec_dss(a); |
| 1608 | } |
| 1609 | |
| 1610 | /* vec_dssall */ |
| 1611 | |
| 1612 | static void __attribute__((__always_inline__)) |
| 1613 | vec_dssall(void) |
| 1614 | { |
| 1615 | __builtin_altivec_dssall(); |
| 1616 | } |
| 1617 | |
| 1618 | /* vec_dst */ |
| 1619 | |
| 1620 | static void __attribute__((__always_inline__)) |
| 1621 | vec_dst(void *a, int b, int c) |
| 1622 | { |
| 1623 | __builtin_altivec_dst(a, b, c); |
| 1624 | } |
| 1625 | |
| 1626 | /* vec_dstst */ |
| 1627 | |
| 1628 | static void __attribute__((__always_inline__)) |
| 1629 | vec_dstst(void *a, int b, int c) |
| 1630 | { |
| 1631 | __builtin_altivec_dstst(a, b, c); |
| 1632 | } |
| 1633 | |
| 1634 | /* vec_dststt */ |
| 1635 | |
| 1636 | static void __attribute__((__always_inline__)) |
| 1637 | vec_dststt(void *a, int b, int c) |
| 1638 | { |
| 1639 | __builtin_altivec_dststt(a, b, c); |
| 1640 | } |
| 1641 | |
| 1642 | /* vec_dstt */ |
| 1643 | |
| 1644 | static void __attribute__((__always_inline__)) |
| 1645 | vec_dstt(void *a, int b, int c) |
| 1646 | { |
| 1647 | __builtin_altivec_dstt(a, b, c); |
| 1648 | } |
| 1649 | |
| 1650 | /* vec_expte */ |
| 1651 | |
| 1652 | static vector float __attribute__((__always_inline__)) |
| 1653 | vec_expte(vector float a) |
| 1654 | { |
| 1655 | return __builtin_altivec_vexptefp(a); |
| 1656 | } |
| 1657 | |
| 1658 | /* vec_vexptefp */ |
| 1659 | |
| 1660 | static vector float __attribute__((__always_inline__)) |
| 1661 | vec_vexptefp(vector float a) |
| 1662 | { |
| 1663 | return __builtin_altivec_vexptefp(a); |
| 1664 | } |
| 1665 | |
| 1666 | /* vec_floor */ |
| 1667 | |
| 1668 | static vector float __attribute__((__always_inline__)) |
| 1669 | vec_floor(vector float a) |
| 1670 | { |
| 1671 | return __builtin_altivec_vrfim(a); |
| 1672 | } |
| 1673 | |
| 1674 | /* vec_vrfim */ |
| 1675 | |
| 1676 | static vector float __attribute__((__always_inline__)) |
| 1677 | vec_vrfim(vector float a) |
| 1678 | { |
| 1679 | return __builtin_altivec_vrfim(a); |
| 1680 | } |
| 1681 | |
| 1682 | /* vec_ld */ |
| 1683 | |
| 1684 | static vector signed char __ATTRS_o_ai |
| 1685 | vec_ld(int a, vector signed char *b) |
| 1686 | { |
| 1687 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1688 | } |
| 1689 | |
| 1690 | static vector signed char __ATTRS_o_ai |
| 1691 | vec_ld(int a, signed char *b) |
| 1692 | { |
| 1693 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1694 | } |
| 1695 | |
| 1696 | static vector unsigned char __ATTRS_o_ai |
| 1697 | vec_ld(int a, vector unsigned char *b) |
| 1698 | { |
| 1699 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1700 | } |
| 1701 | |
| 1702 | static vector unsigned char __ATTRS_o_ai |
| 1703 | vec_ld(int a, unsigned char *b) |
| 1704 | { |
| 1705 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1706 | } |
| 1707 | |
| 1708 | static vector short __ATTRS_o_ai |
| 1709 | vec_ld(int a, vector short *b) |
| 1710 | { |
| 1711 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1712 | } |
| 1713 | |
| 1714 | static vector short __ATTRS_o_ai |
| 1715 | vec_ld(int a, short *b) |
| 1716 | { |
| 1717 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1718 | } |
| 1719 | |
| 1720 | static vector unsigned short __ATTRS_o_ai |
| 1721 | vec_ld(int a, vector unsigned short *b) |
| 1722 | { |
| 1723 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1724 | } |
| 1725 | |
| 1726 | static vector unsigned short __ATTRS_o_ai |
| 1727 | vec_ld(int a, unsigned short *b) |
| 1728 | { |
| 1729 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1730 | } |
| 1731 | |
| 1732 | static vector int __ATTRS_o_ai |
| 1733 | vec_ld(int a, vector int *b) |
| 1734 | { |
| 1735 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1736 | } |
| 1737 | |
| 1738 | static vector int __ATTRS_o_ai |
| 1739 | vec_ld(int a, int *b) |
| 1740 | { |
| 1741 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1742 | } |
| 1743 | |
| 1744 | static vector unsigned int __ATTRS_o_ai |
| 1745 | vec_ld(int a, vector unsigned int *b) |
| 1746 | { |
| 1747 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1748 | } |
| 1749 | |
| 1750 | static vector unsigned int __ATTRS_o_ai |
| 1751 | vec_ld(int a, unsigned int *b) |
| 1752 | { |
| 1753 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1754 | } |
| 1755 | |
| 1756 | static vector float __ATTRS_o_ai |
| 1757 | vec_ld(int a, vector float *b) |
| 1758 | { |
| 1759 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1760 | } |
| 1761 | |
| 1762 | static vector float __ATTRS_o_ai |
| 1763 | vec_ld(int a, float *b) |
| 1764 | { |
| 1765 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1766 | } |
| 1767 | |
| 1768 | /* vec_lvx */ |
| 1769 | |
| 1770 | static vector signed char __ATTRS_o_ai |
| 1771 | vec_lvx(int a, vector signed char *b) |
| 1772 | { |
| 1773 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1774 | } |
| 1775 | |
| 1776 | static vector signed char __ATTRS_o_ai |
| 1777 | vec_lvx(int a, signed char *b) |
| 1778 | { |
| 1779 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1780 | } |
| 1781 | |
| 1782 | static vector unsigned char __ATTRS_o_ai |
| 1783 | vec_lvx(int a, vector unsigned char *b) |
| 1784 | { |
| 1785 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1786 | } |
| 1787 | |
| 1788 | static vector unsigned char __ATTRS_o_ai |
| 1789 | vec_lvx(int a, unsigned char *b) |
| 1790 | { |
| 1791 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1792 | } |
| 1793 | |
| 1794 | static vector short __ATTRS_o_ai |
| 1795 | vec_lvx(int a, vector short *b) |
| 1796 | { |
| 1797 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1798 | } |
| 1799 | |
| 1800 | static vector short __ATTRS_o_ai |
| 1801 | vec_lvx(int a, short *b) |
| 1802 | { |
| 1803 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1804 | } |
| 1805 | |
| 1806 | static vector unsigned short __ATTRS_o_ai |
| 1807 | vec_lvx(int a, vector unsigned short *b) |
| 1808 | { |
| 1809 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1810 | } |
| 1811 | |
| 1812 | static vector unsigned short __ATTRS_o_ai |
| 1813 | vec_lvx(int a, unsigned short *b) |
| 1814 | { |
| 1815 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1816 | } |
| 1817 | |
| 1818 | static vector int __ATTRS_o_ai |
| 1819 | vec_lvx(int a, vector int *b) |
| 1820 | { |
| 1821 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1822 | } |
| 1823 | |
| 1824 | static vector int __ATTRS_o_ai |
| 1825 | vec_lvx(int a, int *b) |
| 1826 | { |
| 1827 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1828 | } |
| 1829 | |
| 1830 | static vector unsigned int __ATTRS_o_ai |
| 1831 | vec_lvx(int a, vector unsigned int *b) |
| 1832 | { |
| 1833 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1834 | } |
| 1835 | |
| 1836 | static vector unsigned int __ATTRS_o_ai |
| 1837 | vec_lvx(int a, unsigned int *b) |
| 1838 | { |
| 1839 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1840 | } |
| 1841 | |
| 1842 | static vector float __ATTRS_o_ai |
| 1843 | vec_lvx(int a, vector float *b) |
| 1844 | { |
| 1845 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1846 | } |
| 1847 | |
| 1848 | static vector float __ATTRS_o_ai |
| 1849 | vec_lvx(int a, float *b) |
| 1850 | { |
| 1851 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1852 | } |
| 1853 | |
| 1854 | /* vec_lde */ |
| 1855 | |
| 1856 | static vector signed char __ATTRS_o_ai |
| 1857 | vec_lde(int a, vector signed char *b) |
| 1858 | { |
| 1859 | return (vector signed char)__builtin_altivec_lvebx(a, b); |
| 1860 | } |
| 1861 | |
| 1862 | static vector unsigned char __ATTRS_o_ai |
| 1863 | vec_lde(int a, vector unsigned char *b) |
| 1864 | { |
| 1865 | return (vector unsigned char)__builtin_altivec_lvebx(a, b); |
| 1866 | } |
| 1867 | |
| 1868 | static vector short __ATTRS_o_ai |
| 1869 | vec_lde(int a, vector short *b) |
| 1870 | { |
| 1871 | return (vector short)__builtin_altivec_lvehx(a, b); |
| 1872 | } |
| 1873 | |
| 1874 | static vector unsigned short __ATTRS_o_ai |
| 1875 | vec_lde(int a, vector unsigned short *b) |
| 1876 | { |
| 1877 | return (vector unsigned short)__builtin_altivec_lvehx(a, b); |
| 1878 | } |
| 1879 | |
| 1880 | static vector int __ATTRS_o_ai |
| 1881 | vec_lde(int a, vector int *b) |
| 1882 | { |
| 1883 | return (vector int)__builtin_altivec_lvewx(a, b); |
| 1884 | } |
| 1885 | |
| 1886 | static vector unsigned int __ATTRS_o_ai |
| 1887 | vec_lde(int a, vector unsigned int *b) |
| 1888 | { |
| 1889 | return (vector unsigned int)__builtin_altivec_lvewx(a, b); |
| 1890 | } |
| 1891 | |
| 1892 | static vector float __ATTRS_o_ai |
| 1893 | vec_lde(int a, vector float *b) |
| 1894 | { |
| 1895 | return (vector float)__builtin_altivec_lvewx(a, b); |
| 1896 | } |
| 1897 | |
| 1898 | /* vec_lvebx */ |
| 1899 | |
| 1900 | static vector signed char __ATTRS_o_ai |
| 1901 | vec_lvebx(int a, vector signed char *b) |
| 1902 | { |
| 1903 | return (vector signed char)__builtin_altivec_lvebx(a, b); |
| 1904 | } |
| 1905 | |
| 1906 | static vector unsigned char __ATTRS_o_ai |
| 1907 | vec_lvebx(int a, vector unsigned char *b) |
| 1908 | { |
| 1909 | return (vector unsigned char)__builtin_altivec_lvebx(a, b); |
| 1910 | } |
| 1911 | |
| 1912 | /* vec_lvehx */ |
| 1913 | |
| 1914 | static vector short __ATTRS_o_ai |
| 1915 | vec_lvehx(int a, vector short *b) |
| 1916 | { |
| 1917 | return (vector short)__builtin_altivec_lvehx(a, b); |
| 1918 | } |
| 1919 | |
| 1920 | static vector unsigned short __ATTRS_o_ai |
| 1921 | vec_lvehx(int a, vector unsigned short *b) |
| 1922 | { |
| 1923 | return (vector unsigned short)__builtin_altivec_lvehx(a, b); |
| 1924 | } |
| 1925 | |
| 1926 | /* vec_lvewx */ |
| 1927 | |
| 1928 | static vector int __ATTRS_o_ai |
| 1929 | vec_lvewx(int a, vector int *b) |
| 1930 | { |
| 1931 | return (vector int)__builtin_altivec_lvewx(a, b); |
| 1932 | } |
| 1933 | |
| 1934 | static vector unsigned int __ATTRS_o_ai |
| 1935 | vec_lvewx(int a, vector unsigned int *b) |
| 1936 | { |
| 1937 | return (vector unsigned int)__builtin_altivec_lvewx(a, b); |
| 1938 | } |
| 1939 | |
| 1940 | static vector float __ATTRS_o_ai |
| 1941 | vec_lvewx(int a, vector float *b) |
| 1942 | { |
| 1943 | return (vector float)__builtin_altivec_lvewx(a, b); |
| 1944 | } |
| 1945 | |
| 1946 | /* vec_ldl */ |
| 1947 | |
| 1948 | static vector signed char __ATTRS_o_ai |
| 1949 | vec_ldl(int a, vector signed char *b) |
| 1950 | { |
| 1951 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 1952 | } |
| 1953 | |
| 1954 | static vector signed char __ATTRS_o_ai |
| 1955 | vec_ldl(int a, signed char *b) |
| 1956 | { |
| 1957 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 1958 | } |
| 1959 | |
| 1960 | static vector unsigned char __ATTRS_o_ai |
| 1961 | vec_ldl(int a, vector unsigned char *b) |
| 1962 | { |
| 1963 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 1964 | } |
| 1965 | |
| 1966 | static vector unsigned char __ATTRS_o_ai |
| 1967 | vec_ldl(int a, unsigned char *b) |
| 1968 | { |
| 1969 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 1970 | } |
| 1971 | |
| 1972 | static vector short __ATTRS_o_ai |
| 1973 | vec_ldl(int a, vector short *b) |
| 1974 | { |
| 1975 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 1976 | } |
| 1977 | |
| 1978 | static vector short __ATTRS_o_ai |
| 1979 | vec_ldl(int a, short *b) |
| 1980 | { |
| 1981 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 1982 | } |
| 1983 | |
| 1984 | static vector unsigned short __ATTRS_o_ai |
| 1985 | vec_ldl(int a, vector unsigned short *b) |
| 1986 | { |
| 1987 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 1988 | } |
| 1989 | |
| 1990 | static vector unsigned short __ATTRS_o_ai |
| 1991 | vec_ldl(int a, unsigned short *b) |
| 1992 | { |
| 1993 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 1994 | } |
| 1995 | |
| 1996 | static vector int __ATTRS_o_ai |
| 1997 | vec_ldl(int a, vector int *b) |
| 1998 | { |
| 1999 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2000 | } |
| 2001 | |
| 2002 | static vector int __ATTRS_o_ai |
| 2003 | vec_ldl(int a, int *b) |
| 2004 | { |
| 2005 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2006 | } |
| 2007 | |
| 2008 | static vector unsigned int __ATTRS_o_ai |
| 2009 | vec_ldl(int a, vector unsigned int *b) |
| 2010 | { |
| 2011 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2012 | } |
| 2013 | |
| 2014 | static vector unsigned int __ATTRS_o_ai |
| 2015 | vec_ldl(int a, unsigned int *b) |
| 2016 | { |
| 2017 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2018 | } |
| 2019 | |
| 2020 | static vector float __ATTRS_o_ai |
| 2021 | vec_ldl(int a, vector float *b) |
| 2022 | { |
| 2023 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2024 | } |
| 2025 | |
| 2026 | static vector float __ATTRS_o_ai |
| 2027 | vec_ldl(int a, float *b) |
| 2028 | { |
| 2029 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2030 | } |
| 2031 | |
| 2032 | /* vec_lvxl */ |
| 2033 | |
| 2034 | static vector signed char __ATTRS_o_ai |
| 2035 | vec_lvxl(int a, vector signed char *b) |
| 2036 | { |
| 2037 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 2038 | } |
| 2039 | |
| 2040 | static vector signed char __ATTRS_o_ai |
| 2041 | vec_lvxl(int a, signed char *b) |
| 2042 | { |
| 2043 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 2044 | } |
| 2045 | |
| 2046 | static vector unsigned char __ATTRS_o_ai |
| 2047 | vec_lvxl(int a, vector unsigned char *b) |
| 2048 | { |
| 2049 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 2050 | } |
| 2051 | |
| 2052 | static vector unsigned char __ATTRS_o_ai |
| 2053 | vec_lvxl(int a, unsigned char *b) |
| 2054 | { |
| 2055 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 2056 | } |
| 2057 | |
| 2058 | static vector short __ATTRS_o_ai |
| 2059 | vec_lvxl(int a, vector short *b) |
| 2060 | { |
| 2061 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 2062 | } |
| 2063 | |
| 2064 | static vector short __ATTRS_o_ai |
| 2065 | vec_lvxl(int a, short *b) |
| 2066 | { |
| 2067 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 2068 | } |
| 2069 | |
| 2070 | static vector unsigned short __ATTRS_o_ai |
| 2071 | vec_lvxl(int a, vector unsigned short *b) |
| 2072 | { |
| 2073 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2074 | } |
| 2075 | |
| 2076 | static vector unsigned short __ATTRS_o_ai |
| 2077 | vec_lvxl(int a, unsigned short *b) |
| 2078 | { |
| 2079 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2080 | } |
| 2081 | |
| 2082 | static vector int __ATTRS_o_ai |
| 2083 | vec_lvxl(int a, vector int *b) |
| 2084 | { |
| 2085 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2086 | } |
| 2087 | |
| 2088 | static vector int __ATTRS_o_ai |
| 2089 | vec_lvxl(int a, int *b) |
| 2090 | { |
| 2091 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2092 | } |
| 2093 | |
| 2094 | static vector unsigned int __ATTRS_o_ai |
| 2095 | vec_lvxl(int a, vector unsigned int *b) |
| 2096 | { |
| 2097 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2098 | } |
| 2099 | |
| 2100 | static vector unsigned int __ATTRS_o_ai |
| 2101 | vec_lvxl(int a, unsigned int *b) |
| 2102 | { |
| 2103 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2104 | } |
| 2105 | |
| 2106 | static vector float __ATTRS_o_ai |
| 2107 | vec_lvxl(int a, vector float *b) |
| 2108 | { |
| 2109 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2110 | } |
| 2111 | |
| 2112 | static vector float __ATTRS_o_ai |
| 2113 | vec_lvxl(int a, float *b) |
| 2114 | { |
| 2115 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2116 | } |
| 2117 | |
| 2118 | /* vec_loge */ |
| 2119 | |
| 2120 | static vector float __attribute__((__always_inline__)) |
| 2121 | vec_loge(vector float a) |
| 2122 | { |
| 2123 | return __builtin_altivec_vlogefp(a); |
| 2124 | } |
| 2125 | |
| 2126 | /* vec_vlogefp */ |
| 2127 | |
| 2128 | static vector float __attribute__((__always_inline__)) |
| 2129 | vec_vlogefp(vector float a) |
| 2130 | { |
| 2131 | return __builtin_altivec_vlogefp(a); |
| 2132 | } |
| 2133 | |
| 2134 | /* vec_lvsl */ |
| 2135 | |
| 2136 | static vector unsigned char __ATTRS_o_ai |
| 2137 | vec_lvsl(int a, signed char *b) |
| 2138 | { |
| 2139 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2140 | } |
| 2141 | |
| 2142 | static vector unsigned char __ATTRS_o_ai |
| 2143 | vec_lvsl(int a, unsigned char *b) |
| 2144 | { |
| 2145 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2146 | } |
| 2147 | |
| 2148 | static vector unsigned char __ATTRS_o_ai |
| 2149 | vec_lvsl(int a, short *b) |
| 2150 | { |
| 2151 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2152 | } |
| 2153 | |
| 2154 | static vector unsigned char __ATTRS_o_ai |
| 2155 | vec_lvsl(int a, unsigned short *b) |
| 2156 | { |
| 2157 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2158 | } |
| 2159 | |
| 2160 | static vector unsigned char __ATTRS_o_ai |
| 2161 | vec_lvsl(int a, int *b) |
| 2162 | { |
| 2163 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2164 | } |
| 2165 | |
| 2166 | static vector unsigned char __ATTRS_o_ai |
| 2167 | vec_lvsl(int a, unsigned int *b) |
| 2168 | { |
| 2169 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2170 | } |
| 2171 | |
| 2172 | static vector unsigned char __ATTRS_o_ai |
| 2173 | vec_lvsl(int a, float *b) |
| 2174 | { |
| 2175 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2176 | } |
| 2177 | |
| 2178 | /* vec_lvsr */ |
| 2179 | |
| 2180 | static vector unsigned char __ATTRS_o_ai |
| 2181 | vec_lvsr(int a, signed char *b) |
| 2182 | { |
| 2183 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2184 | } |
| 2185 | |
| 2186 | static vector unsigned char __ATTRS_o_ai |
| 2187 | vec_lvsr(int a, unsigned char *b) |
| 2188 | { |
| 2189 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2190 | } |
| 2191 | |
| 2192 | static vector unsigned char __ATTRS_o_ai |
| 2193 | vec_lvsr(int a, short *b) |
| 2194 | { |
| 2195 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2196 | } |
| 2197 | |
| 2198 | static vector unsigned char __ATTRS_o_ai |
| 2199 | vec_lvsr(int a, unsigned short *b) |
| 2200 | { |
| 2201 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2202 | } |
| 2203 | |
| 2204 | static vector unsigned char __ATTRS_o_ai |
| 2205 | vec_lvsr(int a, int *b) |
| 2206 | { |
| 2207 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2208 | } |
| 2209 | |
| 2210 | static vector unsigned char __ATTRS_o_ai |
| 2211 | vec_lvsr(int a, unsigned int *b) |
| 2212 | { |
| 2213 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2214 | } |
| 2215 | |
| 2216 | static vector unsigned char __ATTRS_o_ai |
| 2217 | vec_lvsr(int a, float *b) |
| 2218 | { |
| 2219 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2220 | } |
| 2221 | |
| 2222 | /* vec_madd */ |
| 2223 | |
| 2224 | static vector float __attribute__((__always_inline__)) |
| 2225 | vec_madd(vector float a, vector float b, vector float c) |
| 2226 | { |
| 2227 | return __builtin_altivec_vmaddfp(a, b, c); |
| 2228 | } |
| 2229 | |
| 2230 | /* vec_vmaddfp */ |
| 2231 | |
| 2232 | static vector float __attribute__((__always_inline__)) |
| 2233 | vec_vmaddfp(vector float a, vector float b, vector float c) |
| 2234 | { |
| 2235 | return __builtin_altivec_vmaddfp(a, b, c); |
| 2236 | } |
| 2237 | |
| 2238 | /* vec_madds */ |
| 2239 | |
| 2240 | static vector signed short __attribute__((__always_inline__)) |
| 2241 | vec_madds(vector signed short a, vector signed short b, vector signed short c) |
| 2242 | { |
| 2243 | return __builtin_altivec_vmhaddshs(a, b, c); |
| 2244 | } |
| 2245 | |
| 2246 | /* vec_vmhaddshs */ |
| 2247 | static vector signed short __attribute__((__always_inline__)) |
| 2248 | vec_vmhaddshs(vector signed short a, vector signed short b, vector signed short c) |
| 2249 | { |
| 2250 | return __builtin_altivec_vmhaddshs(a, b, c); |
| 2251 | } |
| 2252 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2253 | /* vec_max */ |
| 2254 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2255 | static vector signed char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2256 | vec_max(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2257 | { |
| 2258 | return __builtin_altivec_vmaxsb(a, b); |
| 2259 | } |
| 2260 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2261 | static vector unsigned char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2262 | vec_max(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2263 | { |
| 2264 | return __builtin_altivec_vmaxub(a, b); |
| 2265 | } |
| 2266 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2267 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2268 | vec_max(vector short a, vector short b) |
| 2269 | { |
| 2270 | return __builtin_altivec_vmaxsh(a, b); |
| 2271 | } |
| 2272 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2273 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2274 | vec_max(vector unsigned short a, vector unsigned short b) |
| 2275 | { |
| 2276 | return __builtin_altivec_vmaxuh(a, b); |
| 2277 | } |
| 2278 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2279 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2280 | vec_max(vector int a, vector int b) |
| 2281 | { |
| 2282 | return __builtin_altivec_vmaxsw(a, b); |
| 2283 | } |
| 2284 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2285 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2286 | vec_max(vector unsigned int a, vector unsigned int b) |
| 2287 | { |
| 2288 | return __builtin_altivec_vmaxuw(a, b); |
| 2289 | } |
| 2290 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2291 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2292 | vec_max(vector float a, vector float b) |
| 2293 | { |
| 2294 | return __builtin_altivec_vmaxfp(a, b); |
| 2295 | } |
| 2296 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2297 | /* vec_vmaxsb */ |
| 2298 | |
| 2299 | static vector signed char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2300 | vec_vmaxsb(vector signed char a, vector signed char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2301 | { |
| 2302 | return __builtin_altivec_vmaxsb(a, b); |
| 2303 | } |
| 2304 | |
| 2305 | /* vec_vmaxub */ |
| 2306 | |
| 2307 | static vector unsigned char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2308 | vec_vmaxub(vector unsigned char a, vector unsigned char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2309 | { |
| 2310 | return __builtin_altivec_vmaxub(a, b); |
| 2311 | } |
| 2312 | |
| 2313 | /* vec_vmaxsh */ |
| 2314 | |
| 2315 | static vector short __attribute__((__always_inline__)) |
| 2316 | vec_vmaxsh(vector short a, vector short b) |
| 2317 | { |
| 2318 | return __builtin_altivec_vmaxsh(a, b); |
| 2319 | } |
| 2320 | |
| 2321 | /* vec_vmaxuh */ |
| 2322 | |
| 2323 | static vector unsigned short __attribute__((__always_inline__)) |
| 2324 | vec_vmaxuh(vector unsigned short a, vector unsigned short b) |
| 2325 | { |
| 2326 | return __builtin_altivec_vmaxuh(a, b); |
| 2327 | } |
| 2328 | |
| 2329 | /* vec_vmaxsw */ |
| 2330 | |
| 2331 | static vector int __attribute__((__always_inline__)) |
| 2332 | vec_vmaxsw(vector int a, vector int b) |
| 2333 | { |
| 2334 | return __builtin_altivec_vmaxsw(a, b); |
| 2335 | } |
| 2336 | |
| 2337 | /* vec_vmaxuw */ |
| 2338 | |
| 2339 | static vector unsigned int __attribute__((__always_inline__)) |
| 2340 | vec_vmaxuw(vector unsigned int a, vector unsigned int b) |
| 2341 | { |
| 2342 | return __builtin_altivec_vmaxuw(a, b); |
| 2343 | } |
| 2344 | |
| 2345 | /* vec_vmaxfp */ |
| 2346 | |
| 2347 | static vector float __attribute__((__always_inline__)) |
| 2348 | vec_vmaxfp(vector float a, vector float b) |
| 2349 | { |
| 2350 | return __builtin_altivec_vmaxfp(a, b); |
| 2351 | } |
| 2352 | |
| 2353 | /* vec_mergeh */ |
| 2354 | |
| 2355 | static vector signed char __ATTRS_o_ai |
| 2356 | vec_mergeh(vector signed char a, vector signed char b) |
| 2357 | { |
| 2358 | return vec_perm(a, b, (vector unsigned char) |
| 2359 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2360 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2361 | } |
| 2362 | |
| 2363 | static vector unsigned char __ATTRS_o_ai |
| 2364 | vec_mergeh(vector unsigned char a, vector unsigned char b) |
| 2365 | { |
| 2366 | return vec_perm(a, b, (vector unsigned char) |
| 2367 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2368 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2369 | } |
| 2370 | |
| 2371 | static vector short __ATTRS_o_ai |
| 2372 | vec_mergeh(vector short a, vector short b) |
| 2373 | { |
| 2374 | return vec_perm(a, b, (vector unsigned char) |
| 2375 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2376 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2377 | } |
| 2378 | |
| 2379 | static vector unsigned short __ATTRS_o_ai |
| 2380 | vec_mergeh(vector unsigned short a, vector unsigned short b) |
| 2381 | { |
| 2382 | return vec_perm(a, b, (vector unsigned char) |
| 2383 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2384 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2385 | } |
| 2386 | |
| 2387 | static vector int __ATTRS_o_ai |
| 2388 | vec_mergeh(vector int a, vector int b) |
| 2389 | { |
| 2390 | return vec_perm(a, b, (vector unsigned char) |
| 2391 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2392 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2393 | } |
| 2394 | |
| 2395 | static vector unsigned int __ATTRS_o_ai |
| 2396 | vec_mergeh(vector unsigned int a, vector unsigned int b) |
| 2397 | { |
| 2398 | return vec_perm(a, b, (vector unsigned char) |
| 2399 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2400 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2401 | } |
| 2402 | |
| 2403 | static vector float __ATTRS_o_ai |
| 2404 | vec_mergeh(vector float a, vector float b) |
| 2405 | { |
| 2406 | return vec_perm(a, b, (vector unsigned char) |
| 2407 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2408 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2409 | } |
| 2410 | |
| 2411 | /* vec_vmrghb */ |
| 2412 | |
| 2413 | #define __builtin_altivec_vmrghb vec_vmrghb |
| 2414 | |
| 2415 | static vector signed char __ATTRS_o_ai |
| 2416 | vec_vmrghb(vector signed char a, vector signed char b) |
| 2417 | { |
| 2418 | return vec_perm(a, b, (vector unsigned char) |
| 2419 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2420 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2421 | } |
| 2422 | |
| 2423 | static vector unsigned char __ATTRS_o_ai |
| 2424 | vec_vmrghb(vector unsigned char a, vector unsigned char b) |
| 2425 | { |
| 2426 | return vec_perm(a, b, (vector unsigned char) |
| 2427 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2428 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2429 | } |
| 2430 | |
| 2431 | /* vec_vmrghh */ |
| 2432 | |
| 2433 | #define __builtin_altivec_vmrghh vec_vmrghh |
| 2434 | |
| 2435 | static vector short __ATTRS_o_ai |
| 2436 | vec_vmrghh(vector short a, vector short b) |
| 2437 | { |
| 2438 | return vec_perm(a, b, (vector unsigned char) |
| 2439 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2440 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2441 | } |
| 2442 | |
| 2443 | static vector unsigned short __ATTRS_o_ai |
| 2444 | vec_vmrghh(vector unsigned short a, vector unsigned short b) |
| 2445 | { |
| 2446 | return vec_perm(a, b, (vector unsigned char) |
| 2447 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2448 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2449 | } |
| 2450 | |
| 2451 | /* vec_vmrghw */ |
| 2452 | |
| 2453 | #define __builtin_altivec_vmrghw vec_vmrghw |
| 2454 | |
| 2455 | static vector int __ATTRS_o_ai |
| 2456 | vec_vmrghw(vector int a, vector int b) |
| 2457 | { |
| 2458 | return vec_perm(a, b, (vector unsigned char) |
| 2459 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2460 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2461 | } |
| 2462 | |
| 2463 | static vector unsigned int __ATTRS_o_ai |
| 2464 | vec_vmrghw(vector unsigned int a, vector unsigned int b) |
| 2465 | { |
| 2466 | return vec_perm(a, b, (vector unsigned char) |
| 2467 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2468 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2469 | } |
| 2470 | |
| 2471 | static vector float __ATTRS_o_ai |
| 2472 | vec_vmrghw(vector float a, vector float b) |
| 2473 | { |
| 2474 | return vec_perm(a, b, (vector unsigned char) |
| 2475 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2476 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2477 | } |
| 2478 | |
| 2479 | /* vec_mergel */ |
| 2480 | |
| 2481 | static vector signed char __ATTRS_o_ai |
| 2482 | vec_mergel(vector signed char a, vector signed char b) |
| 2483 | { |
| 2484 | return vec_perm(a, b, (vector unsigned char) |
| 2485 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2486 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2487 | } |
| 2488 | |
| 2489 | static vector unsigned char __ATTRS_o_ai |
| 2490 | vec_mergel(vector unsigned char a, vector unsigned char b) |
| 2491 | { |
| 2492 | return vec_perm(a, b, (vector unsigned char) |
| 2493 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2494 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2495 | } |
| 2496 | |
| 2497 | static vector short __ATTRS_o_ai |
| 2498 | vec_mergel(vector short a, vector short b) |
| 2499 | { |
| 2500 | return vec_perm(a, b, (vector unsigned char) |
| 2501 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2502 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2503 | } |
| 2504 | |
| 2505 | static vector unsigned short __ATTRS_o_ai |
| 2506 | vec_mergel(vector unsigned short a, vector unsigned short b) |
| 2507 | { |
| 2508 | return vec_perm(a, b, (vector unsigned char) |
| 2509 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2510 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2511 | } |
| 2512 | |
| 2513 | static vector int __ATTRS_o_ai |
| 2514 | vec_mergel(vector int a, vector int b) |
| 2515 | { |
| 2516 | return vec_perm(a, b, (vector unsigned char) |
| 2517 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2518 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2519 | } |
| 2520 | |
| 2521 | static vector unsigned int __ATTRS_o_ai |
| 2522 | vec_mergel(vector unsigned int a, vector unsigned int b) |
| 2523 | { |
| 2524 | return vec_perm(a, b, (vector unsigned char) |
| 2525 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2526 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2527 | } |
| 2528 | |
| 2529 | static vector float __ATTRS_o_ai |
| 2530 | vec_mergel(vector float a, vector float b) |
| 2531 | { |
| 2532 | return vec_perm(a, b, (vector unsigned char) |
| 2533 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2534 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2535 | } |
| 2536 | |
| 2537 | /* vec_vmrglb */ |
| 2538 | |
| 2539 | #define __builtin_altivec_vmrglb vec_vmrglb |
| 2540 | |
| 2541 | static vector signed char __ATTRS_o_ai |
| 2542 | vec_vmrglb(vector signed char a, vector signed char b) |
| 2543 | { |
| 2544 | return vec_perm(a, b, (vector unsigned char) |
| 2545 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2546 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2547 | } |
| 2548 | |
| 2549 | static vector unsigned char __ATTRS_o_ai |
| 2550 | vec_vmrglb(vector unsigned char a, vector unsigned char b) |
| 2551 | { |
| 2552 | return vec_perm(a, b, (vector unsigned char) |
| 2553 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2554 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2555 | } |
| 2556 | |
| 2557 | /* vec_vmrglh */ |
| 2558 | |
| 2559 | #define __builtin_altivec_vmrglh vec_vmrglh |
| 2560 | |
| 2561 | static vector short __ATTRS_o_ai |
| 2562 | vec_vmrglh(vector short a, vector short b) |
| 2563 | { |
| 2564 | return vec_perm(a, b, (vector unsigned char) |
| 2565 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2566 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2567 | } |
| 2568 | |
| 2569 | static vector unsigned short __ATTRS_o_ai |
| 2570 | vec_vmrglh(vector unsigned short a, vector unsigned short b) |
| 2571 | { |
| 2572 | return vec_perm(a, b, (vector unsigned char) |
| 2573 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2574 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2575 | } |
| 2576 | |
| 2577 | /* vec_vmrglw */ |
| 2578 | |
| 2579 | #define __builtin_altivec_vmrglw vec_vmrglw |
| 2580 | |
| 2581 | static vector int __ATTRS_o_ai |
| 2582 | vec_vmrglw(vector int a, vector int b) |
| 2583 | { |
| 2584 | return vec_perm(a, b, (vector unsigned char) |
| 2585 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2586 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2587 | } |
| 2588 | |
| 2589 | static vector unsigned int __ATTRS_o_ai |
| 2590 | vec_vmrglw(vector unsigned int a, vector unsigned int b) |
| 2591 | { |
| 2592 | return vec_perm(a, b, (vector unsigned char) |
| 2593 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2594 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2595 | } |
| 2596 | |
| 2597 | static vector float __ATTRS_o_ai |
| 2598 | vec_vmrglw(vector float a, vector float b) |
| 2599 | { |
| 2600 | return vec_perm(a, b, (vector unsigned char) |
| 2601 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2602 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2603 | } |
| 2604 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2605 | /* vec_mfvscr */ |
| 2606 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2607 | static vector unsigned short __attribute__((__always_inline__)) |
| 2608 | vec_mfvscr(void) |
| 2609 | { |
| 2610 | return __builtin_altivec_mfvscr(); |
| 2611 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2612 | |
| 2613 | /* vec_min */ |
| 2614 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2615 | static vector signed char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2616 | vec_min(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2617 | { |
| 2618 | return __builtin_altivec_vminsb(a, b); |
| 2619 | } |
| 2620 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2621 | static vector unsigned char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2622 | vec_min(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2623 | { |
| 2624 | return __builtin_altivec_vminub(a, b); |
| 2625 | } |
| 2626 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2627 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2628 | vec_min(vector short a, vector short b) |
| 2629 | { |
| 2630 | return __builtin_altivec_vminsh(a, b); |
| 2631 | } |
| 2632 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2633 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2634 | vec_min(vector unsigned short a, vector unsigned short b) |
| 2635 | { |
| 2636 | return __builtin_altivec_vminuh(a, b); |
| 2637 | } |
| 2638 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2639 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2640 | vec_min(vector int a, vector int b) |
| 2641 | { |
| 2642 | return __builtin_altivec_vminsw(a, b); |
| 2643 | } |
| 2644 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2645 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2646 | vec_min(vector unsigned int a, vector unsigned int b) |
| 2647 | { |
| 2648 | return __builtin_altivec_vminuw(a, b); |
| 2649 | } |
| 2650 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2651 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2652 | vec_min(vector float a, vector float b) |
| 2653 | { |
| 2654 | return __builtin_altivec_vminfp(a, b); |
| 2655 | } |
| 2656 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2657 | /* vec_vminsb */ |
| 2658 | |
| 2659 | static vector signed char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2660 | vec_vminsb(vector signed char a, vector signed char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2661 | { |
| 2662 | return __builtin_altivec_vminsb(a, b); |
| 2663 | } |
| 2664 | |
| 2665 | /* vec_vminub */ |
| 2666 | |
| 2667 | static vector unsigned char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2668 | vec_vminub(vector unsigned char a, vector unsigned char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2669 | { |
| 2670 | return __builtin_altivec_vminub(a, b); |
| 2671 | } |
| 2672 | |
| 2673 | /* vec_vminsh */ |
| 2674 | |
| 2675 | static vector short __attribute__((__always_inline__)) |
| 2676 | vec_vminsh(vector short a, vector short b) |
| 2677 | { |
| 2678 | return __builtin_altivec_vminsh(a, b); |
| 2679 | } |
| 2680 | |
| 2681 | /* vec_vminuh */ |
| 2682 | |
| 2683 | static vector unsigned short __attribute__((__always_inline__)) |
| 2684 | vec_vminuh(vector unsigned short a, vector unsigned short b) |
| 2685 | { |
| 2686 | return __builtin_altivec_vminuh(a, b); |
| 2687 | } |
| 2688 | |
| 2689 | /* vec_vminsw */ |
| 2690 | |
| 2691 | static vector int __attribute__((__always_inline__)) |
| 2692 | vec_vminsw(vector int a, vector int b) |
| 2693 | { |
| 2694 | return __builtin_altivec_vminsw(a, b); |
| 2695 | } |
| 2696 | |
| 2697 | /* vec_vminuw */ |
| 2698 | |
| 2699 | static vector unsigned int __attribute__((__always_inline__)) |
| 2700 | vec_vminuw(vector unsigned int a, vector unsigned int b) |
| 2701 | { |
| 2702 | return __builtin_altivec_vminuw(a, b); |
| 2703 | } |
| 2704 | |
| 2705 | /* vec_vminfp */ |
| 2706 | |
| 2707 | static vector float __attribute__((__always_inline__)) |
| 2708 | vec_vminfp(vector float a, vector float b) |
| 2709 | { |
| 2710 | return __builtin_altivec_vminfp(a, b); |
| 2711 | } |
| 2712 | |
| 2713 | /* vec_mladd */ |
| 2714 | |
| 2715 | #define __builtin_altivec_vmladduhm vec_mladd |
| 2716 | |
| 2717 | static vector short __ATTRS_o_ai |
| 2718 | vec_mladd(vector short a, vector short b, vector short c) |
| 2719 | { |
| 2720 | return a * b + c; |
| 2721 | } |
| 2722 | |
| 2723 | static vector short __ATTRS_o_ai |
| 2724 | vec_mladd(vector short a, vector unsigned short b, vector unsigned short c) |
| 2725 | { |
| 2726 | return a * (vector short)b + (vector short)c; |
| 2727 | } |
| 2728 | |
| 2729 | static vector short __ATTRS_o_ai |
| 2730 | vec_mladd(vector unsigned short a, vector short b, vector short c) |
| 2731 | { |
| 2732 | return (vector short)a * b + c; |
| 2733 | } |
| 2734 | |
| 2735 | static vector unsigned short __ATTRS_o_ai |
| 2736 | vec_mladd(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 2737 | { |
| 2738 | return a * b + c; |
| 2739 | } |
| 2740 | |
| 2741 | /* vec_vmladduhm */ |
| 2742 | |
| 2743 | static vector short __ATTRS_o_ai |
| 2744 | vec_vmladduhm(vector short a, vector short b, vector short c) |
| 2745 | { |
| 2746 | return a * b + c; |
| 2747 | } |
| 2748 | |
| 2749 | static vector short __ATTRS_o_ai |
| 2750 | vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c) |
| 2751 | { |
| 2752 | return a * (vector short)b + (vector short)c; |
| 2753 | } |
| 2754 | |
| 2755 | static vector short __ATTRS_o_ai |
| 2756 | vec_vmladduhm(vector unsigned short a, vector short b, vector short c) |
| 2757 | { |
| 2758 | return (vector short)a * b + c; |
| 2759 | } |
| 2760 | |
| 2761 | static vector unsigned short __ATTRS_o_ai |
| 2762 | vec_vmladduhm(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 2763 | { |
| 2764 | return a * b + c; |
| 2765 | } |
| 2766 | |
| 2767 | /* vec_mradds */ |
| 2768 | |
| 2769 | static vector short __attribute__((__always_inline__)) |
| 2770 | vec_mradds(vector short a, vector short b, vector short c) |
| 2771 | { |
| 2772 | return __builtin_altivec_vmhraddshs(a, b, c); |
| 2773 | } |
| 2774 | |
| 2775 | /* vec_vmhraddshs */ |
| 2776 | |
| 2777 | static vector short __attribute__((__always_inline__)) |
| 2778 | vec_vmhraddshs(vector short a, vector short b, vector short c) |
| 2779 | { |
| 2780 | return __builtin_altivec_vmhraddshs(a, b, c); |
| 2781 | } |
| 2782 | |
| 2783 | /* vec_msum */ |
| 2784 | |
| 2785 | static vector int __ATTRS_o_ai |
| 2786 | vec_msum(vector signed char a, vector unsigned char b, vector int c) |
| 2787 | { |
| 2788 | return __builtin_altivec_vmsummbm(a, b, c); |
| 2789 | } |
| 2790 | |
| 2791 | static vector unsigned int __ATTRS_o_ai |
| 2792 | vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c) |
| 2793 | { |
| 2794 | return __builtin_altivec_vmsumubm(a, b, c); |
| 2795 | } |
| 2796 | |
| 2797 | static vector int __ATTRS_o_ai |
| 2798 | vec_msum(vector short a, vector short b, vector int c) |
| 2799 | { |
| 2800 | return __builtin_altivec_vmsumshm(a, b, c); |
| 2801 | } |
| 2802 | |
| 2803 | static vector unsigned int __ATTRS_o_ai |
| 2804 | vec_msum(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2805 | { |
| 2806 | return __builtin_altivec_vmsumuhm(a, b, c); |
| 2807 | } |
| 2808 | |
| 2809 | /* vec_vmsummbm */ |
| 2810 | |
| 2811 | static vector int __attribute__((__always_inline__)) |
| 2812 | vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c) |
| 2813 | { |
| 2814 | return __builtin_altivec_vmsummbm(a, b, c); |
| 2815 | } |
| 2816 | |
| 2817 | /* vec_vmsumubm */ |
| 2818 | |
| 2819 | static vector unsigned int __attribute__((__always_inline__)) |
| 2820 | vec_vmsumubm(vector unsigned char a, vector unsigned char b, vector unsigned int c) |
| 2821 | { |
| 2822 | return __builtin_altivec_vmsumubm(a, b, c); |
| 2823 | } |
| 2824 | |
| 2825 | /* vec_vmsumshm */ |
| 2826 | |
| 2827 | static vector int __attribute__((__always_inline__)) |
| 2828 | vec_vmsumshm(vector short a, vector short b, vector int c) |
| 2829 | { |
| 2830 | return __builtin_altivec_vmsumshm(a, b, c); |
| 2831 | } |
| 2832 | |
| 2833 | /* vec_vmsumuhm */ |
| 2834 | |
| 2835 | static vector unsigned int __attribute__((__always_inline__)) |
| 2836 | vec_vmsumuhm(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2837 | { |
| 2838 | return __builtin_altivec_vmsumuhm(a, b, c); |
| 2839 | } |
| 2840 | |
| 2841 | /* vec_msums */ |
| 2842 | |
| 2843 | static vector int __ATTRS_o_ai |
| 2844 | vec_msums(vector short a, vector short b, vector int c) |
| 2845 | { |
| 2846 | return __builtin_altivec_vmsumshs(a, b, c); |
| 2847 | } |
| 2848 | |
| 2849 | static vector unsigned int __ATTRS_o_ai |
| 2850 | vec_msums(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2851 | { |
| 2852 | return __builtin_altivec_vmsumuhs(a, b, c); |
| 2853 | } |
| 2854 | |
| 2855 | /* vec_vmsumshs */ |
| 2856 | |
| 2857 | static vector int __attribute__((__always_inline__)) |
| 2858 | vec_vmsumshs(vector short a, vector short b, vector int c) |
| 2859 | { |
| 2860 | return __builtin_altivec_vmsumshs(a, b, c); |
| 2861 | } |
| 2862 | |
| 2863 | /* vec_vmsumuhs */ |
| 2864 | |
| 2865 | static vector unsigned int __attribute__((__always_inline__)) |
| 2866 | vec_vmsumuhs(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2867 | { |
| 2868 | return __builtin_altivec_vmsumuhs(a, b, c); |
| 2869 | } |
| 2870 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2871 | /* vec_mtvscr */ |
| 2872 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2873 | static void __ATTRS_o_ai |
| 2874 | vec_mtvscr(vector signed char a) |
| 2875 | { |
| 2876 | __builtin_altivec_mtvscr((vector int)a); |
| 2877 | } |
| 2878 | |
| 2879 | static void __ATTRS_o_ai |
| 2880 | vec_mtvscr(vector unsigned char a) |
| 2881 | { |
| 2882 | __builtin_altivec_mtvscr((vector int)a); |
| 2883 | } |
| 2884 | |
| 2885 | static void __ATTRS_o_ai |
| 2886 | vec_mtvscr(vector short a) |
| 2887 | { |
| 2888 | __builtin_altivec_mtvscr((vector int)a); |
| 2889 | } |
| 2890 | |
| 2891 | static void __ATTRS_o_ai |
| 2892 | vec_mtvscr(vector unsigned short a) |
| 2893 | { |
| 2894 | __builtin_altivec_mtvscr((vector int)a); |
| 2895 | } |
| 2896 | |
| 2897 | static void __ATTRS_o_ai |
| 2898 | vec_mtvscr(vector int a) |
| 2899 | { |
| 2900 | __builtin_altivec_mtvscr((vector int)a); |
| 2901 | } |
| 2902 | |
| 2903 | static void __ATTRS_o_ai |
| 2904 | vec_mtvscr(vector unsigned int a) |
| 2905 | { |
| 2906 | __builtin_altivec_mtvscr((vector int)a); |
| 2907 | } |
| 2908 | |
| 2909 | static void __ATTRS_o_ai |
| 2910 | vec_mtvscr(vector float a) |
| 2911 | { |
| 2912 | __builtin_altivec_mtvscr((vector int)a); |
| 2913 | } |
| 2914 | |
| 2915 | /* vec_mule */ |
| 2916 | |
| 2917 | static vector short __ATTRS_o_ai |
| 2918 | vec_mule(vector signed char a, vector signed char b) |
| 2919 | { |
| 2920 | return __builtin_altivec_vmulesb(a, b); |
| 2921 | } |
| 2922 | |
| 2923 | static vector unsigned short __ATTRS_o_ai |
| 2924 | vec_mule(vector unsigned char a, vector unsigned char b) |
| 2925 | { |
| 2926 | return __builtin_altivec_vmuleub(a, b); |
| 2927 | } |
| 2928 | |
| 2929 | static vector int __ATTRS_o_ai |
| 2930 | vec_mule(vector short a, vector short b) |
| 2931 | { |
| 2932 | return __builtin_altivec_vmulesh(a, b); |
| 2933 | } |
| 2934 | |
| 2935 | static vector unsigned int __ATTRS_o_ai |
| 2936 | vec_mule(vector unsigned short a, vector unsigned short b) |
| 2937 | { |
| 2938 | return __builtin_altivec_vmuleuh(a, b); |
| 2939 | } |
| 2940 | |
| 2941 | /* vec_vmulesb */ |
| 2942 | |
| 2943 | static vector short __attribute__((__always_inline__)) |
| 2944 | vec_vmulesb(vector signed char a, vector signed char b) |
| 2945 | { |
| 2946 | return __builtin_altivec_vmulesb(a, b); |
| 2947 | } |
| 2948 | |
| 2949 | /* vec_vmuleub */ |
| 2950 | |
| 2951 | static vector unsigned short __attribute__((__always_inline__)) |
| 2952 | vec_vmuleub(vector unsigned char a, vector unsigned char b) |
| 2953 | { |
| 2954 | return __builtin_altivec_vmuleub(a, b); |
| 2955 | } |
| 2956 | |
| 2957 | /* vec_vmulesh */ |
| 2958 | |
| 2959 | static vector int __attribute__((__always_inline__)) |
| 2960 | vec_vmulesh(vector short a, vector short b) |
| 2961 | { |
| 2962 | return __builtin_altivec_vmulesh(a, b); |
| 2963 | } |
| 2964 | |
| 2965 | /* vec_vmuleuh */ |
| 2966 | |
| 2967 | static vector unsigned int __attribute__((__always_inline__)) |
| 2968 | vec_vmuleuh(vector unsigned short a, vector unsigned short b) |
| 2969 | { |
| 2970 | return __builtin_altivec_vmuleuh(a, b); |
| 2971 | } |
| 2972 | |
| 2973 | /* vec_mulo */ |
| 2974 | |
| 2975 | static vector short __ATTRS_o_ai |
| 2976 | vec_mulo(vector signed char a, vector signed char b) |
| 2977 | { |
| 2978 | return __builtin_altivec_vmulosb(a, b); |
| 2979 | } |
| 2980 | |
| 2981 | static vector unsigned short __ATTRS_o_ai |
| 2982 | vec_mulo(vector unsigned char a, vector unsigned char b) |
| 2983 | { |
| 2984 | return __builtin_altivec_vmuloub(a, b); |
| 2985 | } |
| 2986 | |
| 2987 | static vector int __ATTRS_o_ai |
| 2988 | vec_mulo(vector short a, vector short b) |
| 2989 | { |
| 2990 | return __builtin_altivec_vmulosh(a, b); |
| 2991 | } |
| 2992 | |
| 2993 | static vector unsigned int __ATTRS_o_ai |
| 2994 | vec_mulo(vector unsigned short a, vector unsigned short b) |
| 2995 | { |
| 2996 | return __builtin_altivec_vmulouh(a, b); |
| 2997 | } |
| 2998 | |
| 2999 | /* vec_vmulosb */ |
| 3000 | |
| 3001 | static vector short __attribute__((__always_inline__)) |
| 3002 | vec_vmulosb(vector signed char a, vector signed char b) |
| 3003 | { |
| 3004 | return __builtin_altivec_vmulosb(a, b); |
| 3005 | } |
| 3006 | |
| 3007 | /* vec_vmuloub */ |
| 3008 | |
| 3009 | static vector unsigned short __attribute__((__always_inline__)) |
| 3010 | vec_vmuloub(vector unsigned char a, vector unsigned char b) |
| 3011 | { |
| 3012 | return __builtin_altivec_vmuloub(a, b); |
| 3013 | } |
| 3014 | |
| 3015 | /* vec_vmulosh */ |
| 3016 | |
| 3017 | static vector int __attribute__((__always_inline__)) |
| 3018 | vec_vmulosh(vector short a, vector short b) |
| 3019 | { |
| 3020 | return __builtin_altivec_vmulosh(a, b); |
| 3021 | } |
| 3022 | |
| 3023 | /* vec_vmulouh */ |
| 3024 | |
| 3025 | static vector unsigned int __attribute__((__always_inline__)) |
| 3026 | vec_vmulouh(vector unsigned short a, vector unsigned short b) |
| 3027 | { |
| 3028 | return __builtin_altivec_vmulouh(a, b); |
| 3029 | } |
| 3030 | |
| 3031 | /* vec_nmsub */ |
| 3032 | |
| 3033 | static vector float __attribute__((__always_inline__)) |
| 3034 | vec_nmsub(vector float a, vector float b, vector float c) |
| 3035 | { |
| 3036 | return __builtin_altivec_vnmsubfp(a, b, c); |
| 3037 | } |
| 3038 | |
| 3039 | /* vec_vnmsubfp */ |
| 3040 | |
| 3041 | static vector float __attribute__((__always_inline__)) |
| 3042 | vec_vnmsubfp(vector float a, vector float b, vector float c) |
| 3043 | { |
| 3044 | return __builtin_altivec_vnmsubfp(a, b, c); |
| 3045 | } |
| 3046 | |
| 3047 | /* vec_nor */ |
| 3048 | |
| 3049 | #define __builtin_altivec_vnor vec_nor |
| 3050 | |
| 3051 | static vector signed char __ATTRS_o_ai |
| 3052 | vec_nor(vector signed char a, vector signed char b) |
| 3053 | { |
| 3054 | return ~(a | b); |
| 3055 | } |
| 3056 | |
| 3057 | static vector unsigned char __ATTRS_o_ai |
| 3058 | vec_nor(vector unsigned char a, vector unsigned char b) |
| 3059 | { |
| 3060 | return ~(a | b); |
| 3061 | } |
| 3062 | |
| 3063 | static vector short __ATTRS_o_ai |
| 3064 | vec_nor(vector short a, vector short b) |
| 3065 | { |
| 3066 | return ~(a | b); |
| 3067 | } |
| 3068 | |
| 3069 | static vector unsigned short __ATTRS_o_ai |
| 3070 | vec_nor(vector unsigned short a, vector unsigned short b) |
| 3071 | { |
| 3072 | return ~(a | b); |
| 3073 | } |
| 3074 | |
| 3075 | static vector int __ATTRS_o_ai |
| 3076 | vec_nor(vector int a, vector int b) |
| 3077 | { |
| 3078 | return ~(a | b); |
| 3079 | } |
| 3080 | |
| 3081 | static vector unsigned int __ATTRS_o_ai |
| 3082 | vec_nor(vector unsigned int a, vector unsigned int b) |
| 3083 | { |
| 3084 | return ~(a | b); |
| 3085 | } |
| 3086 | |
| 3087 | static vector float __ATTRS_o_ai |
| 3088 | vec_nor(vector float a, vector float b) |
| 3089 | { |
| 3090 | vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); |
| 3091 | return (vector float)res; |
| 3092 | } |
| 3093 | |
| 3094 | /* vec_vnor */ |
| 3095 | |
| 3096 | static vector signed char __ATTRS_o_ai |
| 3097 | vec_vnor(vector signed char a, vector signed char b) |
| 3098 | { |
| 3099 | return ~(a | b); |
| 3100 | } |
| 3101 | |
| 3102 | static vector unsigned char __ATTRS_o_ai |
| 3103 | vec_vnor(vector unsigned char a, vector unsigned char b) |
| 3104 | { |
| 3105 | return ~(a | b); |
| 3106 | } |
| 3107 | |
| 3108 | static vector short __ATTRS_o_ai |
| 3109 | vec_vnor(vector short a, vector short b) |
| 3110 | { |
| 3111 | return ~(a | b); |
| 3112 | } |
| 3113 | |
| 3114 | static vector unsigned short __ATTRS_o_ai |
| 3115 | vec_vnor(vector unsigned short a, vector unsigned short b) |
| 3116 | { |
| 3117 | return ~(a | b); |
| 3118 | } |
| 3119 | |
| 3120 | static vector int __ATTRS_o_ai |
| 3121 | vec_vnor(vector int a, vector int b) |
| 3122 | { |
| 3123 | return ~(a | b); |
| 3124 | } |
| 3125 | |
| 3126 | static vector unsigned int __ATTRS_o_ai |
| 3127 | vec_vnor(vector unsigned int a, vector unsigned int b) |
| 3128 | { |
| 3129 | return ~(a | b); |
| 3130 | } |
| 3131 | |
| 3132 | static vector float __ATTRS_o_ai |
| 3133 | vec_vnor(vector float a, vector float b) |
| 3134 | { |
| 3135 | vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); |
| 3136 | return (vector float)res; |
| 3137 | } |
| 3138 | |
| 3139 | /* vec_or */ |
| 3140 | |
| 3141 | #define __builtin_altivec_vor vec_or |
| 3142 | |
| 3143 | static vector signed char __ATTRS_o_ai |
| 3144 | vec_or(vector signed char a, vector signed char b) |
| 3145 | { |
| 3146 | return a | b; |
| 3147 | } |
| 3148 | |
| 3149 | static vector unsigned char __ATTRS_o_ai |
| 3150 | vec_or(vector unsigned char a, vector unsigned char b) |
| 3151 | { |
| 3152 | return a | b; |
| 3153 | } |
| 3154 | |
| 3155 | static vector short __ATTRS_o_ai |
| 3156 | vec_or(vector short a, vector short b) |
| 3157 | { |
| 3158 | return a | b; |
| 3159 | } |
| 3160 | |
| 3161 | static vector unsigned short __ATTRS_o_ai |
| 3162 | vec_or(vector unsigned short a, vector unsigned short b) |
| 3163 | { |
| 3164 | return a | b; |
| 3165 | } |
| 3166 | |
| 3167 | static vector int __ATTRS_o_ai |
| 3168 | vec_or(vector int a, vector int b) |
| 3169 | { |
| 3170 | return a | b; |
| 3171 | } |
| 3172 | |
| 3173 | static vector unsigned int __ATTRS_o_ai |
| 3174 | vec_or(vector unsigned int a, vector unsigned int b) |
| 3175 | { |
| 3176 | return a | b; |
| 3177 | } |
| 3178 | |
| 3179 | static vector float __ATTRS_o_ai |
| 3180 | vec_or(vector float a, vector float b) |
| 3181 | { |
| 3182 | vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; |
| 3183 | return (vector float)res; |
| 3184 | } |
| 3185 | |
| 3186 | /* vec_vor */ |
| 3187 | |
| 3188 | static vector signed char __ATTRS_o_ai |
| 3189 | vec_vor(vector signed char a, vector signed char b) |
| 3190 | { |
| 3191 | return a | b; |
| 3192 | } |
| 3193 | |
| 3194 | static vector unsigned char __ATTRS_o_ai |
| 3195 | vec_vor(vector unsigned char a, vector unsigned char b) |
| 3196 | { |
| 3197 | return a | b; |
| 3198 | } |
| 3199 | |
| 3200 | static vector short __ATTRS_o_ai |
| 3201 | vec_vor(vector short a, vector short b) |
| 3202 | { |
| 3203 | return a | b; |
| 3204 | } |
| 3205 | |
| 3206 | static vector unsigned short __ATTRS_o_ai |
| 3207 | vec_vor(vector unsigned short a, vector unsigned short b) |
| 3208 | { |
| 3209 | return a | b; |
| 3210 | } |
| 3211 | |
| 3212 | static vector int __ATTRS_o_ai |
| 3213 | vec_vor(vector int a, vector int b) |
| 3214 | { |
| 3215 | return a | b; |
| 3216 | } |
| 3217 | |
| 3218 | static vector unsigned int __ATTRS_o_ai |
| 3219 | vec_vor(vector unsigned int a, vector unsigned int b) |
| 3220 | { |
| 3221 | return a | b; |
| 3222 | } |
| 3223 | |
| 3224 | static vector float __ATTRS_o_ai |
| 3225 | vec_vor(vector float a, vector float b) |
| 3226 | { |
| 3227 | vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; |
| 3228 | return (vector float)res; |
| 3229 | } |
| 3230 | |
| 3231 | /* vec_pack */ |
| 3232 | |
| 3233 | static vector signed char __ATTRS_o_ai |
| 3234 | vec_pack(vector signed short a, vector signed short b) |
| 3235 | { |
| 3236 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3237 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3238 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3239 | } |
| 3240 | |
| 3241 | static vector unsigned char __ATTRS_o_ai |
| 3242 | vec_pack(vector unsigned short a, vector unsigned short b) |
| 3243 | { |
| 3244 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3245 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3246 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3247 | } |
| 3248 | |
| 3249 | static vector short __ATTRS_o_ai |
| 3250 | vec_pack(vector int a, vector int b) |
| 3251 | { |
| 3252 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3253 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3254 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3255 | } |
| 3256 | |
| 3257 | static vector unsigned short __ATTRS_o_ai |
| 3258 | vec_pack(vector unsigned int a, vector unsigned int b) |
| 3259 | { |
| 3260 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3261 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3262 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3263 | } |
| 3264 | |
| 3265 | /* vec_vpkuhum */ |
| 3266 | |
| 3267 | #define __builtin_altivec_vpkuhum vec_vpkuhum |
| 3268 | |
| 3269 | static vector signed char __ATTRS_o_ai |
| 3270 | vec_vpkuhum(vector signed short a, vector signed short b) |
| 3271 | { |
| 3272 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3273 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3274 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3275 | } |
| 3276 | |
| 3277 | static vector unsigned char __ATTRS_o_ai |
| 3278 | vec_vpkuhum(vector unsigned short a, vector unsigned short b) |
| 3279 | { |
| 3280 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3281 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3282 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3283 | } |
| 3284 | |
| 3285 | /* vec_vpkuwum */ |
| 3286 | |
| 3287 | #define __builtin_altivec_vpkuwum vec_vpkuwum |
| 3288 | |
| 3289 | static vector short __ATTRS_o_ai |
| 3290 | vec_vpkuwum(vector int a, vector int b) |
| 3291 | { |
| 3292 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3293 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3294 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3295 | } |
| 3296 | |
| 3297 | static vector unsigned short __ATTRS_o_ai |
| 3298 | vec_vpkuwum(vector unsigned int a, vector unsigned int b) |
| 3299 | { |
| 3300 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3301 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3302 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3303 | } |
| 3304 | |
| 3305 | /* vec_packpx */ |
| 3306 | |
| 3307 | static vector pixel __attribute__((__always_inline__)) |
| 3308 | vec_packpx(vector unsigned int a, vector unsigned int b) |
| 3309 | { |
| 3310 | return (vector pixel)__builtin_altivec_vpkpx(a, b); |
| 3311 | } |
| 3312 | |
| 3313 | /* vec_vpkpx */ |
| 3314 | |
| 3315 | static vector pixel __attribute__((__always_inline__)) |
| 3316 | vec_vpkpx(vector unsigned int a, vector unsigned int b) |
| 3317 | { |
| 3318 | return (vector pixel)__builtin_altivec_vpkpx(a, b); |
| 3319 | } |
| 3320 | |
| 3321 | /* vec_packs */ |
| 3322 | |
| 3323 | static vector signed char __ATTRS_o_ai |
| 3324 | vec_packs(vector short a, vector short b) |
| 3325 | { |
| 3326 | return __builtin_altivec_vpkshss(a, b); |
| 3327 | } |
| 3328 | |
| 3329 | static vector unsigned char __ATTRS_o_ai |
| 3330 | vec_packs(vector unsigned short a, vector unsigned short b) |
| 3331 | { |
| 3332 | return __builtin_altivec_vpkuhus(a, b); |
| 3333 | } |
| 3334 | |
| 3335 | static vector signed short __ATTRS_o_ai |
| 3336 | vec_packs(vector int a, vector int b) |
| 3337 | { |
| 3338 | return __builtin_altivec_vpkswss(a, b); |
| 3339 | } |
| 3340 | |
| 3341 | static vector unsigned short __ATTRS_o_ai |
| 3342 | vec_packs(vector unsigned int a, vector unsigned int b) |
| 3343 | { |
| 3344 | return __builtin_altivec_vpkuwus(a, b); |
| 3345 | } |
| 3346 | |
| 3347 | /* vec_vpkshss */ |
| 3348 | |
| 3349 | static vector signed char __attribute__((__always_inline__)) |
| 3350 | vec_vpkshss(vector short a, vector short b) |
| 3351 | { |
| 3352 | return __builtin_altivec_vpkshss(a, b); |
| 3353 | } |
| 3354 | |
| 3355 | /* vec_vpkuhus */ |
| 3356 | |
| 3357 | static vector unsigned char __attribute__((__always_inline__)) |
| 3358 | vec_vpkuhus(vector unsigned short a, vector unsigned short b) |
| 3359 | { |
| 3360 | return __builtin_altivec_vpkuhus(a, b); |
| 3361 | } |
| 3362 | |
| 3363 | /* vec_vpkswss */ |
| 3364 | |
| 3365 | static vector signed short __attribute__((__always_inline__)) |
| 3366 | vec_vpkswss(vector int a, vector int b) |
| 3367 | { |
| 3368 | return __builtin_altivec_vpkswss(a, b); |
| 3369 | } |
| 3370 | |
| 3371 | /* vec_vpkuwus */ |
| 3372 | |
| 3373 | static vector unsigned short __attribute__((__always_inline__)) |
| 3374 | vec_vpkuwus(vector unsigned int a, vector unsigned int b) |
| 3375 | { |
| 3376 | return __builtin_altivec_vpkuwus(a, b); |
| 3377 | } |
| 3378 | |
| 3379 | /* vec_packsu */ |
| 3380 | |
| 3381 | static vector unsigned char __ATTRS_o_ai |
| 3382 | vec_packsu(vector short a, vector short b) |
| 3383 | { |
| 3384 | return __builtin_altivec_vpkshus(a, b); |
| 3385 | } |
| 3386 | |
| 3387 | static vector unsigned char __ATTRS_o_ai |
| 3388 | vec_packsu(vector unsigned short a, vector unsigned short b) |
| 3389 | { |
| 3390 | return __builtin_altivec_vpkuhus(a, b); |
| 3391 | } |
| 3392 | |
| 3393 | static vector unsigned short __ATTRS_o_ai |
| 3394 | vec_packsu(vector int a, vector int b) |
| 3395 | { |
| 3396 | return __builtin_altivec_vpkswus(a, b); |
| 3397 | } |
| 3398 | |
| 3399 | static vector unsigned short __ATTRS_o_ai |
| 3400 | vec_packsu(vector unsigned int a, vector unsigned int b) |
| 3401 | { |
| 3402 | return __builtin_altivec_vpkuwus(a, b); |
| 3403 | } |
| 3404 | |
| 3405 | /* vec_vpkshus */ |
| 3406 | |
| 3407 | static vector unsigned char __ATTRS_o_ai |
| 3408 | vec_vpkshus(vector short a, vector short b) |
| 3409 | { |
| 3410 | return __builtin_altivec_vpkshus(a, b); |
| 3411 | } |
| 3412 | |
| 3413 | static vector unsigned char __ATTRS_o_ai |
| 3414 | vec_vpkshus(vector unsigned short a, vector unsigned short b) |
| 3415 | { |
| 3416 | return __builtin_altivec_vpkuhus(a, b); |
| 3417 | } |
| 3418 | |
| 3419 | /* vec_vpkswus */ |
| 3420 | |
| 3421 | static vector unsigned short __ATTRS_o_ai |
| 3422 | vec_vpkswus(vector int a, vector int b) |
| 3423 | { |
| 3424 | return __builtin_altivec_vpkswus(a, b); |
| 3425 | } |
| 3426 | |
| 3427 | static vector unsigned short __ATTRS_o_ai |
| 3428 | vec_vpkswus(vector unsigned int a, vector unsigned int b) |
| 3429 | { |
| 3430 | return __builtin_altivec_vpkuwus(a, b); |
| 3431 | } |
| 3432 | |
| 3433 | /* vec_perm */ |
| 3434 | |
| 3435 | vector signed char __ATTRS_o_ai |
| 3436 | vec_perm(vector signed char a, vector signed char b, vector unsigned char c) |
| 3437 | { |
| 3438 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3439 | } |
| 3440 | |
| 3441 | vector unsigned char __ATTRS_o_ai |
| 3442 | vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3443 | { |
| 3444 | return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3445 | } |
| 3446 | |
| 3447 | vector short __ATTRS_o_ai |
| 3448 | vec_perm(vector short a, vector short b, vector unsigned char c) |
| 3449 | { |
| 3450 | return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3451 | } |
| 3452 | |
| 3453 | vector unsigned short __ATTRS_o_ai |
| 3454 | vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c) |
| 3455 | { |
| 3456 | return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3457 | } |
| 3458 | |
| 3459 | vector int __ATTRS_o_ai |
| 3460 | vec_perm(vector int a, vector int b, vector unsigned char c) |
| 3461 | { |
| 3462 | return (vector int)__builtin_altivec_vperm_4si(a, b, c); |
| 3463 | } |
| 3464 | |
| 3465 | vector unsigned int __ATTRS_o_ai |
| 3466 | vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c) |
| 3467 | { |
| 3468 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3469 | } |
| 3470 | |
| 3471 | vector float __ATTRS_o_ai |
| 3472 | vec_perm(vector float a, vector float b, vector unsigned char c) |
| 3473 | { |
| 3474 | return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3475 | } |
| 3476 | |
| 3477 | /* vec_vperm */ |
| 3478 | |
| 3479 | vector signed char __ATTRS_o_ai |
| 3480 | vec_vperm(vector signed char a, vector signed char b, vector unsigned char c) |
| 3481 | { |
| 3482 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3483 | } |
| 3484 | |
| 3485 | vector unsigned char __ATTRS_o_ai |
| 3486 | vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3487 | { |
| 3488 | return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3489 | } |
| 3490 | |
| 3491 | vector short __ATTRS_o_ai |
| 3492 | vec_vperm(vector short a, vector short b, vector unsigned char c) |
| 3493 | { |
| 3494 | return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3495 | } |
| 3496 | |
| 3497 | vector unsigned short __ATTRS_o_ai |
| 3498 | vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char c) |
| 3499 | { |
| 3500 | return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3501 | } |
| 3502 | |
| 3503 | vector int __ATTRS_o_ai |
| 3504 | vec_vperm(vector int a, vector int b, vector unsigned char c) |
| 3505 | { |
| 3506 | return (vector int)__builtin_altivec_vperm_4si(a, b, c); |
| 3507 | } |
| 3508 | |
| 3509 | vector unsigned int __ATTRS_o_ai |
| 3510 | vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c) |
| 3511 | { |
| 3512 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3513 | } |
| 3514 | |
| 3515 | vector float __ATTRS_o_ai |
| 3516 | vec_vperm(vector float a, vector float b, vector unsigned char c) |
| 3517 | { |
| 3518 | return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3519 | } |
| 3520 | |
| 3521 | /* vec_re */ |
| 3522 | |
| 3523 | vector float __attribute__((__always_inline__)) |
| 3524 | vec_re(vector float a) |
| 3525 | { |
| 3526 | return __builtin_altivec_vrefp(a); |
| 3527 | } |
| 3528 | |
| 3529 | /* vec_vrefp */ |
| 3530 | |
| 3531 | vector float __attribute__((__always_inline__)) |
| 3532 | vec_vrefp(vector float a) |
| 3533 | { |
| 3534 | return __builtin_altivec_vrefp(a); |
| 3535 | } |
| 3536 | |
| 3537 | /* vec_rl */ |
| 3538 | |
| 3539 | static vector signed char __ATTRS_o_ai |
| 3540 | vec_rl(vector signed char a, vector unsigned char b) |
| 3541 | { |
| 3542 | return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); |
| 3543 | } |
| 3544 | |
| 3545 | static vector unsigned char __ATTRS_o_ai |
| 3546 | vec_rl(vector unsigned char a, vector unsigned char b) |
| 3547 | { |
| 3548 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); |
| 3549 | } |
| 3550 | |
| 3551 | static vector short __ATTRS_o_ai |
| 3552 | vec_rl(vector short a, vector unsigned short b) |
| 3553 | { |
| 3554 | return __builtin_altivec_vrlh(a, b); |
| 3555 | } |
| 3556 | |
| 3557 | static vector unsigned short __ATTRS_o_ai |
| 3558 | vec_rl(vector unsigned short a, vector unsigned short b) |
| 3559 | { |
| 3560 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); |
| 3561 | } |
| 3562 | |
| 3563 | static vector int __ATTRS_o_ai |
| 3564 | vec_rl(vector int a, vector unsigned int b) |
| 3565 | { |
| 3566 | return __builtin_altivec_vrlw(a, b); |
| 3567 | } |
| 3568 | |
| 3569 | static vector unsigned int __ATTRS_o_ai |
| 3570 | vec_rl(vector unsigned int a, vector unsigned int b) |
| 3571 | { |
| 3572 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); |
| 3573 | } |
| 3574 | |
| 3575 | /* vec_vrlb */ |
| 3576 | |
| 3577 | static vector signed char __ATTRS_o_ai |
| 3578 | vec_vrlb(vector signed char a, vector unsigned char b) |
| 3579 | { |
| 3580 | return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); |
| 3581 | } |
| 3582 | |
| 3583 | static vector unsigned char __ATTRS_o_ai |
| 3584 | vec_vrlb(vector unsigned char a, vector unsigned char b) |
| 3585 | { |
| 3586 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); |
| 3587 | } |
| 3588 | |
| 3589 | /* vec_vrlh */ |
| 3590 | |
| 3591 | static vector short __ATTRS_o_ai |
| 3592 | vec_vrlh(vector short a, vector unsigned short b) |
| 3593 | { |
| 3594 | return __builtin_altivec_vrlh(a, b); |
| 3595 | } |
| 3596 | |
| 3597 | static vector unsigned short __ATTRS_o_ai |
| 3598 | vec_vrlh(vector unsigned short a, vector unsigned short b) |
| 3599 | { |
| 3600 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); |
| 3601 | } |
| 3602 | |
| 3603 | /* vec_vrlw */ |
| 3604 | |
| 3605 | static vector int __ATTRS_o_ai |
| 3606 | vec_vrlw(vector int a, vector unsigned int b) |
| 3607 | { |
| 3608 | return __builtin_altivec_vrlw(a, b); |
| 3609 | } |
| 3610 | |
| 3611 | static vector unsigned int __ATTRS_o_ai |
| 3612 | vec_vrlw(vector unsigned int a, vector unsigned int b) |
| 3613 | { |
| 3614 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); |
| 3615 | } |
| 3616 | |
| 3617 | /* vec_round */ |
| 3618 | |
| 3619 | static vector float __attribute__((__always_inline__)) |
| 3620 | vec_round(vector float a) |
| 3621 | { |
| 3622 | return __builtin_altivec_vrfin(a); |
| 3623 | } |
| 3624 | |
| 3625 | /* vec_vrfin */ |
| 3626 | |
| 3627 | static vector float __attribute__((__always_inline__)) |
| 3628 | vec_vrfin(vector float a) |
| 3629 | { |
| 3630 | return __builtin_altivec_vrfin(a); |
| 3631 | } |
| 3632 | |
| 3633 | /* vec_rsqrte */ |
| 3634 | |
| 3635 | static __vector float __attribute__((__always_inline__)) |
| 3636 | vec_rsqrte(vector float a) |
| 3637 | { |
| 3638 | return __builtin_altivec_vrsqrtefp(a); |
| 3639 | } |
| 3640 | |
| 3641 | /* vec_vrsqrtefp */ |
| 3642 | |
| 3643 | static __vector float __attribute__((__always_inline__)) |
| 3644 | vec_vrsqrtefp(vector float a) |
| 3645 | { |
| 3646 | return __builtin_altivec_vrsqrtefp(a); |
| 3647 | } |
| 3648 | |
| 3649 | /* vec_sel */ |
| 3650 | |
| 3651 | #define __builtin_altivec_vsel_4si vec_sel |
| 3652 | |
| 3653 | static vector signed char __ATTRS_o_ai |
| 3654 | vec_sel(vector signed char a, vector signed char b, vector unsigned char c) |
| 3655 | { |
| 3656 | return (a & ~(vector signed char)c) | (b & (vector signed char)c); |
| 3657 | } |
| 3658 | |
| 3659 | static vector unsigned char __ATTRS_o_ai |
| 3660 | vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3661 | { |
| 3662 | return (a & ~c) | (b & c); |
| 3663 | } |
| 3664 | |
| 3665 | static vector short __ATTRS_o_ai |
| 3666 | vec_sel(vector short a, vector short b, vector unsigned short c) |
| 3667 | { |
| 3668 | return (a & ~(vector short)c) | (b & (vector short)c); |
| 3669 | } |
| 3670 | |
| 3671 | static vector unsigned short __ATTRS_o_ai |
| 3672 | vec_sel(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 3673 | { |
| 3674 | return (a & ~c) | (b & c); |
| 3675 | } |
| 3676 | |
| 3677 | static vector int __ATTRS_o_ai |
| 3678 | vec_sel(vector int a, vector int b, vector unsigned int c) |
| 3679 | { |
| 3680 | return (a & ~(vector int)c) | (b & (vector int)c); |
| 3681 | } |
| 3682 | |
| 3683 | static vector unsigned int __ATTRS_o_ai |
| 3684 | vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c) |
| 3685 | { |
| 3686 | return (a & ~c) | (b & c); |
| 3687 | } |
| 3688 | |
| 3689 | static vector float __ATTRS_o_ai |
| 3690 | vec_sel(vector float a, vector float b, vector unsigned int c) |
| 3691 | { |
| 3692 | vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); |
| 3693 | return (vector float)res; |
| 3694 | } |
| 3695 | |
| 3696 | /* vec_vsel */ |
| 3697 | |
| 3698 | static vector signed char __ATTRS_o_ai |
| 3699 | vec_vsel(vector signed char a, vector signed char b, vector unsigned char c) |
| 3700 | { |
| 3701 | return (a & ~(vector signed char)c) | (b & (vector signed char)c); |
| 3702 | } |
| 3703 | |
| 3704 | static vector unsigned char __ATTRS_o_ai |
| 3705 | vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3706 | { |
| 3707 | return (a & ~c) | (b & c); |
| 3708 | } |
| 3709 | |
| 3710 | static vector short __ATTRS_o_ai |
| 3711 | vec_vsel(vector short a, vector short b, vector unsigned short c) |
| 3712 | { |
| 3713 | return (a & ~(vector short)c) | (b & (vector short)c); |
| 3714 | } |
| 3715 | |
| 3716 | static vector unsigned short __ATTRS_o_ai |
| 3717 | vec_vsel(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 3718 | { |
| 3719 | return (a & ~c) | (b & c); |
| 3720 | } |
| 3721 | |
| 3722 | static vector int __ATTRS_o_ai |
| 3723 | vec_vsel(vector int a, vector int b, vector unsigned int c) |
| 3724 | { |
| 3725 | return (a & ~(vector int)c) | (b & (vector int)c); |
| 3726 | } |
| 3727 | |
| 3728 | static vector unsigned int __ATTRS_o_ai |
| 3729 | vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c) |
| 3730 | { |
| 3731 | return (a & ~c) | (b & c); |
| 3732 | } |
| 3733 | |
| 3734 | static vector float __ATTRS_o_ai |
| 3735 | vec_vsel(vector float a, vector float b, vector unsigned int c) |
| 3736 | { |
| 3737 | vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); |
| 3738 | return (vector float)res; |
| 3739 | } |
| 3740 | |
| 3741 | /* vec_sl */ |
| 3742 | |
| 3743 | static vector signed char __ATTRS_o_ai |
| 3744 | vec_sl(vector signed char a, vector unsigned char b) |
| 3745 | { |
| 3746 | return a << (vector signed char)b; |
| 3747 | } |
| 3748 | |
| 3749 | static vector unsigned char __ATTRS_o_ai |
| 3750 | vec_sl(vector unsigned char a, vector unsigned char b) |
| 3751 | { |
| 3752 | return a << b; |
| 3753 | } |
| 3754 | |
| 3755 | static vector short __ATTRS_o_ai |
| 3756 | vec_sl(vector short a, vector unsigned short b) |
| 3757 | { |
| 3758 | return a << (vector short)b; |
| 3759 | } |
| 3760 | |
| 3761 | static vector unsigned short __ATTRS_o_ai |
| 3762 | vec_sl(vector unsigned short a, vector unsigned short b) |
| 3763 | { |
| 3764 | return a << b; |
| 3765 | } |
| 3766 | |
| 3767 | static vector int __ATTRS_o_ai |
| 3768 | vec_sl(vector int a, vector unsigned int b) |
| 3769 | { |
| 3770 | return a << (vector int)b; |
| 3771 | } |
| 3772 | |
| 3773 | static vector unsigned int __ATTRS_o_ai |
| 3774 | vec_sl(vector unsigned int a, vector unsigned int b) |
| 3775 | { |
| 3776 | return a << b; |
| 3777 | } |
| 3778 | |
| 3779 | /* vec_vslb */ |
| 3780 | |
| 3781 | #define __builtin_altivec_vslb vec_vslb |
| 3782 | |
| 3783 | static vector signed char __ATTRS_o_ai |
| 3784 | vec_vslb(vector signed char a, vector unsigned char b) |
| 3785 | { |
| 3786 | return vec_sl(a, b); |
| 3787 | } |
| 3788 | |
| 3789 | static vector unsigned char __ATTRS_o_ai |
| 3790 | vec_vslb(vector unsigned char a, vector unsigned char b) |
| 3791 | { |
| 3792 | return vec_sl(a, b); |
| 3793 | } |
| 3794 | |
| 3795 | /* vec_vslh */ |
| 3796 | |
| 3797 | #define __builtin_altivec_vslh vec_vslh |
| 3798 | |
| 3799 | static vector short __ATTRS_o_ai |
| 3800 | vec_vslh(vector short a, vector unsigned short b) |
| 3801 | { |
| 3802 | return vec_sl(a, b); |
| 3803 | } |
| 3804 | |
| 3805 | static vector unsigned short __ATTRS_o_ai |
| 3806 | vec_vslh(vector unsigned short a, vector unsigned short b) |
| 3807 | { |
| 3808 | return vec_sl(a, b); |
| 3809 | } |
| 3810 | |
| 3811 | /* vec_vslw */ |
| 3812 | |
| 3813 | #define __builtin_altivec_vslw vec_vslw |
| 3814 | |
| 3815 | static vector int __ATTRS_o_ai |
| 3816 | vec_vslw(vector int a, vector unsigned int b) |
| 3817 | { |
| 3818 | return vec_sl(a, b); |
| 3819 | } |
| 3820 | |
| 3821 | static vector unsigned int __ATTRS_o_ai |
| 3822 | vec_vslw(vector unsigned int a, vector unsigned int b) |
| 3823 | { |
| 3824 | return vec_sl(a, b); |
| 3825 | } |
| 3826 | |
| 3827 | /* vec_sld */ |
| 3828 | |
| 3829 | #define __builtin_altivec_vsldoi_4si vec_sld |
| 3830 | |
| 3831 | static vector signed char __ATTRS_o_ai |
| 3832 | vec_sld(vector signed char a, vector signed char b, unsigned char c) |
| 3833 | { |
| 3834 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3835 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3836 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3837 | } |
| 3838 | |
| 3839 | static vector unsigned char __ATTRS_o_ai |
| 3840 | vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c) |
| 3841 | { |
| 3842 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3843 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3844 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3845 | } |
| 3846 | |
| 3847 | static vector short __ATTRS_o_ai |
| 3848 | vec_sld(vector short a, vector short b, unsigned char c) |
| 3849 | { |
| 3850 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3851 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3852 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3853 | } |
| 3854 | |
| 3855 | static vector unsigned short __ATTRS_o_ai |
| 3856 | vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c) |
| 3857 | { |
| 3858 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3859 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3860 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3861 | } |
| 3862 | |
| 3863 | static vector int __ATTRS_o_ai |
| 3864 | vec_sld(vector int a, vector int b, unsigned char c) |
| 3865 | { |
| 3866 | return vec_perm(a, b, (vector unsigned char) |
| 3867 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3868 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3869 | } |
| 3870 | |
| 3871 | static vector unsigned int __ATTRS_o_ai |
| 3872 | vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c) |
| 3873 | { |
| 3874 | return (vector unsigned int)vec_perm(a, b, (vector unsigned char) |
| 3875 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3876 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3877 | } |
| 3878 | |
| 3879 | static vector float __ATTRS_o_ai |
| 3880 | vec_sld(vector float a, vector float b, unsigned char c) |
| 3881 | { |
| 3882 | return (vector float)vec_perm(a, b, (vector unsigned char) |
| 3883 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3884 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3885 | } |
| 3886 | |
| 3887 | /* vec_vsldoi */ |
| 3888 | |
| 3889 | static vector signed char __ATTRS_o_ai |
| 3890 | vec_vsldoi(vector signed char a, vector signed char b, unsigned char c) |
| 3891 | { |
| 3892 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3893 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3894 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3895 | } |
| 3896 | |
| 3897 | static vector unsigned char __ATTRS_o_ai |
| 3898 | vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c) |
| 3899 | { |
| 3900 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3901 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3902 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3903 | } |
| 3904 | |
| 3905 | static vector short __ATTRS_o_ai |
| 3906 | vec_vsldoi(vector short a, vector short b, unsigned char c) |
| 3907 | { |
| 3908 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3909 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3910 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3911 | } |
| 3912 | |
| 3913 | static vector unsigned short __ATTRS_o_ai |
| 3914 | vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c) |
| 3915 | { |
| 3916 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3917 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3918 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3919 | } |
| 3920 | |
| 3921 | static vector int __ATTRS_o_ai |
| 3922 | vec_vsldoi(vector int a, vector int b, unsigned char c) |
| 3923 | { |
| 3924 | return vec_perm(a, b, (vector unsigned char) |
| 3925 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3926 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3927 | } |
| 3928 | |
| 3929 | static vector unsigned int __ATTRS_o_ai |
| 3930 | vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c) |
| 3931 | { |
| 3932 | return (vector unsigned int)vec_perm(a, b, (vector unsigned char) |
| 3933 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3934 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3935 | } |
| 3936 | |
| 3937 | static vector float __ATTRS_o_ai |
| 3938 | vec_vsldoi(vector float a, vector float b, unsigned char c) |
| 3939 | { |
| 3940 | return (vector float)vec_perm(a, b, (vector unsigned char) |
| 3941 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 3942 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 3943 | } |
| 3944 | |
| 3945 | /* vec_sll */ |
| 3946 | |
| 3947 | static vector signed char __ATTRS_o_ai |
| 3948 | vec_sll(vector signed char a, vector unsigned char b) |
| 3949 | { |
| 3950 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3951 | } |
| 3952 | |
| 3953 | static vector signed char __ATTRS_o_ai |
| 3954 | vec_sll(vector signed char a, vector unsigned short b) |
| 3955 | { |
| 3956 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3957 | } |
| 3958 | |
| 3959 | static vector signed char __ATTRS_o_ai |
| 3960 | vec_sll(vector signed char a, vector unsigned int b) |
| 3961 | { |
| 3962 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3963 | } |
| 3964 | |
| 3965 | static vector unsigned char __ATTRS_o_ai |
| 3966 | vec_sll(vector unsigned char a, vector unsigned char b) |
| 3967 | { |
| 3968 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3969 | } |
| 3970 | |
| 3971 | static vector unsigned char __ATTRS_o_ai |
| 3972 | vec_sll(vector unsigned char a, vector unsigned short b) |
| 3973 | { |
| 3974 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3975 | } |
| 3976 | |
| 3977 | static vector unsigned char __ATTRS_o_ai |
| 3978 | vec_sll(vector unsigned char a, vector unsigned int b) |
| 3979 | { |
| 3980 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3981 | } |
| 3982 | |
| 3983 | static vector short __ATTRS_o_ai |
| 3984 | vec_sll(vector short a, vector unsigned char b) |
| 3985 | { |
| 3986 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3987 | } |
| 3988 | |
| 3989 | static vector short __ATTRS_o_ai |
| 3990 | vec_sll(vector short a, vector unsigned short b) |
| 3991 | { |
| 3992 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3993 | } |
| 3994 | |
| 3995 | static vector short __ATTRS_o_ai |
| 3996 | vec_sll(vector short a, vector unsigned int b) |
| 3997 | { |
| 3998 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 3999 | } |
| 4000 | |
| 4001 | static vector unsigned short __ATTRS_o_ai |
| 4002 | vec_sll(vector unsigned short a, vector unsigned char b) |
| 4003 | { |
| 4004 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4005 | } |
| 4006 | |
| 4007 | static vector unsigned short __ATTRS_o_ai |
| 4008 | vec_sll(vector unsigned short a, vector unsigned short b) |
| 4009 | { |
| 4010 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4011 | } |
| 4012 | |
| 4013 | static vector unsigned short __ATTRS_o_ai |
| 4014 | vec_sll(vector unsigned short a, vector unsigned int b) |
| 4015 | { |
| 4016 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4017 | } |
| 4018 | |
| 4019 | static vector int __ATTRS_o_ai |
| 4020 | vec_sll(vector int a, vector unsigned char b) |
| 4021 | { |
| 4022 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4023 | } |
| 4024 | |
| 4025 | static vector int __ATTRS_o_ai |
| 4026 | vec_sll(vector int a, vector unsigned short b) |
| 4027 | { |
| 4028 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4029 | } |
| 4030 | |
| 4031 | static vector int __ATTRS_o_ai |
| 4032 | vec_sll(vector int a, vector unsigned int b) |
| 4033 | { |
| 4034 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4035 | } |
| 4036 | |
| 4037 | static vector unsigned int __ATTRS_o_ai |
| 4038 | vec_sll(vector unsigned int a, vector unsigned char b) |
| 4039 | { |
| 4040 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4041 | } |
| 4042 | |
| 4043 | static vector unsigned int __ATTRS_o_ai |
| 4044 | vec_sll(vector unsigned int a, vector unsigned short b) |
| 4045 | { |
| 4046 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4047 | } |
| 4048 | |
| 4049 | static vector unsigned int __ATTRS_o_ai |
| 4050 | vec_sll(vector unsigned int a, vector unsigned int b) |
| 4051 | { |
| 4052 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4053 | } |
| 4054 | |
| 4055 | /* vec_vsl */ |
| 4056 | |
| 4057 | static vector signed char __ATTRS_o_ai |
| 4058 | vec_vsl(vector signed char a, vector unsigned char b) |
| 4059 | { |
| 4060 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4061 | } |
| 4062 | |
| 4063 | static vector signed char __ATTRS_o_ai |
| 4064 | vec_vsl(vector signed char a, vector unsigned short b) |
| 4065 | { |
| 4066 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4067 | } |
| 4068 | |
| 4069 | static vector signed char __ATTRS_o_ai |
| 4070 | vec_vsl(vector signed char a, vector unsigned int b) |
| 4071 | { |
| 4072 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4073 | } |
| 4074 | |
| 4075 | static vector unsigned char __ATTRS_o_ai |
| 4076 | vec_vsl(vector unsigned char a, vector unsigned char b) |
| 4077 | { |
| 4078 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4079 | } |
| 4080 | |
| 4081 | static vector unsigned char __ATTRS_o_ai |
| 4082 | vec_vsl(vector unsigned char a, vector unsigned short b) |
| 4083 | { |
| 4084 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4085 | } |
| 4086 | |
| 4087 | static vector unsigned char __ATTRS_o_ai |
| 4088 | vec_vsl(vector unsigned char a, vector unsigned int b) |
| 4089 | { |
| 4090 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4091 | } |
| 4092 | |
| 4093 | static vector short __ATTRS_o_ai |
| 4094 | vec_vsl(vector short a, vector unsigned char b) |
| 4095 | { |
| 4096 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4097 | } |
| 4098 | |
| 4099 | static vector short __ATTRS_o_ai |
| 4100 | vec_vsl(vector short a, vector unsigned short b) |
| 4101 | { |
| 4102 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4103 | } |
| 4104 | |
| 4105 | static vector short __ATTRS_o_ai |
| 4106 | vec_vsl(vector short a, vector unsigned int b) |
| 4107 | { |
| 4108 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4109 | } |
| 4110 | |
| 4111 | static vector unsigned short __ATTRS_o_ai |
| 4112 | vec_vsl(vector unsigned short a, vector unsigned char b) |
| 4113 | { |
| 4114 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4115 | } |
| 4116 | |
| 4117 | static vector unsigned short __ATTRS_o_ai |
| 4118 | vec_vsl(vector unsigned short a, vector unsigned short b) |
| 4119 | { |
| 4120 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4121 | } |
| 4122 | |
| 4123 | static vector unsigned short __ATTRS_o_ai |
| 4124 | vec_vsl(vector unsigned short a, vector unsigned int b) |
| 4125 | { |
| 4126 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4127 | } |
| 4128 | |
| 4129 | static vector int __ATTRS_o_ai |
| 4130 | vec_vsl(vector int a, vector unsigned char b) |
| 4131 | { |
| 4132 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4133 | } |
| 4134 | |
| 4135 | static vector int __ATTRS_o_ai |
| 4136 | vec_vsl(vector int a, vector unsigned short b) |
| 4137 | { |
| 4138 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4139 | } |
| 4140 | |
| 4141 | static vector int __ATTRS_o_ai |
| 4142 | vec_vsl(vector int a, vector unsigned int b) |
| 4143 | { |
| 4144 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4145 | } |
| 4146 | |
| 4147 | static vector unsigned int __ATTRS_o_ai |
| 4148 | vec_vsl(vector unsigned int a, vector unsigned char b) |
| 4149 | { |
| 4150 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4151 | } |
| 4152 | |
| 4153 | static vector unsigned int __ATTRS_o_ai |
| 4154 | vec_vsl(vector unsigned int a, vector unsigned short b) |
| 4155 | { |
| 4156 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4157 | } |
| 4158 | |
| 4159 | static vector unsigned int __ATTRS_o_ai |
| 4160 | vec_vsl(vector unsigned int a, vector unsigned int b) |
| 4161 | { |
| 4162 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4163 | } |
| 4164 | |
| 4165 | /* vec_slo */ |
| 4166 | |
| 4167 | static vector signed char __ATTRS_o_ai |
| 4168 | vec_slo(vector signed char a, vector signed char b) |
| 4169 | { |
| 4170 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4171 | } |
| 4172 | |
| 4173 | static vector signed char __ATTRS_o_ai |
| 4174 | vec_slo(vector signed char a, vector unsigned char b) |
| 4175 | { |
| 4176 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4177 | } |
| 4178 | |
| 4179 | static vector unsigned char __ATTRS_o_ai |
| 4180 | vec_slo(vector unsigned char a, vector signed char b) |
| 4181 | { |
| 4182 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4183 | } |
| 4184 | |
| 4185 | static vector unsigned char __ATTRS_o_ai |
| 4186 | vec_slo(vector unsigned char a, vector unsigned char b) |
| 4187 | { |
| 4188 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4189 | } |
| 4190 | |
| 4191 | static vector short __ATTRS_o_ai |
| 4192 | vec_slo(vector short a, vector signed char b) |
| 4193 | { |
| 4194 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4195 | } |
| 4196 | |
| 4197 | static vector short __ATTRS_o_ai |
| 4198 | vec_slo(vector short a, vector unsigned char b) |
| 4199 | { |
| 4200 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4201 | } |
| 4202 | |
| 4203 | static vector unsigned short __ATTRS_o_ai |
| 4204 | vec_slo(vector unsigned short a, vector signed char b) |
| 4205 | { |
| 4206 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4207 | } |
| 4208 | |
| 4209 | static vector unsigned short __ATTRS_o_ai |
| 4210 | vec_slo(vector unsigned short a, vector unsigned char b) |
| 4211 | { |
| 4212 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4213 | } |
| 4214 | |
| 4215 | static vector int __ATTRS_o_ai |
| 4216 | vec_slo(vector int a, vector signed char b) |
| 4217 | { |
| 4218 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4219 | } |
| 4220 | |
| 4221 | static vector int __ATTRS_o_ai |
| 4222 | vec_slo(vector int a, vector unsigned char b) |
| 4223 | { |
| 4224 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4225 | } |
| 4226 | |
| 4227 | static vector unsigned int __ATTRS_o_ai |
| 4228 | vec_slo(vector unsigned int a, vector signed char b) |
| 4229 | { |
| 4230 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4231 | } |
| 4232 | |
| 4233 | static vector unsigned int __ATTRS_o_ai |
| 4234 | vec_slo(vector unsigned int a, vector unsigned char b) |
| 4235 | { |
| 4236 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4237 | } |
| 4238 | |
| 4239 | static vector float __ATTRS_o_ai |
| 4240 | vec_slo(vector float a, vector signed char b) |
| 4241 | { |
| 4242 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4243 | } |
| 4244 | |
| 4245 | static vector float __ATTRS_o_ai |
| 4246 | vec_slo(vector float a, vector unsigned char b) |
| 4247 | { |
| 4248 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4249 | } |
| 4250 | |
| 4251 | /* vec_vslo */ |
| 4252 | |
| 4253 | static vector signed char __ATTRS_o_ai |
| 4254 | vec_vslo(vector signed char a, vector signed char b) |
| 4255 | { |
| 4256 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4257 | } |
| 4258 | |
| 4259 | static vector signed char __ATTRS_o_ai |
| 4260 | vec_vslo(vector signed char a, vector unsigned char b) |
| 4261 | { |
| 4262 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4263 | } |
| 4264 | |
| 4265 | static vector unsigned char __ATTRS_o_ai |
| 4266 | vec_vslo(vector unsigned char a, vector signed char b) |
| 4267 | { |
| 4268 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4269 | } |
| 4270 | |
| 4271 | static vector unsigned char __ATTRS_o_ai |
| 4272 | vec_vslo(vector unsigned char a, vector unsigned char b) |
| 4273 | { |
| 4274 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4275 | } |
| 4276 | |
| 4277 | static vector short __ATTRS_o_ai |
| 4278 | vec_vslo(vector short a, vector signed char b) |
| 4279 | { |
| 4280 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4281 | } |
| 4282 | |
| 4283 | static vector short __ATTRS_o_ai |
| 4284 | vec_vslo(vector short a, vector unsigned char b) |
| 4285 | { |
| 4286 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4287 | } |
| 4288 | |
| 4289 | static vector unsigned short __ATTRS_o_ai |
| 4290 | vec_vslo(vector unsigned short a, vector signed char b) |
| 4291 | { |
| 4292 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4293 | } |
| 4294 | |
| 4295 | static vector unsigned short __ATTRS_o_ai |
| 4296 | vec_vslo(vector unsigned short a, vector unsigned char b) |
| 4297 | { |
| 4298 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4299 | } |
| 4300 | |
| 4301 | static vector int __ATTRS_o_ai |
| 4302 | vec_vslo(vector int a, vector signed char b) |
| 4303 | { |
| 4304 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4305 | } |
| 4306 | |
| 4307 | static vector int __ATTRS_o_ai |
| 4308 | vec_vslo(vector int a, vector unsigned char b) |
| 4309 | { |
| 4310 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4311 | } |
| 4312 | |
| 4313 | static vector unsigned int __ATTRS_o_ai |
| 4314 | vec_vslo(vector unsigned int a, vector signed char b) |
| 4315 | { |
| 4316 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4317 | } |
| 4318 | |
| 4319 | static vector unsigned int __ATTRS_o_ai |
| 4320 | vec_vslo(vector unsigned int a, vector unsigned char b) |
| 4321 | { |
| 4322 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4323 | } |
| 4324 | |
| 4325 | static vector float __ATTRS_o_ai |
| 4326 | vec_vslo(vector float a, vector signed char b) |
| 4327 | { |
| 4328 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4329 | } |
| 4330 | |
| 4331 | static vector float __ATTRS_o_ai |
| 4332 | vec_vslo(vector float a, vector unsigned char b) |
| 4333 | { |
| 4334 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4335 | } |
| 4336 | |
| 4337 | /* vec_splat */ |
| 4338 | |
| 4339 | static vector signed char __ATTRS_o_ai |
| 4340 | vec_splat(vector signed char a, unsigned char b) |
| 4341 | { |
| 4342 | return (vector signed char)vec_perm(a, a, (vector unsigned char)(b)); |
| 4343 | } |
| 4344 | |
| 4345 | static vector unsigned char __ATTRS_o_ai |
| 4346 | vec_splat(vector unsigned char a, unsigned char b) |
| 4347 | { |
| 4348 | return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b)); |
| 4349 | } |
| 4350 | |
| 4351 | static vector short __ATTRS_o_ai |
| 4352 | vec_splat(vector short a, unsigned char b) |
| 4353 | { |
| 4354 | b *= 2; |
| 4355 | return (vector short)vec_perm(a, a, (vector unsigned char) |
| 4356 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4357 | } |
| 4358 | |
| 4359 | static vector unsigned short __ATTRS_o_ai |
| 4360 | vec_splat(vector unsigned short a, unsigned char b) |
| 4361 | { |
| 4362 | b *= 2; |
| 4363 | return (vector unsigned short)vec_perm(a, a, (vector unsigned char) |
| 4364 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4365 | } |
| 4366 | |
| 4367 | static vector int __ATTRS_o_ai |
| 4368 | vec_splat(vector int a, unsigned char b) |
| 4369 | { |
| 4370 | b *= 4; |
| 4371 | return vec_perm(a, a, (vector unsigned char) |
| 4372 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4373 | } |
| 4374 | |
| 4375 | static vector unsigned int __ATTRS_o_ai |
| 4376 | vec_splat(vector unsigned int a, unsigned char b) |
| 4377 | { |
| 4378 | b *= 4; |
| 4379 | return (vector unsigned int)vec_perm(a, a, (vector unsigned char) |
| 4380 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4381 | } |
| 4382 | |
| 4383 | static vector float __ATTRS_o_ai |
| 4384 | vec_splat(vector float a, unsigned char b) |
| 4385 | { |
| 4386 | b *= 4; |
| 4387 | return (vector float)vec_perm(a, a, (vector unsigned char) |
| 4388 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4389 | } |
| 4390 | |
| 4391 | /* vec_vspltb */ |
| 4392 | |
| 4393 | #define __builtin_altivec_vspltb vec_vspltb |
| 4394 | |
| 4395 | static vector signed char __ATTRS_o_ai |
| 4396 | vec_vspltb(vector signed char a, unsigned char b) |
| 4397 | { |
| 4398 | return (vector signed char)vec_perm(a, a, (vector unsigned char)(b)); |
| 4399 | } |
| 4400 | |
| 4401 | static vector unsigned char __ATTRS_o_ai |
| 4402 | vec_vspltb(vector unsigned char a, unsigned char b) |
| 4403 | { |
| 4404 | return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b)); |
| 4405 | } |
| 4406 | |
| 4407 | /* vec_vsplth */ |
| 4408 | |
| 4409 | #define __builtin_altivec_vsplth vec_vsplth |
| 4410 | |
| 4411 | static vector short __ATTRS_o_ai |
| 4412 | vec_vsplth(vector short a, unsigned char b) |
| 4413 | { |
| 4414 | b *= 2; |
| 4415 | return (vector short)vec_perm(a, a, (vector unsigned char) |
| 4416 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4417 | } |
| 4418 | |
| 4419 | static vector unsigned short __ATTRS_o_ai |
| 4420 | vec_vsplth(vector unsigned short a, unsigned char b) |
| 4421 | { |
| 4422 | b *= 2; |
| 4423 | return (vector unsigned short)vec_perm(a, a, (vector unsigned char) |
| 4424 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4425 | } |
| 4426 | |
| 4427 | /* vec_vspltw */ |
| 4428 | |
| 4429 | #define __builtin_altivec_vspltw vec_vspltw |
| 4430 | |
| 4431 | static vector int __ATTRS_o_ai |
| 4432 | vec_vspltw(vector int a, unsigned char b) |
| 4433 | { |
| 4434 | b *= 4; |
| 4435 | return (vector int)vec_perm(a, a, (vector unsigned char) |
| 4436 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4437 | } |
| 4438 | |
| 4439 | static vector unsigned int __ATTRS_o_ai |
| 4440 | vec_vspltw(vector unsigned int a, unsigned char b) |
| 4441 | { |
| 4442 | b *= 4; |
| 4443 | return (vector unsigned int)vec_perm(a, a, (vector unsigned char) |
| 4444 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4445 | } |
| 4446 | |
| 4447 | static vector float __ATTRS_o_ai |
| 4448 | vec_vspltw(vector float a, unsigned char b) |
| 4449 | { |
| 4450 | b *= 4; |
| 4451 | return (vector float)vec_perm(a, a, (vector unsigned char) |
| 4452 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4453 | } |
| 4454 | |
| 4455 | /* vec_splat_s8 */ |
| 4456 | |
| 4457 | #define __builtin_altivec_vspltisb vec_splat_s8 |
| 4458 | |
| 4459 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4460 | static vector signed char __ATTRS_o_ai |
| 4461 | vec_splat_s8(signed char a) |
| 4462 | { |
| 4463 | return (vector signed char)(a); |
| 4464 | } |
| 4465 | |
| 4466 | /* vec_vspltisb */ |
| 4467 | |
| 4468 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4469 | static vector signed char __ATTRS_o_ai |
| 4470 | vec_vspltisb(signed char a) |
| 4471 | { |
| 4472 | return (vector signed char)(a); |
| 4473 | } |
| 4474 | |
| 4475 | /* vec_splat_s16 */ |
| 4476 | |
| 4477 | #define __builtin_altivec_vspltish vec_splat_s16 |
| 4478 | |
| 4479 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4480 | static vector short __ATTRS_o_ai |
| 4481 | vec_splat_s16(signed char a) |
| 4482 | { |
| 4483 | return (vector short)(a); |
| 4484 | } |
| 4485 | |
| 4486 | /* vec_vspltish */ |
| 4487 | |
| 4488 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4489 | static vector short __ATTRS_o_ai |
| 4490 | vec_vspltish(signed char a) |
| 4491 | { |
| 4492 | return (vector short)(a); |
| 4493 | } |
| 4494 | |
| 4495 | /* vec_splat_s32 */ |
| 4496 | |
| 4497 | #define __builtin_altivec_vspltisw vec_splat_s32 |
| 4498 | |
| 4499 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4500 | static vector int __ATTRS_o_ai |
| 4501 | vec_splat_s32(signed char a) |
| 4502 | { |
| 4503 | return (vector int)(a); |
| 4504 | } |
| 4505 | |
| 4506 | /* vec_vspltisw */ |
| 4507 | |
| 4508 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4509 | static vector int __ATTRS_o_ai |
| 4510 | vec_vspltisw(signed char a) |
| 4511 | { |
| 4512 | return (vector int)(a); |
| 4513 | } |
| 4514 | |
| 4515 | /* vec_splat_u8 */ |
| 4516 | |
| 4517 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4518 | static vector unsigned char __ATTRS_o_ai |
| 4519 | vec_splat_u8(unsigned char a) |
| 4520 | { |
| 4521 | return (vector unsigned char)(a); |
| 4522 | } |
| 4523 | |
| 4524 | /* vec_splat_u16 */ |
| 4525 | |
| 4526 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4527 | static vector unsigned short __ATTRS_o_ai |
| 4528 | vec_splat_u16(signed char a) |
| 4529 | { |
| 4530 | return (vector unsigned short)(a); |
| 4531 | } |
| 4532 | |
| 4533 | /* vec_splat_u32 */ |
| 4534 | |
| 4535 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4536 | static vector unsigned int __ATTRS_o_ai |
| 4537 | vec_splat_u32(signed char a) |
| 4538 | { |
| 4539 | return (vector unsigned int)(a); |
| 4540 | } |
| 4541 | |
| 4542 | /* vec_sr */ |
| 4543 | |
| 4544 | static vector signed char __ATTRS_o_ai |
| 4545 | vec_sr(vector signed char a, vector unsigned char b) |
| 4546 | { |
| 4547 | return a >> (vector signed char)b; |
| 4548 | } |
| 4549 | |
| 4550 | static vector unsigned char __ATTRS_o_ai |
| 4551 | vec_sr(vector unsigned char a, vector unsigned char b) |
| 4552 | { |
| 4553 | return a >> b; |
| 4554 | } |
| 4555 | |
| 4556 | static vector short __ATTRS_o_ai |
| 4557 | vec_sr(vector short a, vector unsigned short b) |
| 4558 | { |
| 4559 | return a >> (vector short)b; |
| 4560 | } |
| 4561 | |
| 4562 | static vector unsigned short __ATTRS_o_ai |
| 4563 | vec_sr(vector unsigned short a, vector unsigned short b) |
| 4564 | { |
| 4565 | return a >> b; |
| 4566 | } |
| 4567 | |
| 4568 | static vector int __ATTRS_o_ai |
| 4569 | vec_sr(vector int a, vector unsigned int b) |
| 4570 | { |
| 4571 | return a >> (vector int)b; |
| 4572 | } |
| 4573 | |
| 4574 | static vector unsigned int __ATTRS_o_ai |
| 4575 | vec_sr(vector unsigned int a, vector unsigned int b) |
| 4576 | { |
| 4577 | return a >> b; |
| 4578 | } |
| 4579 | |
| 4580 | /* vec_vsrb */ |
| 4581 | |
| 4582 | #define __builtin_altivec_vsrb vec_vsrb |
| 4583 | |
| 4584 | static vector signed char __ATTRS_o_ai |
| 4585 | vec_vsrb(vector signed char a, vector unsigned char b) |
| 4586 | { |
| 4587 | return a >> (vector signed char)b; |
| 4588 | } |
| 4589 | |
| 4590 | static vector unsigned char __ATTRS_o_ai |
| 4591 | vec_vsrb(vector unsigned char a, vector unsigned char b) |
| 4592 | { |
| 4593 | return a >> b; |
| 4594 | } |
| 4595 | |
| 4596 | /* vec_vsrh */ |
| 4597 | |
| 4598 | #define __builtin_altivec_vsrh vec_vsrh |
| 4599 | |
| 4600 | static vector short __ATTRS_o_ai |
| 4601 | vec_vsrh(vector short a, vector unsigned short b) |
| 4602 | { |
| 4603 | return a >> (vector short)b; |
| 4604 | } |
| 4605 | |
| 4606 | static vector unsigned short __ATTRS_o_ai |
| 4607 | vec_vsrh(vector unsigned short a, vector unsigned short b) |
| 4608 | { |
| 4609 | return a >> b; |
| 4610 | } |
| 4611 | |
| 4612 | /* vec_vsrw */ |
| 4613 | |
| 4614 | #define __builtin_altivec_vsrw vec_vsrw |
| 4615 | |
| 4616 | static vector int __ATTRS_o_ai |
| 4617 | vec_vsrw(vector int a, vector unsigned int b) |
| 4618 | { |
| 4619 | return a >> (vector int)b; |
| 4620 | } |
| 4621 | |
| 4622 | static vector unsigned int __ATTRS_o_ai |
| 4623 | vec_vsrw(vector unsigned int a, vector unsigned int b) |
| 4624 | { |
| 4625 | return a >> b; |
| 4626 | } |
| 4627 | |
| 4628 | /* vec_sra */ |
| 4629 | |
| 4630 | static vector signed char __ATTRS_o_ai |
| 4631 | vec_sra(vector signed char a, vector unsigned char b) |
| 4632 | { |
| 4633 | return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); |
| 4634 | } |
| 4635 | |
| 4636 | static vector unsigned char __ATTRS_o_ai |
| 4637 | vec_sra(vector unsigned char a, vector unsigned char b) |
| 4638 | { |
| 4639 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); |
| 4640 | } |
| 4641 | |
| 4642 | static vector short __ATTRS_o_ai |
| 4643 | vec_sra(vector short a, vector unsigned short b) |
| 4644 | { |
| 4645 | return __builtin_altivec_vsrah(a, (vector unsigned short)b); |
| 4646 | } |
| 4647 | |
| 4648 | static vector unsigned short __ATTRS_o_ai |
| 4649 | vec_sra(vector unsigned short a, vector unsigned short b) |
| 4650 | { |
| 4651 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); |
| 4652 | } |
| 4653 | |
| 4654 | static vector int __ATTRS_o_ai |
| 4655 | vec_sra(vector int a, vector unsigned int b) |
| 4656 | { |
| 4657 | return __builtin_altivec_vsraw(a, b); |
| 4658 | } |
| 4659 | |
| 4660 | static vector unsigned int __ATTRS_o_ai |
| 4661 | vec_sra(vector unsigned int a, vector unsigned int b) |
| 4662 | { |
| 4663 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); |
| 4664 | } |
| 4665 | |
| 4666 | /* vec_vsrab */ |
| 4667 | |
| 4668 | static vector signed char __ATTRS_o_ai |
| 4669 | vec_vsrab(vector signed char a, vector unsigned char b) |
| 4670 | { |
| 4671 | return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); |
| 4672 | } |
| 4673 | |
| 4674 | static vector unsigned char __ATTRS_o_ai |
| 4675 | vec_vsrab(vector unsigned char a, vector unsigned char b) |
| 4676 | { |
| 4677 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); |
| 4678 | } |
| 4679 | |
| 4680 | /* vec_vsrah */ |
| 4681 | |
| 4682 | static vector short __ATTRS_o_ai |
| 4683 | vec_vsrah(vector short a, vector unsigned short b) |
| 4684 | { |
| 4685 | return __builtin_altivec_vsrah(a, (vector unsigned short)b); |
| 4686 | } |
| 4687 | |
| 4688 | static vector unsigned short __ATTRS_o_ai |
| 4689 | vec_vsrah(vector unsigned short a, vector unsigned short b) |
| 4690 | { |
| 4691 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); |
| 4692 | } |
| 4693 | |
| 4694 | /* vec_vsraw */ |
| 4695 | |
| 4696 | static vector int __ATTRS_o_ai |
| 4697 | vec_vsraw(vector int a, vector unsigned int b) |
| 4698 | { |
| 4699 | return __builtin_altivec_vsraw(a, b); |
| 4700 | } |
| 4701 | |
| 4702 | static vector unsigned int __ATTRS_o_ai |
| 4703 | vec_vsraw(vector unsigned int a, vector unsigned int b) |
| 4704 | { |
| 4705 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); |
| 4706 | } |
| 4707 | |
| 4708 | /* vec_srl */ |
| 4709 | |
| 4710 | static vector signed char __ATTRS_o_ai |
| 4711 | vec_srl(vector signed char a, vector unsigned char b) |
| 4712 | { |
| 4713 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4714 | } |
| 4715 | |
| 4716 | static vector signed char __ATTRS_o_ai |
| 4717 | vec_srl(vector signed char a, vector unsigned short b) |
| 4718 | { |
| 4719 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4720 | } |
| 4721 | |
| 4722 | static vector signed char __ATTRS_o_ai |
| 4723 | vec_srl(vector signed char a, vector unsigned int b) |
| 4724 | { |
| 4725 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4726 | } |
| 4727 | |
| 4728 | static vector unsigned char __ATTRS_o_ai |
| 4729 | vec_srl(vector unsigned char a, vector unsigned char b) |
| 4730 | { |
| 4731 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4732 | } |
| 4733 | |
| 4734 | static vector unsigned char __ATTRS_o_ai |
| 4735 | vec_srl(vector unsigned char a, vector unsigned short b) |
| 4736 | { |
| 4737 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4738 | } |
| 4739 | |
| 4740 | static vector unsigned char __ATTRS_o_ai |
| 4741 | vec_srl(vector unsigned char a, vector unsigned int b) |
| 4742 | { |
| 4743 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4744 | } |
| 4745 | |
| 4746 | static vector short __ATTRS_o_ai |
| 4747 | vec_srl(vector short a, vector unsigned char b) |
| 4748 | { |
| 4749 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4750 | } |
| 4751 | |
| 4752 | static vector short __ATTRS_o_ai |
| 4753 | vec_srl(vector short a, vector unsigned short b) |
| 4754 | { |
| 4755 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4756 | } |
| 4757 | |
| 4758 | static vector short __ATTRS_o_ai |
| 4759 | vec_srl(vector short a, vector unsigned int b) |
| 4760 | { |
| 4761 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4762 | } |
| 4763 | |
| 4764 | static vector unsigned short __ATTRS_o_ai |
| 4765 | vec_srl(vector unsigned short a, vector unsigned char b) |
| 4766 | { |
| 4767 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4768 | } |
| 4769 | |
| 4770 | static vector unsigned short __ATTRS_o_ai |
| 4771 | vec_srl(vector unsigned short a, vector unsigned short b) |
| 4772 | { |
| 4773 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4774 | } |
| 4775 | |
| 4776 | static vector unsigned short __ATTRS_o_ai |
| 4777 | vec_srl(vector unsigned short a, vector unsigned int b) |
| 4778 | { |
| 4779 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4780 | } |
| 4781 | |
| 4782 | static vector int __ATTRS_o_ai |
| 4783 | vec_srl(vector int a, vector unsigned char b) |
| 4784 | { |
| 4785 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4786 | } |
| 4787 | |
| 4788 | static vector int __ATTRS_o_ai |
| 4789 | vec_srl(vector int a, vector unsigned short b) |
| 4790 | { |
| 4791 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4792 | } |
| 4793 | |
| 4794 | static vector int __ATTRS_o_ai |
| 4795 | vec_srl(vector int a, vector unsigned int b) |
| 4796 | { |
| 4797 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4798 | } |
| 4799 | |
| 4800 | static vector unsigned int __ATTRS_o_ai |
| 4801 | vec_srl(vector unsigned int a, vector unsigned char b) |
| 4802 | { |
| 4803 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4804 | } |
| 4805 | |
| 4806 | static vector unsigned int __ATTRS_o_ai |
| 4807 | vec_srl(vector unsigned int a, vector unsigned short b) |
| 4808 | { |
| 4809 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4810 | } |
| 4811 | |
| 4812 | static vector unsigned int __ATTRS_o_ai |
| 4813 | vec_srl(vector unsigned int a, vector unsigned int b) |
| 4814 | { |
| 4815 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4816 | } |
| 4817 | |
| 4818 | /* vec_vsr */ |
| 4819 | |
| 4820 | static vector signed char __ATTRS_o_ai |
| 4821 | vec_vsr(vector signed char a, vector unsigned char b) |
| 4822 | { |
| 4823 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4824 | } |
| 4825 | |
| 4826 | static vector signed char __ATTRS_o_ai |
| 4827 | vec_vsr(vector signed char a, vector unsigned short b) |
| 4828 | { |
| 4829 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4830 | } |
| 4831 | |
| 4832 | static vector signed char __ATTRS_o_ai |
| 4833 | vec_vsr(vector signed char a, vector unsigned int b) |
| 4834 | { |
| 4835 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4836 | } |
| 4837 | |
| 4838 | static vector unsigned char __ATTRS_o_ai |
| 4839 | vec_vsr(vector unsigned char a, vector unsigned char b) |
| 4840 | { |
| 4841 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4842 | } |
| 4843 | |
| 4844 | static vector unsigned char __ATTRS_o_ai |
| 4845 | vec_vsr(vector unsigned char a, vector unsigned short b) |
| 4846 | { |
| 4847 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4848 | } |
| 4849 | |
| 4850 | static vector unsigned char __ATTRS_o_ai |
| 4851 | vec_vsr(vector unsigned char a, vector unsigned int b) |
| 4852 | { |
| 4853 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4854 | } |
| 4855 | |
| 4856 | static vector short __ATTRS_o_ai |
| 4857 | vec_vsr(vector short a, vector unsigned char b) |
| 4858 | { |
| 4859 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4860 | } |
| 4861 | |
| 4862 | static vector short __ATTRS_o_ai |
| 4863 | vec_vsr(vector short a, vector unsigned short b) |
| 4864 | { |
| 4865 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4866 | } |
| 4867 | |
| 4868 | static vector short __ATTRS_o_ai |
| 4869 | vec_vsr(vector short a, vector unsigned int b) |
| 4870 | { |
| 4871 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4872 | } |
| 4873 | |
| 4874 | static vector unsigned short __ATTRS_o_ai |
| 4875 | vec_vsr(vector unsigned short a, vector unsigned char b) |
| 4876 | { |
| 4877 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4878 | } |
| 4879 | |
| 4880 | static vector unsigned short __ATTRS_o_ai |
| 4881 | vec_vsr(vector unsigned short a, vector unsigned short b) |
| 4882 | { |
| 4883 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4884 | } |
| 4885 | |
| 4886 | static vector unsigned short __ATTRS_o_ai |
| 4887 | vec_vsr(vector unsigned short a, vector unsigned int b) |
| 4888 | { |
| 4889 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4890 | } |
| 4891 | |
| 4892 | static vector int __ATTRS_o_ai |
| 4893 | vec_vsr(vector int a, vector unsigned char b) |
| 4894 | { |
| 4895 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4896 | } |
| 4897 | |
| 4898 | static vector int __ATTRS_o_ai |
| 4899 | vec_vsr(vector int a, vector unsigned short b) |
| 4900 | { |
| 4901 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4902 | } |
| 4903 | |
| 4904 | static vector int __ATTRS_o_ai |
| 4905 | vec_vsr(vector int a, vector unsigned int b) |
| 4906 | { |
| 4907 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 4908 | } |
| 4909 | |
| 4910 | static vector unsigned int __ATTRS_o_ai |
| 4911 | vec_vsr(vector unsigned int a, vector unsigned char b) |
| 4912 | { |
| 4913 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4914 | } |
| 4915 | |
| 4916 | static vector unsigned int __ATTRS_o_ai |
| 4917 | vec_vsr(vector unsigned int a, vector unsigned short b) |
| 4918 | { |
| 4919 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4920 | } |
| 4921 | |
| 4922 | static vector unsigned int __ATTRS_o_ai |
| 4923 | vec_vsr(vector unsigned int a, vector unsigned int b) |
| 4924 | { |
| 4925 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 4926 | } |
| 4927 | |
| 4928 | /* vec_sro */ |
| 4929 | |
| 4930 | static vector signed char __ATTRS_o_ai |
| 4931 | vec_sro(vector signed char a, vector signed char b) |
| 4932 | { |
| 4933 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4934 | } |
| 4935 | |
| 4936 | static vector signed char __ATTRS_o_ai |
| 4937 | vec_sro(vector signed char a, vector unsigned char b) |
| 4938 | { |
| 4939 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4940 | } |
| 4941 | |
| 4942 | static vector unsigned char __ATTRS_o_ai |
| 4943 | vec_sro(vector unsigned char a, vector signed char b) |
| 4944 | { |
| 4945 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4946 | } |
| 4947 | |
| 4948 | static vector unsigned char __ATTRS_o_ai |
| 4949 | vec_sro(vector unsigned char a, vector unsigned char b) |
| 4950 | { |
| 4951 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4952 | } |
| 4953 | |
| 4954 | static vector short __ATTRS_o_ai |
| 4955 | vec_sro(vector short a, vector signed char b) |
| 4956 | { |
| 4957 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4958 | } |
| 4959 | |
| 4960 | static vector short __ATTRS_o_ai |
| 4961 | vec_sro(vector short a, vector unsigned char b) |
| 4962 | { |
| 4963 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4964 | } |
| 4965 | |
| 4966 | static vector unsigned short __ATTRS_o_ai |
| 4967 | vec_sro(vector unsigned short a, vector signed char b) |
| 4968 | { |
| 4969 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4970 | } |
| 4971 | |
| 4972 | static vector unsigned short __ATTRS_o_ai |
| 4973 | vec_sro(vector unsigned short a, vector unsigned char b) |
| 4974 | { |
| 4975 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4976 | } |
| 4977 | |
| 4978 | static vector int __ATTRS_o_ai |
| 4979 | vec_sro(vector int a, vector signed char b) |
| 4980 | { |
| 4981 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 4982 | } |
| 4983 | |
| 4984 | static vector int __ATTRS_o_ai |
| 4985 | vec_sro(vector int a, vector unsigned char b) |
| 4986 | { |
| 4987 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 4988 | } |
| 4989 | |
| 4990 | static vector unsigned int __ATTRS_o_ai |
| 4991 | vec_sro(vector unsigned int a, vector signed char b) |
| 4992 | { |
| 4993 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 4994 | } |
| 4995 | |
| 4996 | static vector unsigned int __ATTRS_o_ai |
| 4997 | vec_sro(vector unsigned int a, vector unsigned char b) |
| 4998 | { |
| 4999 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5000 | } |
| 5001 | |
| 5002 | static vector float __ATTRS_o_ai |
| 5003 | vec_sro(vector float a, vector signed char b) |
| 5004 | { |
| 5005 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5006 | } |
| 5007 | |
| 5008 | static vector float __ATTRS_o_ai |
| 5009 | vec_sro(vector float a, vector unsigned char b) |
| 5010 | { |
| 5011 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5012 | } |
| 5013 | |
| 5014 | /* vec_vsro */ |
| 5015 | |
| 5016 | static vector signed char __ATTRS_o_ai |
| 5017 | vec_vsro(vector signed char a, vector signed char b) |
| 5018 | { |
| 5019 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5020 | } |
| 5021 | |
| 5022 | static vector signed char __ATTRS_o_ai |
| 5023 | vec_vsro(vector signed char a, vector unsigned char b) |
| 5024 | { |
| 5025 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5026 | } |
| 5027 | |
| 5028 | static vector unsigned char __ATTRS_o_ai |
| 5029 | vec_vsro(vector unsigned char a, vector signed char b) |
| 5030 | { |
| 5031 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5032 | } |
| 5033 | |
| 5034 | static vector unsigned char __ATTRS_o_ai |
| 5035 | vec_vsro(vector unsigned char a, vector unsigned char b) |
| 5036 | { |
| 5037 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5038 | } |
| 5039 | |
| 5040 | static vector short __ATTRS_o_ai |
| 5041 | vec_vsro(vector short a, vector signed char b) |
| 5042 | { |
| 5043 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5044 | } |
| 5045 | |
| 5046 | static vector short __ATTRS_o_ai |
| 5047 | vec_vsro(vector short a, vector unsigned char b) |
| 5048 | { |
| 5049 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5050 | } |
| 5051 | |
| 5052 | static vector unsigned short __ATTRS_o_ai |
| 5053 | vec_vsro(vector unsigned short a, vector signed char b) |
| 5054 | { |
| 5055 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5056 | } |
| 5057 | |
| 5058 | static vector unsigned short __ATTRS_o_ai |
| 5059 | vec_vsro(vector unsigned short a, vector unsigned char b) |
| 5060 | { |
| 5061 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5062 | } |
| 5063 | |
| 5064 | static vector int __ATTRS_o_ai |
| 5065 | vec_vsro(vector int a, vector signed char b) |
| 5066 | { |
| 5067 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5068 | } |
| 5069 | |
| 5070 | static vector int __ATTRS_o_ai |
| 5071 | vec_vsro(vector int a, vector unsigned char b) |
| 5072 | { |
| 5073 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5074 | } |
| 5075 | |
| 5076 | static vector unsigned int __ATTRS_o_ai |
| 5077 | vec_vsro(vector unsigned int a, vector signed char b) |
| 5078 | { |
| 5079 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5080 | } |
| 5081 | |
| 5082 | static vector unsigned int __ATTRS_o_ai |
| 5083 | vec_vsro(vector unsigned int a, vector unsigned char b) |
| 5084 | { |
| 5085 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5086 | } |
| 5087 | |
| 5088 | static vector float __ATTRS_o_ai |
| 5089 | vec_vsro(vector float a, vector signed char b) |
| 5090 | { |
| 5091 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5092 | } |
| 5093 | |
| 5094 | static vector float __ATTRS_o_ai |
| 5095 | vec_vsro(vector float a, vector unsigned char b) |
| 5096 | { |
| 5097 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5098 | } |
| 5099 | |
| 5100 | /* vec_st */ |
| 5101 | |
| 5102 | static void __ATTRS_o_ai |
| 5103 | vec_st(vector signed char a, int b, vector signed char *c) |
| 5104 | { |
| 5105 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5106 | } |
| 5107 | |
| 5108 | static void __ATTRS_o_ai |
| 5109 | vec_st(vector signed char a, int b, signed char *c) |
| 5110 | { |
| 5111 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5112 | } |
| 5113 | |
| 5114 | static void __ATTRS_o_ai |
| 5115 | vec_st(vector unsigned char a, int b, vector unsigned char *c) |
| 5116 | { |
| 5117 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5118 | } |
| 5119 | |
| 5120 | static void __ATTRS_o_ai |
| 5121 | vec_st(vector unsigned char a, int b, unsigned char *c) |
| 5122 | { |
| 5123 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5124 | } |
| 5125 | |
| 5126 | static void __ATTRS_o_ai |
| 5127 | vec_st(vector short a, int b, vector short *c) |
| 5128 | { |
| 5129 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5130 | } |
| 5131 | |
| 5132 | static void __ATTRS_o_ai |
| 5133 | vec_st(vector short a, int b, short *c) |
| 5134 | { |
| 5135 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5136 | } |
| 5137 | |
| 5138 | static void __ATTRS_o_ai |
| 5139 | vec_st(vector unsigned short a, int b, vector unsigned short *c) |
| 5140 | { |
| 5141 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5142 | } |
| 5143 | |
| 5144 | static void __ATTRS_o_ai |
| 5145 | vec_st(vector unsigned short a, int b, unsigned short *c) |
| 5146 | { |
| 5147 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5148 | } |
| 5149 | |
| 5150 | static void __ATTRS_o_ai |
| 5151 | vec_st(vector int a, int b, vector int *c) |
| 5152 | { |
| 5153 | __builtin_altivec_stvx(a, b, c); |
| 5154 | } |
| 5155 | |
| 5156 | static void __ATTRS_o_ai |
| 5157 | vec_st(vector int a, int b, int *c) |
| 5158 | { |
| 5159 | __builtin_altivec_stvx(a, b, c); |
| 5160 | } |
| 5161 | |
| 5162 | static void __ATTRS_o_ai |
| 5163 | vec_st(vector unsigned int a, int b, vector unsigned int *c) |
| 5164 | { |
| 5165 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5166 | } |
| 5167 | |
| 5168 | static void __ATTRS_o_ai |
| 5169 | vec_st(vector unsigned int a, int b, unsigned int *c) |
| 5170 | { |
| 5171 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5172 | } |
| 5173 | |
| 5174 | static void __ATTRS_o_ai |
| 5175 | vec_st(vector float a, int b, vector float *c) |
| 5176 | { |
| 5177 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5178 | } |
| 5179 | |
| 5180 | static void __ATTRS_o_ai |
| 5181 | vec_st(vector float a, int b, float *c) |
| 5182 | { |
| 5183 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5184 | } |
| 5185 | |
| 5186 | /* vec_stvx */ |
| 5187 | |
| 5188 | static void __ATTRS_o_ai |
| 5189 | vec_stvx(vector signed char a, int b, vector signed char *c) |
| 5190 | { |
| 5191 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5192 | } |
| 5193 | |
| 5194 | static void __ATTRS_o_ai |
| 5195 | vec_stvx(vector signed char a, int b, signed char *c) |
| 5196 | { |
| 5197 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5198 | } |
| 5199 | |
| 5200 | static void __ATTRS_o_ai |
| 5201 | vec_stvx(vector unsigned char a, int b, vector unsigned char *c) |
| 5202 | { |
| 5203 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5204 | } |
| 5205 | |
| 5206 | static void __ATTRS_o_ai |
| 5207 | vec_stvx(vector unsigned char a, int b, unsigned char *c) |
| 5208 | { |
| 5209 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5210 | } |
| 5211 | |
| 5212 | static void __ATTRS_o_ai |
| 5213 | vec_stvx(vector short a, int b, vector short *c) |
| 5214 | { |
| 5215 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5216 | } |
| 5217 | |
| 5218 | static void __ATTRS_o_ai |
| 5219 | vec_stvx(vector short a, int b, short *c) |
| 5220 | { |
| 5221 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5222 | } |
| 5223 | |
| 5224 | static void __ATTRS_o_ai |
| 5225 | vec_stvx(vector unsigned short a, int b, vector unsigned short *c) |
| 5226 | { |
| 5227 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5228 | } |
| 5229 | |
| 5230 | static void __ATTRS_o_ai |
| 5231 | vec_stvx(vector unsigned short a, int b, unsigned short *c) |
| 5232 | { |
| 5233 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5234 | } |
| 5235 | |
| 5236 | static void __ATTRS_o_ai |
| 5237 | vec_stvx(vector int a, int b, vector int *c) |
| 5238 | { |
| 5239 | __builtin_altivec_stvx(a, b, c); |
| 5240 | } |
| 5241 | |
| 5242 | static void __ATTRS_o_ai |
| 5243 | vec_stvx(vector int a, int b, int *c) |
| 5244 | { |
| 5245 | __builtin_altivec_stvx(a, b, c); |
| 5246 | } |
| 5247 | |
| 5248 | static void __ATTRS_o_ai |
| 5249 | vec_stvx(vector unsigned int a, int b, vector unsigned int *c) |
| 5250 | { |
| 5251 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5252 | } |
| 5253 | |
| 5254 | static void __ATTRS_o_ai |
| 5255 | vec_stvx(vector unsigned int a, int b, unsigned int *c) |
| 5256 | { |
| 5257 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5258 | } |
| 5259 | |
| 5260 | static void __ATTRS_o_ai |
| 5261 | vec_stvx(vector float a, int b, vector float *c) |
| 5262 | { |
| 5263 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5264 | } |
| 5265 | |
| 5266 | static void __ATTRS_o_ai |
| 5267 | vec_stvx(vector float a, int b, float *c) |
| 5268 | { |
| 5269 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5270 | } |
| 5271 | |
| 5272 | /* vec_ste */ |
| 5273 | |
| 5274 | static void __ATTRS_o_ai |
| 5275 | vec_ste(vector signed char a, int b, signed char *c) |
| 5276 | { |
| 5277 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5278 | } |
| 5279 | |
| 5280 | static void __ATTRS_o_ai |
| 5281 | vec_ste(vector unsigned char a, int b, unsigned char *c) |
| 5282 | { |
| 5283 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5284 | } |
| 5285 | |
| 5286 | static void __ATTRS_o_ai |
| 5287 | vec_ste(vector short a, int b, short *c) |
| 5288 | { |
| 5289 | __builtin_altivec_stvehx(a, b, c); |
| 5290 | } |
| 5291 | |
| 5292 | static void __ATTRS_o_ai |
| 5293 | vec_ste(vector unsigned short a, int b, unsigned short *c) |
| 5294 | { |
| 5295 | __builtin_altivec_stvehx((vector short)a, b, c); |
| 5296 | } |
| 5297 | |
| 5298 | static void __ATTRS_o_ai |
| 5299 | vec_ste(vector int a, int b, int *c) |
| 5300 | { |
| 5301 | __builtin_altivec_stvewx(a, b, c); |
| 5302 | } |
| 5303 | |
| 5304 | static void __ATTRS_o_ai |
| 5305 | vec_ste(vector unsigned int a, int b, unsigned int *c) |
| 5306 | { |
| 5307 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5308 | } |
| 5309 | |
| 5310 | static void __ATTRS_o_ai |
| 5311 | vec_ste(vector float a, int b, float *c) |
| 5312 | { |
| 5313 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5314 | } |
| 5315 | |
| 5316 | /* vec_stvebx */ |
| 5317 | |
| 5318 | static void __ATTRS_o_ai |
| 5319 | vec_stvebx(vector signed char a, int b, signed char *c) |
| 5320 | { |
| 5321 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5322 | } |
| 5323 | |
| 5324 | static void __ATTRS_o_ai |
| 5325 | vec_stvebx(vector unsigned char a, int b, unsigned char *c) |
| 5326 | { |
| 5327 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5328 | } |
| 5329 | |
| 5330 | /* vec_stvehx */ |
| 5331 | |
| 5332 | static void __ATTRS_o_ai |
| 5333 | vec_stvehx(vector short a, int b, short *c) |
| 5334 | { |
| 5335 | __builtin_altivec_stvehx(a, b, c); |
| 5336 | } |
| 5337 | |
| 5338 | static void __ATTRS_o_ai |
| 5339 | vec_stvehx(vector unsigned short a, int b, unsigned short *c) |
| 5340 | { |
| 5341 | __builtin_altivec_stvehx((vector short)a, b, c); |
| 5342 | } |
| 5343 | |
| 5344 | /* vec_stvewx */ |
| 5345 | |
| 5346 | static void __ATTRS_o_ai |
| 5347 | vec_stvewx(vector int a, int b, int *c) |
| 5348 | { |
| 5349 | __builtin_altivec_stvewx(a, b, c); |
| 5350 | } |
| 5351 | |
| 5352 | static void __ATTRS_o_ai |
| 5353 | vec_stvewx(vector unsigned int a, int b, unsigned int *c) |
| 5354 | { |
| 5355 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5356 | } |
| 5357 | |
| 5358 | static void __ATTRS_o_ai |
| 5359 | vec_stvewx(vector float a, int b, float *c) |
| 5360 | { |
| 5361 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5362 | } |
| 5363 | |
| 5364 | /* vec_stl */ |
| 5365 | |
| 5366 | static void __ATTRS_o_ai |
| 5367 | vec_stl(vector signed char a, int b, vector signed char *c) |
| 5368 | { |
| 5369 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5370 | } |
| 5371 | |
| 5372 | static void __ATTRS_o_ai |
| 5373 | vec_stl(vector signed char a, int b, signed char *c) |
| 5374 | { |
| 5375 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5376 | } |
| 5377 | |
| 5378 | static void __ATTRS_o_ai |
| 5379 | vec_stl(vector unsigned char a, int b, vector unsigned char *c) |
| 5380 | { |
| 5381 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5382 | } |
| 5383 | |
| 5384 | static void __ATTRS_o_ai |
| 5385 | vec_stl(vector unsigned char a, int b, unsigned char *c) |
| 5386 | { |
| 5387 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5388 | } |
| 5389 | |
| 5390 | static void __ATTRS_o_ai |
| 5391 | vec_stl(vector short a, int b, vector short *c) |
| 5392 | { |
| 5393 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5394 | } |
| 5395 | |
| 5396 | static void __ATTRS_o_ai |
| 5397 | vec_stl(vector short a, int b, short *c) |
| 5398 | { |
| 5399 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5400 | } |
| 5401 | |
| 5402 | static void __ATTRS_o_ai |
| 5403 | vec_stl(vector unsigned short a, int b, vector unsigned short *c) |
| 5404 | { |
| 5405 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5406 | } |
| 5407 | |
| 5408 | static void __ATTRS_o_ai |
| 5409 | vec_stl(vector unsigned short a, int b, unsigned short *c) |
| 5410 | { |
| 5411 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5412 | } |
| 5413 | |
| 5414 | static void __ATTRS_o_ai |
| 5415 | vec_stl(vector int a, int b, vector int *c) |
| 5416 | { |
| 5417 | __builtin_altivec_stvxl(a, b, c); |
| 5418 | } |
| 5419 | |
| 5420 | static void __ATTRS_o_ai |
| 5421 | vec_stl(vector int a, int b, int *c) |
| 5422 | { |
| 5423 | __builtin_altivec_stvxl(a, b, c); |
| 5424 | } |
| 5425 | |
| 5426 | static void __ATTRS_o_ai |
| 5427 | vec_stl(vector unsigned int a, int b, vector unsigned int *c) |
| 5428 | { |
| 5429 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5430 | } |
| 5431 | |
| 5432 | static void __ATTRS_o_ai |
| 5433 | vec_stl(vector unsigned int a, int b, unsigned int *c) |
| 5434 | { |
| 5435 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5436 | } |
| 5437 | |
| 5438 | static void __ATTRS_o_ai |
| 5439 | vec_stl(vector float a, int b, vector float *c) |
| 5440 | { |
| 5441 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5442 | } |
| 5443 | |
| 5444 | static void __ATTRS_o_ai |
| 5445 | vec_stl(vector float a, int b, float *c) |
| 5446 | { |
| 5447 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5448 | } |
| 5449 | |
| 5450 | /* vec_stvxl */ |
| 5451 | |
| 5452 | static void __ATTRS_o_ai |
| 5453 | vec_stvxl(vector signed char a, int b, vector signed char *c) |
| 5454 | { |
| 5455 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5456 | } |
| 5457 | |
| 5458 | static void __ATTRS_o_ai |
| 5459 | vec_stvxl(vector signed char a, int b, signed char *c) |
| 5460 | { |
| 5461 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5462 | } |
| 5463 | |
| 5464 | static void __ATTRS_o_ai |
| 5465 | vec_stvxl(vector unsigned char a, int b, vector unsigned char *c) |
| 5466 | { |
| 5467 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5468 | } |
| 5469 | |
| 5470 | static void __ATTRS_o_ai |
| 5471 | vec_stvxl(vector unsigned char a, int b, unsigned char *c) |
| 5472 | { |
| 5473 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5474 | } |
| 5475 | |
| 5476 | static void __ATTRS_o_ai |
| 5477 | vec_stvxl(vector short a, int b, vector short *c) |
| 5478 | { |
| 5479 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5480 | } |
| 5481 | |
| 5482 | static void __ATTRS_o_ai |
| 5483 | vec_stvxl(vector short a, int b, short *c) |
| 5484 | { |
| 5485 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5486 | } |
| 5487 | |
| 5488 | static void __ATTRS_o_ai |
| 5489 | vec_stvxl(vector unsigned short a, int b, vector unsigned short *c) |
| 5490 | { |
| 5491 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5492 | } |
| 5493 | |
| 5494 | static void __ATTRS_o_ai |
| 5495 | vec_stvxl(vector unsigned short a, int b, unsigned short *c) |
| 5496 | { |
| 5497 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5498 | } |
| 5499 | |
| 5500 | static void __ATTRS_o_ai |
| 5501 | vec_stvxl(vector int a, int b, vector int *c) |
| 5502 | { |
| 5503 | __builtin_altivec_stvxl(a, b, c); |
| 5504 | } |
| 5505 | |
| 5506 | static void __ATTRS_o_ai |
| 5507 | vec_stvxl(vector int a, int b, int *c) |
| 5508 | { |
| 5509 | __builtin_altivec_stvxl(a, b, c); |
| 5510 | } |
| 5511 | |
| 5512 | static void __ATTRS_o_ai |
| 5513 | vec_stvxl(vector unsigned int a, int b, vector unsigned int *c) |
| 5514 | { |
| 5515 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5516 | } |
| 5517 | |
| 5518 | static void __ATTRS_o_ai |
| 5519 | vec_stvxl(vector unsigned int a, int b, unsigned int *c) |
| 5520 | { |
| 5521 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5522 | } |
| 5523 | |
| 5524 | static void __ATTRS_o_ai |
| 5525 | vec_stvxl(vector float a, int b, vector float *c) |
| 5526 | { |
| 5527 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5528 | } |
| 5529 | |
| 5530 | static void __ATTRS_o_ai |
| 5531 | vec_stvxl(vector float a, int b, float *c) |
| 5532 | { |
| 5533 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5534 | } |
| 5535 | |
| 5536 | /* vec_sub */ |
| 5537 | |
| 5538 | static vector signed char __ATTRS_o_ai |
| 5539 | vec_sub(vector signed char a, vector signed char b) |
| 5540 | { |
| 5541 | return a - b; |
| 5542 | } |
| 5543 | |
| 5544 | static vector unsigned char __ATTRS_o_ai |
| 5545 | vec_sub(vector unsigned char a, vector unsigned char b) |
| 5546 | { |
| 5547 | return a - b; |
| 5548 | } |
| 5549 | |
| 5550 | static vector short __ATTRS_o_ai |
| 5551 | vec_sub(vector short a, vector short b) |
| 5552 | { |
| 5553 | return a - b; |
| 5554 | } |
| 5555 | |
| 5556 | static vector unsigned short __ATTRS_o_ai |
| 5557 | vec_sub(vector unsigned short a, vector unsigned short b) |
| 5558 | { |
| 5559 | return a - b; |
| 5560 | } |
| 5561 | |
| 5562 | static vector int __ATTRS_o_ai |
| 5563 | vec_sub(vector int a, vector int b) |
| 5564 | { |
| 5565 | return a - b; |
| 5566 | } |
| 5567 | |
| 5568 | static vector unsigned int __ATTRS_o_ai |
| 5569 | vec_sub(vector unsigned int a, vector unsigned int b) |
| 5570 | { |
| 5571 | return a - b; |
| 5572 | } |
| 5573 | |
| 5574 | static vector float __ATTRS_o_ai |
| 5575 | vec_sub(vector float a, vector float b) |
| 5576 | { |
| 5577 | return a - b; |
| 5578 | } |
| 5579 | |
| 5580 | /* vec_vsububm */ |
| 5581 | |
| 5582 | #define __builtin_altivec_vsububm vec_vsububm |
| 5583 | |
| 5584 | static vector signed char __ATTRS_o_ai |
| 5585 | vec_vsububm(vector signed char a, vector signed char b) |
| 5586 | { |
| 5587 | return a - b; |
| 5588 | } |
| 5589 | |
| 5590 | static vector unsigned char __ATTRS_o_ai |
| 5591 | vec_vsububm(vector unsigned char a, vector unsigned char b) |
| 5592 | { |
| 5593 | return a - b; |
| 5594 | } |
| 5595 | |
| 5596 | /* vec_vsubuhm */ |
| 5597 | |
| 5598 | #define __builtin_altivec_vsubuhm vec_vsubuhm |
| 5599 | |
| 5600 | static vector short __ATTRS_o_ai |
| 5601 | vec_vsubuhm(vector short a, vector short b) |
| 5602 | { |
| 5603 | return a - b; |
| 5604 | } |
| 5605 | |
| 5606 | static vector unsigned short __ATTRS_o_ai |
| 5607 | vec_vsubuhm(vector unsigned short a, vector unsigned short b) |
| 5608 | { |
| 5609 | return a - b; |
| 5610 | } |
| 5611 | |
| 5612 | /* vec_vsubuwm */ |
| 5613 | |
| 5614 | #define __builtin_altivec_vsubuwm vec_vsubuwm |
| 5615 | |
| 5616 | static vector int __ATTRS_o_ai |
| 5617 | vec_vsubuwm(vector int a, vector int b) |
| 5618 | { |
| 5619 | return a - b; |
| 5620 | } |
| 5621 | |
| 5622 | static vector unsigned int __ATTRS_o_ai |
| 5623 | vec_vsubuwm(vector unsigned int a, vector unsigned int b) |
| 5624 | { |
| 5625 | return a - b; |
| 5626 | } |
| 5627 | |
| 5628 | /* vec_vsubfp */ |
| 5629 | |
| 5630 | #define __builtin_altivec_vsubfp vec_vsubfp |
| 5631 | |
| 5632 | static vector float __attribute__((__always_inline__)) |
| 5633 | vec_vsubfp(vector float a, vector float b) |
| 5634 | { |
| 5635 | return a - b; |
| 5636 | } |
| 5637 | |
| 5638 | /* vec_subc */ |
| 5639 | |
| 5640 | static vector unsigned int __attribute__((__always_inline__)) |
| 5641 | vec_subc(vector unsigned int a, vector unsigned int b) |
| 5642 | { |
| 5643 | return __builtin_altivec_vsubcuw(a, b); |
| 5644 | } |
| 5645 | |
| 5646 | /* vec_vsubcuw */ |
| 5647 | |
| 5648 | static vector unsigned int __attribute__((__always_inline__)) |
| 5649 | vec_vsubcuw(vector unsigned int a, vector unsigned int b) |
| 5650 | { |
| 5651 | return __builtin_altivec_vsubcuw(a, b); |
| 5652 | } |
| 5653 | |
| 5654 | /* vec_subs */ |
| 5655 | |
| 5656 | static vector signed char __ATTRS_o_ai |
| 5657 | vec_subs(vector signed char a, vector signed char b) |
| 5658 | { |
| 5659 | return __builtin_altivec_vsubsbs(a, b); |
| 5660 | } |
| 5661 | |
| 5662 | static vector unsigned char __ATTRS_o_ai |
| 5663 | vec_subs(vector unsigned char a, vector unsigned char b) |
| 5664 | { |
| 5665 | return __builtin_altivec_vsububs(a, b); |
| 5666 | } |
| 5667 | |
| 5668 | static vector short __ATTRS_o_ai |
| 5669 | vec_subs(vector short a, vector short b) |
| 5670 | { |
| 5671 | return __builtin_altivec_vsubshs(a, b); |
| 5672 | } |
| 5673 | |
| 5674 | static vector unsigned short __ATTRS_o_ai |
| 5675 | vec_subs(vector unsigned short a, vector unsigned short b) |
| 5676 | { |
| 5677 | return __builtin_altivec_vsubuhs(a, b); |
| 5678 | } |
| 5679 | |
| 5680 | static vector int __ATTRS_o_ai |
| 5681 | vec_subs(vector int a, vector int b) |
| 5682 | { |
| 5683 | return __builtin_altivec_vsubsws(a, b); |
| 5684 | } |
| 5685 | |
| 5686 | static vector unsigned int __ATTRS_o_ai |
| 5687 | vec_subs(vector unsigned int a, vector unsigned int b) |
| 5688 | { |
| 5689 | return __builtin_altivec_vsubuws(a, b); |
| 5690 | } |
| 5691 | |
| 5692 | /* vec_vsubsbs */ |
| 5693 | |
| 5694 | static vector signed char __attribute__((__always_inline__)) |
| 5695 | vec_vsubsbs(vector signed char a, vector signed char b) |
| 5696 | { |
| 5697 | return __builtin_altivec_vsubsbs(a, b); |
| 5698 | } |
| 5699 | |
| 5700 | /* vec_vsububs */ |
| 5701 | |
| 5702 | static vector unsigned char __attribute__((__always_inline__)) |
| 5703 | vec_vsububs(vector unsigned char a, vector unsigned char b) |
| 5704 | { |
| 5705 | return __builtin_altivec_vsububs(a, b); |
| 5706 | } |
| 5707 | |
| 5708 | /* vec_vsubshs */ |
| 5709 | |
| 5710 | static vector short __attribute__((__always_inline__)) |
| 5711 | vec_vsubshs(vector short a, vector short b) |
| 5712 | { |
| 5713 | return __builtin_altivec_vsubshs(a, b); |
| 5714 | } |
| 5715 | |
| 5716 | /* vec_vsubuhs */ |
| 5717 | |
| 5718 | static vector unsigned short __attribute__((__always_inline__)) |
| 5719 | vec_vsubuhs(vector unsigned short a, vector unsigned short b) |
| 5720 | { |
| 5721 | return __builtin_altivec_vsubuhs(a, b); |
| 5722 | } |
| 5723 | |
| 5724 | /* vec_vsubsws */ |
| 5725 | |
| 5726 | static vector int __attribute__((__always_inline__)) |
| 5727 | vec_vsubsws(vector int a, vector int b) |
| 5728 | { |
| 5729 | return __builtin_altivec_vsubsws(a, b); |
| 5730 | } |
| 5731 | |
| 5732 | /* vec_vsubuws */ |
| 5733 | |
| 5734 | static vector unsigned int __attribute__((__always_inline__)) |
| 5735 | vec_vsubuws(vector unsigned int a, vector unsigned int b) |
| 5736 | { |
| 5737 | return __builtin_altivec_vsubuws(a, b); |
| 5738 | } |
| 5739 | |
| 5740 | /* vec_sum4s */ |
| 5741 | |
| 5742 | static vector int __ATTRS_o_ai |
| 5743 | vec_sum4s(vector signed char a, vector int b) |
| 5744 | { |
| 5745 | return __builtin_altivec_vsum4sbs(a, b); |
| 5746 | } |
| 5747 | |
| 5748 | static vector unsigned int __ATTRS_o_ai |
| 5749 | vec_sum4s(vector unsigned char a, vector unsigned int b) |
| 5750 | { |
| 5751 | return __builtin_altivec_vsum4ubs(a, b); |
| 5752 | } |
| 5753 | |
| 5754 | static vector int __ATTRS_o_ai |
| 5755 | vec_sum4s(vector signed short a, vector int b) |
| 5756 | { |
| 5757 | return __builtin_altivec_vsum4shs(a, b); |
| 5758 | } |
| 5759 | |
| 5760 | /* vec_vsum4sbs */ |
| 5761 | |
| 5762 | static vector int __attribute__((__always_inline__)) |
| 5763 | vec_vsum4sbs(vector signed char a, vector int b) |
| 5764 | { |
| 5765 | return __builtin_altivec_vsum4sbs(a, b); |
| 5766 | } |
| 5767 | |
| 5768 | /* vec_vsum4ubs */ |
| 5769 | |
| 5770 | static vector unsigned int __attribute__((__always_inline__)) |
| 5771 | vec_vsum4ubs(vector unsigned char a, vector unsigned int b) |
| 5772 | { |
| 5773 | return __builtin_altivec_vsum4ubs(a, b); |
| 5774 | } |
| 5775 | |
| 5776 | /* vec_vsum4shs */ |
| 5777 | |
| 5778 | static vector int __attribute__((__always_inline__)) |
| 5779 | vec_vsum4shs(vector signed short a, vector int b) |
| 5780 | { |
| 5781 | return __builtin_altivec_vsum4shs(a, b); |
| 5782 | } |
| 5783 | |
| 5784 | /* vec_sum2s */ |
| 5785 | |
| 5786 | static vector signed int __attribute__((__always_inline__)) |
| 5787 | vec_sum2s(vector int a, vector int b) |
| 5788 | { |
| 5789 | return __builtin_altivec_vsum2sws(a, b); |
| 5790 | } |
| 5791 | |
| 5792 | /* vec_vsum2sws */ |
| 5793 | |
| 5794 | static vector signed int __attribute__((__always_inline__)) |
| 5795 | vec_vsum2sws(vector int a, vector int b) |
| 5796 | { |
| 5797 | return __builtin_altivec_vsum2sws(a, b); |
| 5798 | } |
| 5799 | |
| 5800 | /* vec_sums */ |
| 5801 | |
| 5802 | static vector signed int __attribute__((__always_inline__)) |
| 5803 | vec_sums(vector signed int a, vector signed int b) |
| 5804 | { |
| 5805 | return __builtin_altivec_vsumsws(a, b); |
| 5806 | } |
| 5807 | |
| 5808 | /* vec_vsumsws */ |
| 5809 | |
| 5810 | static vector signed int __attribute__((__always_inline__)) |
| 5811 | vec_vsumsws(vector signed int a, vector signed int b) |
| 5812 | { |
| 5813 | return __builtin_altivec_vsumsws(a, b); |
| 5814 | } |
| 5815 | |
| 5816 | /* vec_trunc */ |
| 5817 | |
| 5818 | static vector float __attribute__((__always_inline__)) |
| 5819 | vec_trunc(vector float a) |
| 5820 | { |
| 5821 | return __builtin_altivec_vrfiz(a); |
| 5822 | } |
| 5823 | |
| 5824 | /* vec_vrfiz */ |
| 5825 | |
| 5826 | static vector float __attribute__((__always_inline__)) |
| 5827 | vec_vrfiz(vector float a) |
| 5828 | { |
| 5829 | return __builtin_altivec_vrfiz(a); |
| 5830 | } |
| 5831 | |
| 5832 | /* vec_unpackh */ |
| 5833 | |
| 5834 | static vector short __ATTRS_o_ai |
| 5835 | vec_unpackh(vector signed char a) |
| 5836 | { |
| 5837 | return __builtin_altivec_vupkhsb((vector char)a); |
| 5838 | } |
| 5839 | |
| 5840 | static vector int __ATTRS_o_ai |
| 5841 | vec_unpackh(vector short a) |
| 5842 | { |
| 5843 | return __builtin_altivec_vupkhsh(a); |
| 5844 | } |
| 5845 | |
| 5846 | /* vec_vupkhsb */ |
| 5847 | |
| 5848 | static vector short __attribute__((__always_inline__)) |
| 5849 | vec_vupkhsb(vector signed char a) |
| 5850 | { |
| 5851 | return __builtin_altivec_vupkhsb((vector char)a); |
| 5852 | } |
| 5853 | |
| 5854 | /* vec_vupkhsh */ |
| 5855 | |
| 5856 | static vector int __attribute__((__always_inline__)) |
| 5857 | vec_vupkhsh(vector short a) |
| 5858 | { |
| 5859 | return __builtin_altivec_vupkhsh(a); |
| 5860 | } |
| 5861 | |
| 5862 | /* vec_unpackl */ |
| 5863 | |
| 5864 | static vector short __ATTRS_o_ai |
| 5865 | vec_unpackl(vector signed char a) |
| 5866 | { |
| 5867 | return __builtin_altivec_vupklsb((vector char)a); |
| 5868 | } |
| 5869 | |
| 5870 | static vector int __ATTRS_o_ai |
| 5871 | vec_unpackl(vector short a) |
| 5872 | { |
| 5873 | return __builtin_altivec_vupklsh(a); |
| 5874 | } |
| 5875 | |
| 5876 | /* vec_vupklsb */ |
| 5877 | |
| 5878 | static vector short __attribute__((__always_inline__)) |
| 5879 | vec_vupklsb(vector signed char a) |
| 5880 | { |
| 5881 | return __builtin_altivec_vupklsb((vector char)a); |
| 5882 | } |
| 5883 | |
| 5884 | /* vec_vupklsh */ |
| 5885 | |
| 5886 | static vector int __attribute__((__always_inline__)) |
| 5887 | vec_vupklsh(vector short a) |
| 5888 | { |
| 5889 | return __builtin_altivec_vupklsh(a); |
| 5890 | } |
| 5891 | |
| 5892 | /* vec_xor */ |
| 5893 | |
| 5894 | #define __builtin_altivec_vxor vec_xor |
| 5895 | |
| 5896 | static vector signed char __ATTRS_o_ai |
| 5897 | vec_xor(vector signed char a, vector signed char b) |
| 5898 | { |
| 5899 | return a ^ b; |
| 5900 | } |
| 5901 | |
| 5902 | static vector unsigned char __ATTRS_o_ai |
| 5903 | vec_xor(vector unsigned char a, vector unsigned char b) |
| 5904 | { |
| 5905 | return a ^ b; |
| 5906 | } |
| 5907 | |
| 5908 | static vector short __ATTRS_o_ai |
| 5909 | vec_xor(vector short a, vector short b) |
| 5910 | { |
| 5911 | return a ^ b; |
| 5912 | } |
| 5913 | |
| 5914 | static vector unsigned short __ATTRS_o_ai |
| 5915 | vec_xor(vector unsigned short a, vector unsigned short b) |
| 5916 | { |
| 5917 | return a ^ b; |
| 5918 | } |
| 5919 | |
| 5920 | static vector int __ATTRS_o_ai |
| 5921 | vec_xor(vector int a, vector int b) |
| 5922 | { |
| 5923 | return a ^ b; |
| 5924 | } |
| 5925 | |
| 5926 | static vector unsigned int __ATTRS_o_ai |
| 5927 | vec_xor(vector unsigned int a, vector unsigned int b) |
| 5928 | { |
| 5929 | return a ^ b; |
| 5930 | } |
| 5931 | |
| 5932 | static vector float __ATTRS_o_ai |
| 5933 | vec_xor(vector float a, vector float b) |
| 5934 | { |
| 5935 | vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; |
| 5936 | return (vector float)res; |
| 5937 | } |
| 5938 | |
| 5939 | /* vec_vxor */ |
| 5940 | |
| 5941 | static vector signed char __ATTRS_o_ai |
| 5942 | vec_vxor(vector signed char a, vector signed char b) |
| 5943 | { |
| 5944 | return a ^ b; |
| 5945 | } |
| 5946 | |
| 5947 | static vector unsigned char __ATTRS_o_ai |
| 5948 | vec_vxor(vector unsigned char a, vector unsigned char b) |
| 5949 | { |
| 5950 | return a ^ b; |
| 5951 | } |
| 5952 | |
| 5953 | static vector short __ATTRS_o_ai |
| 5954 | vec_vxor(vector short a, vector short b) |
| 5955 | { |
| 5956 | return a ^ b; |
| 5957 | } |
| 5958 | |
| 5959 | static vector unsigned short __ATTRS_o_ai |
| 5960 | vec_vxor(vector unsigned short a, vector unsigned short b) |
| 5961 | { |
| 5962 | return a ^ b; |
| 5963 | } |
| 5964 | |
| 5965 | static vector int __ATTRS_o_ai |
| 5966 | vec_vxor(vector int a, vector int b) |
| 5967 | { |
| 5968 | return a ^ b; |
| 5969 | } |
| 5970 | |
| 5971 | static vector unsigned int __ATTRS_o_ai |
| 5972 | vec_vxor(vector unsigned int a, vector unsigned int b) |
| 5973 | { |
| 5974 | return a ^ b; |
| 5975 | } |
| 5976 | |
| 5977 | static vector float __ATTRS_o_ai |
| 5978 | vec_vxor(vector float a, vector float b) |
| 5979 | { |
| 5980 | vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; |
| 5981 | return (vector float)res; |
| 5982 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5983 | |
| 5984 | /* ------------------------------ predicates ------------------------------------ */ |
| 5985 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5986 | /* vec_all_eq */ |
| 5987 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 5988 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5989 | vec_all_eq(vector signed char a, vector signed char b) |
| 5990 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 5991 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5992 | } |
| 5993 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 5994 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5995 | vec_all_eq(vector unsigned char a, vector unsigned char b) |
| 5996 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 5997 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 5998 | } |
| 5999 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6000 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6001 | vec_all_eq(vector short a, vector short b) |
| 6002 | { |
| 6003 | return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b); |
| 6004 | } |
| 6005 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6006 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6007 | vec_all_eq(vector unsigned short a, vector unsigned short b) |
| 6008 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6009 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6010 | } |
| 6011 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6012 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6013 | vec_all_eq(vector int a, vector int b) |
| 6014 | { |
| 6015 | return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b); |
| 6016 | } |
| 6017 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6018 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6019 | vec_all_eq(vector unsigned int a, vector unsigned int b) |
| 6020 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6021 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6022 | } |
| 6023 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6024 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6025 | vec_all_eq(vector float a, vector float b) |
| 6026 | { |
| 6027 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b); |
| 6028 | } |
| 6029 | |
| 6030 | /* vec_all_ge */ |
| 6031 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6032 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6033 | vec_all_ge(vector signed char a, vector signed char b) |
| 6034 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6035 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6036 | } |
| 6037 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6038 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6039 | vec_all_ge(vector unsigned char a, vector unsigned char b) |
| 6040 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6041 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6042 | } |
| 6043 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6044 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6045 | vec_all_ge(vector short a, vector short b) |
| 6046 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6047 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6048 | } |
| 6049 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6050 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6051 | vec_all_ge(vector unsigned short a, vector unsigned short b) |
| 6052 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6053 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6054 | } |
| 6055 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6056 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6057 | vec_all_ge(vector int a, vector int b) |
| 6058 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6059 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6060 | } |
| 6061 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6062 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6063 | vec_all_ge(vector unsigned int a, vector unsigned int b) |
| 6064 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6065 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6066 | } |
| 6067 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6068 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6069 | vec_all_ge(vector float a, vector float b) |
| 6070 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6071 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6072 | } |
| 6073 | |
| 6074 | /* vec_all_gt */ |
| 6075 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6076 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6077 | vec_all_gt(vector signed char a, vector signed char b) |
| 6078 | { |
| 6079 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b); |
| 6080 | } |
| 6081 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6082 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6083 | vec_all_gt(vector unsigned char a, vector unsigned char b) |
| 6084 | { |
| 6085 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b); |
| 6086 | } |
| 6087 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6088 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6089 | vec_all_gt(vector short a, vector short b) |
| 6090 | { |
| 6091 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b); |
| 6092 | } |
| 6093 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6094 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6095 | vec_all_gt(vector unsigned short a, vector unsigned short b) |
| 6096 | { |
| 6097 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b); |
| 6098 | } |
| 6099 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6100 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6101 | vec_all_gt(vector int a, vector int b) |
| 6102 | { |
| 6103 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b); |
| 6104 | } |
| 6105 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6106 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6107 | vec_all_gt(vector unsigned int a, vector unsigned int b) |
| 6108 | { |
| 6109 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b); |
| 6110 | } |
| 6111 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6112 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6113 | vec_all_gt(vector float a, vector float b) |
| 6114 | { |
| 6115 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b); |
| 6116 | } |
| 6117 | |
| 6118 | /* vec_all_in */ |
| 6119 | |
| 6120 | static int __attribute__((__always_inline__)) |
| 6121 | vec_all_in(vector float a, vector float b) |
| 6122 | { |
| 6123 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b); |
| 6124 | } |
| 6125 | |
| 6126 | /* vec_all_le */ |
| 6127 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6128 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6129 | vec_all_le(vector signed char a, vector signed char b) |
| 6130 | { |
| 6131 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b); |
| 6132 | } |
| 6133 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6134 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6135 | vec_all_le(vector unsigned char a, vector unsigned char b) |
| 6136 | { |
| 6137 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b); |
| 6138 | } |
| 6139 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6140 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6141 | vec_all_le(vector short a, vector short b) |
| 6142 | { |
| 6143 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b); |
| 6144 | } |
| 6145 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6146 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6147 | vec_all_le(vector unsigned short a, vector unsigned short b) |
| 6148 | { |
| 6149 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b); |
| 6150 | } |
| 6151 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6152 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6153 | vec_all_le(vector int a, vector int b) |
| 6154 | { |
| 6155 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b); |
| 6156 | } |
| 6157 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6158 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6159 | vec_all_le(vector unsigned int a, vector unsigned int b) |
| 6160 | { |
| 6161 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b); |
| 6162 | } |
| 6163 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6164 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6165 | vec_all_le(vector float a, vector float b) |
| 6166 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6167 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6168 | } |
| 6169 | |
| 6170 | /* vec_all_lt */ |
| 6171 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6172 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6173 | vec_all_lt(vector signed char a, vector signed char b) |
| 6174 | { |
| 6175 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a); |
| 6176 | } |
| 6177 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6178 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6179 | vec_all_lt(vector unsigned char a, vector unsigned char b) |
| 6180 | { |
| 6181 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a); |
| 6182 | } |
| 6183 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6184 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6185 | vec_all_lt(vector short a, vector short b) |
| 6186 | { |
| 6187 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a); |
| 6188 | } |
| 6189 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6190 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6191 | vec_all_lt(vector unsigned short a, vector unsigned short b) |
| 6192 | { |
| 6193 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a); |
| 6194 | } |
| 6195 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6196 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6197 | vec_all_lt(vector int a, vector int b) |
| 6198 | { |
| 6199 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a); |
| 6200 | } |
| 6201 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6202 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6203 | vec_all_lt(vector unsigned int a, vector unsigned int b) |
| 6204 | { |
| 6205 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a); |
| 6206 | } |
| 6207 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6208 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6209 | vec_all_lt(vector float a, vector float b) |
| 6210 | { |
| 6211 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a); |
| 6212 | } |
| 6213 | |
| 6214 | /* vec_all_nan */ |
| 6215 | |
| 6216 | static int __attribute__((__always_inline__)) |
| 6217 | vec_all_nan(vector float a) |
| 6218 | { |
| 6219 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a); |
| 6220 | } |
| 6221 | |
| 6222 | /* vec_all_ne */ |
| 6223 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6224 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6225 | vec_all_ne(vector signed char a, vector signed char b) |
| 6226 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6227 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6228 | } |
| 6229 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6230 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6231 | vec_all_ne(vector unsigned char a, vector unsigned char b) |
| 6232 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6233 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6234 | } |
| 6235 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6236 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6237 | vec_all_ne(vector short a, vector short b) |
| 6238 | { |
| 6239 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b); |
| 6240 | } |
| 6241 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6242 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6243 | vec_all_ne(vector unsigned short a, vector unsigned short b) |
| 6244 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6245 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6246 | } |
| 6247 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6248 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6249 | vec_all_ne(vector int a, vector int b) |
| 6250 | { |
| 6251 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b); |
| 6252 | } |
| 6253 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6254 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6255 | vec_all_ne(vector unsigned int a, vector unsigned int b) |
| 6256 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6257 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6258 | } |
| 6259 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6260 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6261 | vec_all_ne(vector float a, vector float b) |
| 6262 | { |
| 6263 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b); |
| 6264 | } |
| 6265 | |
| 6266 | /* vec_all_nge */ |
| 6267 | |
| 6268 | static int __attribute__((__always_inline__)) |
| 6269 | vec_all_nge(vector float a, vector float b) |
| 6270 | { |
| 6271 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b); |
| 6272 | } |
| 6273 | |
| 6274 | /* vec_all_ngt */ |
| 6275 | |
| 6276 | static int __attribute__((__always_inline__)) |
| 6277 | vec_all_ngt(vector float a, vector float b) |
| 6278 | { |
| 6279 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b); |
| 6280 | } |
| 6281 | |
| 6282 | /* vec_all_nle */ |
| 6283 | |
| 6284 | static int __attribute__((__always_inline__)) |
| 6285 | vec_all_nle(vector float a, vector float b) |
| 6286 | { |
| 6287 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a); |
| 6288 | } |
| 6289 | |
| 6290 | /* vec_all_nlt */ |
| 6291 | |
| 6292 | static int __attribute__((__always_inline__)) |
| 6293 | vec_all_nlt(vector float a, vector float b) |
| 6294 | { |
| 6295 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a); |
| 6296 | } |
| 6297 | |
| 6298 | /* vec_all_numeric */ |
| 6299 | |
| 6300 | static int __attribute__((__always_inline__)) |
| 6301 | vec_all_numeric(vector float a) |
| 6302 | { |
| 6303 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a); |
| 6304 | } |
| 6305 | |
| 6306 | /* vec_any_eq */ |
| 6307 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6308 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6309 | vec_any_eq(vector signed char a, vector signed char b) |
| 6310 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6311 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6312 | } |
| 6313 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6314 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6315 | vec_any_eq(vector unsigned char a, vector unsigned char b) |
| 6316 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6317 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6318 | } |
| 6319 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6320 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6321 | vec_any_eq(vector short a, vector short b) |
| 6322 | { |
| 6323 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b); |
| 6324 | } |
| 6325 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6326 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6327 | vec_any_eq(vector unsigned short a, vector unsigned short b) |
| 6328 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6329 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6330 | } |
| 6331 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6332 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6333 | vec_any_eq(vector int a, vector int b) |
| 6334 | { |
| 6335 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b); |
| 6336 | } |
| 6337 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6338 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6339 | vec_any_eq(vector unsigned int a, vector unsigned int b) |
| 6340 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6341 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6342 | } |
| 6343 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6344 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6345 | vec_any_eq(vector float a, vector float b) |
| 6346 | { |
| 6347 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b); |
| 6348 | } |
| 6349 | |
| 6350 | /* vec_any_ge */ |
| 6351 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6352 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6353 | vec_any_ge(vector signed char a, vector signed char b) |
| 6354 | { |
| 6355 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a); |
| 6356 | } |
| 6357 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6358 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6359 | vec_any_ge(vector unsigned char a, vector unsigned char b) |
| 6360 | { |
| 6361 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a); |
| 6362 | } |
| 6363 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6364 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6365 | vec_any_ge(vector short a, vector short b) |
| 6366 | { |
| 6367 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a); |
| 6368 | } |
| 6369 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6370 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6371 | vec_any_ge(vector unsigned short a, vector unsigned short b) |
| 6372 | { |
| 6373 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a); |
| 6374 | } |
| 6375 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6376 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6377 | vec_any_ge(vector int a, vector int b) |
| 6378 | { |
| 6379 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a); |
| 6380 | } |
| 6381 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6382 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6383 | vec_any_ge(vector unsigned int a, vector unsigned int b) |
| 6384 | { |
| 6385 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a); |
| 6386 | } |
| 6387 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6388 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6389 | vec_any_ge(vector float a, vector float b) |
| 6390 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6391 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6392 | } |
| 6393 | |
| 6394 | /* vec_any_gt */ |
| 6395 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6396 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6397 | vec_any_gt(vector signed char a, vector signed char b) |
| 6398 | { |
| 6399 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b); |
| 6400 | } |
| 6401 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6402 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6403 | vec_any_gt(vector unsigned char a, vector unsigned char b) |
| 6404 | { |
| 6405 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b); |
| 6406 | } |
| 6407 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6408 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6409 | vec_any_gt(vector short a, vector short b) |
| 6410 | { |
| 6411 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b); |
| 6412 | } |
| 6413 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6414 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6415 | vec_any_gt(vector unsigned short a, vector unsigned short b) |
| 6416 | { |
| 6417 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b); |
| 6418 | } |
| 6419 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6420 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6421 | vec_any_gt(vector int a, vector int b) |
| 6422 | { |
| 6423 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b); |
| 6424 | } |
| 6425 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6426 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6427 | vec_any_gt(vector unsigned int a, vector unsigned int b) |
| 6428 | { |
| 6429 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b); |
| 6430 | } |
| 6431 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6432 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6433 | vec_any_gt(vector float a, vector float b) |
| 6434 | { |
| 6435 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b); |
| 6436 | } |
| 6437 | |
| 6438 | /* vec_any_le */ |
| 6439 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6440 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6441 | vec_any_le(vector signed char a, vector signed char b) |
| 6442 | { |
| 6443 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b); |
| 6444 | } |
| 6445 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6446 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6447 | vec_any_le(vector unsigned char a, vector unsigned char b) |
| 6448 | { |
| 6449 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b); |
| 6450 | } |
| 6451 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6452 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6453 | vec_any_le(vector short a, vector short b) |
| 6454 | { |
| 6455 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b); |
| 6456 | } |
| 6457 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6458 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6459 | vec_any_le(vector unsigned short a, vector unsigned short b) |
| 6460 | { |
| 6461 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b); |
| 6462 | } |
| 6463 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6464 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6465 | vec_any_le(vector int a, vector int b) |
| 6466 | { |
| 6467 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b); |
| 6468 | } |
| 6469 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6470 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6471 | vec_any_le(vector unsigned int a, vector unsigned int b) |
| 6472 | { |
| 6473 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b); |
| 6474 | } |
| 6475 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6476 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6477 | vec_any_le(vector float a, vector float b) |
| 6478 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6479 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6480 | } |
| 6481 | |
| 6482 | /* vec_any_lt */ |
| 6483 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6484 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6485 | vec_any_lt(vector signed char a, vector signed char b) |
| 6486 | { |
| 6487 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a); |
| 6488 | } |
| 6489 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6490 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6491 | vec_any_lt(vector unsigned char a, vector unsigned char b) |
| 6492 | { |
| 6493 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a); |
| 6494 | } |
| 6495 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6496 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6497 | vec_any_lt(vector short a, vector short b) |
| 6498 | { |
| 6499 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a); |
| 6500 | } |
| 6501 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6502 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6503 | vec_any_lt(vector unsigned short a, vector unsigned short b) |
| 6504 | { |
| 6505 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a); |
| 6506 | } |
| 6507 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6508 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6509 | vec_any_lt(vector int a, vector int b) |
| 6510 | { |
| 6511 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a); |
| 6512 | } |
| 6513 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6514 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6515 | vec_any_lt(vector unsigned int a, vector unsigned int b) |
| 6516 | { |
| 6517 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a); |
| 6518 | } |
| 6519 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6520 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6521 | vec_any_lt(vector float a, vector float b) |
| 6522 | { |
| 6523 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a); |
| 6524 | } |
| 6525 | |
| 6526 | /* vec_any_nan */ |
| 6527 | |
| 6528 | static int __attribute__((__always_inline__)) |
| 6529 | vec_any_nan(vector float a) |
| 6530 | { |
| 6531 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a); |
| 6532 | } |
| 6533 | |
| 6534 | /* vec_any_ne */ |
| 6535 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6536 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6537 | vec_any_ne(vector signed char a, vector signed char b) |
| 6538 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6539 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6540 | } |
| 6541 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6542 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6543 | vec_any_ne(vector unsigned char a, vector unsigned char b) |
| 6544 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6545 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6546 | } |
| 6547 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6548 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6549 | vec_any_ne(vector short a, vector short b) |
| 6550 | { |
| 6551 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b); |
| 6552 | } |
| 6553 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6554 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6555 | vec_any_ne(vector unsigned short a, vector unsigned short b) |
| 6556 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6557 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6558 | } |
| 6559 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6560 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6561 | vec_any_ne(vector int a, vector int b) |
| 6562 | { |
| 6563 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b); |
| 6564 | } |
| 6565 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6566 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6567 | vec_any_ne(vector unsigned int a, vector unsigned int b) |
| 6568 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6569 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6570 | } |
| 6571 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6572 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6573 | vec_any_ne(vector float a, vector float b) |
| 6574 | { |
| 6575 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b); |
| 6576 | } |
| 6577 | |
| 6578 | /* vec_any_nge */ |
| 6579 | |
| 6580 | static int __attribute__((__always_inline__)) |
| 6581 | vec_any_nge(vector float a, vector float b) |
| 6582 | { |
| 6583 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b); |
| 6584 | } |
| 6585 | |
| 6586 | /* vec_any_ngt */ |
| 6587 | |
| 6588 | static int __attribute__((__always_inline__)) |
| 6589 | vec_any_ngt(vector float a, vector float b) |
| 6590 | { |
| 6591 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b); |
| 6592 | } |
| 6593 | |
| 6594 | /* vec_any_nle */ |
| 6595 | |
| 6596 | static int __attribute__((__always_inline__)) |
| 6597 | vec_any_nle(vector float a, vector float b) |
| 6598 | { |
| 6599 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a); |
| 6600 | } |
| 6601 | |
| 6602 | /* vec_any_nlt */ |
| 6603 | |
| 6604 | static int __attribute__((__always_inline__)) |
| 6605 | vec_any_nlt(vector float a, vector float b) |
| 6606 | { |
| 6607 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a); |
| 6608 | } |
| 6609 | |
| 6610 | /* vec_any_numeric */ |
| 6611 | |
| 6612 | static int __attribute__((__always_inline__)) |
| 6613 | vec_any_numeric(vector float a) |
| 6614 | { |
| 6615 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a); |
| 6616 | } |
| 6617 | |
| 6618 | /* vec_any_out */ |
| 6619 | |
| 6620 | static int __attribute__((__always_inline__)) |
| 6621 | vec_any_out(vector float a, vector float b) |
| 6622 | { |
| 6623 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b); |
| 6624 | } |
| 6625 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6626 | #undef __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6627 | |
| 6628 | #endif /* __ALTIVEC_H */ |