Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1 | /*===---- altivec.h - Standard header for type generic math ---------------===*\ |
| 2 | * |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 3 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | * See https://llvm.org/LICENSE.txt for license information. |
| 5 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6 | * |
| 7 | \*===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | #ifndef __ALTIVEC_H |
| 10 | #define __ALTIVEC_H |
| 11 | |
| 12 | #ifndef __ALTIVEC__ |
| 13 | #error "AltiVec support not enabled" |
| 14 | #endif |
| 15 | |
| 16 | /* Constants for mapping CR6 bits to predicate result. */ |
| 17 | |
| 18 | #define __CR6_EQ 0 |
| 19 | #define __CR6_EQ_REV 1 |
| 20 | #define __CR6_LT 2 |
| 21 | #define __CR6_LT_REV 3 |
| 22 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 23 | /* Constants for vec_test_data_class */ |
| 24 | #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) |
| 25 | #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) |
| 26 | #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ |
| 27 | __VEC_CLASS_FP_SUBNORMAL_N) |
| 28 | #define __VEC_CLASS_FP_ZERO_N (1<<2) |
| 29 | #define __VEC_CLASS_FP_ZERO_P (1<<3) |
| 30 | #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ |
| 31 | __VEC_CLASS_FP_ZERO_N) |
| 32 | #define __VEC_CLASS_FP_INFINITY_N (1<<4) |
| 33 | #define __VEC_CLASS_FP_INFINITY_P (1<<5) |
| 34 | #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ |
| 35 | __VEC_CLASS_FP_INFINITY_N) |
| 36 | #define __VEC_CLASS_FP_NAN (1<<6) |
| 37 | #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ |
| 38 | __VEC_CLASS_FP_SUBNORMAL | \ |
| 39 | __VEC_CLASS_FP_ZERO | \ |
| 40 | __VEC_CLASS_FP_INFINITY) |
| 41 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 42 | #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) |
| 43 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 44 | #include <stddef.h> |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 45 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 46 | static __inline__ vector signed char __ATTRS_o_ai vec_perm( |
| 47 | vector signed char __a, vector signed char __b, vector unsigned char __c); |
| 48 | |
| 49 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 50 | vec_perm(vector unsigned char __a, vector unsigned char __b, |
| 51 | vector unsigned char __c); |
| 52 | |
| 53 | static __inline__ vector bool char __ATTRS_o_ai |
| 54 | vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); |
| 55 | |
| 56 | static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, |
| 57 | vector signed short __b, |
| 58 | vector unsigned char __c); |
| 59 | |
| 60 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 61 | vec_perm(vector unsigned short __a, vector unsigned short __b, |
| 62 | vector unsigned char __c); |
| 63 | |
| 64 | static __inline__ vector bool short __ATTRS_o_ai vec_perm( |
| 65 | vector bool short __a, vector bool short __b, vector unsigned char __c); |
| 66 | |
| 67 | static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, |
| 68 | vector pixel __b, |
| 69 | vector unsigned char __c); |
| 70 | |
| 71 | static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, |
| 72 | vector signed int __b, |
| 73 | vector unsigned char __c); |
| 74 | |
| 75 | static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( |
| 76 | vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); |
| 77 | |
| 78 | static __inline__ vector bool int __ATTRS_o_ai |
| 79 | vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); |
| 80 | |
| 81 | static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, |
| 82 | vector float __b, |
| 83 | vector unsigned char __c); |
| 84 | |
| 85 | #ifdef __VSX__ |
| 86 | static __inline__ vector long long __ATTRS_o_ai |
| 87 | vec_perm(vector signed long long __a, vector signed long long __b, |
| 88 | vector unsigned char __c); |
| 89 | |
| 90 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 91 | vec_perm(vector unsigned long long __a, vector unsigned long long __b, |
| 92 | vector unsigned char __c); |
| 93 | |
| 94 | static __inline__ vector bool long long __ATTRS_o_ai |
| 95 | vec_perm(vector bool long long __a, vector bool long long __b, |
| 96 | vector unsigned char __c); |
| 97 | |
| 98 | static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, |
| 99 | vector double __b, |
| 100 | vector unsigned char __c); |
| 101 | #endif |
| 102 | |
| 103 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 104 | vec_xor(vector unsigned char __a, vector unsigned char __b); |
| 105 | |
| 106 | /* vec_abs */ |
| 107 | |
| 108 | #define __builtin_altivec_abs_v16qi vec_abs |
| 109 | #define __builtin_altivec_abs_v8hi vec_abs |
| 110 | #define __builtin_altivec_abs_v4si vec_abs |
| 111 | |
| 112 | static __inline__ vector signed char __ATTRS_o_ai |
| 113 | vec_abs(vector signed char __a) { |
| 114 | return __builtin_altivec_vmaxsb(__a, -__a); |
| 115 | } |
| 116 | |
| 117 | static __inline__ vector signed short __ATTRS_o_ai |
| 118 | vec_abs(vector signed short __a) { |
| 119 | return __builtin_altivec_vmaxsh(__a, -__a); |
| 120 | } |
| 121 | |
| 122 | static __inline__ vector signed int __ATTRS_o_ai |
| 123 | vec_abs(vector signed int __a) { |
| 124 | return __builtin_altivec_vmaxsw(__a, -__a); |
| 125 | } |
| 126 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 127 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 128 | static __inline__ vector signed long long __ATTRS_o_ai |
| 129 | vec_abs(vector signed long long __a) { |
| 130 | return __builtin_altivec_vmaxsd(__a, -__a); |
| 131 | } |
| 132 | #endif |
| 133 | |
| 134 | static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { |
| 135 | #ifdef __VSX__ |
| 136 | return __builtin_vsx_xvabssp(__a); |
| 137 | #else |
| 138 | vector unsigned int __res = |
| 139 | (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); |
| 140 | return (vector float)__res; |
| 141 | #endif |
| 142 | } |
| 143 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 144 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 145 | static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { |
| 146 | return __builtin_vsx_xvabsdp(__a); |
| 147 | } |
| 148 | #endif |
| 149 | |
| 150 | /* vec_abss */ |
| 151 | #define __builtin_altivec_abss_v16qi vec_abss |
| 152 | #define __builtin_altivec_abss_v8hi vec_abss |
| 153 | #define __builtin_altivec_abss_v4si vec_abss |
| 154 | |
| 155 | static __inline__ vector signed char __ATTRS_o_ai |
| 156 | vec_abss(vector signed char __a) { |
| 157 | return __builtin_altivec_vmaxsb( |
| 158 | __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); |
| 159 | } |
| 160 | |
| 161 | static __inline__ vector signed short __ATTRS_o_ai |
| 162 | vec_abss(vector signed short __a) { |
| 163 | return __builtin_altivec_vmaxsh( |
| 164 | __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); |
| 165 | } |
| 166 | |
| 167 | static __inline__ vector signed int __ATTRS_o_ai |
| 168 | vec_abss(vector signed int __a) { |
| 169 | return __builtin_altivec_vmaxsw( |
| 170 | __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); |
| 171 | } |
| 172 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 173 | /* vec_absd */ |
| 174 | #if defined(__POWER9_VECTOR__) |
| 175 | |
| 176 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 177 | vec_absd(vector unsigned char __a, vector unsigned char __b) { |
| 178 | return __builtin_altivec_vabsdub(__a, __b); |
| 179 | } |
| 180 | |
| 181 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 182 | vec_absd(vector unsigned short __a, vector unsigned short __b) { |
| 183 | return __builtin_altivec_vabsduh(__a, __b); |
| 184 | } |
| 185 | |
| 186 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 187 | vec_absd(vector unsigned int __a, vector unsigned int __b) { |
| 188 | return __builtin_altivec_vabsduw(__a, __b); |
| 189 | } |
| 190 | |
| 191 | #endif /* End __POWER9_VECTOR__ */ |
| 192 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 193 | /* vec_add */ |
| 194 | |
| 195 | static __inline__ vector signed char __ATTRS_o_ai |
| 196 | vec_add(vector signed char __a, vector signed char __b) { |
| 197 | return __a + __b; |
| 198 | } |
| 199 | |
| 200 | static __inline__ vector signed char __ATTRS_o_ai |
| 201 | vec_add(vector bool char __a, vector signed char __b) { |
| 202 | return (vector signed char)__a + __b; |
| 203 | } |
| 204 | |
| 205 | static __inline__ vector signed char __ATTRS_o_ai |
| 206 | vec_add(vector signed char __a, vector bool char __b) { |
| 207 | return __a + (vector signed char)__b; |
| 208 | } |
| 209 | |
| 210 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 211 | vec_add(vector unsigned char __a, vector unsigned char __b) { |
| 212 | return __a + __b; |
| 213 | } |
| 214 | |
| 215 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 216 | vec_add(vector bool char __a, vector unsigned char __b) { |
| 217 | return (vector unsigned char)__a + __b; |
| 218 | } |
| 219 | |
| 220 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 221 | vec_add(vector unsigned char __a, vector bool char __b) { |
| 222 | return __a + (vector unsigned char)__b; |
| 223 | } |
| 224 | |
| 225 | static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, |
| 226 | vector short __b) { |
| 227 | return __a + __b; |
| 228 | } |
| 229 | |
| 230 | static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, |
| 231 | vector short __b) { |
| 232 | return (vector short)__a + __b; |
| 233 | } |
| 234 | |
| 235 | static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, |
| 236 | vector bool short __b) { |
| 237 | return __a + (vector short)__b; |
| 238 | } |
| 239 | |
| 240 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 241 | vec_add(vector unsigned short __a, vector unsigned short __b) { |
| 242 | return __a + __b; |
| 243 | } |
| 244 | |
| 245 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 246 | vec_add(vector bool short __a, vector unsigned short __b) { |
| 247 | return (vector unsigned short)__a + __b; |
| 248 | } |
| 249 | |
| 250 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 251 | vec_add(vector unsigned short __a, vector bool short __b) { |
| 252 | return __a + (vector unsigned short)__b; |
| 253 | } |
| 254 | |
| 255 | static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, |
| 256 | vector int __b) { |
| 257 | return __a + __b; |
| 258 | } |
| 259 | |
| 260 | static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, |
| 261 | vector int __b) { |
| 262 | return (vector int)__a + __b; |
| 263 | } |
| 264 | |
| 265 | static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, |
| 266 | vector bool int __b) { |
| 267 | return __a + (vector int)__b; |
| 268 | } |
| 269 | |
| 270 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 271 | vec_add(vector unsigned int __a, vector unsigned int __b) { |
| 272 | return __a + __b; |
| 273 | } |
| 274 | |
| 275 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 276 | vec_add(vector bool int __a, vector unsigned int __b) { |
| 277 | return (vector unsigned int)__a + __b; |
| 278 | } |
| 279 | |
| 280 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 281 | vec_add(vector unsigned int __a, vector bool int __b) { |
| 282 | return __a + (vector unsigned int)__b; |
| 283 | } |
| 284 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 285 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 286 | static __inline__ vector signed long long __ATTRS_o_ai |
| 287 | vec_add(vector signed long long __a, vector signed long long __b) { |
| 288 | return __a + __b; |
| 289 | } |
| 290 | |
| 291 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 292 | vec_add(vector unsigned long long __a, vector unsigned long long __b) { |
| 293 | return __a + __b; |
| 294 | } |
| 295 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 296 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 297 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 298 | vec_add(vector signed __int128 __a, vector signed __int128 __b) { |
| 299 | return __a + __b; |
| 300 | } |
| 301 | |
| 302 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 303 | vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 304 | return __a + __b; |
| 305 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 306 | #endif |
| 307 | |
| 308 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 309 | vec_add_u128(vector unsigned char __a, vector unsigned char __b) { |
| 310 | return __builtin_altivec_vadduqm(__a, __b); |
| 311 | } |
| 312 | #elif defined(__VSX__) |
| 313 | static __inline__ vector signed long long __ATTRS_o_ai |
| 314 | vec_add(vector signed long long __a, vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 315 | #ifdef __LITTLE_ENDIAN__ |
| 316 | // Little endian systems on CPU's prior to Power8 don't really exist |
| 317 | // so scalarizing is fine. |
| 318 | return __a + __b; |
| 319 | #else |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 320 | vector unsigned int __res = |
| 321 | (vector unsigned int)__a + (vector unsigned int)__b; |
| 322 | vector unsigned int __carry = __builtin_altivec_vaddcuw( |
| 323 | (vector unsigned int)__a, (vector unsigned int)__b); |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 324 | __carry = __builtin_shufflevector((vector unsigned char)__carry, |
| 325 | (vector unsigned char)__carry, 0, 0, 0, 7, |
| 326 | 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 327 | return (vector signed long long)(__res + __carry); |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 328 | #endif |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 332 | vec_add(vector unsigned long long __a, vector unsigned long long __b) { |
| 333 | return (vector unsigned long long)vec_add((vector signed long long)__a, |
| 334 | (vector signed long long)__b); |
| 335 | } |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 336 | #endif // __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 337 | |
| 338 | static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, |
| 339 | vector float __b) { |
| 340 | return __a + __b; |
| 341 | } |
| 342 | |
| 343 | #ifdef __VSX__ |
| 344 | static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, |
| 345 | vector double __b) { |
| 346 | return __a + __b; |
| 347 | } |
| 348 | #endif // __VSX__ |
| 349 | |
| 350 | /* vec_adde */ |
| 351 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 352 | #ifdef __POWER8_VECTOR__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 353 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 354 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 355 | vec_adde(vector signed __int128 __a, vector signed __int128 __b, |
| 356 | vector signed __int128 __c) { |
| 357 | return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| 358 | } |
| 359 | |
| 360 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 361 | vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 362 | vector unsigned __int128 __c) { |
| 363 | return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| 364 | } |
| 365 | #endif |
| 366 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 367 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 368 | vec_adde_u128(vector unsigned char __a, vector unsigned char __b, |
| 369 | vector unsigned char __c) { |
| 370 | return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); |
| 371 | } |
| 372 | #endif |
| 373 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 374 | static __inline__ vector signed int __ATTRS_o_ai |
| 375 | vec_adde(vector signed int __a, vector signed int __b, |
| 376 | vector signed int __c) { |
| 377 | vector signed int __mask = {1, 1, 1, 1}; |
| 378 | vector signed int __carry = __c & __mask; |
| 379 | return vec_add(vec_add(__a, __b), __carry); |
| 380 | } |
| 381 | |
| 382 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 383 | vec_adde(vector unsigned int __a, vector unsigned int __b, |
| 384 | vector unsigned int __c) { |
| 385 | vector unsigned int __mask = {1, 1, 1, 1}; |
| 386 | vector unsigned int __carry = __c & __mask; |
| 387 | return vec_add(vec_add(__a, __b), __carry); |
| 388 | } |
| 389 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 390 | /* vec_addec */ |
| 391 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 392 | #ifdef __POWER8_VECTOR__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 393 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 394 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 395 | vec_addec(vector signed __int128 __a, vector signed __int128 __b, |
| 396 | vector signed __int128 __c) { |
| 397 | return __builtin_altivec_vaddecuq(__a, __b, __c); |
| 398 | } |
| 399 | |
| 400 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 401 | vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 402 | vector unsigned __int128 __c) { |
| 403 | return __builtin_altivec_vaddecuq(__a, __b, __c); |
| 404 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 405 | #endif |
| 406 | |
| 407 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 408 | vec_addec_u128(vector unsigned char __a, vector unsigned char __b, |
| 409 | vector unsigned char __c) { |
| 410 | return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); |
| 411 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 412 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 413 | #ifdef __powerpc64__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 414 | static __inline__ vector signed int __ATTRS_o_ai |
| 415 | vec_addec(vector signed int __a, vector signed int __b, |
| 416 | vector signed int __c) { |
| 417 | |
| 418 | signed int __result[4]; |
| 419 | for (int i = 0; i < 4; i++) { |
| 420 | unsigned int __tempa = (unsigned int) __a[i]; |
| 421 | unsigned int __tempb = (unsigned int) __b[i]; |
| 422 | unsigned int __tempc = (unsigned int) __c[i]; |
| 423 | __tempc = __tempc & 0x00000001; |
| 424 | unsigned long long __longa = (unsigned long long) __tempa; |
| 425 | unsigned long long __longb = (unsigned long long) __tempb; |
| 426 | unsigned long long __longc = (unsigned long long) __tempc; |
| 427 | unsigned long long __sum = __longa + __longb + __longc; |
| 428 | unsigned long long __res = (__sum >> 32) & 0x01; |
| 429 | unsigned long long __tempres = (unsigned int) __res; |
| 430 | __result[i] = (signed int) __tempres; |
| 431 | } |
| 432 | |
| 433 | vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; |
| 434 | return ret; |
| 435 | } |
| 436 | |
| 437 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 438 | vec_addec(vector unsigned int __a, vector unsigned int __b, |
| 439 | vector unsigned int __c) { |
| 440 | |
| 441 | unsigned int __result[4]; |
| 442 | for (int i = 0; i < 4; i++) { |
| 443 | unsigned int __tempc = __c[i] & 1; |
| 444 | unsigned long long __longa = (unsigned long long) __a[i]; |
| 445 | unsigned long long __longb = (unsigned long long) __b[i]; |
| 446 | unsigned long long __longc = (unsigned long long) __tempc; |
| 447 | unsigned long long __sum = __longa + __longb + __longc; |
| 448 | unsigned long long __res = (__sum >> 32) & 0x01; |
| 449 | unsigned long long __tempres = (unsigned int) __res; |
| 450 | __result[i] = (signed int) __tempres; |
| 451 | } |
| 452 | |
| 453 | vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; |
| 454 | return ret; |
| 455 | } |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 456 | #endif // __powerpc64__ |
| 457 | #endif // __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 458 | |
| 459 | /* vec_vaddubm */ |
| 460 | |
| 461 | #define __builtin_altivec_vaddubm vec_vaddubm |
| 462 | |
| 463 | static __inline__ vector signed char __ATTRS_o_ai |
| 464 | vec_vaddubm(vector signed char __a, vector signed char __b) { |
| 465 | return __a + __b; |
| 466 | } |
| 467 | |
| 468 | static __inline__ vector signed char __ATTRS_o_ai |
| 469 | vec_vaddubm(vector bool char __a, vector signed char __b) { |
| 470 | return (vector signed char)__a + __b; |
| 471 | } |
| 472 | |
| 473 | static __inline__ vector signed char __ATTRS_o_ai |
| 474 | vec_vaddubm(vector signed char __a, vector bool char __b) { |
| 475 | return __a + (vector signed char)__b; |
| 476 | } |
| 477 | |
| 478 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 479 | vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { |
| 480 | return __a + __b; |
| 481 | } |
| 482 | |
| 483 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 484 | vec_vaddubm(vector bool char __a, vector unsigned char __b) { |
| 485 | return (vector unsigned char)__a + __b; |
| 486 | } |
| 487 | |
| 488 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 489 | vec_vaddubm(vector unsigned char __a, vector bool char __b) { |
| 490 | return __a + (vector unsigned char)__b; |
| 491 | } |
| 492 | |
| 493 | /* vec_vadduhm */ |
| 494 | |
| 495 | #define __builtin_altivec_vadduhm vec_vadduhm |
| 496 | |
| 497 | static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, |
| 498 | vector short __b) { |
| 499 | return __a + __b; |
| 500 | } |
| 501 | |
| 502 | static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, |
| 503 | vector short __b) { |
| 504 | return (vector short)__a + __b; |
| 505 | } |
| 506 | |
| 507 | static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, |
| 508 | vector bool short __b) { |
| 509 | return __a + (vector short)__b; |
| 510 | } |
| 511 | |
| 512 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 513 | vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { |
| 514 | return __a + __b; |
| 515 | } |
| 516 | |
| 517 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 518 | vec_vadduhm(vector bool short __a, vector unsigned short __b) { |
| 519 | return (vector unsigned short)__a + __b; |
| 520 | } |
| 521 | |
| 522 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 523 | vec_vadduhm(vector unsigned short __a, vector bool short __b) { |
| 524 | return __a + (vector unsigned short)__b; |
| 525 | } |
| 526 | |
| 527 | /* vec_vadduwm */ |
| 528 | |
| 529 | #define __builtin_altivec_vadduwm vec_vadduwm |
| 530 | |
| 531 | static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, |
| 532 | vector int __b) { |
| 533 | return __a + __b; |
| 534 | } |
| 535 | |
| 536 | static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, |
| 537 | vector int __b) { |
| 538 | return (vector int)__a + __b; |
| 539 | } |
| 540 | |
| 541 | static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, |
| 542 | vector bool int __b) { |
| 543 | return __a + (vector int)__b; |
| 544 | } |
| 545 | |
| 546 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 547 | vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { |
| 548 | return __a + __b; |
| 549 | } |
| 550 | |
| 551 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 552 | vec_vadduwm(vector bool int __a, vector unsigned int __b) { |
| 553 | return (vector unsigned int)__a + __b; |
| 554 | } |
| 555 | |
| 556 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 557 | vec_vadduwm(vector unsigned int __a, vector bool int __b) { |
| 558 | return __a + (vector unsigned int)__b; |
| 559 | } |
| 560 | |
| 561 | /* vec_vaddfp */ |
| 562 | |
| 563 | #define __builtin_altivec_vaddfp vec_vaddfp |
| 564 | |
| 565 | static __inline__ vector float __attribute__((__always_inline__)) |
| 566 | vec_vaddfp(vector float __a, vector float __b) { |
| 567 | return __a + __b; |
| 568 | } |
| 569 | |
| 570 | /* vec_addc */ |
| 571 | |
| 572 | static __inline__ vector signed int __ATTRS_o_ai |
| 573 | vec_addc(vector signed int __a, vector signed int __b) { |
| 574 | return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, |
| 575 | (vector unsigned int)__b); |
| 576 | } |
| 577 | |
| 578 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 579 | vec_addc(vector unsigned int __a, vector unsigned int __b) { |
| 580 | return __builtin_altivec_vaddcuw(__a, __b); |
| 581 | } |
| 582 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 583 | #ifdef __POWER8_VECTOR__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 584 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 585 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 586 | vec_addc(vector signed __int128 __a, vector signed __int128 __b) { |
| 587 | return (vector signed __int128)__builtin_altivec_vaddcuq( |
| 588 | (vector unsigned __int128)__a, (vector unsigned __int128)__b); |
| 589 | } |
| 590 | |
| 591 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 592 | vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 593 | return __builtin_altivec_vaddcuq(__a, __b); |
| 594 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 595 | #endif |
| 596 | |
| 597 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 598 | vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { |
| 599 | return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); |
| 600 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 601 | #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) |
| 602 | |
| 603 | /* vec_vaddcuw */ |
| 604 | |
| 605 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 606 | vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { |
| 607 | return __builtin_altivec_vaddcuw(__a, __b); |
| 608 | } |
| 609 | |
| 610 | /* vec_adds */ |
| 611 | |
| 612 | static __inline__ vector signed char __ATTRS_o_ai |
| 613 | vec_adds(vector signed char __a, vector signed char __b) { |
| 614 | return __builtin_altivec_vaddsbs(__a, __b); |
| 615 | } |
| 616 | |
| 617 | static __inline__ vector signed char __ATTRS_o_ai |
| 618 | vec_adds(vector bool char __a, vector signed char __b) { |
| 619 | return __builtin_altivec_vaddsbs((vector signed char)__a, __b); |
| 620 | } |
| 621 | |
| 622 | static __inline__ vector signed char __ATTRS_o_ai |
| 623 | vec_adds(vector signed char __a, vector bool char __b) { |
| 624 | return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); |
| 625 | } |
| 626 | |
| 627 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 628 | vec_adds(vector unsigned char __a, vector unsigned char __b) { |
| 629 | return __builtin_altivec_vaddubs(__a, __b); |
| 630 | } |
| 631 | |
| 632 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 633 | vec_adds(vector bool char __a, vector unsigned char __b) { |
| 634 | return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); |
| 635 | } |
| 636 | |
| 637 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 638 | vec_adds(vector unsigned char __a, vector bool char __b) { |
| 639 | return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); |
| 640 | } |
| 641 | |
| 642 | static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, |
| 643 | vector short __b) { |
| 644 | return __builtin_altivec_vaddshs(__a, __b); |
| 645 | } |
| 646 | |
| 647 | static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, |
| 648 | vector short __b) { |
| 649 | return __builtin_altivec_vaddshs((vector short)__a, __b); |
| 650 | } |
| 651 | |
| 652 | static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, |
| 653 | vector bool short __b) { |
| 654 | return __builtin_altivec_vaddshs(__a, (vector short)__b); |
| 655 | } |
| 656 | |
| 657 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 658 | vec_adds(vector unsigned short __a, vector unsigned short __b) { |
| 659 | return __builtin_altivec_vadduhs(__a, __b); |
| 660 | } |
| 661 | |
| 662 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 663 | vec_adds(vector bool short __a, vector unsigned short __b) { |
| 664 | return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); |
| 665 | } |
| 666 | |
| 667 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 668 | vec_adds(vector unsigned short __a, vector bool short __b) { |
| 669 | return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); |
| 670 | } |
| 671 | |
| 672 | static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, |
| 673 | vector int __b) { |
| 674 | return __builtin_altivec_vaddsws(__a, __b); |
| 675 | } |
| 676 | |
| 677 | static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, |
| 678 | vector int __b) { |
| 679 | return __builtin_altivec_vaddsws((vector int)__a, __b); |
| 680 | } |
| 681 | |
| 682 | static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, |
| 683 | vector bool int __b) { |
| 684 | return __builtin_altivec_vaddsws(__a, (vector int)__b); |
| 685 | } |
| 686 | |
| 687 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 688 | vec_adds(vector unsigned int __a, vector unsigned int __b) { |
| 689 | return __builtin_altivec_vadduws(__a, __b); |
| 690 | } |
| 691 | |
| 692 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 693 | vec_adds(vector bool int __a, vector unsigned int __b) { |
| 694 | return __builtin_altivec_vadduws((vector unsigned int)__a, __b); |
| 695 | } |
| 696 | |
| 697 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 698 | vec_adds(vector unsigned int __a, vector bool int __b) { |
| 699 | return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); |
| 700 | } |
| 701 | |
| 702 | /* vec_vaddsbs */ |
| 703 | |
| 704 | static __inline__ vector signed char __ATTRS_o_ai |
| 705 | vec_vaddsbs(vector signed char __a, vector signed char __b) { |
| 706 | return __builtin_altivec_vaddsbs(__a, __b); |
| 707 | } |
| 708 | |
| 709 | static __inline__ vector signed char __ATTRS_o_ai |
| 710 | vec_vaddsbs(vector bool char __a, vector signed char __b) { |
| 711 | return __builtin_altivec_vaddsbs((vector signed char)__a, __b); |
| 712 | } |
| 713 | |
| 714 | static __inline__ vector signed char __ATTRS_o_ai |
| 715 | vec_vaddsbs(vector signed char __a, vector bool char __b) { |
| 716 | return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); |
| 717 | } |
| 718 | |
| 719 | /* vec_vaddubs */ |
| 720 | |
| 721 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 722 | vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { |
| 723 | return __builtin_altivec_vaddubs(__a, __b); |
| 724 | } |
| 725 | |
| 726 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 727 | vec_vaddubs(vector bool char __a, vector unsigned char __b) { |
| 728 | return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); |
| 729 | } |
| 730 | |
| 731 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 732 | vec_vaddubs(vector unsigned char __a, vector bool char __b) { |
| 733 | return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); |
| 734 | } |
| 735 | |
| 736 | /* vec_vaddshs */ |
| 737 | |
| 738 | static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, |
| 739 | vector short __b) { |
| 740 | return __builtin_altivec_vaddshs(__a, __b); |
| 741 | } |
| 742 | |
| 743 | static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, |
| 744 | vector short __b) { |
| 745 | return __builtin_altivec_vaddshs((vector short)__a, __b); |
| 746 | } |
| 747 | |
| 748 | static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, |
| 749 | vector bool short __b) { |
| 750 | return __builtin_altivec_vaddshs(__a, (vector short)__b); |
| 751 | } |
| 752 | |
| 753 | /* vec_vadduhs */ |
| 754 | |
| 755 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 756 | vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { |
| 757 | return __builtin_altivec_vadduhs(__a, __b); |
| 758 | } |
| 759 | |
| 760 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 761 | vec_vadduhs(vector bool short __a, vector unsigned short __b) { |
| 762 | return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); |
| 763 | } |
| 764 | |
| 765 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 766 | vec_vadduhs(vector unsigned short __a, vector bool short __b) { |
| 767 | return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); |
| 768 | } |
| 769 | |
| 770 | /* vec_vaddsws */ |
| 771 | |
| 772 | static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, |
| 773 | vector int __b) { |
| 774 | return __builtin_altivec_vaddsws(__a, __b); |
| 775 | } |
| 776 | |
| 777 | static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, |
| 778 | vector int __b) { |
| 779 | return __builtin_altivec_vaddsws((vector int)__a, __b); |
| 780 | } |
| 781 | |
| 782 | static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, |
| 783 | vector bool int __b) { |
| 784 | return __builtin_altivec_vaddsws(__a, (vector int)__b); |
| 785 | } |
| 786 | |
| 787 | /* vec_vadduws */ |
| 788 | |
| 789 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 790 | vec_vadduws(vector unsigned int __a, vector unsigned int __b) { |
| 791 | return __builtin_altivec_vadduws(__a, __b); |
| 792 | } |
| 793 | |
| 794 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 795 | vec_vadduws(vector bool int __a, vector unsigned int __b) { |
| 796 | return __builtin_altivec_vadduws((vector unsigned int)__a, __b); |
| 797 | } |
| 798 | |
| 799 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 800 | vec_vadduws(vector unsigned int __a, vector bool int __b) { |
| 801 | return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); |
| 802 | } |
| 803 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 804 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 805 | defined(__SIZEOF_INT128__) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 806 | /* vec_vadduqm */ |
| 807 | |
| 808 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 809 | vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { |
| 810 | return __a + __b; |
| 811 | } |
| 812 | |
| 813 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 814 | vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 815 | return __a + __b; |
| 816 | } |
| 817 | |
| 818 | /* vec_vaddeuqm */ |
| 819 | |
| 820 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 821 | vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, |
| 822 | vector signed __int128 __c) { |
| 823 | return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| 824 | } |
| 825 | |
| 826 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 827 | vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 828 | vector unsigned __int128 __c) { |
| 829 | return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| 830 | } |
| 831 | |
| 832 | /* vec_vaddcuq */ |
| 833 | |
| 834 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 835 | vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { |
| 836 | return __builtin_altivec_vaddcuq(__a, __b); |
| 837 | } |
| 838 | |
| 839 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 840 | vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 841 | return __builtin_altivec_vaddcuq(__a, __b); |
| 842 | } |
| 843 | |
| 844 | /* vec_vaddecuq */ |
| 845 | |
| 846 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 847 | vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, |
| 848 | vector signed __int128 __c) { |
| 849 | return __builtin_altivec_vaddecuq(__a, __b, __c); |
| 850 | } |
| 851 | |
| 852 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 853 | vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 854 | vector unsigned __int128 __c) { |
| 855 | return __builtin_altivec_vaddecuq(__a, __b, __c); |
| 856 | } |
| 857 | #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) |
| 858 | |
| 859 | /* vec_and */ |
| 860 | |
| 861 | #define __builtin_altivec_vand vec_and |
| 862 | |
| 863 | static __inline__ vector signed char __ATTRS_o_ai |
| 864 | vec_and(vector signed char __a, vector signed char __b) { |
| 865 | return __a & __b; |
| 866 | } |
| 867 | |
| 868 | static __inline__ vector signed char __ATTRS_o_ai |
| 869 | vec_and(vector bool char __a, vector signed char __b) { |
| 870 | return (vector signed char)__a & __b; |
| 871 | } |
| 872 | |
| 873 | static __inline__ vector signed char __ATTRS_o_ai |
| 874 | vec_and(vector signed char __a, vector bool char __b) { |
| 875 | return __a & (vector signed char)__b; |
| 876 | } |
| 877 | |
| 878 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 879 | vec_and(vector unsigned char __a, vector unsigned char __b) { |
| 880 | return __a & __b; |
| 881 | } |
| 882 | |
| 883 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 884 | vec_and(vector bool char __a, vector unsigned char __b) { |
| 885 | return (vector unsigned char)__a & __b; |
| 886 | } |
| 887 | |
| 888 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 889 | vec_and(vector unsigned char __a, vector bool char __b) { |
| 890 | return __a & (vector unsigned char)__b; |
| 891 | } |
| 892 | |
| 893 | static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, |
| 894 | vector bool char __b) { |
| 895 | return __a & __b; |
| 896 | } |
| 897 | |
| 898 | static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, |
| 899 | vector short __b) { |
| 900 | return __a & __b; |
| 901 | } |
| 902 | |
| 903 | static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, |
| 904 | vector short __b) { |
| 905 | return (vector short)__a & __b; |
| 906 | } |
| 907 | |
| 908 | static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, |
| 909 | vector bool short __b) { |
| 910 | return __a & (vector short)__b; |
| 911 | } |
| 912 | |
| 913 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 914 | vec_and(vector unsigned short __a, vector unsigned short __b) { |
| 915 | return __a & __b; |
| 916 | } |
| 917 | |
| 918 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 919 | vec_and(vector bool short __a, vector unsigned short __b) { |
| 920 | return (vector unsigned short)__a & __b; |
| 921 | } |
| 922 | |
| 923 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 924 | vec_and(vector unsigned short __a, vector bool short __b) { |
| 925 | return __a & (vector unsigned short)__b; |
| 926 | } |
| 927 | |
| 928 | static __inline__ vector bool short __ATTRS_o_ai |
| 929 | vec_and(vector bool short __a, vector bool short __b) { |
| 930 | return __a & __b; |
| 931 | } |
| 932 | |
| 933 | static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, |
| 934 | vector int __b) { |
| 935 | return __a & __b; |
| 936 | } |
| 937 | |
| 938 | static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, |
| 939 | vector int __b) { |
| 940 | return (vector int)__a & __b; |
| 941 | } |
| 942 | |
| 943 | static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, |
| 944 | vector bool int __b) { |
| 945 | return __a & (vector int)__b; |
| 946 | } |
| 947 | |
| 948 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 949 | vec_and(vector unsigned int __a, vector unsigned int __b) { |
| 950 | return __a & __b; |
| 951 | } |
| 952 | |
| 953 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 954 | vec_and(vector bool int __a, vector unsigned int __b) { |
| 955 | return (vector unsigned int)__a & __b; |
| 956 | } |
| 957 | |
| 958 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 959 | vec_and(vector unsigned int __a, vector bool int __b) { |
| 960 | return __a & (vector unsigned int)__b; |
| 961 | } |
| 962 | |
| 963 | static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, |
| 964 | vector bool int __b) { |
| 965 | return __a & __b; |
| 966 | } |
| 967 | |
| 968 | static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, |
| 969 | vector float __b) { |
| 970 | vector unsigned int __res = |
| 971 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 972 | return (vector float)__res; |
| 973 | } |
| 974 | |
| 975 | static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, |
| 976 | vector float __b) { |
| 977 | vector unsigned int __res = |
| 978 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 979 | return (vector float)__res; |
| 980 | } |
| 981 | |
| 982 | static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, |
| 983 | vector bool int __b) { |
| 984 | vector unsigned int __res = |
| 985 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 986 | return (vector float)__res; |
| 987 | } |
| 988 | |
| 989 | #ifdef __VSX__ |
| 990 | static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, |
| 991 | vector double __b) { |
| 992 | vector unsigned long long __res = |
| 993 | (vector unsigned long long)__a & (vector unsigned long long)__b; |
| 994 | return (vector double)__res; |
| 995 | } |
| 996 | |
| 997 | static __inline__ vector double __ATTRS_o_ai |
| 998 | vec_and(vector double __a, vector bool long long __b) { |
| 999 | vector unsigned long long __res = |
| 1000 | (vector unsigned long long)__a & (vector unsigned long long)__b; |
| 1001 | return (vector double)__res; |
| 1002 | } |
| 1003 | |
| 1004 | static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, |
| 1005 | vector double __b) { |
| 1006 | vector unsigned long long __res = |
| 1007 | (vector unsigned long long)__a & (vector unsigned long long)__b; |
| 1008 | return (vector double)__res; |
| 1009 | } |
| 1010 | |
| 1011 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1012 | vec_and(vector signed long long __a, vector signed long long __b) { |
| 1013 | return __a & __b; |
| 1014 | } |
| 1015 | |
| 1016 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1017 | vec_and(vector bool long long __a, vector signed long long __b) { |
| 1018 | return (vector signed long long)__a & __b; |
| 1019 | } |
| 1020 | |
| 1021 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1022 | vec_and(vector signed long long __a, vector bool long long __b) { |
| 1023 | return __a & (vector signed long long)__b; |
| 1024 | } |
| 1025 | |
| 1026 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1027 | vec_and(vector unsigned long long __a, vector unsigned long long __b) { |
| 1028 | return __a & __b; |
| 1029 | } |
| 1030 | |
| 1031 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1032 | vec_and(vector bool long long __a, vector unsigned long long __b) { |
| 1033 | return (vector unsigned long long)__a & __b; |
| 1034 | } |
| 1035 | |
| 1036 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1037 | vec_and(vector unsigned long long __a, vector bool long long __b) { |
| 1038 | return __a & (vector unsigned long long)__b; |
| 1039 | } |
| 1040 | |
| 1041 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1042 | vec_and(vector bool long long __a, vector bool long long __b) { |
| 1043 | return __a & __b; |
| 1044 | } |
| 1045 | #endif |
| 1046 | |
| 1047 | /* vec_vand */ |
| 1048 | |
| 1049 | static __inline__ vector signed char __ATTRS_o_ai |
| 1050 | vec_vand(vector signed char __a, vector signed char __b) { |
| 1051 | return __a & __b; |
| 1052 | } |
| 1053 | |
| 1054 | static __inline__ vector signed char __ATTRS_o_ai |
| 1055 | vec_vand(vector bool char __a, vector signed char __b) { |
| 1056 | return (vector signed char)__a & __b; |
| 1057 | } |
| 1058 | |
| 1059 | static __inline__ vector signed char __ATTRS_o_ai |
| 1060 | vec_vand(vector signed char __a, vector bool char __b) { |
| 1061 | return __a & (vector signed char)__b; |
| 1062 | } |
| 1063 | |
| 1064 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1065 | vec_vand(vector unsigned char __a, vector unsigned char __b) { |
| 1066 | return __a & __b; |
| 1067 | } |
| 1068 | |
| 1069 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1070 | vec_vand(vector bool char __a, vector unsigned char __b) { |
| 1071 | return (vector unsigned char)__a & __b; |
| 1072 | } |
| 1073 | |
| 1074 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1075 | vec_vand(vector unsigned char __a, vector bool char __b) { |
| 1076 | return __a & (vector unsigned char)__b; |
| 1077 | } |
| 1078 | |
| 1079 | static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, |
| 1080 | vector bool char __b) { |
| 1081 | return __a & __b; |
| 1082 | } |
| 1083 | |
| 1084 | static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, |
| 1085 | vector short __b) { |
| 1086 | return __a & __b; |
| 1087 | } |
| 1088 | |
| 1089 | static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, |
| 1090 | vector short __b) { |
| 1091 | return (vector short)__a & __b; |
| 1092 | } |
| 1093 | |
| 1094 | static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, |
| 1095 | vector bool short __b) { |
| 1096 | return __a & (vector short)__b; |
| 1097 | } |
| 1098 | |
| 1099 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1100 | vec_vand(vector unsigned short __a, vector unsigned short __b) { |
| 1101 | return __a & __b; |
| 1102 | } |
| 1103 | |
| 1104 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1105 | vec_vand(vector bool short __a, vector unsigned short __b) { |
| 1106 | return (vector unsigned short)__a & __b; |
| 1107 | } |
| 1108 | |
| 1109 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1110 | vec_vand(vector unsigned short __a, vector bool short __b) { |
| 1111 | return __a & (vector unsigned short)__b; |
| 1112 | } |
| 1113 | |
| 1114 | static __inline__ vector bool short __ATTRS_o_ai |
| 1115 | vec_vand(vector bool short __a, vector bool short __b) { |
| 1116 | return __a & __b; |
| 1117 | } |
| 1118 | |
| 1119 | static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, |
| 1120 | vector int __b) { |
| 1121 | return __a & __b; |
| 1122 | } |
| 1123 | |
| 1124 | static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, |
| 1125 | vector int __b) { |
| 1126 | return (vector int)__a & __b; |
| 1127 | } |
| 1128 | |
| 1129 | static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, |
| 1130 | vector bool int __b) { |
| 1131 | return __a & (vector int)__b; |
| 1132 | } |
| 1133 | |
| 1134 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1135 | vec_vand(vector unsigned int __a, vector unsigned int __b) { |
| 1136 | return __a & __b; |
| 1137 | } |
| 1138 | |
| 1139 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1140 | vec_vand(vector bool int __a, vector unsigned int __b) { |
| 1141 | return (vector unsigned int)__a & __b; |
| 1142 | } |
| 1143 | |
| 1144 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1145 | vec_vand(vector unsigned int __a, vector bool int __b) { |
| 1146 | return __a & (vector unsigned int)__b; |
| 1147 | } |
| 1148 | |
| 1149 | static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, |
| 1150 | vector bool int __b) { |
| 1151 | return __a & __b; |
| 1152 | } |
| 1153 | |
| 1154 | static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, |
| 1155 | vector float __b) { |
| 1156 | vector unsigned int __res = |
| 1157 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 1158 | return (vector float)__res; |
| 1159 | } |
| 1160 | |
| 1161 | static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, |
| 1162 | vector float __b) { |
| 1163 | vector unsigned int __res = |
| 1164 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 1165 | return (vector float)__res; |
| 1166 | } |
| 1167 | |
| 1168 | static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, |
| 1169 | vector bool int __b) { |
| 1170 | vector unsigned int __res = |
| 1171 | (vector unsigned int)__a & (vector unsigned int)__b; |
| 1172 | return (vector float)__res; |
| 1173 | } |
| 1174 | |
| 1175 | #ifdef __VSX__ |
| 1176 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1177 | vec_vand(vector signed long long __a, vector signed long long __b) { |
| 1178 | return __a & __b; |
| 1179 | } |
| 1180 | |
| 1181 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1182 | vec_vand(vector bool long long __a, vector signed long long __b) { |
| 1183 | return (vector signed long long)__a & __b; |
| 1184 | } |
| 1185 | |
| 1186 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1187 | vec_vand(vector signed long long __a, vector bool long long __b) { |
| 1188 | return __a & (vector signed long long)__b; |
| 1189 | } |
| 1190 | |
| 1191 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1192 | vec_vand(vector unsigned long long __a, vector unsigned long long __b) { |
| 1193 | return __a & __b; |
| 1194 | } |
| 1195 | |
| 1196 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1197 | vec_vand(vector bool long long __a, vector unsigned long long __b) { |
| 1198 | return (vector unsigned long long)__a & __b; |
| 1199 | } |
| 1200 | |
| 1201 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1202 | vec_vand(vector unsigned long long __a, vector bool long long __b) { |
| 1203 | return __a & (vector unsigned long long)__b; |
| 1204 | } |
| 1205 | |
| 1206 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1207 | vec_vand(vector bool long long __a, vector bool long long __b) { |
| 1208 | return __a & __b; |
| 1209 | } |
| 1210 | #endif |
| 1211 | |
| 1212 | /* vec_andc */ |
| 1213 | |
| 1214 | #define __builtin_altivec_vandc vec_andc |
| 1215 | |
| 1216 | static __inline__ vector signed char __ATTRS_o_ai |
| 1217 | vec_andc(vector signed char __a, vector signed char __b) { |
| 1218 | return __a & ~__b; |
| 1219 | } |
| 1220 | |
| 1221 | static __inline__ vector signed char __ATTRS_o_ai |
| 1222 | vec_andc(vector bool char __a, vector signed char __b) { |
| 1223 | return (vector signed char)__a & ~__b; |
| 1224 | } |
| 1225 | |
| 1226 | static __inline__ vector signed char __ATTRS_o_ai |
| 1227 | vec_andc(vector signed char __a, vector bool char __b) { |
| 1228 | return __a & ~(vector signed char)__b; |
| 1229 | } |
| 1230 | |
| 1231 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1232 | vec_andc(vector unsigned char __a, vector unsigned char __b) { |
| 1233 | return __a & ~__b; |
| 1234 | } |
| 1235 | |
| 1236 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1237 | vec_andc(vector bool char __a, vector unsigned char __b) { |
| 1238 | return (vector unsigned char)__a & ~__b; |
| 1239 | } |
| 1240 | |
| 1241 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1242 | vec_andc(vector unsigned char __a, vector bool char __b) { |
| 1243 | return __a & ~(vector unsigned char)__b; |
| 1244 | } |
| 1245 | |
| 1246 | static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, |
| 1247 | vector bool char __b) { |
| 1248 | return __a & ~__b; |
| 1249 | } |
| 1250 | |
| 1251 | static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, |
| 1252 | vector short __b) { |
| 1253 | return __a & ~__b; |
| 1254 | } |
| 1255 | |
| 1256 | static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, |
| 1257 | vector short __b) { |
| 1258 | return (vector short)__a & ~__b; |
| 1259 | } |
| 1260 | |
| 1261 | static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, |
| 1262 | vector bool short __b) { |
| 1263 | return __a & ~(vector short)__b; |
| 1264 | } |
| 1265 | |
| 1266 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1267 | vec_andc(vector unsigned short __a, vector unsigned short __b) { |
| 1268 | return __a & ~__b; |
| 1269 | } |
| 1270 | |
| 1271 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1272 | vec_andc(vector bool short __a, vector unsigned short __b) { |
| 1273 | return (vector unsigned short)__a & ~__b; |
| 1274 | } |
| 1275 | |
| 1276 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1277 | vec_andc(vector unsigned short __a, vector bool short __b) { |
| 1278 | return __a & ~(vector unsigned short)__b; |
| 1279 | } |
| 1280 | |
| 1281 | static __inline__ vector bool short __ATTRS_o_ai |
| 1282 | vec_andc(vector bool short __a, vector bool short __b) { |
| 1283 | return __a & ~__b; |
| 1284 | } |
| 1285 | |
| 1286 | static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, |
| 1287 | vector int __b) { |
| 1288 | return __a & ~__b; |
| 1289 | } |
| 1290 | |
| 1291 | static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, |
| 1292 | vector int __b) { |
| 1293 | return (vector int)__a & ~__b; |
| 1294 | } |
| 1295 | |
| 1296 | static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, |
| 1297 | vector bool int __b) { |
| 1298 | return __a & ~(vector int)__b; |
| 1299 | } |
| 1300 | |
| 1301 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1302 | vec_andc(vector unsigned int __a, vector unsigned int __b) { |
| 1303 | return __a & ~__b; |
| 1304 | } |
| 1305 | |
| 1306 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1307 | vec_andc(vector bool int __a, vector unsigned int __b) { |
| 1308 | return (vector unsigned int)__a & ~__b; |
| 1309 | } |
| 1310 | |
| 1311 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1312 | vec_andc(vector unsigned int __a, vector bool int __b) { |
| 1313 | return __a & ~(vector unsigned int)__b; |
| 1314 | } |
| 1315 | |
| 1316 | static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, |
| 1317 | vector bool int __b) { |
| 1318 | return __a & ~__b; |
| 1319 | } |
| 1320 | |
| 1321 | static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, |
| 1322 | vector float __b) { |
| 1323 | vector unsigned int __res = |
| 1324 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1325 | return (vector float)__res; |
| 1326 | } |
| 1327 | |
| 1328 | static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, |
| 1329 | vector float __b) { |
| 1330 | vector unsigned int __res = |
| 1331 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1332 | return (vector float)__res; |
| 1333 | } |
| 1334 | |
| 1335 | static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, |
| 1336 | vector bool int __b) { |
| 1337 | vector unsigned int __res = |
| 1338 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1339 | return (vector float)__res; |
| 1340 | } |
| 1341 | |
| 1342 | #ifdef __VSX__ |
| 1343 | static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, |
| 1344 | vector double __b) { |
| 1345 | vector unsigned long long __res = |
| 1346 | (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| 1347 | return (vector double)__res; |
| 1348 | } |
| 1349 | |
| 1350 | static __inline__ vector double __ATTRS_o_ai |
| 1351 | vec_andc(vector double __a, vector bool long long __b) { |
| 1352 | vector unsigned long long __res = |
| 1353 | (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| 1354 | return (vector double)__res; |
| 1355 | } |
| 1356 | |
| 1357 | static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, |
| 1358 | vector double __b) { |
| 1359 | vector unsigned long long __res = |
| 1360 | (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| 1361 | return (vector double)__res; |
| 1362 | } |
| 1363 | |
| 1364 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1365 | vec_andc(vector signed long long __a, vector signed long long __b) { |
| 1366 | return __a & ~__b; |
| 1367 | } |
| 1368 | |
| 1369 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1370 | vec_andc(vector bool long long __a, vector signed long long __b) { |
| 1371 | return (vector signed long long)__a & ~__b; |
| 1372 | } |
| 1373 | |
| 1374 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1375 | vec_andc(vector signed long long __a, vector bool long long __b) { |
| 1376 | return __a & ~(vector signed long long)__b; |
| 1377 | } |
| 1378 | |
| 1379 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1380 | vec_andc(vector unsigned long long __a, vector unsigned long long __b) { |
| 1381 | return __a & ~__b; |
| 1382 | } |
| 1383 | |
| 1384 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1385 | vec_andc(vector bool long long __a, vector unsigned long long __b) { |
| 1386 | return (vector unsigned long long)__a & ~__b; |
| 1387 | } |
| 1388 | |
| 1389 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1390 | vec_andc(vector unsigned long long __a, vector bool long long __b) { |
| 1391 | return __a & ~(vector unsigned long long)__b; |
| 1392 | } |
| 1393 | |
| 1394 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1395 | vec_andc(vector bool long long __a, vector bool long long __b) { |
| 1396 | return __a & ~__b; |
| 1397 | } |
| 1398 | #endif |
| 1399 | |
| 1400 | /* vec_vandc */ |
| 1401 | |
| 1402 | static __inline__ vector signed char __ATTRS_o_ai |
| 1403 | vec_vandc(vector signed char __a, vector signed char __b) { |
| 1404 | return __a & ~__b; |
| 1405 | } |
| 1406 | |
| 1407 | static __inline__ vector signed char __ATTRS_o_ai |
| 1408 | vec_vandc(vector bool char __a, vector signed char __b) { |
| 1409 | return (vector signed char)__a & ~__b; |
| 1410 | } |
| 1411 | |
| 1412 | static __inline__ vector signed char __ATTRS_o_ai |
| 1413 | vec_vandc(vector signed char __a, vector bool char __b) { |
| 1414 | return __a & ~(vector signed char)__b; |
| 1415 | } |
| 1416 | |
| 1417 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1418 | vec_vandc(vector unsigned char __a, vector unsigned char __b) { |
| 1419 | return __a & ~__b; |
| 1420 | } |
| 1421 | |
| 1422 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1423 | vec_vandc(vector bool char __a, vector unsigned char __b) { |
| 1424 | return (vector unsigned char)__a & ~__b; |
| 1425 | } |
| 1426 | |
| 1427 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1428 | vec_vandc(vector unsigned char __a, vector bool char __b) { |
| 1429 | return __a & ~(vector unsigned char)__b; |
| 1430 | } |
| 1431 | |
| 1432 | static __inline__ vector bool char __ATTRS_o_ai |
| 1433 | vec_vandc(vector bool char __a, vector bool char __b) { |
| 1434 | return __a & ~__b; |
| 1435 | } |
| 1436 | |
| 1437 | static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, |
| 1438 | vector short __b) { |
| 1439 | return __a & ~__b; |
| 1440 | } |
| 1441 | |
| 1442 | static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, |
| 1443 | vector short __b) { |
| 1444 | return (vector short)__a & ~__b; |
| 1445 | } |
| 1446 | |
| 1447 | static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, |
| 1448 | vector bool short __b) { |
| 1449 | return __a & ~(vector short)__b; |
| 1450 | } |
| 1451 | |
| 1452 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1453 | vec_vandc(vector unsigned short __a, vector unsigned short __b) { |
| 1454 | return __a & ~__b; |
| 1455 | } |
| 1456 | |
| 1457 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1458 | vec_vandc(vector bool short __a, vector unsigned short __b) { |
| 1459 | return (vector unsigned short)__a & ~__b; |
| 1460 | } |
| 1461 | |
| 1462 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1463 | vec_vandc(vector unsigned short __a, vector bool short __b) { |
| 1464 | return __a & ~(vector unsigned short)__b; |
| 1465 | } |
| 1466 | |
| 1467 | static __inline__ vector bool short __ATTRS_o_ai |
| 1468 | vec_vandc(vector bool short __a, vector bool short __b) { |
| 1469 | return __a & ~__b; |
| 1470 | } |
| 1471 | |
| 1472 | static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, |
| 1473 | vector int __b) { |
| 1474 | return __a & ~__b; |
| 1475 | } |
| 1476 | |
| 1477 | static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, |
| 1478 | vector int __b) { |
| 1479 | return (vector int)__a & ~__b; |
| 1480 | } |
| 1481 | |
| 1482 | static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, |
| 1483 | vector bool int __b) { |
| 1484 | return __a & ~(vector int)__b; |
| 1485 | } |
| 1486 | |
| 1487 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1488 | vec_vandc(vector unsigned int __a, vector unsigned int __b) { |
| 1489 | return __a & ~__b; |
| 1490 | } |
| 1491 | |
| 1492 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1493 | vec_vandc(vector bool int __a, vector unsigned int __b) { |
| 1494 | return (vector unsigned int)__a & ~__b; |
| 1495 | } |
| 1496 | |
| 1497 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1498 | vec_vandc(vector unsigned int __a, vector bool int __b) { |
| 1499 | return __a & ~(vector unsigned int)__b; |
| 1500 | } |
| 1501 | |
| 1502 | static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, |
| 1503 | vector bool int __b) { |
| 1504 | return __a & ~__b; |
| 1505 | } |
| 1506 | |
| 1507 | static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, |
| 1508 | vector float __b) { |
| 1509 | vector unsigned int __res = |
| 1510 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1511 | return (vector float)__res; |
| 1512 | } |
| 1513 | |
| 1514 | static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, |
| 1515 | vector float __b) { |
| 1516 | vector unsigned int __res = |
| 1517 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1518 | return (vector float)__res; |
| 1519 | } |
| 1520 | |
| 1521 | static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, |
| 1522 | vector bool int __b) { |
| 1523 | vector unsigned int __res = |
| 1524 | (vector unsigned int)__a & ~(vector unsigned int)__b; |
| 1525 | return (vector float)__res; |
| 1526 | } |
| 1527 | |
| 1528 | #ifdef __VSX__ |
| 1529 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1530 | vec_vandc(vector signed long long __a, vector signed long long __b) { |
| 1531 | return __a & ~__b; |
| 1532 | } |
| 1533 | |
| 1534 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1535 | vec_vandc(vector bool long long __a, vector signed long long __b) { |
| 1536 | return (vector signed long long)__a & ~__b; |
| 1537 | } |
| 1538 | |
| 1539 | static __inline__ vector signed long long __ATTRS_o_ai |
| 1540 | vec_vandc(vector signed long long __a, vector bool long long __b) { |
| 1541 | return __a & ~(vector signed long long)__b; |
| 1542 | } |
| 1543 | |
| 1544 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1545 | vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { |
| 1546 | return __a & ~__b; |
| 1547 | } |
| 1548 | |
| 1549 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1550 | vec_vandc(vector bool long long __a, vector unsigned long long __b) { |
| 1551 | return (vector unsigned long long)__a & ~__b; |
| 1552 | } |
| 1553 | |
| 1554 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1555 | vec_vandc(vector unsigned long long __a, vector bool long long __b) { |
| 1556 | return __a & ~(vector unsigned long long)__b; |
| 1557 | } |
| 1558 | |
| 1559 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1560 | vec_vandc(vector bool long long __a, vector bool long long __b) { |
| 1561 | return __a & ~__b; |
| 1562 | } |
| 1563 | #endif |
| 1564 | |
| 1565 | /* vec_avg */ |
| 1566 | |
| 1567 | static __inline__ vector signed char __ATTRS_o_ai |
| 1568 | vec_avg(vector signed char __a, vector signed char __b) { |
| 1569 | return __builtin_altivec_vavgsb(__a, __b); |
| 1570 | } |
| 1571 | |
| 1572 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 1573 | vec_avg(vector unsigned char __a, vector unsigned char __b) { |
| 1574 | return __builtin_altivec_vavgub(__a, __b); |
| 1575 | } |
| 1576 | |
| 1577 | static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, |
| 1578 | vector short __b) { |
| 1579 | return __builtin_altivec_vavgsh(__a, __b); |
| 1580 | } |
| 1581 | |
| 1582 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 1583 | vec_avg(vector unsigned short __a, vector unsigned short __b) { |
| 1584 | return __builtin_altivec_vavguh(__a, __b); |
| 1585 | } |
| 1586 | |
| 1587 | static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, |
| 1588 | vector int __b) { |
| 1589 | return __builtin_altivec_vavgsw(__a, __b); |
| 1590 | } |
| 1591 | |
| 1592 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1593 | vec_avg(vector unsigned int __a, vector unsigned int __b) { |
| 1594 | return __builtin_altivec_vavguw(__a, __b); |
| 1595 | } |
| 1596 | |
| 1597 | /* vec_vavgsb */ |
| 1598 | |
| 1599 | static __inline__ vector signed char __attribute__((__always_inline__)) |
| 1600 | vec_vavgsb(vector signed char __a, vector signed char __b) { |
| 1601 | return __builtin_altivec_vavgsb(__a, __b); |
| 1602 | } |
| 1603 | |
| 1604 | /* vec_vavgub */ |
| 1605 | |
| 1606 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 1607 | vec_vavgub(vector unsigned char __a, vector unsigned char __b) { |
| 1608 | return __builtin_altivec_vavgub(__a, __b); |
| 1609 | } |
| 1610 | |
| 1611 | /* vec_vavgsh */ |
| 1612 | |
| 1613 | static __inline__ vector short __attribute__((__always_inline__)) |
| 1614 | vec_vavgsh(vector short __a, vector short __b) { |
| 1615 | return __builtin_altivec_vavgsh(__a, __b); |
| 1616 | } |
| 1617 | |
| 1618 | /* vec_vavguh */ |
| 1619 | |
| 1620 | static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| 1621 | vec_vavguh(vector unsigned short __a, vector unsigned short __b) { |
| 1622 | return __builtin_altivec_vavguh(__a, __b); |
| 1623 | } |
| 1624 | |
| 1625 | /* vec_vavgsw */ |
| 1626 | |
| 1627 | static __inline__ vector int __attribute__((__always_inline__)) |
| 1628 | vec_vavgsw(vector int __a, vector int __b) { |
| 1629 | return __builtin_altivec_vavgsw(__a, __b); |
| 1630 | } |
| 1631 | |
| 1632 | /* vec_vavguw */ |
| 1633 | |
| 1634 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 1635 | vec_vavguw(vector unsigned int __a, vector unsigned int __b) { |
| 1636 | return __builtin_altivec_vavguw(__a, __b); |
| 1637 | } |
| 1638 | |
| 1639 | /* vec_ceil */ |
| 1640 | |
| 1641 | static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { |
| 1642 | #ifdef __VSX__ |
| 1643 | return __builtin_vsx_xvrspip(__a); |
| 1644 | #else |
| 1645 | return __builtin_altivec_vrfip(__a); |
| 1646 | #endif |
| 1647 | } |
| 1648 | |
| 1649 | #ifdef __VSX__ |
| 1650 | static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { |
| 1651 | return __builtin_vsx_xvrdpip(__a); |
| 1652 | } |
| 1653 | #endif |
| 1654 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1655 | /* vec_roundp */ |
| 1656 | static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { |
| 1657 | return vec_ceil(__a); |
| 1658 | } |
| 1659 | |
| 1660 | #ifdef __VSX__ |
| 1661 | static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { |
| 1662 | return vec_ceil(__a); |
| 1663 | } |
| 1664 | #endif |
| 1665 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1666 | /* vec_vrfip */ |
| 1667 | |
| 1668 | static __inline__ vector float __attribute__((__always_inline__)) |
| 1669 | vec_vrfip(vector float __a) { |
| 1670 | return __builtin_altivec_vrfip(__a); |
| 1671 | } |
| 1672 | |
| 1673 | /* vec_cmpb */ |
| 1674 | |
| 1675 | static __inline__ vector int __attribute__((__always_inline__)) |
| 1676 | vec_cmpb(vector float __a, vector float __b) { |
| 1677 | return __builtin_altivec_vcmpbfp(__a, __b); |
| 1678 | } |
| 1679 | |
| 1680 | /* vec_vcmpbfp */ |
| 1681 | |
| 1682 | static __inline__ vector int __attribute__((__always_inline__)) |
| 1683 | vec_vcmpbfp(vector float __a, vector float __b) { |
| 1684 | return __builtin_altivec_vcmpbfp(__a, __b); |
| 1685 | } |
| 1686 | |
| 1687 | /* vec_cmpeq */ |
| 1688 | |
| 1689 | static __inline__ vector bool char __ATTRS_o_ai |
| 1690 | vec_cmpeq(vector signed char __a, vector signed char __b) { |
| 1691 | return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| 1692 | (vector char)__b); |
| 1693 | } |
| 1694 | |
| 1695 | static __inline__ vector bool char __ATTRS_o_ai |
| 1696 | vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { |
| 1697 | return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| 1698 | (vector char)__b); |
| 1699 | } |
| 1700 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1701 | static __inline__ vector bool char __ATTRS_o_ai |
| 1702 | vec_cmpeq(vector bool char __a, vector bool char __b) { |
| 1703 | return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| 1704 | (vector char)__b); |
| 1705 | } |
| 1706 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1707 | static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, |
| 1708 | vector short __b) { |
| 1709 | return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); |
| 1710 | } |
| 1711 | |
| 1712 | static __inline__ vector bool short __ATTRS_o_ai |
| 1713 | vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { |
| 1714 | return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, |
| 1715 | (vector short)__b); |
| 1716 | } |
| 1717 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1718 | static __inline__ vector bool short __ATTRS_o_ai |
| 1719 | vec_cmpeq(vector bool short __a, vector bool short __b) { |
| 1720 | return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, |
| 1721 | (vector short)__b); |
| 1722 | } |
| 1723 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1724 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, |
| 1725 | vector int __b) { |
| 1726 | return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); |
| 1727 | } |
| 1728 | |
| 1729 | static __inline__ vector bool int __ATTRS_o_ai |
| 1730 | vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { |
| 1731 | return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, |
| 1732 | (vector int)__b); |
| 1733 | } |
| 1734 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1735 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, |
| 1736 | vector bool int __b) { |
| 1737 | return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, |
| 1738 | (vector int)__b); |
| 1739 | } |
| 1740 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1741 | #ifdef __POWER8_VECTOR__ |
| 1742 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1743 | vec_cmpeq(vector signed long long __a, vector signed long long __b) { |
| 1744 | return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); |
| 1745 | } |
| 1746 | |
| 1747 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1748 | vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { |
| 1749 | return (vector bool long long)__builtin_altivec_vcmpequd( |
| 1750 | (vector long long)__a, (vector long long)__b); |
| 1751 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1752 | |
| 1753 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1754 | vec_cmpeq(vector bool long long __a, vector bool long long __b) { |
| 1755 | return (vector bool long long)__builtin_altivec_vcmpequd( |
| 1756 | (vector long long)__a, (vector long long)__b); |
| 1757 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1758 | #elif defined(__VSX__) |
| 1759 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1760 | vec_cmpeq(vector signed long long __a, vector signed long long __b) { |
| 1761 | vector bool int __wordcmp = |
| 1762 | vec_cmpeq((vector signed int)__a, (vector signed int)__b); |
| 1763 | #ifdef __LITTLE_ENDIAN__ |
| 1764 | __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); |
| 1765 | return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, |
| 1766 | 1, 3, 3); |
| 1767 | #else |
| 1768 | __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); |
| 1769 | return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, |
| 1770 | 0, 2, 2); |
| 1771 | #endif |
| 1772 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1773 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1774 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1775 | vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { |
| 1776 | return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); |
| 1777 | } |
| 1778 | |
| 1779 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1780 | vec_cmpeq(vector bool long long __a, vector bool long long __b) { |
| 1781 | return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); |
| 1782 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1783 | #endif |
| 1784 | |
| 1785 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, |
| 1786 | vector float __b) { |
| 1787 | #ifdef __VSX__ |
| 1788 | return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); |
| 1789 | #else |
| 1790 | return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); |
| 1791 | #endif |
| 1792 | } |
| 1793 | |
| 1794 | #ifdef __VSX__ |
| 1795 | static __inline__ vector bool long long __ATTRS_o_ai |
| 1796 | vec_cmpeq(vector double __a, vector double __b) { |
| 1797 | return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); |
| 1798 | } |
| 1799 | #endif |
| 1800 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1801 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 1802 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 1803 | vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { |
| 1804 | return (vector bool __int128)__builtin_altivec_vcmpequq( |
| 1805 | (vector bool __int128)__a, (vector bool __int128)__b); |
| 1806 | } |
| 1807 | |
| 1808 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 1809 | vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 1810 | return (vector bool __int128)__builtin_altivec_vcmpequq( |
| 1811 | (vector bool __int128)__a, (vector bool __int128)__b); |
| 1812 | } |
| 1813 | #endif |
| 1814 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1815 | #ifdef __POWER9_VECTOR__ |
| 1816 | /* vec_cmpne */ |
| 1817 | |
| 1818 | static __inline__ vector bool char __ATTRS_o_ai |
| 1819 | vec_cmpne(vector bool char __a, vector bool char __b) { |
| 1820 | return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| 1821 | (vector char)__b); |
| 1822 | } |
| 1823 | |
| 1824 | static __inline__ vector bool char __ATTRS_o_ai |
| 1825 | vec_cmpne(vector signed char __a, vector signed char __b) { |
| 1826 | return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| 1827 | (vector char)__b); |
| 1828 | } |
| 1829 | |
| 1830 | static __inline__ vector bool char __ATTRS_o_ai |
| 1831 | vec_cmpne(vector unsigned char __a, vector unsigned char __b) { |
| 1832 | return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| 1833 | (vector char)__b); |
| 1834 | } |
| 1835 | |
| 1836 | static __inline__ vector bool short __ATTRS_o_ai |
| 1837 | vec_cmpne(vector bool short __a, vector bool short __b) { |
| 1838 | return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| 1839 | (vector short)__b); |
| 1840 | } |
| 1841 | |
| 1842 | static __inline__ vector bool short __ATTRS_o_ai |
| 1843 | vec_cmpne(vector signed short __a, vector signed short __b) { |
| 1844 | return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| 1845 | (vector short)__b); |
| 1846 | } |
| 1847 | |
| 1848 | static __inline__ vector bool short __ATTRS_o_ai |
| 1849 | vec_cmpne(vector unsigned short __a, vector unsigned short __b) { |
| 1850 | return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| 1851 | (vector short)__b); |
| 1852 | } |
| 1853 | |
| 1854 | static __inline__ vector bool int __ATTRS_o_ai |
| 1855 | vec_cmpne(vector bool int __a, vector bool int __b) { |
| 1856 | return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| 1857 | (vector int)__b); |
| 1858 | } |
| 1859 | |
| 1860 | static __inline__ vector bool int __ATTRS_o_ai |
| 1861 | vec_cmpne(vector signed int __a, vector signed int __b) { |
| 1862 | return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| 1863 | (vector int)__b); |
| 1864 | } |
| 1865 | |
| 1866 | static __inline__ vector bool int __ATTRS_o_ai |
| 1867 | vec_cmpne(vector unsigned int __a, vector unsigned int __b) { |
| 1868 | return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| 1869 | (vector int)__b); |
| 1870 | } |
| 1871 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1872 | static __inline__ vector bool int __ATTRS_o_ai |
| 1873 | vec_cmpne(vector float __a, vector float __b) { |
| 1874 | return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| 1875 | (vector int)__b); |
| 1876 | } |
| 1877 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1878 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 1879 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 1880 | vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 1881 | return (vector bool __int128) ~(__builtin_altivec_vcmpequq( |
| 1882 | (vector bool __int128)__a, (vector bool __int128)__b)); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1883 | } |
| 1884 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 1885 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 1886 | vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { |
| 1887 | return (vector bool __int128) ~(__builtin_altivec_vcmpequq( |
| 1888 | (vector bool __int128)__a, (vector bool __int128)__b)); |
| 1889 | } |
| 1890 | #endif |
| 1891 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1892 | /* vec_cmpnez */ |
| 1893 | |
| 1894 | static __inline__ vector bool char __ATTRS_o_ai |
| 1895 | vec_cmpnez(vector signed char __a, vector signed char __b) { |
| 1896 | return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, |
| 1897 | (vector char)__b); |
| 1898 | } |
| 1899 | |
| 1900 | static __inline__ vector bool char __ATTRS_o_ai |
| 1901 | vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { |
| 1902 | return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, |
| 1903 | (vector char)__b); |
| 1904 | } |
| 1905 | |
| 1906 | static __inline__ vector bool short __ATTRS_o_ai |
| 1907 | vec_cmpnez(vector signed short __a, vector signed short __b) { |
| 1908 | return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, |
| 1909 | (vector short)__b); |
| 1910 | } |
| 1911 | |
| 1912 | static __inline__ vector bool short __ATTRS_o_ai |
| 1913 | vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { |
| 1914 | return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, |
| 1915 | (vector short)__b); |
| 1916 | } |
| 1917 | |
| 1918 | static __inline__ vector bool int __ATTRS_o_ai |
| 1919 | vec_cmpnez(vector signed int __a, vector signed int __b) { |
| 1920 | return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, |
| 1921 | (vector int)__b); |
| 1922 | } |
| 1923 | |
| 1924 | static __inline__ vector bool int __ATTRS_o_ai |
| 1925 | vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { |
| 1926 | return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, |
| 1927 | (vector int)__b); |
| 1928 | } |
| 1929 | |
| 1930 | static __inline__ signed int __ATTRS_o_ai |
| 1931 | vec_cntlz_lsbb(vector signed char __a) { |
| 1932 | #ifdef __LITTLE_ENDIAN__ |
| 1933 | return __builtin_altivec_vctzlsbb(__a); |
| 1934 | #else |
| 1935 | return __builtin_altivec_vclzlsbb(__a); |
| 1936 | #endif |
| 1937 | } |
| 1938 | |
| 1939 | static __inline__ signed int __ATTRS_o_ai |
| 1940 | vec_cntlz_lsbb(vector unsigned char __a) { |
| 1941 | #ifdef __LITTLE_ENDIAN__ |
| 1942 | return __builtin_altivec_vctzlsbb(__a); |
| 1943 | #else |
| 1944 | return __builtin_altivec_vclzlsbb(__a); |
| 1945 | #endif |
| 1946 | } |
| 1947 | |
| 1948 | static __inline__ signed int __ATTRS_o_ai |
| 1949 | vec_cnttz_lsbb(vector signed char __a) { |
| 1950 | #ifdef __LITTLE_ENDIAN__ |
| 1951 | return __builtin_altivec_vclzlsbb(__a); |
| 1952 | #else |
| 1953 | return __builtin_altivec_vctzlsbb(__a); |
| 1954 | #endif |
| 1955 | } |
| 1956 | |
| 1957 | static __inline__ signed int __ATTRS_o_ai |
| 1958 | vec_cnttz_lsbb(vector unsigned char __a) { |
| 1959 | #ifdef __LITTLE_ENDIAN__ |
| 1960 | return __builtin_altivec_vclzlsbb(__a); |
| 1961 | #else |
| 1962 | return __builtin_altivec_vctzlsbb(__a); |
| 1963 | #endif |
| 1964 | } |
| 1965 | |
| 1966 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1967 | vec_parity_lsbb(vector unsigned int __a) { |
| 1968 | return __builtin_altivec_vprtybw(__a); |
| 1969 | } |
| 1970 | |
| 1971 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 1972 | vec_parity_lsbb(vector signed int __a) { |
| 1973 | return __builtin_altivec_vprtybw(__a); |
| 1974 | } |
| 1975 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1976 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1977 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 1978 | vec_parity_lsbb(vector unsigned __int128 __a) { |
| 1979 | return __builtin_altivec_vprtybq(__a); |
| 1980 | } |
| 1981 | |
| 1982 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 1983 | vec_parity_lsbb(vector signed __int128 __a) { |
| 1984 | return __builtin_altivec_vprtybq(__a); |
| 1985 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 1986 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 1987 | |
| 1988 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1989 | vec_parity_lsbb(vector unsigned long long __a) { |
| 1990 | return __builtin_altivec_vprtybd(__a); |
| 1991 | } |
| 1992 | |
| 1993 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 1994 | vec_parity_lsbb(vector signed long long __a) { |
| 1995 | return __builtin_altivec_vprtybd(__a); |
| 1996 | } |
| 1997 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 1998 | #else |
| 1999 | /* vec_cmpne */ |
| 2000 | |
| 2001 | static __inline__ vector bool char __ATTRS_o_ai |
| 2002 | vec_cmpne(vector bool char __a, vector bool char __b) { |
| 2003 | return ~(vec_cmpeq(__a, __b)); |
| 2004 | } |
| 2005 | |
| 2006 | static __inline__ vector bool char __ATTRS_o_ai |
| 2007 | vec_cmpne(vector signed char __a, vector signed char __b) { |
| 2008 | return ~(vec_cmpeq(__a, __b)); |
| 2009 | } |
| 2010 | |
| 2011 | static __inline__ vector bool char __ATTRS_o_ai |
| 2012 | vec_cmpne(vector unsigned char __a, vector unsigned char __b) { |
| 2013 | return ~(vec_cmpeq(__a, __b)); |
| 2014 | } |
| 2015 | |
| 2016 | static __inline__ vector bool short __ATTRS_o_ai |
| 2017 | vec_cmpne(vector bool short __a, vector bool short __b) { |
| 2018 | return ~(vec_cmpeq(__a, __b)); |
| 2019 | } |
| 2020 | |
| 2021 | static __inline__ vector bool short __ATTRS_o_ai |
| 2022 | vec_cmpne(vector signed short __a, vector signed short __b) { |
| 2023 | return ~(vec_cmpeq(__a, __b)); |
| 2024 | } |
| 2025 | |
| 2026 | static __inline__ vector bool short __ATTRS_o_ai |
| 2027 | vec_cmpne(vector unsigned short __a, vector unsigned short __b) { |
| 2028 | return ~(vec_cmpeq(__a, __b)); |
| 2029 | } |
| 2030 | |
| 2031 | static __inline__ vector bool int __ATTRS_o_ai |
| 2032 | vec_cmpne(vector bool int __a, vector bool int __b) { |
| 2033 | return ~(vec_cmpeq(__a, __b)); |
| 2034 | } |
| 2035 | |
| 2036 | static __inline__ vector bool int __ATTRS_o_ai |
| 2037 | vec_cmpne(vector signed int __a, vector signed int __b) { |
| 2038 | return ~(vec_cmpeq(__a, __b)); |
| 2039 | } |
| 2040 | |
| 2041 | static __inline__ vector bool int __ATTRS_o_ai |
| 2042 | vec_cmpne(vector unsigned int __a, vector unsigned int __b) { |
| 2043 | return ~(vec_cmpeq(__a, __b)); |
| 2044 | } |
| 2045 | |
| 2046 | static __inline__ vector bool int __ATTRS_o_ai |
| 2047 | vec_cmpne(vector float __a, vector float __b) { |
| 2048 | return ~(vec_cmpeq(__a, __b)); |
| 2049 | } |
| 2050 | #endif |
| 2051 | |
| 2052 | #ifdef __POWER8_VECTOR__ |
| 2053 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2054 | vec_cmpne(vector bool long long __a, vector bool long long __b) { |
| 2055 | return (vector bool long long) |
| 2056 | ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| 2057 | } |
| 2058 | |
| 2059 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2060 | vec_cmpne(vector signed long long __a, vector signed long long __b) { |
| 2061 | return (vector bool long long) |
| 2062 | ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| 2063 | } |
| 2064 | |
| 2065 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2066 | vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { |
| 2067 | return (vector bool long long) |
| 2068 | ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| 2069 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2070 | #elif defined(__VSX__) |
| 2071 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2072 | vec_cmpne(vector bool long long __a, vector bool long long __b) { |
| 2073 | return (vector bool long long)~( |
| 2074 | vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| 2075 | } |
| 2076 | |
| 2077 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2078 | vec_cmpne(vector signed long long __a, vector signed long long __b) { |
| 2079 | return (vector bool long long)~( |
| 2080 | vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| 2081 | } |
| 2082 | |
| 2083 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2084 | vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { |
| 2085 | return (vector bool long long)~( |
| 2086 | vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| 2087 | } |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2088 | #endif |
| 2089 | |
| 2090 | #ifdef __VSX__ |
| 2091 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2092 | vec_cmpne(vector double __a, vector double __b) { |
| 2093 | return (vector bool long long) |
| 2094 | ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| 2095 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2096 | #endif |
| 2097 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2098 | /* vec_cmpgt */ |
| 2099 | |
| 2100 | static __inline__ vector bool char __ATTRS_o_ai |
| 2101 | vec_cmpgt(vector signed char __a, vector signed char __b) { |
| 2102 | return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); |
| 2103 | } |
| 2104 | |
| 2105 | static __inline__ vector bool char __ATTRS_o_ai |
| 2106 | vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { |
| 2107 | return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); |
| 2108 | } |
| 2109 | |
| 2110 | static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, |
| 2111 | vector short __b) { |
| 2112 | return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); |
| 2113 | } |
| 2114 | |
| 2115 | static __inline__ vector bool short __ATTRS_o_ai |
| 2116 | vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { |
| 2117 | return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); |
| 2118 | } |
| 2119 | |
| 2120 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, |
| 2121 | vector int __b) { |
| 2122 | return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); |
| 2123 | } |
| 2124 | |
| 2125 | static __inline__ vector bool int __ATTRS_o_ai |
| 2126 | vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { |
| 2127 | return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); |
| 2128 | } |
| 2129 | |
| 2130 | #ifdef __POWER8_VECTOR__ |
| 2131 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2132 | vec_cmpgt(vector signed long long __a, vector signed long long __b) { |
| 2133 | return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); |
| 2134 | } |
| 2135 | |
| 2136 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2137 | vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { |
| 2138 | return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); |
| 2139 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2140 | #elif defined(__VSX__) |
| 2141 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2142 | vec_cmpgt(vector signed long long __a, vector signed long long __b) { |
| 2143 | vector signed int __sgtw = (vector signed int)vec_cmpgt( |
| 2144 | (vector signed int)__a, (vector signed int)__b); |
| 2145 | vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( |
| 2146 | (vector unsigned int)__a, (vector unsigned int)__b); |
| 2147 | vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( |
| 2148 | (vector signed int)__a, (vector signed int)__b); |
| 2149 | #ifdef __LITTLE_ENDIAN__ |
| 2150 | __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; |
| 2151 | __sgtw |= (vector signed int)__ugtw; |
| 2152 | return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, |
| 2153 | 3); |
| 2154 | #else |
| 2155 | __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; |
| 2156 | __sgtw |= (vector signed int)__ugtw; |
| 2157 | return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, |
| 2158 | 2); |
| 2159 | #endif |
| 2160 | } |
| 2161 | |
| 2162 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2163 | vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { |
| 2164 | vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( |
| 2165 | (vector unsigned int)__a, (vector unsigned int)__b); |
| 2166 | vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( |
| 2167 | (vector signed int)__a, (vector signed int)__b); |
| 2168 | #ifdef __LITTLE_ENDIAN__ |
| 2169 | __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; |
| 2170 | __ugtw |= __eqw; |
| 2171 | return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, |
| 2172 | 3); |
| 2173 | #else |
| 2174 | __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; |
| 2175 | __ugtw |= __eqw; |
| 2176 | return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, |
| 2177 | 2); |
| 2178 | #endif |
| 2179 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2180 | #endif |
| 2181 | |
| 2182 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, |
| 2183 | vector float __b) { |
| 2184 | #ifdef __VSX__ |
| 2185 | return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); |
| 2186 | #else |
| 2187 | return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); |
| 2188 | #endif |
| 2189 | } |
| 2190 | |
| 2191 | #ifdef __VSX__ |
| 2192 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2193 | vec_cmpgt(vector double __a, vector double __b) { |
| 2194 | return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); |
| 2195 | } |
| 2196 | #endif |
| 2197 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2198 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2199 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2200 | vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { |
| 2201 | return (vector bool __int128)__builtin_altivec_vcmpgtsq( |
| 2202 | (vector bool __int128)__a, (vector bool __int128)__b); |
| 2203 | } |
| 2204 | |
| 2205 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2206 | vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 2207 | return (vector bool __int128)__builtin_altivec_vcmpgtuq( |
| 2208 | (vector bool __int128)__a, (vector bool __int128)__b); |
| 2209 | } |
| 2210 | #endif |
| 2211 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2212 | /* vec_cmpge */ |
| 2213 | |
| 2214 | static __inline__ vector bool char __ATTRS_o_ai |
| 2215 | vec_cmpge(vector signed char __a, vector signed char __b) { |
| 2216 | return ~(vec_cmpgt(__b, __a)); |
| 2217 | } |
| 2218 | |
| 2219 | static __inline__ vector bool char __ATTRS_o_ai |
| 2220 | vec_cmpge(vector unsigned char __a, vector unsigned char __b) { |
| 2221 | return ~(vec_cmpgt(__b, __a)); |
| 2222 | } |
| 2223 | |
| 2224 | static __inline__ vector bool short __ATTRS_o_ai |
| 2225 | vec_cmpge(vector signed short __a, vector signed short __b) { |
| 2226 | return ~(vec_cmpgt(__b, __a)); |
| 2227 | } |
| 2228 | |
| 2229 | static __inline__ vector bool short __ATTRS_o_ai |
| 2230 | vec_cmpge(vector unsigned short __a, vector unsigned short __b) { |
| 2231 | return ~(vec_cmpgt(__b, __a)); |
| 2232 | } |
| 2233 | |
| 2234 | static __inline__ vector bool int __ATTRS_o_ai |
| 2235 | vec_cmpge(vector signed int __a, vector signed int __b) { |
| 2236 | return ~(vec_cmpgt(__b, __a)); |
| 2237 | } |
| 2238 | |
| 2239 | static __inline__ vector bool int __ATTRS_o_ai |
| 2240 | vec_cmpge(vector unsigned int __a, vector unsigned int __b) { |
| 2241 | return ~(vec_cmpgt(__b, __a)); |
| 2242 | } |
| 2243 | |
| 2244 | static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, |
| 2245 | vector float __b) { |
| 2246 | #ifdef __VSX__ |
| 2247 | return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); |
| 2248 | #else |
| 2249 | return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); |
| 2250 | #endif |
| 2251 | } |
| 2252 | |
| 2253 | #ifdef __VSX__ |
| 2254 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2255 | vec_cmpge(vector double __a, vector double __b) { |
| 2256 | return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); |
| 2257 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2258 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2259 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2260 | vec_cmpge(vector signed long long __a, vector signed long long __b) { |
| 2261 | return ~(vec_cmpgt(__b, __a)); |
| 2262 | } |
| 2263 | |
| 2264 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2265 | vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { |
| 2266 | return ~(vec_cmpgt(__b, __a)); |
| 2267 | } |
| 2268 | #endif |
| 2269 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2270 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2271 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2272 | vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { |
| 2273 | return ~(vec_cmpgt(__b, __a)); |
| 2274 | } |
| 2275 | |
| 2276 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2277 | vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 2278 | return ~(vec_cmpgt(__b, __a)); |
| 2279 | } |
| 2280 | #endif |
| 2281 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2282 | /* vec_vcmpgefp */ |
| 2283 | |
| 2284 | static __inline__ vector bool int __attribute__((__always_inline__)) |
| 2285 | vec_vcmpgefp(vector float __a, vector float __b) { |
| 2286 | return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); |
| 2287 | } |
| 2288 | |
| 2289 | /* vec_vcmpgtsb */ |
| 2290 | |
| 2291 | static __inline__ vector bool char __attribute__((__always_inline__)) |
| 2292 | vec_vcmpgtsb(vector signed char __a, vector signed char __b) { |
| 2293 | return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); |
| 2294 | } |
| 2295 | |
| 2296 | /* vec_vcmpgtub */ |
| 2297 | |
| 2298 | static __inline__ vector bool char __attribute__((__always_inline__)) |
| 2299 | vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { |
| 2300 | return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); |
| 2301 | } |
| 2302 | |
| 2303 | /* vec_vcmpgtsh */ |
| 2304 | |
| 2305 | static __inline__ vector bool short __attribute__((__always_inline__)) |
| 2306 | vec_vcmpgtsh(vector short __a, vector short __b) { |
| 2307 | return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); |
| 2308 | } |
| 2309 | |
| 2310 | /* vec_vcmpgtuh */ |
| 2311 | |
| 2312 | static __inline__ vector bool short __attribute__((__always_inline__)) |
| 2313 | vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { |
| 2314 | return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); |
| 2315 | } |
| 2316 | |
| 2317 | /* vec_vcmpgtsw */ |
| 2318 | |
| 2319 | static __inline__ vector bool int __attribute__((__always_inline__)) |
| 2320 | vec_vcmpgtsw(vector int __a, vector int __b) { |
| 2321 | return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); |
| 2322 | } |
| 2323 | |
| 2324 | /* vec_vcmpgtuw */ |
| 2325 | |
| 2326 | static __inline__ vector bool int __attribute__((__always_inline__)) |
| 2327 | vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { |
| 2328 | return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); |
| 2329 | } |
| 2330 | |
| 2331 | /* vec_vcmpgtfp */ |
| 2332 | |
| 2333 | static __inline__ vector bool int __attribute__((__always_inline__)) |
| 2334 | vec_vcmpgtfp(vector float __a, vector float __b) { |
| 2335 | return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); |
| 2336 | } |
| 2337 | |
| 2338 | /* vec_cmple */ |
| 2339 | |
| 2340 | static __inline__ vector bool char __ATTRS_o_ai |
| 2341 | vec_cmple(vector signed char __a, vector signed char __b) { |
| 2342 | return vec_cmpge(__b, __a); |
| 2343 | } |
| 2344 | |
| 2345 | static __inline__ vector bool char __ATTRS_o_ai |
| 2346 | vec_cmple(vector unsigned char __a, vector unsigned char __b) { |
| 2347 | return vec_cmpge(__b, __a); |
| 2348 | } |
| 2349 | |
| 2350 | static __inline__ vector bool short __ATTRS_o_ai |
| 2351 | vec_cmple(vector signed short __a, vector signed short __b) { |
| 2352 | return vec_cmpge(__b, __a); |
| 2353 | } |
| 2354 | |
| 2355 | static __inline__ vector bool short __ATTRS_o_ai |
| 2356 | vec_cmple(vector unsigned short __a, vector unsigned short __b) { |
| 2357 | return vec_cmpge(__b, __a); |
| 2358 | } |
| 2359 | |
| 2360 | static __inline__ vector bool int __ATTRS_o_ai |
| 2361 | vec_cmple(vector signed int __a, vector signed int __b) { |
| 2362 | return vec_cmpge(__b, __a); |
| 2363 | } |
| 2364 | |
| 2365 | static __inline__ vector bool int __ATTRS_o_ai |
| 2366 | vec_cmple(vector unsigned int __a, vector unsigned int __b) { |
| 2367 | return vec_cmpge(__b, __a); |
| 2368 | } |
| 2369 | |
| 2370 | static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, |
| 2371 | vector float __b) { |
| 2372 | return vec_cmpge(__b, __a); |
| 2373 | } |
| 2374 | |
| 2375 | #ifdef __VSX__ |
| 2376 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2377 | vec_cmple(vector double __a, vector double __b) { |
| 2378 | return vec_cmpge(__b, __a); |
| 2379 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2380 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2381 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2382 | vec_cmple(vector signed long long __a, vector signed long long __b) { |
| 2383 | return vec_cmpge(__b, __a); |
| 2384 | } |
| 2385 | |
| 2386 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2387 | vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { |
| 2388 | return vec_cmpge(__b, __a); |
| 2389 | } |
| 2390 | #endif |
| 2391 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2392 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2393 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2394 | vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { |
| 2395 | return vec_cmpge(__b, __a); |
| 2396 | } |
| 2397 | |
| 2398 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2399 | vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 2400 | return vec_cmpge(__b, __a); |
| 2401 | } |
| 2402 | #endif |
| 2403 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2404 | /* vec_cmplt */ |
| 2405 | |
| 2406 | static __inline__ vector bool char __ATTRS_o_ai |
| 2407 | vec_cmplt(vector signed char __a, vector signed char __b) { |
| 2408 | return vec_cmpgt(__b, __a); |
| 2409 | } |
| 2410 | |
| 2411 | static __inline__ vector bool char __ATTRS_o_ai |
| 2412 | vec_cmplt(vector unsigned char __a, vector unsigned char __b) { |
| 2413 | return vec_cmpgt(__b, __a); |
| 2414 | } |
| 2415 | |
| 2416 | static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, |
| 2417 | vector short __b) { |
| 2418 | return vec_cmpgt(__b, __a); |
| 2419 | } |
| 2420 | |
| 2421 | static __inline__ vector bool short __ATTRS_o_ai |
| 2422 | vec_cmplt(vector unsigned short __a, vector unsigned short __b) { |
| 2423 | return vec_cmpgt(__b, __a); |
| 2424 | } |
| 2425 | |
| 2426 | static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, |
| 2427 | vector int __b) { |
| 2428 | return vec_cmpgt(__b, __a); |
| 2429 | } |
| 2430 | |
| 2431 | static __inline__ vector bool int __ATTRS_o_ai |
| 2432 | vec_cmplt(vector unsigned int __a, vector unsigned int __b) { |
| 2433 | return vec_cmpgt(__b, __a); |
| 2434 | } |
| 2435 | |
| 2436 | static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, |
| 2437 | vector float __b) { |
| 2438 | return vec_cmpgt(__b, __a); |
| 2439 | } |
| 2440 | |
| 2441 | #ifdef __VSX__ |
| 2442 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2443 | vec_cmplt(vector double __a, vector double __b) { |
| 2444 | return vec_cmpgt(__b, __a); |
| 2445 | } |
| 2446 | #endif |
| 2447 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2448 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2449 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2450 | vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { |
| 2451 | return vec_cmpgt(__b, __a); |
| 2452 | } |
| 2453 | |
| 2454 | static __inline__ vector bool __int128 __ATTRS_o_ai |
| 2455 | vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 2456 | return vec_cmpgt(__b, __a); |
| 2457 | } |
| 2458 | #endif |
| 2459 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2460 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2461 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2462 | vec_cmplt(vector signed long long __a, vector signed long long __b) { |
| 2463 | return vec_cmpgt(__b, __a); |
| 2464 | } |
| 2465 | |
| 2466 | static __inline__ vector bool long long __ATTRS_o_ai |
| 2467 | vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { |
| 2468 | return vec_cmpgt(__b, __a); |
| 2469 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2470 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2471 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2472 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2473 | /* vec_popcnt */ |
| 2474 | |
| 2475 | static __inline__ vector signed char __ATTRS_o_ai |
| 2476 | vec_popcnt(vector signed char __a) { |
| 2477 | return __builtin_altivec_vpopcntb(__a); |
| 2478 | } |
| 2479 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 2480 | vec_popcnt(vector unsigned char __a) { |
| 2481 | return __builtin_altivec_vpopcntb(__a); |
| 2482 | } |
| 2483 | static __inline__ vector signed short __ATTRS_o_ai |
| 2484 | vec_popcnt(vector signed short __a) { |
| 2485 | return __builtin_altivec_vpopcnth(__a); |
| 2486 | } |
| 2487 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 2488 | vec_popcnt(vector unsigned short __a) { |
| 2489 | return __builtin_altivec_vpopcnth(__a); |
| 2490 | } |
| 2491 | static __inline__ vector signed int __ATTRS_o_ai |
| 2492 | vec_popcnt(vector signed int __a) { |
| 2493 | return __builtin_altivec_vpopcntw(__a); |
| 2494 | } |
| 2495 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 2496 | vec_popcnt(vector unsigned int __a) { |
| 2497 | return __builtin_altivec_vpopcntw(__a); |
| 2498 | } |
| 2499 | static __inline__ vector signed long long __ATTRS_o_ai |
| 2500 | vec_popcnt(vector signed long long __a) { |
| 2501 | return __builtin_altivec_vpopcntd(__a); |
| 2502 | } |
| 2503 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 2504 | vec_popcnt(vector unsigned long long __a) { |
| 2505 | return __builtin_altivec_vpopcntd(__a); |
| 2506 | } |
| 2507 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 2508 | #define vec_vclz vec_cntlz |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 2509 | /* vec_cntlz */ |
| 2510 | |
| 2511 | static __inline__ vector signed char __ATTRS_o_ai |
| 2512 | vec_cntlz(vector signed char __a) { |
| 2513 | return __builtin_altivec_vclzb(__a); |
| 2514 | } |
| 2515 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 2516 | vec_cntlz(vector unsigned char __a) { |
| 2517 | return __builtin_altivec_vclzb(__a); |
| 2518 | } |
| 2519 | static __inline__ vector signed short __ATTRS_o_ai |
| 2520 | vec_cntlz(vector signed short __a) { |
| 2521 | return __builtin_altivec_vclzh(__a); |
| 2522 | } |
| 2523 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 2524 | vec_cntlz(vector unsigned short __a) { |
| 2525 | return __builtin_altivec_vclzh(__a); |
| 2526 | } |
| 2527 | static __inline__ vector signed int __ATTRS_o_ai |
| 2528 | vec_cntlz(vector signed int __a) { |
| 2529 | return __builtin_altivec_vclzw(__a); |
| 2530 | } |
| 2531 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 2532 | vec_cntlz(vector unsigned int __a) { |
| 2533 | return __builtin_altivec_vclzw(__a); |
| 2534 | } |
| 2535 | static __inline__ vector signed long long __ATTRS_o_ai |
| 2536 | vec_cntlz(vector signed long long __a) { |
| 2537 | return __builtin_altivec_vclzd(__a); |
| 2538 | } |
| 2539 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 2540 | vec_cntlz(vector unsigned long long __a) { |
| 2541 | return __builtin_altivec_vclzd(__a); |
| 2542 | } |
| 2543 | #endif |
| 2544 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2545 | #ifdef __POWER9_VECTOR__ |
| 2546 | |
| 2547 | /* vec_cnttz */ |
| 2548 | |
| 2549 | static __inline__ vector signed char __ATTRS_o_ai |
| 2550 | vec_cnttz(vector signed char __a) { |
| 2551 | return __builtin_altivec_vctzb(__a); |
| 2552 | } |
| 2553 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 2554 | vec_cnttz(vector unsigned char __a) { |
| 2555 | return __builtin_altivec_vctzb(__a); |
| 2556 | } |
| 2557 | static __inline__ vector signed short __ATTRS_o_ai |
| 2558 | vec_cnttz(vector signed short __a) { |
| 2559 | return __builtin_altivec_vctzh(__a); |
| 2560 | } |
| 2561 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 2562 | vec_cnttz(vector unsigned short __a) { |
| 2563 | return __builtin_altivec_vctzh(__a); |
| 2564 | } |
| 2565 | static __inline__ vector signed int __ATTRS_o_ai |
| 2566 | vec_cnttz(vector signed int __a) { |
| 2567 | return __builtin_altivec_vctzw(__a); |
| 2568 | } |
| 2569 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 2570 | vec_cnttz(vector unsigned int __a) { |
| 2571 | return __builtin_altivec_vctzw(__a); |
| 2572 | } |
| 2573 | static __inline__ vector signed long long __ATTRS_o_ai |
| 2574 | vec_cnttz(vector signed long long __a) { |
| 2575 | return __builtin_altivec_vctzd(__a); |
| 2576 | } |
| 2577 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 2578 | vec_cnttz(vector unsigned long long __a) { |
| 2579 | return __builtin_altivec_vctzd(__a); |
| 2580 | } |
| 2581 | |
| 2582 | /* vec_first_match_index */ |
| 2583 | |
| 2584 | static __inline__ unsigned __ATTRS_o_ai |
| 2585 | vec_first_match_index(vector signed char __a, vector signed char __b) { |
| 2586 | vector unsigned long long __res = |
| 2587 | #ifdef __LITTLE_ENDIAN__ |
| 2588 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2589 | #else |
| 2590 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2591 | #endif |
| 2592 | if (__res[0] == 64) { |
| 2593 | return (__res[1] + 64) >> 3; |
| 2594 | } |
| 2595 | return __res[0] >> 3; |
| 2596 | } |
| 2597 | |
| 2598 | static __inline__ unsigned __ATTRS_o_ai |
| 2599 | vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { |
| 2600 | vector unsigned long long __res = |
| 2601 | #ifdef __LITTLE_ENDIAN__ |
| 2602 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2603 | #else |
| 2604 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2605 | #endif |
| 2606 | if (__res[0] == 64) { |
| 2607 | return (__res[1] + 64) >> 3; |
| 2608 | } |
| 2609 | return __res[0] >> 3; |
| 2610 | } |
| 2611 | |
| 2612 | static __inline__ unsigned __ATTRS_o_ai |
| 2613 | vec_first_match_index(vector signed short __a, vector signed short __b) { |
| 2614 | vector unsigned long long __res = |
| 2615 | #ifdef __LITTLE_ENDIAN__ |
| 2616 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2617 | #else |
| 2618 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2619 | #endif |
| 2620 | if (__res[0] == 64) { |
| 2621 | return (__res[1] + 64) >> 4; |
| 2622 | } |
| 2623 | return __res[0] >> 4; |
| 2624 | } |
| 2625 | |
| 2626 | static __inline__ unsigned __ATTRS_o_ai |
| 2627 | vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { |
| 2628 | vector unsigned long long __res = |
| 2629 | #ifdef __LITTLE_ENDIAN__ |
| 2630 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2631 | #else |
| 2632 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2633 | #endif |
| 2634 | if (__res[0] == 64) { |
| 2635 | return (__res[1] + 64) >> 4; |
| 2636 | } |
| 2637 | return __res[0] >> 4; |
| 2638 | } |
| 2639 | |
| 2640 | static __inline__ unsigned __ATTRS_o_ai |
| 2641 | vec_first_match_index(vector signed int __a, vector signed int __b) { |
| 2642 | vector unsigned long long __res = |
| 2643 | #ifdef __LITTLE_ENDIAN__ |
| 2644 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2645 | #else |
| 2646 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2647 | #endif |
| 2648 | if (__res[0] == 64) { |
| 2649 | return (__res[1] + 64) >> 5; |
| 2650 | } |
| 2651 | return __res[0] >> 5; |
| 2652 | } |
| 2653 | |
| 2654 | static __inline__ unsigned __ATTRS_o_ai |
| 2655 | vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { |
| 2656 | vector unsigned long long __res = |
| 2657 | #ifdef __LITTLE_ENDIAN__ |
| 2658 | vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2659 | #else |
| 2660 | vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| 2661 | #endif |
| 2662 | if (__res[0] == 64) { |
| 2663 | return (__res[1] + 64) >> 5; |
| 2664 | } |
| 2665 | return __res[0] >> 5; |
| 2666 | } |
| 2667 | |
| 2668 | /* vec_first_match_or_eos_index */ |
| 2669 | |
| 2670 | static __inline__ unsigned __ATTRS_o_ai |
| 2671 | vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { |
| 2672 | /* Compare the result of the comparison of two vectors with either and OR the |
| 2673 | result. Either the elements are equal or one will equal the comparison |
| 2674 | result if either is zero. |
| 2675 | */ |
| 2676 | vector bool char __tmp1 = vec_cmpeq(__a, __b); |
| 2677 | vector bool char __tmp2 = __tmp1 | |
| 2678 | vec_cmpeq((vector signed char)__tmp1, __a) | |
| 2679 | vec_cmpeq((vector signed char)__tmp1, __b); |
| 2680 | |
| 2681 | vector unsigned long long __res = |
| 2682 | #ifdef __LITTLE_ENDIAN__ |
| 2683 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2684 | #else |
| 2685 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2686 | #endif |
| 2687 | if (__res[0] == 64) { |
| 2688 | return (__res[1] + 64) >> 3; |
| 2689 | } |
| 2690 | return __res[0] >> 3; |
| 2691 | } |
| 2692 | |
| 2693 | static __inline__ unsigned __ATTRS_o_ai |
| 2694 | vec_first_match_or_eos_index(vector unsigned char __a, |
| 2695 | vector unsigned char __b) { |
| 2696 | vector bool char __tmp1 = vec_cmpeq(__a, __b); |
| 2697 | vector bool char __tmp2 = __tmp1 | |
| 2698 | vec_cmpeq((vector unsigned char)__tmp1, __a) | |
| 2699 | vec_cmpeq((vector unsigned char)__tmp1, __b); |
| 2700 | |
| 2701 | vector unsigned long long __res = |
| 2702 | #ifdef __LITTLE_ENDIAN__ |
| 2703 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2704 | #else |
| 2705 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2706 | #endif |
| 2707 | if (__res[0] == 64) { |
| 2708 | return (__res[1] + 64) >> 3; |
| 2709 | } |
| 2710 | return __res[0] >> 3; |
| 2711 | } |
| 2712 | |
| 2713 | static __inline__ unsigned __ATTRS_o_ai |
| 2714 | vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { |
| 2715 | vector bool short __tmp1 = vec_cmpeq(__a, __b); |
| 2716 | vector bool short __tmp2 = __tmp1 | |
| 2717 | vec_cmpeq((vector signed short)__tmp1, __a) | |
| 2718 | vec_cmpeq((vector signed short)__tmp1, __b); |
| 2719 | |
| 2720 | vector unsigned long long __res = |
| 2721 | #ifdef __LITTLE_ENDIAN__ |
| 2722 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2723 | #else |
| 2724 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2725 | #endif |
| 2726 | if (__res[0] == 64) { |
| 2727 | return (__res[1] + 64) >> 4; |
| 2728 | } |
| 2729 | return __res[0] >> 4; |
| 2730 | } |
| 2731 | |
| 2732 | static __inline__ unsigned __ATTRS_o_ai |
| 2733 | vec_first_match_or_eos_index(vector unsigned short __a, |
| 2734 | vector unsigned short __b) { |
| 2735 | vector bool short __tmp1 = vec_cmpeq(__a, __b); |
| 2736 | vector bool short __tmp2 = __tmp1 | |
| 2737 | vec_cmpeq((vector unsigned short)__tmp1, __a) | |
| 2738 | vec_cmpeq((vector unsigned short)__tmp1, __b); |
| 2739 | |
| 2740 | vector unsigned long long __res = |
| 2741 | #ifdef __LITTLE_ENDIAN__ |
| 2742 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2743 | #else |
| 2744 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2745 | #endif |
| 2746 | if (__res[0] == 64) { |
| 2747 | return (__res[1] + 64) >> 4; |
| 2748 | } |
| 2749 | return __res[0] >> 4; |
| 2750 | } |
| 2751 | |
| 2752 | static __inline__ unsigned __ATTRS_o_ai |
| 2753 | vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { |
| 2754 | vector bool int __tmp1 = vec_cmpeq(__a, __b); |
| 2755 | vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | |
| 2756 | vec_cmpeq((vector signed int)__tmp1, __b); |
| 2757 | |
| 2758 | vector unsigned long long __res = |
| 2759 | #ifdef __LITTLE_ENDIAN__ |
| 2760 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2761 | #else |
| 2762 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2763 | #endif |
| 2764 | if (__res[0] == 64) { |
| 2765 | return (__res[1] + 64) >> 5; |
| 2766 | } |
| 2767 | return __res[0] >> 5; |
| 2768 | } |
| 2769 | |
| 2770 | static __inline__ unsigned __ATTRS_o_ai |
| 2771 | vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { |
| 2772 | vector bool int __tmp1 = vec_cmpeq(__a, __b); |
| 2773 | vector bool int __tmp2 = __tmp1 | |
| 2774 | vec_cmpeq((vector unsigned int)__tmp1, __a) | |
| 2775 | vec_cmpeq((vector unsigned int)__tmp1, __b); |
| 2776 | |
| 2777 | vector unsigned long long __res = |
| 2778 | #ifdef __LITTLE_ENDIAN__ |
| 2779 | vec_cnttz((vector unsigned long long)__tmp2); |
| 2780 | #else |
| 2781 | vec_cntlz((vector unsigned long long)__tmp2); |
| 2782 | #endif |
| 2783 | if (__res[0] == 64) { |
| 2784 | return (__res[1] + 64) >> 5; |
| 2785 | } |
| 2786 | return __res[0] >> 5; |
| 2787 | } |
| 2788 | |
| 2789 | /* vec_first_mismatch_index */ |
| 2790 | |
| 2791 | static __inline__ unsigned __ATTRS_o_ai |
| 2792 | vec_first_mismatch_index(vector signed char __a, vector signed char __b) { |
| 2793 | vector unsigned long long __res = |
| 2794 | #ifdef __LITTLE_ENDIAN__ |
| 2795 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2796 | #else |
| 2797 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2798 | #endif |
| 2799 | if (__res[0] == 64) { |
| 2800 | return (__res[1] + 64) >> 3; |
| 2801 | } |
| 2802 | return __res[0] >> 3; |
| 2803 | } |
| 2804 | |
| 2805 | static __inline__ unsigned __ATTRS_o_ai |
| 2806 | vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { |
| 2807 | vector unsigned long long __res = |
| 2808 | #ifdef __LITTLE_ENDIAN__ |
| 2809 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2810 | #else |
| 2811 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2812 | #endif |
| 2813 | if (__res[0] == 64) { |
| 2814 | return (__res[1] + 64) >> 3; |
| 2815 | } |
| 2816 | return __res[0] >> 3; |
| 2817 | } |
| 2818 | |
| 2819 | static __inline__ unsigned __ATTRS_o_ai |
| 2820 | vec_first_mismatch_index(vector signed short __a, vector signed short __b) { |
| 2821 | vector unsigned long long __res = |
| 2822 | #ifdef __LITTLE_ENDIAN__ |
| 2823 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2824 | #else |
| 2825 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2826 | #endif |
| 2827 | if (__res[0] == 64) { |
| 2828 | return (__res[1] + 64) >> 4; |
| 2829 | } |
| 2830 | return __res[0] >> 4; |
| 2831 | } |
| 2832 | |
| 2833 | static __inline__ unsigned __ATTRS_o_ai |
| 2834 | vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { |
| 2835 | vector unsigned long long __res = |
| 2836 | #ifdef __LITTLE_ENDIAN__ |
| 2837 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2838 | #else |
| 2839 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2840 | #endif |
| 2841 | if (__res[0] == 64) { |
| 2842 | return (__res[1] + 64) >> 4; |
| 2843 | } |
| 2844 | return __res[0] >> 4; |
| 2845 | } |
| 2846 | |
| 2847 | static __inline__ unsigned __ATTRS_o_ai |
| 2848 | vec_first_mismatch_index(vector signed int __a, vector signed int __b) { |
| 2849 | vector unsigned long long __res = |
| 2850 | #ifdef __LITTLE_ENDIAN__ |
| 2851 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2852 | #else |
| 2853 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2854 | #endif |
| 2855 | if (__res[0] == 64) { |
| 2856 | return (__res[1] + 64) >> 5; |
| 2857 | } |
| 2858 | return __res[0] >> 5; |
| 2859 | } |
| 2860 | |
| 2861 | static __inline__ unsigned __ATTRS_o_ai |
| 2862 | vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { |
| 2863 | vector unsigned long long __res = |
| 2864 | #ifdef __LITTLE_ENDIAN__ |
| 2865 | vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2866 | #else |
| 2867 | vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); |
| 2868 | #endif |
| 2869 | if (__res[0] == 64) { |
| 2870 | return (__res[1] + 64) >> 5; |
| 2871 | } |
| 2872 | return __res[0] >> 5; |
| 2873 | } |
| 2874 | |
| 2875 | /* vec_first_mismatch_or_eos_index */ |
| 2876 | |
| 2877 | static __inline__ unsigned __ATTRS_o_ai |
| 2878 | vec_first_mismatch_or_eos_index(vector signed char __a, |
| 2879 | vector signed char __b) { |
| 2880 | vector unsigned long long __res = |
| 2881 | #ifdef __LITTLE_ENDIAN__ |
| 2882 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2883 | #else |
| 2884 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2885 | #endif |
| 2886 | if (__res[0] == 64) { |
| 2887 | return (__res[1] + 64) >> 3; |
| 2888 | } |
| 2889 | return __res[0] >> 3; |
| 2890 | } |
| 2891 | |
| 2892 | static __inline__ unsigned __ATTRS_o_ai |
| 2893 | vec_first_mismatch_or_eos_index(vector unsigned char __a, |
| 2894 | vector unsigned char __b) { |
| 2895 | vector unsigned long long __res = |
| 2896 | #ifdef __LITTLE_ENDIAN__ |
| 2897 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2898 | #else |
| 2899 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2900 | #endif |
| 2901 | if (__res[0] == 64) { |
| 2902 | return (__res[1] + 64) >> 3; |
| 2903 | } |
| 2904 | return __res[0] >> 3; |
| 2905 | } |
| 2906 | |
| 2907 | static __inline__ unsigned __ATTRS_o_ai |
| 2908 | vec_first_mismatch_or_eos_index(vector signed short __a, |
| 2909 | vector signed short __b) { |
| 2910 | vector unsigned long long __res = |
| 2911 | #ifdef __LITTLE_ENDIAN__ |
| 2912 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2913 | #else |
| 2914 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2915 | #endif |
| 2916 | if (__res[0] == 64) { |
| 2917 | return (__res[1] + 64) >> 4; |
| 2918 | } |
| 2919 | return __res[0] >> 4; |
| 2920 | } |
| 2921 | |
| 2922 | static __inline__ unsigned __ATTRS_o_ai |
| 2923 | vec_first_mismatch_or_eos_index(vector unsigned short __a, |
| 2924 | vector unsigned short __b) { |
| 2925 | vector unsigned long long __res = |
| 2926 | #ifdef __LITTLE_ENDIAN__ |
| 2927 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2928 | #else |
| 2929 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2930 | #endif |
| 2931 | if (__res[0] == 64) { |
| 2932 | return (__res[1] + 64) >> 4; |
| 2933 | } |
| 2934 | return __res[0] >> 4; |
| 2935 | } |
| 2936 | |
| 2937 | static __inline__ unsigned __ATTRS_o_ai |
| 2938 | vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { |
| 2939 | vector unsigned long long __res = |
| 2940 | #ifdef __LITTLE_ENDIAN__ |
| 2941 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2942 | #else |
| 2943 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2944 | #endif |
| 2945 | if (__res[0] == 64) { |
| 2946 | return (__res[1] + 64) >> 5; |
| 2947 | } |
| 2948 | return __res[0] >> 5; |
| 2949 | } |
| 2950 | |
| 2951 | static __inline__ unsigned __ATTRS_o_ai |
| 2952 | vec_first_mismatch_or_eos_index(vector unsigned int __a, |
| 2953 | vector unsigned int __b) { |
| 2954 | vector unsigned long long __res = |
| 2955 | #ifdef __LITTLE_ENDIAN__ |
| 2956 | vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2957 | #else |
| 2958 | vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); |
| 2959 | #endif |
| 2960 | if (__res[0] == 64) { |
| 2961 | return (__res[1] + 64) >> 5; |
| 2962 | } |
| 2963 | return __res[0] >> 5; |
| 2964 | } |
| 2965 | |
| 2966 | static __inline__ vector double __ATTRS_o_ai |
| 2967 | vec_insert_exp(vector double __a, vector unsigned long long __b) { |
| 2968 | return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); |
| 2969 | } |
| 2970 | |
| 2971 | static __inline__ vector double __ATTRS_o_ai |
| 2972 | vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { |
| 2973 | return __builtin_vsx_xviexpdp(__a,__b); |
| 2974 | } |
| 2975 | |
| 2976 | static __inline__ vector float __ATTRS_o_ai |
| 2977 | vec_insert_exp(vector float __a, vector unsigned int __b) { |
| 2978 | return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); |
| 2979 | } |
| 2980 | |
| 2981 | static __inline__ vector float __ATTRS_o_ai |
| 2982 | vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { |
| 2983 | return __builtin_vsx_xviexpsp(__a,__b); |
| 2984 | } |
| 2985 | |
| 2986 | #if defined(__powerpc64__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2987 | static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2988 | size_t __b) { |
| 2989 | return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 2990 | } |
| 2991 | |
| 2992 | static __inline__ vector unsigned char __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2993 | vec_xl_len(const unsigned char *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2994 | return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 2995 | } |
| 2996 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 2997 | static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 2998 | size_t __b) { |
| 2999 | return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3000 | } |
| 3001 | |
| 3002 | static __inline__ vector unsigned short __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3003 | vec_xl_len(const unsigned short *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3004 | return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3005 | } |
| 3006 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3007 | static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3008 | size_t __b) { |
| 3009 | return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3010 | } |
| 3011 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3012 | static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3013 | size_t __b) { |
| 3014 | return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3015 | } |
| 3016 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3017 | static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3018 | return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3019 | } |
| 3020 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3021 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3022 | static __inline__ vector signed __int128 __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3023 | vec_xl_len(const signed __int128 *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3024 | return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3025 | } |
| 3026 | |
| 3027 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3028 | vec_xl_len(const unsigned __int128 *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3029 | return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3030 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3031 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3032 | |
| 3033 | static __inline__ vector signed long long __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3034 | vec_xl_len(const signed long long *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3035 | return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3036 | } |
| 3037 | |
| 3038 | static __inline__ vector unsigned long long __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3039 | vec_xl_len(const unsigned long long *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3040 | return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3041 | } |
| 3042 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3043 | static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3044 | size_t __b) { |
| 3045 | return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); |
| 3046 | } |
| 3047 | |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3048 | static __inline__ vector unsigned char __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3049 | vec_xl_len_r(const unsigned char *__a, size_t __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3050 | vector unsigned char __res = |
| 3051 | (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3052 | vector unsigned char __mask = |
| 3053 | (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 3054 | return (vector unsigned char)__builtin_altivec_vperm_4si( |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3055 | (vector int)__res, (vector int)__res, __mask); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3056 | } |
| 3057 | |
| 3058 | // vec_xst_len |
| 3059 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, |
| 3060 | unsigned char *__b, |
| 3061 | size_t __c) { |
| 3062 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3063 | } |
| 3064 | |
| 3065 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, |
| 3066 | signed char *__b, size_t __c) { |
| 3067 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3068 | } |
| 3069 | |
| 3070 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, |
| 3071 | signed short *__b, size_t __c) { |
| 3072 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3073 | } |
| 3074 | |
| 3075 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, |
| 3076 | unsigned short *__b, |
| 3077 | size_t __c) { |
| 3078 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3079 | } |
| 3080 | |
| 3081 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, |
| 3082 | signed int *__b, size_t __c) { |
| 3083 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3084 | } |
| 3085 | |
| 3086 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, |
| 3087 | unsigned int *__b, size_t __c) { |
| 3088 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3089 | } |
| 3090 | |
| 3091 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, |
| 3092 | size_t __c) { |
| 3093 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3094 | } |
| 3095 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3096 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3097 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, |
| 3098 | signed __int128 *__b, |
| 3099 | size_t __c) { |
| 3100 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3101 | } |
| 3102 | |
| 3103 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, |
| 3104 | unsigned __int128 *__b, |
| 3105 | size_t __c) { |
| 3106 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3107 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3108 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3109 | |
| 3110 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, |
| 3111 | signed long long *__b, |
| 3112 | size_t __c) { |
| 3113 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3114 | } |
| 3115 | |
| 3116 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, |
| 3117 | unsigned long long *__b, |
| 3118 | size_t __c) { |
| 3119 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3120 | } |
| 3121 | |
| 3122 | static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, |
| 3123 | size_t __c) { |
| 3124 | return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); |
| 3125 | } |
| 3126 | |
| 3127 | static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, |
| 3128 | unsigned char *__b, |
| 3129 | size_t __c) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3130 | vector unsigned char __mask = |
| 3131 | (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); |
| 3132 | vector unsigned char __res = |
| 3133 | __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); |
| 3134 | return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3135 | } |
| 3136 | #endif |
| 3137 | #endif |
| 3138 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 3139 | #if defined(__POWER9_VECTOR__) && defined(__powerpc64__) |
| 3140 | #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT)) |
| 3141 | #define __vec_strmb(PTR, CNT, VAL) \ |
| 3142 | vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT)) |
| 3143 | #else |
| 3144 | #define __vec_ldrmb __builtin_vsx_ldrmb |
| 3145 | #define __vec_strmb __builtin_vsx_strmb |
| 3146 | #endif |
| 3147 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3148 | /* vec_cpsgn */ |
| 3149 | |
| 3150 | #ifdef __VSX__ |
| 3151 | static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, |
| 3152 | vector float __b) { |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 3153 | return __builtin_vsx_xvcpsgnsp(__b, __a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3154 | } |
| 3155 | |
| 3156 | static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, |
| 3157 | vector double __b) { |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 3158 | return __builtin_vsx_xvcpsgndp(__b, __a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3159 | } |
| 3160 | #endif |
| 3161 | |
| 3162 | /* vec_ctf */ |
| 3163 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3164 | #ifdef __VSX__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3165 | // There are some functions that have different signatures with the XL compiler |
| 3166 | // from those in Clang/GCC and documented in the PVIPR. This macro ensures that |
| 3167 | // the XL-compatible signatures are used for those functions. |
| 3168 | #ifdef __XL_COMPAT_ALTIVEC__ |
| 3169 | #define vec_ctf(__a, __b) \ |
| 3170 | _Generic((__a), vector int \ |
| 3171 | : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ |
| 3172 | vector unsigned int \ |
| 3173 | : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ |
| 3174 | (__b)), \ |
| 3175 | vector unsigned long long \ |
| 3176 | : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \ |
| 3177 | (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ |
| 3178 | vector signed long long \ |
| 3179 | : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \ |
| 3180 | (vector float)(vector unsigned)((0x7f - (__b)) << 23))) |
| 3181 | #else // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3182 | #define vec_ctf(__a, __b) \ |
| 3183 | _Generic((__a), vector int \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3184 | : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3185 | vector unsigned int \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3186 | : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ |
| 3187 | (__b)), \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3188 | vector unsigned long long \ |
| 3189 | : (__builtin_convertvector((vector unsigned long long)(__a), \ |
| 3190 | vector double) * \ |
| 3191 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3192 | << 52)), \ |
| 3193 | vector signed long long \ |
| 3194 | : (__builtin_convertvector((vector signed long long)(__a), \ |
| 3195 | vector double) * \ |
| 3196 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3197 | << 52))) |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3198 | #endif // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3199 | #else |
| 3200 | #define vec_ctf(__a, __b) \ |
| 3201 | _Generic((__a), vector int \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3202 | : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3203 | vector unsigned int \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3204 | : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ |
| 3205 | (__b))) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3206 | #endif |
| 3207 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3208 | /* vec_ctd */ |
| 3209 | #ifdef __VSX__ |
| 3210 | #define vec_ctd(__a, __b) \ |
| 3211 | _Generic((__a), vector signed int \ |
| 3212 | : (vec_doublee((vector signed int)(__a)) * \ |
| 3213 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3214 | << 52)), \ |
| 3215 | vector unsigned int \ |
| 3216 | : (vec_doublee((vector unsigned int)(__a)) * \ |
| 3217 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3218 | << 52)), \ |
| 3219 | vector unsigned long long \ |
| 3220 | : (__builtin_convertvector((vector unsigned long long)(__a), \ |
| 3221 | vector double) * \ |
| 3222 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3223 | << 52)), \ |
| 3224 | vector signed long long \ |
| 3225 | : (__builtin_convertvector((vector signed long long)(__a), \ |
| 3226 | vector double) * \ |
| 3227 | (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ |
| 3228 | << 52))) |
| 3229 | #endif // __VSX__ |
| 3230 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3231 | /* vec_vcfsx */ |
| 3232 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3233 | #define vec_vcfux __builtin_altivec_vcfux |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3234 | /* vec_vcfux */ |
| 3235 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3236 | #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3237 | |
| 3238 | /* vec_cts */ |
| 3239 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3240 | #ifdef __VSX__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3241 | #ifdef __XL_COMPAT_ALTIVEC__ |
| 3242 | #define vec_cts(__a, __b) \ |
| 3243 | _Generic((__a), vector float \ |
| 3244 | : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ |
| 3245 | vector double \ |
| 3246 | : __extension__({ \ |
| 3247 | vector double __ret = \ |
| 3248 | (vector double)(__a) * \ |
| 3249 | (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ |
| 3250 | << 52); \ |
| 3251 | __builtin_vsx_xvcvdpsxws(__ret); \ |
| 3252 | })) |
| 3253 | #else // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3254 | #define vec_cts(__a, __b) \ |
| 3255 | _Generic((__a), vector float \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3256 | : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ |
| 3257 | vector double \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3258 | : __extension__({ \ |
| 3259 | vector double __ret = \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3260 | (vector double)(__a) * \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3261 | (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ |
| 3262 | << 52); \ |
| 3263 | __builtin_convertvector(__ret, vector signed long long); \ |
| 3264 | })) |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3265 | #endif // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3266 | #else |
| 3267 | #define vec_cts __builtin_altivec_vctsxs |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3268 | #endif |
| 3269 | |
| 3270 | /* vec_vctsxs */ |
| 3271 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3272 | #define vec_vctsxs __builtin_altivec_vctsxs |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3273 | |
| 3274 | /* vec_ctu */ |
| 3275 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3276 | #ifdef __VSX__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3277 | #ifdef __XL_COMPAT_ALTIVEC__ |
| 3278 | #define vec_ctu(__a, __b) \ |
| 3279 | _Generic((__a), vector float \ |
| 3280 | : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ |
| 3281 | vector double \ |
| 3282 | : __extension__({ \ |
| 3283 | vector double __ret = \ |
| 3284 | (vector double)(__a) * \ |
| 3285 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3286 | << 52); \ |
| 3287 | __builtin_vsx_xvcvdpuxws(__ret); \ |
| 3288 | })) |
| 3289 | #else // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3290 | #define vec_ctu(__a, __b) \ |
| 3291 | _Generic((__a), vector float \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3292 | : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ |
| 3293 | vector double \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3294 | : __extension__({ \ |
| 3295 | vector double __ret = \ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3296 | (vector double)(__a) * \ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3297 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3298 | << 52); \ |
| 3299 | __builtin_convertvector(__ret, vector unsigned long long); \ |
| 3300 | })) |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3301 | #endif // __XL_COMPAT_ALTIVEC__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3302 | #else |
| 3303 | #define vec_ctu __builtin_altivec_vctuxs |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3304 | #endif |
| 3305 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3306 | #ifdef __LITTLE_ENDIAN__ |
| 3307 | /* vec_ctsl */ |
| 3308 | |
| 3309 | #ifdef __VSX__ |
| 3310 | #define vec_ctsl(__a, __b) \ |
| 3311 | _Generic((__a), vector float \ |
| 3312 | : __extension__({ \ |
| 3313 | vector float __ret = \ |
| 3314 | (vector float)(__a) * \ |
| 3315 | (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ |
| 3316 | __builtin_vsx_xvcvspsxds( \ |
| 3317 | __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ |
| 3318 | }), \ |
| 3319 | vector double \ |
| 3320 | : __extension__({ \ |
| 3321 | vector double __ret = \ |
| 3322 | (vector double)(__a) * \ |
| 3323 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3324 | << 52); \ |
| 3325 | __builtin_convertvector(__ret, vector signed long long); \ |
| 3326 | })) |
| 3327 | |
| 3328 | /* vec_ctul */ |
| 3329 | |
| 3330 | #define vec_ctul(__a, __b) \ |
| 3331 | _Generic((__a), vector float \ |
| 3332 | : __extension__({ \ |
| 3333 | vector float __ret = \ |
| 3334 | (vector float)(__a) * \ |
| 3335 | (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ |
| 3336 | __builtin_vsx_xvcvspuxds( \ |
| 3337 | __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ |
| 3338 | }), \ |
| 3339 | vector double \ |
| 3340 | : __extension__({ \ |
| 3341 | vector double __ret = \ |
| 3342 | (vector double)(__a) * \ |
| 3343 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3344 | << 52); \ |
| 3345 | __builtin_convertvector(__ret, vector unsigned long long); \ |
| 3346 | })) |
| 3347 | #endif |
| 3348 | #else // __LITTLE_ENDIAN__ |
| 3349 | /* vec_ctsl */ |
| 3350 | |
| 3351 | #ifdef __VSX__ |
| 3352 | #define vec_ctsl(__a, __b) \ |
| 3353 | _Generic((__a), vector float \ |
| 3354 | : __extension__({ \ |
| 3355 | vector float __ret = \ |
| 3356 | (vector float)(__a) * \ |
| 3357 | (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ |
| 3358 | __builtin_vsx_xvcvspsxds(__ret); \ |
| 3359 | }), \ |
| 3360 | vector double \ |
| 3361 | : __extension__({ \ |
| 3362 | vector double __ret = \ |
| 3363 | (vector double)(__a) * \ |
| 3364 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3365 | << 52); \ |
| 3366 | __builtin_convertvector(__ret, vector signed long long); \ |
| 3367 | })) |
| 3368 | |
| 3369 | /* vec_ctul */ |
| 3370 | |
| 3371 | #define vec_ctul(__a, __b) \ |
| 3372 | _Generic((__a), vector float \ |
| 3373 | : __extension__({ \ |
| 3374 | vector float __ret = \ |
| 3375 | (vector float)(__a) * \ |
| 3376 | (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ |
| 3377 | __builtin_vsx_xvcvspuxds(__ret); \ |
| 3378 | }), \ |
| 3379 | vector double \ |
| 3380 | : __extension__({ \ |
| 3381 | vector double __ret = \ |
| 3382 | (vector double)(__a) * \ |
| 3383 | (vector double)(vector unsigned long long)((0x3ffULL + __b) \ |
| 3384 | << 52); \ |
| 3385 | __builtin_convertvector(__ret, vector unsigned long long); \ |
| 3386 | })) |
| 3387 | #endif |
| 3388 | #endif // __LITTLE_ENDIAN__ |
| 3389 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3390 | /* vec_vctuxs */ |
| 3391 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3392 | #define vec_vctuxs __builtin_altivec_vctuxs |
| 3393 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3394 | /* vec_signext */ |
| 3395 | |
| 3396 | #ifdef __POWER9_VECTOR__ |
| 3397 | static __inline__ vector signed int __ATTRS_o_ai |
| 3398 | vec_signexti(vector signed char __a) { |
| 3399 | return __builtin_altivec_vextsb2w(__a); |
| 3400 | } |
| 3401 | |
| 3402 | static __inline__ vector signed int __ATTRS_o_ai |
| 3403 | vec_signexti(vector signed short __a) { |
| 3404 | return __builtin_altivec_vextsh2w(__a); |
| 3405 | } |
| 3406 | |
| 3407 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3408 | vec_signextll(vector signed char __a) { |
| 3409 | return __builtin_altivec_vextsb2d(__a); |
| 3410 | } |
| 3411 | |
| 3412 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3413 | vec_signextll(vector signed short __a) { |
| 3414 | return __builtin_altivec_vextsh2d(__a); |
| 3415 | } |
| 3416 | |
| 3417 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3418 | vec_signextll(vector signed int __a) { |
| 3419 | return __builtin_altivec_vextsw2d(__a); |
| 3420 | } |
| 3421 | #endif |
| 3422 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3423 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3424 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 3425 | vec_signextq(vector signed long long __a) { |
| 3426 | return __builtin_altivec_vextsd2q(__a); |
| 3427 | } |
| 3428 | #endif |
| 3429 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3430 | /* vec_signed */ |
| 3431 | |
| 3432 | static __inline__ vector signed int __ATTRS_o_ai |
| 3433 | vec_sld(vector signed int, vector signed int, unsigned const int __c); |
| 3434 | |
| 3435 | static __inline__ vector signed int __ATTRS_o_ai |
| 3436 | vec_signed(vector float __a) { |
| 3437 | return __builtin_convertvector(__a, vector signed int); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3438 | } |
| 3439 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3440 | #ifdef __VSX__ |
| 3441 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3442 | vec_signed(vector double __a) { |
| 3443 | return __builtin_convertvector(__a, vector signed long long); |
| 3444 | } |
| 3445 | |
| 3446 | static __inline__ vector signed int __attribute__((__always_inline__)) |
| 3447 | vec_signed2(vector double __a, vector double __b) { |
| 3448 | return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; |
| 3449 | } |
| 3450 | |
| 3451 | static __inline__ vector signed int __ATTRS_o_ai |
| 3452 | vec_signede(vector double __a) { |
| 3453 | #ifdef __LITTLE_ENDIAN__ |
| 3454 | vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); |
| 3455 | return vec_sld(__ret, __ret, 12); |
| 3456 | #else |
| 3457 | return __builtin_vsx_xvcvdpsxws(__a); |
| 3458 | #endif |
| 3459 | } |
| 3460 | |
| 3461 | static __inline__ vector signed int __ATTRS_o_ai |
| 3462 | vec_signedo(vector double __a) { |
| 3463 | #ifdef __LITTLE_ENDIAN__ |
| 3464 | return __builtin_vsx_xvcvdpsxws(__a); |
| 3465 | #else |
| 3466 | vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); |
| 3467 | return vec_sld(__ret, __ret, 12); |
| 3468 | #endif |
| 3469 | } |
| 3470 | #endif |
| 3471 | |
| 3472 | /* vec_unsigned */ |
| 3473 | |
| 3474 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3475 | vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); |
| 3476 | |
| 3477 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3478 | vec_unsigned(vector float __a) { |
| 3479 | return __builtin_convertvector(__a, vector unsigned int); |
| 3480 | } |
| 3481 | |
| 3482 | #ifdef __VSX__ |
| 3483 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 3484 | vec_unsigned(vector double __a) { |
| 3485 | return __builtin_convertvector(__a, vector unsigned long long); |
| 3486 | } |
| 3487 | |
| 3488 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 3489 | vec_unsigned2(vector double __a, vector double __b) { |
| 3490 | return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; |
| 3491 | } |
| 3492 | |
| 3493 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3494 | vec_unsignede(vector double __a) { |
| 3495 | #ifdef __LITTLE_ENDIAN__ |
| 3496 | vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); |
| 3497 | return vec_sld(__ret, __ret, 12); |
| 3498 | #else |
| 3499 | return __builtin_vsx_xvcvdpuxws(__a); |
| 3500 | #endif |
| 3501 | } |
| 3502 | |
| 3503 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3504 | vec_unsignedo(vector double __a) { |
| 3505 | #ifdef __LITTLE_ENDIAN__ |
| 3506 | return __builtin_vsx_xvcvdpuxws(__a); |
| 3507 | #else |
| 3508 | vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); |
| 3509 | return vec_sld(__ret, __ret, 12); |
| 3510 | #endif |
| 3511 | } |
| 3512 | #endif |
| 3513 | |
| 3514 | /* vec_float */ |
| 3515 | |
| 3516 | static __inline__ vector float __ATTRS_o_ai |
| 3517 | vec_sld(vector float, vector float, unsigned const int __c); |
| 3518 | |
| 3519 | static __inline__ vector float __ATTRS_o_ai |
| 3520 | vec_float(vector signed int __a) { |
| 3521 | return __builtin_convertvector(__a, vector float); |
| 3522 | } |
| 3523 | |
| 3524 | static __inline__ vector float __ATTRS_o_ai |
| 3525 | vec_float(vector unsigned int __a) { |
| 3526 | return __builtin_convertvector(__a, vector float); |
| 3527 | } |
| 3528 | |
| 3529 | #ifdef __VSX__ |
| 3530 | static __inline__ vector float __ATTRS_o_ai |
| 3531 | vec_float2(vector signed long long __a, vector signed long long __b) { |
| 3532 | return (vector float) { __a[0], __a[1], __b[0], __b[1] }; |
| 3533 | } |
| 3534 | |
| 3535 | static __inline__ vector float __ATTRS_o_ai |
| 3536 | vec_float2(vector unsigned long long __a, vector unsigned long long __b) { |
| 3537 | return (vector float) { __a[0], __a[1], __b[0], __b[1] }; |
| 3538 | } |
| 3539 | |
| 3540 | static __inline__ vector float __ATTRS_o_ai |
| 3541 | vec_float2(vector double __a, vector double __b) { |
| 3542 | return (vector float) { __a[0], __a[1], __b[0], __b[1] }; |
| 3543 | } |
| 3544 | |
| 3545 | static __inline__ vector float __ATTRS_o_ai |
| 3546 | vec_floate(vector signed long long __a) { |
| 3547 | #ifdef __LITTLE_ENDIAN__ |
| 3548 | vector float __ret = __builtin_vsx_xvcvsxdsp(__a); |
| 3549 | return vec_sld(__ret, __ret, 12); |
| 3550 | #else |
| 3551 | return __builtin_vsx_xvcvsxdsp(__a); |
| 3552 | #endif |
| 3553 | } |
| 3554 | |
| 3555 | static __inline__ vector float __ATTRS_o_ai |
| 3556 | vec_floate(vector unsigned long long __a) { |
| 3557 | #ifdef __LITTLE_ENDIAN__ |
| 3558 | vector float __ret = __builtin_vsx_xvcvuxdsp(__a); |
| 3559 | return vec_sld(__ret, __ret, 12); |
| 3560 | #else |
| 3561 | return __builtin_vsx_xvcvuxdsp(__a); |
| 3562 | #endif |
| 3563 | } |
| 3564 | |
| 3565 | static __inline__ vector float __ATTRS_o_ai |
| 3566 | vec_floate(vector double __a) { |
| 3567 | #ifdef __LITTLE_ENDIAN__ |
| 3568 | vector float __ret = __builtin_vsx_xvcvdpsp(__a); |
| 3569 | return vec_sld(__ret, __ret, 12); |
| 3570 | #else |
| 3571 | return __builtin_vsx_xvcvdpsp(__a); |
| 3572 | #endif |
| 3573 | } |
| 3574 | |
| 3575 | static __inline__ vector float __ATTRS_o_ai |
| 3576 | vec_floato(vector signed long long __a) { |
| 3577 | #ifdef __LITTLE_ENDIAN__ |
| 3578 | return __builtin_vsx_xvcvsxdsp(__a); |
| 3579 | #else |
| 3580 | vector float __ret = __builtin_vsx_xvcvsxdsp(__a); |
| 3581 | return vec_sld(__ret, __ret, 12); |
| 3582 | #endif |
| 3583 | } |
| 3584 | |
| 3585 | static __inline__ vector float __ATTRS_o_ai |
| 3586 | vec_floato(vector unsigned long long __a) { |
| 3587 | #ifdef __LITTLE_ENDIAN__ |
| 3588 | return __builtin_vsx_xvcvuxdsp(__a); |
| 3589 | #else |
| 3590 | vector float __ret = __builtin_vsx_xvcvuxdsp(__a); |
| 3591 | return vec_sld(__ret, __ret, 12); |
| 3592 | #endif |
| 3593 | } |
| 3594 | |
| 3595 | static __inline__ vector float __ATTRS_o_ai |
| 3596 | vec_floato(vector double __a) { |
| 3597 | #ifdef __LITTLE_ENDIAN__ |
| 3598 | return __builtin_vsx_xvcvdpsp(__a); |
| 3599 | #else |
| 3600 | vector float __ret = __builtin_vsx_xvcvdpsp(__a); |
| 3601 | return vec_sld(__ret, __ret, 12); |
| 3602 | #endif |
| 3603 | } |
| 3604 | #endif |
| 3605 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3606 | /* vec_double */ |
| 3607 | |
| 3608 | #ifdef __VSX__ |
| 3609 | static __inline__ vector double __ATTRS_o_ai |
| 3610 | vec_double(vector signed long long __a) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3611 | return __builtin_convertvector(__a, vector double); |
| 3612 | } |
| 3613 | |
| 3614 | static __inline__ vector double __ATTRS_o_ai |
| 3615 | vec_double(vector unsigned long long __a) { |
| 3616 | return __builtin_convertvector(__a, vector double); |
| 3617 | } |
| 3618 | |
| 3619 | static __inline__ vector double __ATTRS_o_ai |
| 3620 | vec_doublee(vector signed int __a) { |
| 3621 | #ifdef __LITTLE_ENDIAN__ |
| 3622 | return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); |
| 3623 | #else |
| 3624 | return __builtin_vsx_xvcvsxwdp(__a); |
| 3625 | #endif |
| 3626 | } |
| 3627 | |
| 3628 | static __inline__ vector double __ATTRS_o_ai |
| 3629 | vec_doublee(vector unsigned int __a) { |
| 3630 | #ifdef __LITTLE_ENDIAN__ |
| 3631 | return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); |
| 3632 | #else |
| 3633 | return __builtin_vsx_xvcvuxwdp(__a); |
| 3634 | #endif |
| 3635 | } |
| 3636 | |
| 3637 | static __inline__ vector double __ATTRS_o_ai |
| 3638 | vec_doublee(vector float __a) { |
| 3639 | #ifdef __LITTLE_ENDIAN__ |
| 3640 | return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); |
| 3641 | #else |
| 3642 | return __builtin_vsx_xvcvspdp(__a); |
| 3643 | #endif |
| 3644 | } |
| 3645 | |
| 3646 | static __inline__ vector double __ATTRS_o_ai |
| 3647 | vec_doubleh(vector signed int __a) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3648 | vector double __ret = {__a[0], __a[1]}; |
| 3649 | return __ret; |
| 3650 | } |
| 3651 | |
| 3652 | static __inline__ vector double __ATTRS_o_ai |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3653 | vec_doubleh(vector unsigned int __a) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3654 | vector double __ret = {__a[0], __a[1]}; |
| 3655 | return __ret; |
| 3656 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 3657 | |
| 3658 | static __inline__ vector double __ATTRS_o_ai |
| 3659 | vec_doubleh(vector float __a) { |
| 3660 | vector double __ret = {__a[0], __a[1]}; |
| 3661 | return __ret; |
| 3662 | } |
| 3663 | |
| 3664 | static __inline__ vector double __ATTRS_o_ai |
| 3665 | vec_doublel(vector signed int __a) { |
| 3666 | vector double __ret = {__a[2], __a[3]}; |
| 3667 | return __ret; |
| 3668 | } |
| 3669 | |
| 3670 | static __inline__ vector double __ATTRS_o_ai |
| 3671 | vec_doublel(vector unsigned int __a) { |
| 3672 | vector double __ret = {__a[2], __a[3]}; |
| 3673 | return __ret; |
| 3674 | } |
| 3675 | |
| 3676 | static __inline__ vector double __ATTRS_o_ai |
| 3677 | vec_doublel(vector float __a) { |
| 3678 | vector double __ret = {__a[2], __a[3]}; |
| 3679 | return __ret; |
| 3680 | } |
| 3681 | |
| 3682 | static __inline__ vector double __ATTRS_o_ai |
| 3683 | vec_doubleo(vector signed int __a) { |
| 3684 | #ifdef __LITTLE_ENDIAN__ |
| 3685 | return __builtin_vsx_xvcvsxwdp(__a); |
| 3686 | #else |
| 3687 | return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); |
| 3688 | #endif |
| 3689 | } |
| 3690 | |
| 3691 | static __inline__ vector double __ATTRS_o_ai |
| 3692 | vec_doubleo(vector unsigned int __a) { |
| 3693 | #ifdef __LITTLE_ENDIAN__ |
| 3694 | return __builtin_vsx_xvcvuxwdp(__a); |
| 3695 | #else |
| 3696 | return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); |
| 3697 | #endif |
| 3698 | } |
| 3699 | |
| 3700 | static __inline__ vector double __ATTRS_o_ai |
| 3701 | vec_doubleo(vector float __a) { |
| 3702 | #ifdef __LITTLE_ENDIAN__ |
| 3703 | return __builtin_vsx_xvcvspdp(__a); |
| 3704 | #else |
| 3705 | return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); |
| 3706 | #endif |
| 3707 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3708 | |
| 3709 | /* vec_cvf */ |
| 3710 | static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { |
| 3711 | return vec_doublee(__a); |
| 3712 | } |
| 3713 | |
| 3714 | static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { |
| 3715 | return vec_floate(__a); |
| 3716 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3717 | #endif |
| 3718 | |
| 3719 | /* vec_div */ |
| 3720 | |
| 3721 | /* Integer vector divides (vectors are scalarized, elements divided |
| 3722 | and the vectors reassembled). |
| 3723 | */ |
| 3724 | static __inline__ vector signed char __ATTRS_o_ai |
| 3725 | vec_div(vector signed char __a, vector signed char __b) { |
| 3726 | return __a / __b; |
| 3727 | } |
| 3728 | |
| 3729 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 3730 | vec_div(vector unsigned char __a, vector unsigned char __b) { |
| 3731 | return __a / __b; |
| 3732 | } |
| 3733 | |
| 3734 | static __inline__ vector signed short __ATTRS_o_ai |
| 3735 | vec_div(vector signed short __a, vector signed short __b) { |
| 3736 | return __a / __b; |
| 3737 | } |
| 3738 | |
| 3739 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 3740 | vec_div(vector unsigned short __a, vector unsigned short __b) { |
| 3741 | return __a / __b; |
| 3742 | } |
| 3743 | |
| 3744 | static __inline__ vector signed int __ATTRS_o_ai |
| 3745 | vec_div(vector signed int __a, vector signed int __b) { |
| 3746 | return __a / __b; |
| 3747 | } |
| 3748 | |
| 3749 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3750 | vec_div(vector unsigned int __a, vector unsigned int __b) { |
| 3751 | return __a / __b; |
| 3752 | } |
| 3753 | |
| 3754 | #ifdef __VSX__ |
| 3755 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3756 | vec_div(vector signed long long __a, vector signed long long __b) { |
| 3757 | return __a / __b; |
| 3758 | } |
| 3759 | |
| 3760 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 3761 | vec_div(vector unsigned long long __a, vector unsigned long long __b) { |
| 3762 | return __a / __b; |
| 3763 | } |
| 3764 | |
| 3765 | static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, |
| 3766 | vector float __b) { |
| 3767 | return __a / __b; |
| 3768 | } |
| 3769 | |
| 3770 | static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, |
| 3771 | vector double __b) { |
| 3772 | return __a / __b; |
| 3773 | } |
| 3774 | #endif |
| 3775 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3776 | /* vec_dive */ |
| 3777 | |
| 3778 | #ifdef __POWER10_VECTOR__ |
| 3779 | static __inline__ vector signed int __ATTRS_o_ai |
| 3780 | vec_dive(vector signed int __a, vector signed int __b) { |
| 3781 | return __builtin_altivec_vdivesw(__a, __b); |
| 3782 | } |
| 3783 | |
| 3784 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3785 | vec_dive(vector unsigned int __a, vector unsigned int __b) { |
| 3786 | return __builtin_altivec_vdiveuw(__a, __b); |
| 3787 | } |
| 3788 | |
| 3789 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3790 | vec_dive(vector signed long long __a, vector signed long long __b) { |
| 3791 | return __builtin_altivec_vdivesd(__a, __b); |
| 3792 | } |
| 3793 | |
| 3794 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 3795 | vec_dive(vector unsigned long long __a, vector unsigned long long __b) { |
| 3796 | return __builtin_altivec_vdiveud(__a, __b); |
| 3797 | } |
| 3798 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3799 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3800 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 3801 | vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 3802 | return __builtin_altivec_vdiveuq(__a, __b); |
| 3803 | } |
| 3804 | |
| 3805 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 3806 | vec_dive(vector signed __int128 __a, vector signed __int128 __b) { |
| 3807 | return __builtin_altivec_vdivesq(__a, __b); |
| 3808 | } |
| 3809 | #endif |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3810 | #endif |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3811 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3812 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3813 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 3814 | vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 3815 | return __a / __b; |
| 3816 | } |
| 3817 | |
| 3818 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 3819 | vec_div(vector signed __int128 __a, vector signed __int128 __b) { |
| 3820 | return __a / __b; |
| 3821 | } |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 3822 | #endif /* __POWER10_VECTOR__ */ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3823 | |
| 3824 | /* vec_xvtdiv */ |
| 3825 | |
| 3826 | #ifdef __VSX__ |
| 3827 | static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, |
| 3828 | vector double __b) { |
| 3829 | return __builtin_vsx_xvtdivdp(__a, __b); |
| 3830 | } |
| 3831 | |
| 3832 | static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, |
| 3833 | vector float __b) { |
| 3834 | return __builtin_vsx_xvtdivsp(__a, __b); |
| 3835 | } |
| 3836 | #endif |
| 3837 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3838 | /* vec_dss */ |
| 3839 | |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 3840 | #define vec_dss __builtin_altivec_dss |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3841 | |
| 3842 | /* vec_dssall */ |
| 3843 | |
| 3844 | static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { |
| 3845 | __builtin_altivec_dssall(); |
| 3846 | } |
| 3847 | |
| 3848 | /* vec_dst */ |
| 3849 | #define vec_dst(__PTR, __CW, __STR) \ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3850 | __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3851 | |
| 3852 | /* vec_dstst */ |
| 3853 | #define vec_dstst(__PTR, __CW, __STR) \ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3854 | __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3855 | |
| 3856 | /* vec_dststt */ |
| 3857 | #define vec_dststt(__PTR, __CW, __STR) \ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3858 | __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3859 | |
| 3860 | /* vec_dstt */ |
| 3861 | #define vec_dstt(__PTR, __CW, __STR) \ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 3862 | __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3863 | |
| 3864 | /* vec_eqv */ |
| 3865 | |
| 3866 | #ifdef __POWER8_VECTOR__ |
| 3867 | static __inline__ vector signed char __ATTRS_o_ai |
| 3868 | vec_eqv(vector signed char __a, vector signed char __b) { |
| 3869 | return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3870 | (vector unsigned int)__b); |
| 3871 | } |
| 3872 | |
| 3873 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 3874 | vec_eqv(vector unsigned char __a, vector unsigned char __b) { |
| 3875 | return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3876 | (vector unsigned int)__b); |
| 3877 | } |
| 3878 | |
| 3879 | static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, |
| 3880 | vector bool char __b) { |
| 3881 | return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3882 | (vector unsigned int)__b); |
| 3883 | } |
| 3884 | |
| 3885 | static __inline__ vector signed short __ATTRS_o_ai |
| 3886 | vec_eqv(vector signed short __a, vector signed short __b) { |
| 3887 | return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3888 | (vector unsigned int)__b); |
| 3889 | } |
| 3890 | |
| 3891 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 3892 | vec_eqv(vector unsigned short __a, vector unsigned short __b) { |
| 3893 | return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3894 | (vector unsigned int)__b); |
| 3895 | } |
| 3896 | |
| 3897 | static __inline__ vector bool short __ATTRS_o_ai |
| 3898 | vec_eqv(vector bool short __a, vector bool short __b) { |
| 3899 | return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3900 | (vector unsigned int)__b); |
| 3901 | } |
| 3902 | |
| 3903 | static __inline__ vector signed int __ATTRS_o_ai |
| 3904 | vec_eqv(vector signed int __a, vector signed int __b) { |
| 3905 | return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3906 | (vector unsigned int)__b); |
| 3907 | } |
| 3908 | |
| 3909 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 3910 | vec_eqv(vector unsigned int __a, vector unsigned int __b) { |
| 3911 | return __builtin_vsx_xxleqv(__a, __b); |
| 3912 | } |
| 3913 | |
| 3914 | static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, |
| 3915 | vector bool int __b) { |
| 3916 | return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3917 | (vector unsigned int)__b); |
| 3918 | } |
| 3919 | |
| 3920 | static __inline__ vector signed long long __ATTRS_o_ai |
| 3921 | vec_eqv(vector signed long long __a, vector signed long long __b) { |
| 3922 | return (vector signed long long)__builtin_vsx_xxleqv( |
| 3923 | (vector unsigned int)__a, (vector unsigned int)__b); |
| 3924 | } |
| 3925 | |
| 3926 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 3927 | vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { |
| 3928 | return (vector unsigned long long)__builtin_vsx_xxleqv( |
| 3929 | (vector unsigned int)__a, (vector unsigned int)__b); |
| 3930 | } |
| 3931 | |
| 3932 | static __inline__ vector bool long long __ATTRS_o_ai |
| 3933 | vec_eqv(vector bool long long __a, vector bool long long __b) { |
| 3934 | return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3935 | (vector unsigned int)__b); |
| 3936 | } |
| 3937 | |
| 3938 | static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, |
| 3939 | vector float __b) { |
| 3940 | return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3941 | (vector unsigned int)__b); |
| 3942 | } |
| 3943 | |
| 3944 | static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, |
| 3945 | vector double __b) { |
| 3946 | return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, |
| 3947 | (vector unsigned int)__b); |
| 3948 | } |
| 3949 | #endif |
| 3950 | |
| 3951 | /* vec_expte */ |
| 3952 | |
| 3953 | static __inline__ vector float __attribute__((__always_inline__)) |
| 3954 | vec_expte(vector float __a) { |
| 3955 | return __builtin_altivec_vexptefp(__a); |
| 3956 | } |
| 3957 | |
| 3958 | /* vec_vexptefp */ |
| 3959 | |
| 3960 | static __inline__ vector float __attribute__((__always_inline__)) |
| 3961 | vec_vexptefp(vector float __a) { |
| 3962 | return __builtin_altivec_vexptefp(__a); |
| 3963 | } |
| 3964 | |
| 3965 | /* vec_floor */ |
| 3966 | |
| 3967 | static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { |
| 3968 | #ifdef __VSX__ |
| 3969 | return __builtin_vsx_xvrspim(__a); |
| 3970 | #else |
| 3971 | return __builtin_altivec_vrfim(__a); |
| 3972 | #endif |
| 3973 | } |
| 3974 | |
| 3975 | #ifdef __VSX__ |
| 3976 | static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { |
| 3977 | return __builtin_vsx_xvrdpim(__a); |
| 3978 | } |
| 3979 | #endif |
| 3980 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 3981 | /* vec_roundm */ |
| 3982 | static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { |
| 3983 | return vec_floor(__a); |
| 3984 | } |
| 3985 | |
| 3986 | #ifdef __VSX__ |
| 3987 | static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { |
| 3988 | return vec_floor(__a); |
| 3989 | } |
| 3990 | #endif |
| 3991 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 3992 | /* vec_vrfim */ |
| 3993 | |
| 3994 | static __inline__ vector float __attribute__((__always_inline__)) |
| 3995 | vec_vrfim(vector float __a) { |
| 3996 | return __builtin_altivec_vrfim(__a); |
| 3997 | } |
| 3998 | |
| 3999 | /* vec_ld */ |
| 4000 | |
| 4001 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4002 | vec_ld(long __a, const vector signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4003 | return (vector signed char)__builtin_altivec_lvx(__a, __b); |
| 4004 | } |
| 4005 | |
| 4006 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4007 | vec_ld(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4008 | return (vector signed char)__builtin_altivec_lvx(__a, __b); |
| 4009 | } |
| 4010 | |
| 4011 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4012 | vec_ld(long __a, const vector unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4013 | return (vector unsigned char)__builtin_altivec_lvx(__a, __b); |
| 4014 | } |
| 4015 | |
| 4016 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4017 | vec_ld(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4018 | return (vector unsigned char)__builtin_altivec_lvx(__a, __b); |
| 4019 | } |
| 4020 | |
| 4021 | static __inline__ vector bool char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4022 | vec_ld(long __a, const vector bool char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4023 | return (vector bool char)__builtin_altivec_lvx(__a, __b); |
| 4024 | } |
| 4025 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4026 | static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4027 | const vector short *__b) { |
| 4028 | return (vector short)__builtin_altivec_lvx(__a, __b); |
| 4029 | } |
| 4030 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4031 | static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4032 | return (vector short)__builtin_altivec_lvx(__a, __b); |
| 4033 | } |
| 4034 | |
| 4035 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4036 | vec_ld(long __a, const vector unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4037 | return (vector unsigned short)__builtin_altivec_lvx(__a, __b); |
| 4038 | } |
| 4039 | |
| 4040 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4041 | vec_ld(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4042 | return (vector unsigned short)__builtin_altivec_lvx(__a, __b); |
| 4043 | } |
| 4044 | |
| 4045 | static __inline__ vector bool short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4046 | vec_ld(long __a, const vector bool short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4047 | return (vector bool short)__builtin_altivec_lvx(__a, __b); |
| 4048 | } |
| 4049 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4050 | static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4051 | const vector pixel *__b) { |
| 4052 | return (vector pixel)__builtin_altivec_lvx(__a, __b); |
| 4053 | } |
| 4054 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4055 | static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4056 | const vector int *__b) { |
| 4057 | return (vector int)__builtin_altivec_lvx(__a, __b); |
| 4058 | } |
| 4059 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4060 | static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4061 | return (vector int)__builtin_altivec_lvx(__a, __b); |
| 4062 | } |
| 4063 | |
| 4064 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4065 | vec_ld(long __a, const vector unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4066 | return (vector unsigned int)__builtin_altivec_lvx(__a, __b); |
| 4067 | } |
| 4068 | |
| 4069 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4070 | vec_ld(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4071 | return (vector unsigned int)__builtin_altivec_lvx(__a, __b); |
| 4072 | } |
| 4073 | |
| 4074 | static __inline__ vector bool int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4075 | vec_ld(long __a, const vector bool int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4076 | return (vector bool int)__builtin_altivec_lvx(__a, __b); |
| 4077 | } |
| 4078 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4079 | static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4080 | const vector float *__b) { |
| 4081 | return (vector float)__builtin_altivec_lvx(__a, __b); |
| 4082 | } |
| 4083 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4084 | static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4085 | return (vector float)__builtin_altivec_lvx(__a, __b); |
| 4086 | } |
| 4087 | |
| 4088 | /* vec_lvx */ |
| 4089 | |
| 4090 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4091 | vec_lvx(long __a, const vector signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4092 | return (vector signed char)__builtin_altivec_lvx(__a, __b); |
| 4093 | } |
| 4094 | |
| 4095 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4096 | vec_lvx(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4097 | return (vector signed char)__builtin_altivec_lvx(__a, __b); |
| 4098 | } |
| 4099 | |
| 4100 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4101 | vec_lvx(long __a, const vector unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4102 | return (vector unsigned char)__builtin_altivec_lvx(__a, __b); |
| 4103 | } |
| 4104 | |
| 4105 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4106 | vec_lvx(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4107 | return (vector unsigned char)__builtin_altivec_lvx(__a, __b); |
| 4108 | } |
| 4109 | |
| 4110 | static __inline__ vector bool char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4111 | vec_lvx(long __a, const vector bool char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4112 | return (vector bool char)__builtin_altivec_lvx(__a, __b); |
| 4113 | } |
| 4114 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4115 | static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4116 | const vector short *__b) { |
| 4117 | return (vector short)__builtin_altivec_lvx(__a, __b); |
| 4118 | } |
| 4119 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4120 | static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4121 | return (vector short)__builtin_altivec_lvx(__a, __b); |
| 4122 | } |
| 4123 | |
| 4124 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4125 | vec_lvx(long __a, const vector unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4126 | return (vector unsigned short)__builtin_altivec_lvx(__a, __b); |
| 4127 | } |
| 4128 | |
| 4129 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4130 | vec_lvx(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4131 | return (vector unsigned short)__builtin_altivec_lvx(__a, __b); |
| 4132 | } |
| 4133 | |
| 4134 | static __inline__ vector bool short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4135 | vec_lvx(long __a, const vector bool short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4136 | return (vector bool short)__builtin_altivec_lvx(__a, __b); |
| 4137 | } |
| 4138 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4139 | static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4140 | const vector pixel *__b) { |
| 4141 | return (vector pixel)__builtin_altivec_lvx(__a, __b); |
| 4142 | } |
| 4143 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4144 | static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4145 | const vector int *__b) { |
| 4146 | return (vector int)__builtin_altivec_lvx(__a, __b); |
| 4147 | } |
| 4148 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4149 | static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4150 | return (vector int)__builtin_altivec_lvx(__a, __b); |
| 4151 | } |
| 4152 | |
| 4153 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4154 | vec_lvx(long __a, const vector unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4155 | return (vector unsigned int)__builtin_altivec_lvx(__a, __b); |
| 4156 | } |
| 4157 | |
| 4158 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4159 | vec_lvx(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4160 | return (vector unsigned int)__builtin_altivec_lvx(__a, __b); |
| 4161 | } |
| 4162 | |
| 4163 | static __inline__ vector bool int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4164 | vec_lvx(long __a, const vector bool int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4165 | return (vector bool int)__builtin_altivec_lvx(__a, __b); |
| 4166 | } |
| 4167 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4168 | static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4169 | const vector float *__b) { |
| 4170 | return (vector float)__builtin_altivec_lvx(__a, __b); |
| 4171 | } |
| 4172 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4173 | static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4174 | return (vector float)__builtin_altivec_lvx(__a, __b); |
| 4175 | } |
| 4176 | |
| 4177 | /* vec_lde */ |
| 4178 | |
| 4179 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4180 | vec_lde(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4181 | return (vector signed char)__builtin_altivec_lvebx(__a, __b); |
| 4182 | } |
| 4183 | |
| 4184 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4185 | vec_lde(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4186 | return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); |
| 4187 | } |
| 4188 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4189 | static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4190 | return (vector short)__builtin_altivec_lvehx(__a, __b); |
| 4191 | } |
| 4192 | |
| 4193 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4194 | vec_lde(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4195 | return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); |
| 4196 | } |
| 4197 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4198 | static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4199 | return (vector int)__builtin_altivec_lvewx(__a, __b); |
| 4200 | } |
| 4201 | |
| 4202 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4203 | vec_lde(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4204 | return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); |
| 4205 | } |
| 4206 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4207 | static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4208 | return (vector float)__builtin_altivec_lvewx(__a, __b); |
| 4209 | } |
| 4210 | |
| 4211 | /* vec_lvebx */ |
| 4212 | |
| 4213 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4214 | vec_lvebx(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4215 | return (vector signed char)__builtin_altivec_lvebx(__a, __b); |
| 4216 | } |
| 4217 | |
| 4218 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4219 | vec_lvebx(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4220 | return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); |
| 4221 | } |
| 4222 | |
| 4223 | /* vec_lvehx */ |
| 4224 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4225 | static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4226 | const short *__b) { |
| 4227 | return (vector short)__builtin_altivec_lvehx(__a, __b); |
| 4228 | } |
| 4229 | |
| 4230 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4231 | vec_lvehx(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4232 | return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); |
| 4233 | } |
| 4234 | |
| 4235 | /* vec_lvewx */ |
| 4236 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4237 | static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4238 | return (vector int)__builtin_altivec_lvewx(__a, __b); |
| 4239 | } |
| 4240 | |
| 4241 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4242 | vec_lvewx(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4243 | return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); |
| 4244 | } |
| 4245 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4246 | static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4247 | const float *__b) { |
| 4248 | return (vector float)__builtin_altivec_lvewx(__a, __b); |
| 4249 | } |
| 4250 | |
| 4251 | /* vec_ldl */ |
| 4252 | |
| 4253 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4254 | vec_ldl(long __a, const vector signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4255 | return (vector signed char)__builtin_altivec_lvxl(__a, __b); |
| 4256 | } |
| 4257 | |
| 4258 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4259 | vec_ldl(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4260 | return (vector signed char)__builtin_altivec_lvxl(__a, __b); |
| 4261 | } |
| 4262 | |
| 4263 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4264 | vec_ldl(long __a, const vector unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4265 | return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); |
| 4266 | } |
| 4267 | |
| 4268 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4269 | vec_ldl(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4270 | return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); |
| 4271 | } |
| 4272 | |
| 4273 | static __inline__ vector bool char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4274 | vec_ldl(long __a, const vector bool char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4275 | return (vector bool char)__builtin_altivec_lvxl(__a, __b); |
| 4276 | } |
| 4277 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4278 | static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4279 | const vector short *__b) { |
| 4280 | return (vector short)__builtin_altivec_lvxl(__a, __b); |
| 4281 | } |
| 4282 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4283 | static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4284 | return (vector short)__builtin_altivec_lvxl(__a, __b); |
| 4285 | } |
| 4286 | |
| 4287 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4288 | vec_ldl(long __a, const vector unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4289 | return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); |
| 4290 | } |
| 4291 | |
| 4292 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4293 | vec_ldl(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4294 | return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); |
| 4295 | } |
| 4296 | |
| 4297 | static __inline__ vector bool short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4298 | vec_ldl(long __a, const vector bool short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4299 | return (vector bool short)__builtin_altivec_lvxl(__a, __b); |
| 4300 | } |
| 4301 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4302 | static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4303 | const vector pixel *__b) { |
| 4304 | return (vector pixel short)__builtin_altivec_lvxl(__a, __b); |
| 4305 | } |
| 4306 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4307 | static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4308 | const vector int *__b) { |
| 4309 | return (vector int)__builtin_altivec_lvxl(__a, __b); |
| 4310 | } |
| 4311 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4312 | static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4313 | return (vector int)__builtin_altivec_lvxl(__a, __b); |
| 4314 | } |
| 4315 | |
| 4316 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4317 | vec_ldl(long __a, const vector unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4318 | return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); |
| 4319 | } |
| 4320 | |
| 4321 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4322 | vec_ldl(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4323 | return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); |
| 4324 | } |
| 4325 | |
| 4326 | static __inline__ vector bool int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4327 | vec_ldl(long __a, const vector bool int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4328 | return (vector bool int)__builtin_altivec_lvxl(__a, __b); |
| 4329 | } |
| 4330 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4331 | static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4332 | const vector float *__b) { |
| 4333 | return (vector float)__builtin_altivec_lvxl(__a, __b); |
| 4334 | } |
| 4335 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4336 | static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4337 | return (vector float)__builtin_altivec_lvxl(__a, __b); |
| 4338 | } |
| 4339 | |
| 4340 | /* vec_lvxl */ |
| 4341 | |
| 4342 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4343 | vec_lvxl(long __a, const vector signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4344 | return (vector signed char)__builtin_altivec_lvxl(__a, __b); |
| 4345 | } |
| 4346 | |
| 4347 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4348 | vec_lvxl(long __a, const signed char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4349 | return (vector signed char)__builtin_altivec_lvxl(__a, __b); |
| 4350 | } |
| 4351 | |
| 4352 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4353 | vec_lvxl(long __a, const vector unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4354 | return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); |
| 4355 | } |
| 4356 | |
| 4357 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4358 | vec_lvxl(long __a, const unsigned char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4359 | return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); |
| 4360 | } |
| 4361 | |
| 4362 | static __inline__ vector bool char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4363 | vec_lvxl(long __a, const vector bool char *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4364 | return (vector bool char)__builtin_altivec_lvxl(__a, __b); |
| 4365 | } |
| 4366 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4367 | static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4368 | const vector short *__b) { |
| 4369 | return (vector short)__builtin_altivec_lvxl(__a, __b); |
| 4370 | } |
| 4371 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4372 | static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4373 | const short *__b) { |
| 4374 | return (vector short)__builtin_altivec_lvxl(__a, __b); |
| 4375 | } |
| 4376 | |
| 4377 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4378 | vec_lvxl(long __a, const vector unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4379 | return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); |
| 4380 | } |
| 4381 | |
| 4382 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4383 | vec_lvxl(long __a, const unsigned short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4384 | return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); |
| 4385 | } |
| 4386 | |
| 4387 | static __inline__ vector bool short __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4388 | vec_lvxl(long __a, const vector bool short *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4389 | return (vector bool short)__builtin_altivec_lvxl(__a, __b); |
| 4390 | } |
| 4391 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4392 | static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4393 | const vector pixel *__b) { |
| 4394 | return (vector pixel)__builtin_altivec_lvxl(__a, __b); |
| 4395 | } |
| 4396 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4397 | static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4398 | const vector int *__b) { |
| 4399 | return (vector int)__builtin_altivec_lvxl(__a, __b); |
| 4400 | } |
| 4401 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4402 | static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4403 | return (vector int)__builtin_altivec_lvxl(__a, __b); |
| 4404 | } |
| 4405 | |
| 4406 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4407 | vec_lvxl(long __a, const vector unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4408 | return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); |
| 4409 | } |
| 4410 | |
| 4411 | static __inline__ vector unsigned int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4412 | vec_lvxl(long __a, const unsigned int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4413 | return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); |
| 4414 | } |
| 4415 | |
| 4416 | static __inline__ vector bool int __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4417 | vec_lvxl(long __a, const vector bool int *__b) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4418 | return (vector bool int)__builtin_altivec_lvxl(__a, __b); |
| 4419 | } |
| 4420 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4421 | static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4422 | const vector float *__b) { |
| 4423 | return (vector float)__builtin_altivec_lvxl(__a, __b); |
| 4424 | } |
| 4425 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 4426 | static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 4427 | const float *__b) { |
| 4428 | return (vector float)__builtin_altivec_lvxl(__a, __b); |
| 4429 | } |
| 4430 | |
| 4431 | /* vec_loge */ |
| 4432 | |
| 4433 | static __inline__ vector float __attribute__((__always_inline__)) |
| 4434 | vec_loge(vector float __a) { |
| 4435 | return __builtin_altivec_vlogefp(__a); |
| 4436 | } |
| 4437 | |
| 4438 | /* vec_vlogefp */ |
| 4439 | |
| 4440 | static __inline__ vector float __attribute__((__always_inline__)) |
| 4441 | vec_vlogefp(vector float __a) { |
| 4442 | return __builtin_altivec_vlogefp(__a); |
| 4443 | } |
| 4444 | |
| 4445 | /* vec_lvsl */ |
| 4446 | |
| 4447 | #ifdef __LITTLE_ENDIAN__ |
| 4448 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4449 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4450 | loads/stores"))) vec_lvsl(int __a, const signed char *__b) { |
| 4451 | vector unsigned char mask = |
| 4452 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4453 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4454 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4455 | return vec_perm(mask, mask, reverse); |
| 4456 | } |
| 4457 | #else |
| 4458 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4459 | vec_lvsl(int __a, const signed char *__b) { |
| 4460 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4461 | } |
| 4462 | #endif |
| 4463 | |
| 4464 | #ifdef __LITTLE_ENDIAN__ |
| 4465 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4466 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4467 | loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { |
| 4468 | vector unsigned char mask = |
| 4469 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4470 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4471 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4472 | return vec_perm(mask, mask, reverse); |
| 4473 | } |
| 4474 | #else |
| 4475 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4476 | vec_lvsl(int __a, const unsigned char *__b) { |
| 4477 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4478 | } |
| 4479 | #endif |
| 4480 | |
| 4481 | #ifdef __LITTLE_ENDIAN__ |
| 4482 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4483 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4484 | loads/stores"))) vec_lvsl(int __a, const short *__b) { |
| 4485 | vector unsigned char mask = |
| 4486 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4487 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4488 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4489 | return vec_perm(mask, mask, reverse); |
| 4490 | } |
| 4491 | #else |
| 4492 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, |
| 4493 | const short *__b) { |
| 4494 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4495 | } |
| 4496 | #endif |
| 4497 | |
| 4498 | #ifdef __LITTLE_ENDIAN__ |
| 4499 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4500 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4501 | loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { |
| 4502 | vector unsigned char mask = |
| 4503 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4504 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4505 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4506 | return vec_perm(mask, mask, reverse); |
| 4507 | } |
| 4508 | #else |
| 4509 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4510 | vec_lvsl(int __a, const unsigned short *__b) { |
| 4511 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4512 | } |
| 4513 | #endif |
| 4514 | |
| 4515 | #ifdef __LITTLE_ENDIAN__ |
| 4516 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4517 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4518 | loads/stores"))) vec_lvsl(int __a, const int *__b) { |
| 4519 | vector unsigned char mask = |
| 4520 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4521 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4522 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4523 | return vec_perm(mask, mask, reverse); |
| 4524 | } |
| 4525 | #else |
| 4526 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, |
| 4527 | const int *__b) { |
| 4528 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4529 | } |
| 4530 | #endif |
| 4531 | |
| 4532 | #ifdef __LITTLE_ENDIAN__ |
| 4533 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4534 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4535 | loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { |
| 4536 | vector unsigned char mask = |
| 4537 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4538 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4539 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4540 | return vec_perm(mask, mask, reverse); |
| 4541 | } |
| 4542 | #else |
| 4543 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4544 | vec_lvsl(int __a, const unsigned int *__b) { |
| 4545 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4546 | } |
| 4547 | #endif |
| 4548 | |
| 4549 | #ifdef __LITTLE_ENDIAN__ |
| 4550 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4551 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4552 | loads/stores"))) vec_lvsl(int __a, const float *__b) { |
| 4553 | vector unsigned char mask = |
| 4554 | (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4555 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4556 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4557 | return vec_perm(mask, mask, reverse); |
| 4558 | } |
| 4559 | #else |
| 4560 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, |
| 4561 | const float *__b) { |
| 4562 | return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); |
| 4563 | } |
| 4564 | #endif |
| 4565 | |
| 4566 | /* vec_lvsr */ |
| 4567 | |
| 4568 | #ifdef __LITTLE_ENDIAN__ |
| 4569 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4570 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4571 | loads/stores"))) vec_lvsr(int __a, const signed char *__b) { |
| 4572 | vector unsigned char mask = |
| 4573 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4574 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4575 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4576 | return vec_perm(mask, mask, reverse); |
| 4577 | } |
| 4578 | #else |
| 4579 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4580 | vec_lvsr(int __a, const signed char *__b) { |
| 4581 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4582 | } |
| 4583 | #endif |
| 4584 | |
| 4585 | #ifdef __LITTLE_ENDIAN__ |
| 4586 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4587 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4588 | loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { |
| 4589 | vector unsigned char mask = |
| 4590 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4591 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4592 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4593 | return vec_perm(mask, mask, reverse); |
| 4594 | } |
| 4595 | #else |
| 4596 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4597 | vec_lvsr(int __a, const unsigned char *__b) { |
| 4598 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4599 | } |
| 4600 | #endif |
| 4601 | |
| 4602 | #ifdef __LITTLE_ENDIAN__ |
| 4603 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4604 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4605 | loads/stores"))) vec_lvsr(int __a, const short *__b) { |
| 4606 | vector unsigned char mask = |
| 4607 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4608 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4609 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4610 | return vec_perm(mask, mask, reverse); |
| 4611 | } |
| 4612 | #else |
| 4613 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, |
| 4614 | const short *__b) { |
| 4615 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4616 | } |
| 4617 | #endif |
| 4618 | |
| 4619 | #ifdef __LITTLE_ENDIAN__ |
| 4620 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4621 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4622 | loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { |
| 4623 | vector unsigned char mask = |
| 4624 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4625 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4626 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4627 | return vec_perm(mask, mask, reverse); |
| 4628 | } |
| 4629 | #else |
| 4630 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4631 | vec_lvsr(int __a, const unsigned short *__b) { |
| 4632 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4633 | } |
| 4634 | #endif |
| 4635 | |
| 4636 | #ifdef __LITTLE_ENDIAN__ |
| 4637 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4638 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4639 | loads/stores"))) vec_lvsr(int __a, const int *__b) { |
| 4640 | vector unsigned char mask = |
| 4641 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4642 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4643 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4644 | return vec_perm(mask, mask, reverse); |
| 4645 | } |
| 4646 | #else |
| 4647 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, |
| 4648 | const int *__b) { |
| 4649 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4650 | } |
| 4651 | #endif |
| 4652 | |
| 4653 | #ifdef __LITTLE_ENDIAN__ |
| 4654 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4655 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4656 | loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { |
| 4657 | vector unsigned char mask = |
| 4658 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4659 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4660 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4661 | return vec_perm(mask, mask, reverse); |
| 4662 | } |
| 4663 | #else |
| 4664 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4665 | vec_lvsr(int __a, const unsigned int *__b) { |
| 4666 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4667 | } |
| 4668 | #endif |
| 4669 | |
| 4670 | #ifdef __LITTLE_ENDIAN__ |
| 4671 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4672 | __attribute__((__deprecated__("use assignment for unaligned little endian \ |
| 4673 | loads/stores"))) vec_lvsr(int __a, const float *__b) { |
| 4674 | vector unsigned char mask = |
| 4675 | (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4676 | vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, |
| 4677 | 7, 6, 5, 4, 3, 2, 1, 0}; |
| 4678 | return vec_perm(mask, mask, reverse); |
| 4679 | } |
| 4680 | #else |
| 4681 | static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, |
| 4682 | const float *__b) { |
| 4683 | return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); |
| 4684 | } |
| 4685 | #endif |
| 4686 | |
| 4687 | /* vec_madd */ |
| 4688 | static __inline__ vector signed short __ATTRS_o_ai |
| 4689 | vec_mladd(vector signed short, vector signed short, vector signed short); |
| 4690 | static __inline__ vector signed short __ATTRS_o_ai |
| 4691 | vec_mladd(vector signed short, vector unsigned short, vector unsigned short); |
| 4692 | static __inline__ vector signed short __ATTRS_o_ai |
| 4693 | vec_mladd(vector unsigned short, vector signed short, vector signed short); |
| 4694 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4695 | vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); |
| 4696 | |
| 4697 | static __inline__ vector signed short __ATTRS_o_ai vec_madd( |
| 4698 | vector signed short __a, vector signed short __b, vector signed short __c) { |
| 4699 | return vec_mladd(__a, __b, __c); |
| 4700 | } |
| 4701 | |
| 4702 | static __inline__ vector signed short __ATTRS_o_ai |
| 4703 | vec_madd(vector signed short __a, vector unsigned short __b, |
| 4704 | vector unsigned short __c) { |
| 4705 | return vec_mladd(__a, __b, __c); |
| 4706 | } |
| 4707 | |
| 4708 | static __inline__ vector signed short __ATTRS_o_ai |
| 4709 | vec_madd(vector unsigned short __a, vector signed short __b, |
| 4710 | vector signed short __c) { |
| 4711 | return vec_mladd(__a, __b, __c); |
| 4712 | } |
| 4713 | |
| 4714 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4715 | vec_madd(vector unsigned short __a, vector unsigned short __b, |
| 4716 | vector unsigned short __c) { |
| 4717 | return vec_mladd(__a, __b, __c); |
| 4718 | } |
| 4719 | |
| 4720 | static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, |
| 4721 | vector float __b, |
| 4722 | vector float __c) { |
| 4723 | #ifdef __VSX__ |
| 4724 | return __builtin_vsx_xvmaddasp(__a, __b, __c); |
| 4725 | #else |
| 4726 | return __builtin_altivec_vmaddfp(__a, __b, __c); |
| 4727 | #endif |
| 4728 | } |
| 4729 | |
| 4730 | #ifdef __VSX__ |
| 4731 | static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, |
| 4732 | vector double __b, |
| 4733 | vector double __c) { |
| 4734 | return __builtin_vsx_xvmaddadp(__a, __b, __c); |
| 4735 | } |
| 4736 | #endif |
| 4737 | |
| 4738 | /* vec_vmaddfp */ |
| 4739 | |
| 4740 | static __inline__ vector float __attribute__((__always_inline__)) |
| 4741 | vec_vmaddfp(vector float __a, vector float __b, vector float __c) { |
| 4742 | return __builtin_altivec_vmaddfp(__a, __b, __c); |
| 4743 | } |
| 4744 | |
| 4745 | /* vec_madds */ |
| 4746 | |
| 4747 | static __inline__ vector signed short __attribute__((__always_inline__)) |
| 4748 | vec_madds(vector signed short __a, vector signed short __b, |
| 4749 | vector signed short __c) { |
| 4750 | return __builtin_altivec_vmhaddshs(__a, __b, __c); |
| 4751 | } |
| 4752 | |
| 4753 | /* vec_vmhaddshs */ |
| 4754 | static __inline__ vector signed short __attribute__((__always_inline__)) |
| 4755 | vec_vmhaddshs(vector signed short __a, vector signed short __b, |
| 4756 | vector signed short __c) { |
| 4757 | return __builtin_altivec_vmhaddshs(__a, __b, __c); |
| 4758 | } |
| 4759 | |
| 4760 | /* vec_msub */ |
| 4761 | |
| 4762 | #ifdef __VSX__ |
| 4763 | static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, |
| 4764 | vector float __b, |
| 4765 | vector float __c) { |
| 4766 | return __builtin_vsx_xvmsubasp(__a, __b, __c); |
| 4767 | } |
| 4768 | |
| 4769 | static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, |
| 4770 | vector double __b, |
| 4771 | vector double __c) { |
| 4772 | return __builtin_vsx_xvmsubadp(__a, __b, __c); |
| 4773 | } |
| 4774 | #endif |
| 4775 | |
| 4776 | /* vec_max */ |
| 4777 | |
| 4778 | static __inline__ vector signed char __ATTRS_o_ai |
| 4779 | vec_max(vector signed char __a, vector signed char __b) { |
| 4780 | return __builtin_altivec_vmaxsb(__a, __b); |
| 4781 | } |
| 4782 | |
| 4783 | static __inline__ vector signed char __ATTRS_o_ai |
| 4784 | vec_max(vector bool char __a, vector signed char __b) { |
| 4785 | return __builtin_altivec_vmaxsb((vector signed char)__a, __b); |
| 4786 | } |
| 4787 | |
| 4788 | static __inline__ vector signed char __ATTRS_o_ai |
| 4789 | vec_max(vector signed char __a, vector bool char __b) { |
| 4790 | return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); |
| 4791 | } |
| 4792 | |
| 4793 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4794 | vec_max(vector unsigned char __a, vector unsigned char __b) { |
| 4795 | return __builtin_altivec_vmaxub(__a, __b); |
| 4796 | } |
| 4797 | |
| 4798 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4799 | vec_max(vector bool char __a, vector unsigned char __b) { |
| 4800 | return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); |
| 4801 | } |
| 4802 | |
| 4803 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4804 | vec_max(vector unsigned char __a, vector bool char __b) { |
| 4805 | return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); |
| 4806 | } |
| 4807 | |
| 4808 | static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, |
| 4809 | vector short __b) { |
| 4810 | return __builtin_altivec_vmaxsh(__a, __b); |
| 4811 | } |
| 4812 | |
| 4813 | static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, |
| 4814 | vector short __b) { |
| 4815 | return __builtin_altivec_vmaxsh((vector short)__a, __b); |
| 4816 | } |
| 4817 | |
| 4818 | static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, |
| 4819 | vector bool short __b) { |
| 4820 | return __builtin_altivec_vmaxsh(__a, (vector short)__b); |
| 4821 | } |
| 4822 | |
| 4823 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4824 | vec_max(vector unsigned short __a, vector unsigned short __b) { |
| 4825 | return __builtin_altivec_vmaxuh(__a, __b); |
| 4826 | } |
| 4827 | |
| 4828 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4829 | vec_max(vector bool short __a, vector unsigned short __b) { |
| 4830 | return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); |
| 4831 | } |
| 4832 | |
| 4833 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4834 | vec_max(vector unsigned short __a, vector bool short __b) { |
| 4835 | return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); |
| 4836 | } |
| 4837 | |
| 4838 | static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, |
| 4839 | vector int __b) { |
| 4840 | return __builtin_altivec_vmaxsw(__a, __b); |
| 4841 | } |
| 4842 | |
| 4843 | static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, |
| 4844 | vector int __b) { |
| 4845 | return __builtin_altivec_vmaxsw((vector int)__a, __b); |
| 4846 | } |
| 4847 | |
| 4848 | static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, |
| 4849 | vector bool int __b) { |
| 4850 | return __builtin_altivec_vmaxsw(__a, (vector int)__b); |
| 4851 | } |
| 4852 | |
| 4853 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 4854 | vec_max(vector unsigned int __a, vector unsigned int __b) { |
| 4855 | return __builtin_altivec_vmaxuw(__a, __b); |
| 4856 | } |
| 4857 | |
| 4858 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 4859 | vec_max(vector bool int __a, vector unsigned int __b) { |
| 4860 | return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); |
| 4861 | } |
| 4862 | |
| 4863 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 4864 | vec_max(vector unsigned int __a, vector bool int __b) { |
| 4865 | return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); |
| 4866 | } |
| 4867 | |
| 4868 | #ifdef __POWER8_VECTOR__ |
| 4869 | static __inline__ vector signed long long __ATTRS_o_ai |
| 4870 | vec_max(vector signed long long __a, vector signed long long __b) { |
| 4871 | return __builtin_altivec_vmaxsd(__a, __b); |
| 4872 | } |
| 4873 | |
| 4874 | static __inline__ vector signed long long __ATTRS_o_ai |
| 4875 | vec_max(vector bool long long __a, vector signed long long __b) { |
| 4876 | return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); |
| 4877 | } |
| 4878 | |
| 4879 | static __inline__ vector signed long long __ATTRS_o_ai |
| 4880 | vec_max(vector signed long long __a, vector bool long long __b) { |
| 4881 | return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); |
| 4882 | } |
| 4883 | |
| 4884 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 4885 | vec_max(vector unsigned long long __a, vector unsigned long long __b) { |
| 4886 | return __builtin_altivec_vmaxud(__a, __b); |
| 4887 | } |
| 4888 | |
| 4889 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 4890 | vec_max(vector bool long long __a, vector unsigned long long __b) { |
| 4891 | return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); |
| 4892 | } |
| 4893 | |
| 4894 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 4895 | vec_max(vector unsigned long long __a, vector bool long long __b) { |
| 4896 | return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); |
| 4897 | } |
| 4898 | #endif |
| 4899 | |
| 4900 | static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, |
| 4901 | vector float __b) { |
| 4902 | #ifdef __VSX__ |
| 4903 | return __builtin_vsx_xvmaxsp(__a, __b); |
| 4904 | #else |
| 4905 | return __builtin_altivec_vmaxfp(__a, __b); |
| 4906 | #endif |
| 4907 | } |
| 4908 | |
| 4909 | #ifdef __VSX__ |
| 4910 | static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, |
| 4911 | vector double __b) { |
| 4912 | return __builtin_vsx_xvmaxdp(__a, __b); |
| 4913 | } |
| 4914 | #endif |
| 4915 | |
| 4916 | /* vec_vmaxsb */ |
| 4917 | |
| 4918 | static __inline__ vector signed char __ATTRS_o_ai |
| 4919 | vec_vmaxsb(vector signed char __a, vector signed char __b) { |
| 4920 | return __builtin_altivec_vmaxsb(__a, __b); |
| 4921 | } |
| 4922 | |
| 4923 | static __inline__ vector signed char __ATTRS_o_ai |
| 4924 | vec_vmaxsb(vector bool char __a, vector signed char __b) { |
| 4925 | return __builtin_altivec_vmaxsb((vector signed char)__a, __b); |
| 4926 | } |
| 4927 | |
| 4928 | static __inline__ vector signed char __ATTRS_o_ai |
| 4929 | vec_vmaxsb(vector signed char __a, vector bool char __b) { |
| 4930 | return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); |
| 4931 | } |
| 4932 | |
| 4933 | /* vec_vmaxub */ |
| 4934 | |
| 4935 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4936 | vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { |
| 4937 | return __builtin_altivec_vmaxub(__a, __b); |
| 4938 | } |
| 4939 | |
| 4940 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4941 | vec_vmaxub(vector bool char __a, vector unsigned char __b) { |
| 4942 | return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); |
| 4943 | } |
| 4944 | |
| 4945 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 4946 | vec_vmaxub(vector unsigned char __a, vector bool char __b) { |
| 4947 | return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); |
| 4948 | } |
| 4949 | |
| 4950 | /* vec_vmaxsh */ |
| 4951 | |
| 4952 | static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, |
| 4953 | vector short __b) { |
| 4954 | return __builtin_altivec_vmaxsh(__a, __b); |
| 4955 | } |
| 4956 | |
| 4957 | static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, |
| 4958 | vector short __b) { |
| 4959 | return __builtin_altivec_vmaxsh((vector short)__a, __b); |
| 4960 | } |
| 4961 | |
| 4962 | static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, |
| 4963 | vector bool short __b) { |
| 4964 | return __builtin_altivec_vmaxsh(__a, (vector short)__b); |
| 4965 | } |
| 4966 | |
| 4967 | /* vec_vmaxuh */ |
| 4968 | |
| 4969 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4970 | vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { |
| 4971 | return __builtin_altivec_vmaxuh(__a, __b); |
| 4972 | } |
| 4973 | |
| 4974 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4975 | vec_vmaxuh(vector bool short __a, vector unsigned short __b) { |
| 4976 | return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); |
| 4977 | } |
| 4978 | |
| 4979 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 4980 | vec_vmaxuh(vector unsigned short __a, vector bool short __b) { |
| 4981 | return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); |
| 4982 | } |
| 4983 | |
| 4984 | /* vec_vmaxsw */ |
| 4985 | |
| 4986 | static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, |
| 4987 | vector int __b) { |
| 4988 | return __builtin_altivec_vmaxsw(__a, __b); |
| 4989 | } |
| 4990 | |
| 4991 | static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, |
| 4992 | vector int __b) { |
| 4993 | return __builtin_altivec_vmaxsw((vector int)__a, __b); |
| 4994 | } |
| 4995 | |
| 4996 | static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, |
| 4997 | vector bool int __b) { |
| 4998 | return __builtin_altivec_vmaxsw(__a, (vector int)__b); |
| 4999 | } |
| 5000 | |
| 5001 | /* vec_vmaxuw */ |
| 5002 | |
| 5003 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5004 | vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { |
| 5005 | return __builtin_altivec_vmaxuw(__a, __b); |
| 5006 | } |
| 5007 | |
| 5008 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5009 | vec_vmaxuw(vector bool int __a, vector unsigned int __b) { |
| 5010 | return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); |
| 5011 | } |
| 5012 | |
| 5013 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5014 | vec_vmaxuw(vector unsigned int __a, vector bool int __b) { |
| 5015 | return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); |
| 5016 | } |
| 5017 | |
| 5018 | /* vec_vmaxfp */ |
| 5019 | |
| 5020 | static __inline__ vector float __attribute__((__always_inline__)) |
| 5021 | vec_vmaxfp(vector float __a, vector float __b) { |
| 5022 | #ifdef __VSX__ |
| 5023 | return __builtin_vsx_xvmaxsp(__a, __b); |
| 5024 | #else |
| 5025 | return __builtin_altivec_vmaxfp(__a, __b); |
| 5026 | #endif |
| 5027 | } |
| 5028 | |
| 5029 | /* vec_mergeh */ |
| 5030 | |
| 5031 | static __inline__ vector signed char __ATTRS_o_ai |
| 5032 | vec_mergeh(vector signed char __a, vector signed char __b) { |
| 5033 | return vec_perm(__a, __b, |
| 5034 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5035 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5036 | 0x06, 0x16, 0x07, 0x17)); |
| 5037 | } |
| 5038 | |
| 5039 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5040 | vec_mergeh(vector unsigned char __a, vector unsigned char __b) { |
| 5041 | return vec_perm(__a, __b, |
| 5042 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5043 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5044 | 0x06, 0x16, 0x07, 0x17)); |
| 5045 | } |
| 5046 | |
| 5047 | static __inline__ vector bool char __ATTRS_o_ai |
| 5048 | vec_mergeh(vector bool char __a, vector bool char __b) { |
| 5049 | return vec_perm(__a, __b, |
| 5050 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5051 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5052 | 0x06, 0x16, 0x07, 0x17)); |
| 5053 | } |
| 5054 | |
| 5055 | static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, |
| 5056 | vector short __b) { |
| 5057 | return vec_perm(__a, __b, |
| 5058 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5059 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5060 | 0x06, 0x07, 0x16, 0x17)); |
| 5061 | } |
| 5062 | |
| 5063 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5064 | vec_mergeh(vector unsigned short __a, vector unsigned short __b) { |
| 5065 | return vec_perm(__a, __b, |
| 5066 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5067 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5068 | 0x06, 0x07, 0x16, 0x17)); |
| 5069 | } |
| 5070 | |
| 5071 | static __inline__ vector bool short __ATTRS_o_ai |
| 5072 | vec_mergeh(vector bool short __a, vector bool short __b) { |
| 5073 | return vec_perm(__a, __b, |
| 5074 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5075 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5076 | 0x06, 0x07, 0x16, 0x17)); |
| 5077 | } |
| 5078 | |
| 5079 | static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, |
| 5080 | vector pixel __b) { |
| 5081 | return vec_perm(__a, __b, |
| 5082 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5083 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5084 | 0x06, 0x07, 0x16, 0x17)); |
| 5085 | } |
| 5086 | |
| 5087 | static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, |
| 5088 | vector int __b) { |
| 5089 | return vec_perm(__a, __b, |
| 5090 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5091 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5092 | 0x14, 0x15, 0x16, 0x17)); |
| 5093 | } |
| 5094 | |
| 5095 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5096 | vec_mergeh(vector unsigned int __a, vector unsigned int __b) { |
| 5097 | return vec_perm(__a, __b, |
| 5098 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5099 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5100 | 0x14, 0x15, 0x16, 0x17)); |
| 5101 | } |
| 5102 | |
| 5103 | static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, |
| 5104 | vector bool int __b) { |
| 5105 | return vec_perm(__a, __b, |
| 5106 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5107 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5108 | 0x14, 0x15, 0x16, 0x17)); |
| 5109 | } |
| 5110 | |
| 5111 | static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, |
| 5112 | vector float __b) { |
| 5113 | return vec_perm(__a, __b, |
| 5114 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5115 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5116 | 0x14, 0x15, 0x16, 0x17)); |
| 5117 | } |
| 5118 | |
| 5119 | #ifdef __VSX__ |
| 5120 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5121 | vec_mergeh(vector signed long long __a, vector signed long long __b) { |
| 5122 | return vec_perm(__a, __b, |
| 5123 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5124 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5125 | 0x14, 0x15, 0x16, 0x17)); |
| 5126 | } |
| 5127 | |
| 5128 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5129 | vec_mergeh(vector signed long long __a, vector bool long long __b) { |
| 5130 | return vec_perm(__a, (vector signed long long)__b, |
| 5131 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5132 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5133 | 0x14, 0x15, 0x16, 0x17)); |
| 5134 | } |
| 5135 | |
| 5136 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5137 | vec_mergeh(vector bool long long __a, vector signed long long __b) { |
| 5138 | return vec_perm((vector signed long long)__a, __b, |
| 5139 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5140 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5141 | 0x14, 0x15, 0x16, 0x17)); |
| 5142 | } |
| 5143 | |
| 5144 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5145 | vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { |
| 5146 | return vec_perm(__a, __b, |
| 5147 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5148 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5149 | 0x14, 0x15, 0x16, 0x17)); |
| 5150 | } |
| 5151 | |
| 5152 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5153 | vec_mergeh(vector unsigned long long __a, vector bool long long __b) { |
| 5154 | return vec_perm(__a, (vector unsigned long long)__b, |
| 5155 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5156 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5157 | 0x14, 0x15, 0x16, 0x17)); |
| 5158 | } |
| 5159 | |
| 5160 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5161 | vec_mergeh(vector bool long long __a, vector unsigned long long __b) { |
| 5162 | return vec_perm((vector unsigned long long)__a, __b, |
| 5163 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5164 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5165 | 0x14, 0x15, 0x16, 0x17)); |
| 5166 | } |
| 5167 | |
| 5168 | static __inline__ vector bool long long __ATTRS_o_ai |
| 5169 | vec_mergeh(vector bool long long __a, vector bool long long __b) { |
| 5170 | return vec_perm(__a, __b, |
| 5171 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5172 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5173 | 0x14, 0x15, 0x16, 0x17)); |
| 5174 | } |
| 5175 | |
| 5176 | static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, |
| 5177 | vector double __b) { |
| 5178 | return vec_perm(__a, __b, |
| 5179 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5180 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5181 | 0x14, 0x15, 0x16, 0x17)); |
| 5182 | } |
| 5183 | static __inline__ vector double __ATTRS_o_ai |
| 5184 | vec_mergeh(vector double __a, vector bool long long __b) { |
| 5185 | return vec_perm(__a, (vector double)__b, |
| 5186 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5187 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5188 | 0x14, 0x15, 0x16, 0x17)); |
| 5189 | } |
| 5190 | static __inline__ vector double __ATTRS_o_ai |
| 5191 | vec_mergeh(vector bool long long __a, vector double __b) { |
| 5192 | return vec_perm((vector double)__a, __b, |
| 5193 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 5194 | 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, |
| 5195 | 0x14, 0x15, 0x16, 0x17)); |
| 5196 | } |
| 5197 | #endif |
| 5198 | |
| 5199 | /* vec_vmrghb */ |
| 5200 | |
| 5201 | #define __builtin_altivec_vmrghb vec_vmrghb |
| 5202 | |
| 5203 | static __inline__ vector signed char __ATTRS_o_ai |
| 5204 | vec_vmrghb(vector signed char __a, vector signed char __b) { |
| 5205 | return vec_perm(__a, __b, |
| 5206 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5207 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5208 | 0x06, 0x16, 0x07, 0x17)); |
| 5209 | } |
| 5210 | |
| 5211 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5212 | vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { |
| 5213 | return vec_perm(__a, __b, |
| 5214 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5215 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5216 | 0x06, 0x16, 0x07, 0x17)); |
| 5217 | } |
| 5218 | |
| 5219 | static __inline__ vector bool char __ATTRS_o_ai |
| 5220 | vec_vmrghb(vector bool char __a, vector bool char __b) { |
| 5221 | return vec_perm(__a, __b, |
| 5222 | (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, |
| 5223 | 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, |
| 5224 | 0x06, 0x16, 0x07, 0x17)); |
| 5225 | } |
| 5226 | |
| 5227 | /* vec_vmrghh */ |
| 5228 | |
| 5229 | #define __builtin_altivec_vmrghh vec_vmrghh |
| 5230 | |
| 5231 | static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, |
| 5232 | vector short __b) { |
| 5233 | return vec_perm(__a, __b, |
| 5234 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5235 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5236 | 0x06, 0x07, 0x16, 0x17)); |
| 5237 | } |
| 5238 | |
| 5239 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5240 | vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { |
| 5241 | return vec_perm(__a, __b, |
| 5242 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5243 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5244 | 0x06, 0x07, 0x16, 0x17)); |
| 5245 | } |
| 5246 | |
| 5247 | static __inline__ vector bool short __ATTRS_o_ai |
| 5248 | vec_vmrghh(vector bool short __a, vector bool short __b) { |
| 5249 | return vec_perm(__a, __b, |
| 5250 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5251 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5252 | 0x06, 0x07, 0x16, 0x17)); |
| 5253 | } |
| 5254 | |
| 5255 | static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, |
| 5256 | vector pixel __b) { |
| 5257 | return vec_perm(__a, __b, |
| 5258 | (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, |
| 5259 | 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, |
| 5260 | 0x06, 0x07, 0x16, 0x17)); |
| 5261 | } |
| 5262 | |
| 5263 | /* vec_vmrghw */ |
| 5264 | |
| 5265 | #define __builtin_altivec_vmrghw vec_vmrghw |
| 5266 | |
| 5267 | static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, |
| 5268 | vector int __b) { |
| 5269 | return vec_perm(__a, __b, |
| 5270 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5271 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5272 | 0x14, 0x15, 0x16, 0x17)); |
| 5273 | } |
| 5274 | |
| 5275 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5276 | vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { |
| 5277 | return vec_perm(__a, __b, |
| 5278 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5279 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5280 | 0x14, 0x15, 0x16, 0x17)); |
| 5281 | } |
| 5282 | |
| 5283 | static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, |
| 5284 | vector bool int __b) { |
| 5285 | return vec_perm(__a, __b, |
| 5286 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5287 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5288 | 0x14, 0x15, 0x16, 0x17)); |
| 5289 | } |
| 5290 | |
| 5291 | static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, |
| 5292 | vector float __b) { |
| 5293 | return vec_perm(__a, __b, |
| 5294 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5295 | 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, |
| 5296 | 0x14, 0x15, 0x16, 0x17)); |
| 5297 | } |
| 5298 | |
| 5299 | /* vec_mergel */ |
| 5300 | |
| 5301 | static __inline__ vector signed char __ATTRS_o_ai |
| 5302 | vec_mergel(vector signed char __a, vector signed char __b) { |
| 5303 | return vec_perm(__a, __b, |
| 5304 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5305 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5306 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5307 | } |
| 5308 | |
| 5309 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5310 | vec_mergel(vector unsigned char __a, vector unsigned char __b) { |
| 5311 | return vec_perm(__a, __b, |
| 5312 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5313 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5314 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5315 | } |
| 5316 | |
| 5317 | static __inline__ vector bool char __ATTRS_o_ai |
| 5318 | vec_mergel(vector bool char __a, vector bool char __b) { |
| 5319 | return vec_perm(__a, __b, |
| 5320 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5321 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5322 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5323 | } |
| 5324 | |
| 5325 | static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, |
| 5326 | vector short __b) { |
| 5327 | return vec_perm(__a, __b, |
| 5328 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5329 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5330 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5331 | } |
| 5332 | |
| 5333 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5334 | vec_mergel(vector unsigned short __a, vector unsigned short __b) { |
| 5335 | return vec_perm(__a, __b, |
| 5336 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5337 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5338 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5339 | } |
| 5340 | |
| 5341 | static __inline__ vector bool short __ATTRS_o_ai |
| 5342 | vec_mergel(vector bool short __a, vector bool short __b) { |
| 5343 | return vec_perm(__a, __b, |
| 5344 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5345 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5346 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5347 | } |
| 5348 | |
| 5349 | static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, |
| 5350 | vector pixel __b) { |
| 5351 | return vec_perm(__a, __b, |
| 5352 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5353 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5354 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5355 | } |
| 5356 | |
| 5357 | static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, |
| 5358 | vector int __b) { |
| 5359 | return vec_perm(__a, __b, |
| 5360 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5361 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5362 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5363 | } |
| 5364 | |
| 5365 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5366 | vec_mergel(vector unsigned int __a, vector unsigned int __b) { |
| 5367 | return vec_perm(__a, __b, |
| 5368 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5369 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5370 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5371 | } |
| 5372 | |
| 5373 | static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, |
| 5374 | vector bool int __b) { |
| 5375 | return vec_perm(__a, __b, |
| 5376 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5377 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5378 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5379 | } |
| 5380 | |
| 5381 | static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, |
| 5382 | vector float __b) { |
| 5383 | return vec_perm(__a, __b, |
| 5384 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5385 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5386 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5387 | } |
| 5388 | |
| 5389 | #ifdef __VSX__ |
| 5390 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5391 | vec_mergel(vector signed long long __a, vector signed long long __b) { |
| 5392 | return vec_perm(__a, __b, |
| 5393 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5394 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5395 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5396 | } |
| 5397 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5398 | vec_mergel(vector signed long long __a, vector bool long long __b) { |
| 5399 | return vec_perm(__a, (vector signed long long)__b, |
| 5400 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5401 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5402 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5403 | } |
| 5404 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5405 | vec_mergel(vector bool long long __a, vector signed long long __b) { |
| 5406 | return vec_perm((vector signed long long)__a, __b, |
| 5407 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5408 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5409 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5410 | } |
| 5411 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5412 | vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { |
| 5413 | return vec_perm(__a, __b, |
| 5414 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5415 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5416 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5417 | } |
| 5418 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5419 | vec_mergel(vector unsigned long long __a, vector bool long long __b) { |
| 5420 | return vec_perm(__a, (vector unsigned long long)__b, |
| 5421 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5422 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5423 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5424 | } |
| 5425 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5426 | vec_mergel(vector bool long long __a, vector unsigned long long __b) { |
| 5427 | return vec_perm((vector unsigned long long)__a, __b, |
| 5428 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5429 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5430 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5431 | } |
| 5432 | static __inline__ vector bool long long __ATTRS_o_ai |
| 5433 | vec_mergel(vector bool long long __a, vector bool long long __b) { |
| 5434 | return vec_perm(__a, __b, |
| 5435 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5436 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5437 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5438 | } |
| 5439 | static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, |
| 5440 | vector double __b) { |
| 5441 | return vec_perm(__a, __b, |
| 5442 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5443 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5444 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5445 | } |
| 5446 | static __inline__ vector double __ATTRS_o_ai |
| 5447 | vec_mergel(vector double __a, vector bool long long __b) { |
| 5448 | return vec_perm(__a, (vector double)__b, |
| 5449 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5450 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5451 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5452 | } |
| 5453 | static __inline__ vector double __ATTRS_o_ai |
| 5454 | vec_mergel(vector bool long long __a, vector double __b) { |
| 5455 | return vec_perm((vector double)__a, __b, |
| 5456 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, |
| 5457 | 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, |
| 5458 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5459 | } |
| 5460 | #endif |
| 5461 | |
| 5462 | /* vec_vmrglb */ |
| 5463 | |
| 5464 | #define __builtin_altivec_vmrglb vec_vmrglb |
| 5465 | |
| 5466 | static __inline__ vector signed char __ATTRS_o_ai |
| 5467 | vec_vmrglb(vector signed char __a, vector signed char __b) { |
| 5468 | return vec_perm(__a, __b, |
| 5469 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5470 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5471 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5472 | } |
| 5473 | |
| 5474 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5475 | vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { |
| 5476 | return vec_perm(__a, __b, |
| 5477 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5478 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5479 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5480 | } |
| 5481 | |
| 5482 | static __inline__ vector bool char __ATTRS_o_ai |
| 5483 | vec_vmrglb(vector bool char __a, vector bool char __b) { |
| 5484 | return vec_perm(__a, __b, |
| 5485 | (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, |
| 5486 | 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, |
| 5487 | 0x0E, 0x1E, 0x0F, 0x1F)); |
| 5488 | } |
| 5489 | |
| 5490 | /* vec_vmrglh */ |
| 5491 | |
| 5492 | #define __builtin_altivec_vmrglh vec_vmrglh |
| 5493 | |
| 5494 | static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, |
| 5495 | vector short __b) { |
| 5496 | return vec_perm(__a, __b, |
| 5497 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5498 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5499 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5500 | } |
| 5501 | |
| 5502 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5503 | vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { |
| 5504 | return vec_perm(__a, __b, |
| 5505 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5506 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5507 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5508 | } |
| 5509 | |
| 5510 | static __inline__ vector bool short __ATTRS_o_ai |
| 5511 | vec_vmrglh(vector bool short __a, vector bool short __b) { |
| 5512 | return vec_perm(__a, __b, |
| 5513 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5514 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5515 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5516 | } |
| 5517 | |
| 5518 | static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, |
| 5519 | vector pixel __b) { |
| 5520 | return vec_perm(__a, __b, |
| 5521 | (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, |
| 5522 | 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, |
| 5523 | 0x0E, 0x0F, 0x1E, 0x1F)); |
| 5524 | } |
| 5525 | |
| 5526 | /* vec_vmrglw */ |
| 5527 | |
| 5528 | #define __builtin_altivec_vmrglw vec_vmrglw |
| 5529 | |
| 5530 | static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, |
| 5531 | vector int __b) { |
| 5532 | return vec_perm(__a, __b, |
| 5533 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5534 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5535 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5536 | } |
| 5537 | |
| 5538 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5539 | vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { |
| 5540 | return vec_perm(__a, __b, |
| 5541 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5542 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5543 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5544 | } |
| 5545 | |
| 5546 | static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, |
| 5547 | vector bool int __b) { |
| 5548 | return vec_perm(__a, __b, |
| 5549 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5550 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5551 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5552 | } |
| 5553 | |
| 5554 | static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, |
| 5555 | vector float __b) { |
| 5556 | return vec_perm(__a, __b, |
| 5557 | (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, |
| 5558 | 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5559 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5560 | } |
| 5561 | |
| 5562 | #ifdef __POWER8_VECTOR__ |
| 5563 | /* vec_mergee */ |
| 5564 | |
| 5565 | static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, |
| 5566 | vector bool int __b) { |
| 5567 | return vec_perm(__a, __b, |
| 5568 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5569 | 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, |
| 5570 | 0x18, 0x19, 0x1A, 0x1B)); |
| 5571 | } |
| 5572 | |
| 5573 | static __inline__ vector signed int __ATTRS_o_ai |
| 5574 | vec_mergee(vector signed int __a, vector signed int __b) { |
| 5575 | return vec_perm(__a, __b, |
| 5576 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5577 | 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, |
| 5578 | 0x18, 0x19, 0x1A, 0x1B)); |
| 5579 | } |
| 5580 | |
| 5581 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5582 | vec_mergee(vector unsigned int __a, vector unsigned int __b) { |
| 5583 | return vec_perm(__a, __b, |
| 5584 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5585 | 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, |
| 5586 | 0x18, 0x19, 0x1A, 0x1B)); |
| 5587 | } |
| 5588 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 5589 | static __inline__ vector bool long long __ATTRS_o_ai |
| 5590 | vec_mergee(vector bool long long __a, vector bool long long __b) { |
| 5591 | return vec_mergeh(__a, __b); |
| 5592 | } |
| 5593 | |
| 5594 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5595 | vec_mergee(vector signed long long __a, vector signed long long __b) { |
| 5596 | return vec_mergeh(__a, __b); |
| 5597 | } |
| 5598 | |
| 5599 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5600 | vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { |
| 5601 | return vec_mergeh(__a, __b); |
| 5602 | } |
| 5603 | |
| 5604 | static __inline__ vector float __ATTRS_o_ai |
| 5605 | vec_mergee(vector float __a, vector float __b) { |
| 5606 | return vec_perm(__a, __b, |
| 5607 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, |
| 5608 | 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, |
| 5609 | 0x18, 0x19, 0x1A, 0x1B)); |
| 5610 | } |
| 5611 | |
| 5612 | static __inline__ vector double __ATTRS_o_ai |
| 5613 | vec_mergee(vector double __a, vector double __b) { |
| 5614 | return vec_mergeh(__a, __b); |
| 5615 | } |
| 5616 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 5617 | /* vec_mergeo */ |
| 5618 | |
| 5619 | static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, |
| 5620 | vector bool int __b) { |
| 5621 | return vec_perm(__a, __b, |
| 5622 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, |
| 5623 | 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5624 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5625 | } |
| 5626 | |
| 5627 | static __inline__ vector signed int __ATTRS_o_ai |
| 5628 | vec_mergeo(vector signed int __a, vector signed int __b) { |
| 5629 | return vec_perm(__a, __b, |
| 5630 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, |
| 5631 | 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5632 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5633 | } |
| 5634 | |
| 5635 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5636 | vec_mergeo(vector unsigned int __a, vector unsigned int __b) { |
| 5637 | return vec_perm(__a, __b, |
| 5638 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, |
| 5639 | 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5640 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5641 | } |
| 5642 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 5643 | static __inline__ vector bool long long __ATTRS_o_ai |
| 5644 | vec_mergeo(vector bool long long __a, vector bool long long __b) { |
| 5645 | return vec_mergel(__a, __b); |
| 5646 | } |
| 5647 | |
| 5648 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5649 | vec_mergeo(vector signed long long __a, vector signed long long __b) { |
| 5650 | return vec_mergel(__a, __b); |
| 5651 | } |
| 5652 | |
| 5653 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5654 | vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { |
| 5655 | return vec_mergel(__a, __b); |
| 5656 | } |
| 5657 | |
| 5658 | static __inline__ vector float __ATTRS_o_ai |
| 5659 | vec_mergeo(vector float __a, vector float __b) { |
| 5660 | return vec_perm(__a, __b, |
| 5661 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, |
| 5662 | 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, |
| 5663 | 0x1C, 0x1D, 0x1E, 0x1F)); |
| 5664 | } |
| 5665 | |
| 5666 | static __inline__ vector double __ATTRS_o_ai |
| 5667 | vec_mergeo(vector double __a, vector double __b) { |
| 5668 | return vec_mergel(__a, __b); |
| 5669 | } |
| 5670 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 5671 | #endif |
| 5672 | |
| 5673 | /* vec_mfvscr */ |
| 5674 | |
| 5675 | static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| 5676 | vec_mfvscr(void) { |
| 5677 | return __builtin_altivec_mfvscr(); |
| 5678 | } |
| 5679 | |
| 5680 | /* vec_min */ |
| 5681 | |
| 5682 | static __inline__ vector signed char __ATTRS_o_ai |
| 5683 | vec_min(vector signed char __a, vector signed char __b) { |
| 5684 | return __builtin_altivec_vminsb(__a, __b); |
| 5685 | } |
| 5686 | |
| 5687 | static __inline__ vector signed char __ATTRS_o_ai |
| 5688 | vec_min(vector bool char __a, vector signed char __b) { |
| 5689 | return __builtin_altivec_vminsb((vector signed char)__a, __b); |
| 5690 | } |
| 5691 | |
| 5692 | static __inline__ vector signed char __ATTRS_o_ai |
| 5693 | vec_min(vector signed char __a, vector bool char __b) { |
| 5694 | return __builtin_altivec_vminsb(__a, (vector signed char)__b); |
| 5695 | } |
| 5696 | |
| 5697 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5698 | vec_min(vector unsigned char __a, vector unsigned char __b) { |
| 5699 | return __builtin_altivec_vminub(__a, __b); |
| 5700 | } |
| 5701 | |
| 5702 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5703 | vec_min(vector bool char __a, vector unsigned char __b) { |
| 5704 | return __builtin_altivec_vminub((vector unsigned char)__a, __b); |
| 5705 | } |
| 5706 | |
| 5707 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5708 | vec_min(vector unsigned char __a, vector bool char __b) { |
| 5709 | return __builtin_altivec_vminub(__a, (vector unsigned char)__b); |
| 5710 | } |
| 5711 | |
| 5712 | static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, |
| 5713 | vector short __b) { |
| 5714 | return __builtin_altivec_vminsh(__a, __b); |
| 5715 | } |
| 5716 | |
| 5717 | static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, |
| 5718 | vector short __b) { |
| 5719 | return __builtin_altivec_vminsh((vector short)__a, __b); |
| 5720 | } |
| 5721 | |
| 5722 | static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, |
| 5723 | vector bool short __b) { |
| 5724 | return __builtin_altivec_vminsh(__a, (vector short)__b); |
| 5725 | } |
| 5726 | |
| 5727 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5728 | vec_min(vector unsigned short __a, vector unsigned short __b) { |
| 5729 | return __builtin_altivec_vminuh(__a, __b); |
| 5730 | } |
| 5731 | |
| 5732 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5733 | vec_min(vector bool short __a, vector unsigned short __b) { |
| 5734 | return __builtin_altivec_vminuh((vector unsigned short)__a, __b); |
| 5735 | } |
| 5736 | |
| 5737 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5738 | vec_min(vector unsigned short __a, vector bool short __b) { |
| 5739 | return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); |
| 5740 | } |
| 5741 | |
| 5742 | static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, |
| 5743 | vector int __b) { |
| 5744 | return __builtin_altivec_vminsw(__a, __b); |
| 5745 | } |
| 5746 | |
| 5747 | static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, |
| 5748 | vector int __b) { |
| 5749 | return __builtin_altivec_vminsw((vector int)__a, __b); |
| 5750 | } |
| 5751 | |
| 5752 | static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, |
| 5753 | vector bool int __b) { |
| 5754 | return __builtin_altivec_vminsw(__a, (vector int)__b); |
| 5755 | } |
| 5756 | |
| 5757 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5758 | vec_min(vector unsigned int __a, vector unsigned int __b) { |
| 5759 | return __builtin_altivec_vminuw(__a, __b); |
| 5760 | } |
| 5761 | |
| 5762 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5763 | vec_min(vector bool int __a, vector unsigned int __b) { |
| 5764 | return __builtin_altivec_vminuw((vector unsigned int)__a, __b); |
| 5765 | } |
| 5766 | |
| 5767 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5768 | vec_min(vector unsigned int __a, vector bool int __b) { |
| 5769 | return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); |
| 5770 | } |
| 5771 | |
| 5772 | #ifdef __POWER8_VECTOR__ |
| 5773 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5774 | vec_min(vector signed long long __a, vector signed long long __b) { |
| 5775 | return __builtin_altivec_vminsd(__a, __b); |
| 5776 | } |
| 5777 | |
| 5778 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5779 | vec_min(vector bool long long __a, vector signed long long __b) { |
| 5780 | return __builtin_altivec_vminsd((vector signed long long)__a, __b); |
| 5781 | } |
| 5782 | |
| 5783 | static __inline__ vector signed long long __ATTRS_o_ai |
| 5784 | vec_min(vector signed long long __a, vector bool long long __b) { |
| 5785 | return __builtin_altivec_vminsd(__a, (vector signed long long)__b); |
| 5786 | } |
| 5787 | |
| 5788 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5789 | vec_min(vector unsigned long long __a, vector unsigned long long __b) { |
| 5790 | return __builtin_altivec_vminud(__a, __b); |
| 5791 | } |
| 5792 | |
| 5793 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5794 | vec_min(vector bool long long __a, vector unsigned long long __b) { |
| 5795 | return __builtin_altivec_vminud((vector unsigned long long)__a, __b); |
| 5796 | } |
| 5797 | |
| 5798 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 5799 | vec_min(vector unsigned long long __a, vector bool long long __b) { |
| 5800 | return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); |
| 5801 | } |
| 5802 | #endif |
| 5803 | |
| 5804 | static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, |
| 5805 | vector float __b) { |
| 5806 | #ifdef __VSX__ |
| 5807 | return __builtin_vsx_xvminsp(__a, __b); |
| 5808 | #else |
| 5809 | return __builtin_altivec_vminfp(__a, __b); |
| 5810 | #endif |
| 5811 | } |
| 5812 | |
| 5813 | #ifdef __VSX__ |
| 5814 | static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, |
| 5815 | vector double __b) { |
| 5816 | return __builtin_vsx_xvmindp(__a, __b); |
| 5817 | } |
| 5818 | #endif |
| 5819 | |
| 5820 | /* vec_vminsb */ |
| 5821 | |
| 5822 | static __inline__ vector signed char __ATTRS_o_ai |
| 5823 | vec_vminsb(vector signed char __a, vector signed char __b) { |
| 5824 | return __builtin_altivec_vminsb(__a, __b); |
| 5825 | } |
| 5826 | |
| 5827 | static __inline__ vector signed char __ATTRS_o_ai |
| 5828 | vec_vminsb(vector bool char __a, vector signed char __b) { |
| 5829 | return __builtin_altivec_vminsb((vector signed char)__a, __b); |
| 5830 | } |
| 5831 | |
| 5832 | static __inline__ vector signed char __ATTRS_o_ai |
| 5833 | vec_vminsb(vector signed char __a, vector bool char __b) { |
| 5834 | return __builtin_altivec_vminsb(__a, (vector signed char)__b); |
| 5835 | } |
| 5836 | |
| 5837 | /* vec_vminub */ |
| 5838 | |
| 5839 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5840 | vec_vminub(vector unsigned char __a, vector unsigned char __b) { |
| 5841 | return __builtin_altivec_vminub(__a, __b); |
| 5842 | } |
| 5843 | |
| 5844 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5845 | vec_vminub(vector bool char __a, vector unsigned char __b) { |
| 5846 | return __builtin_altivec_vminub((vector unsigned char)__a, __b); |
| 5847 | } |
| 5848 | |
| 5849 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 5850 | vec_vminub(vector unsigned char __a, vector bool char __b) { |
| 5851 | return __builtin_altivec_vminub(__a, (vector unsigned char)__b); |
| 5852 | } |
| 5853 | |
| 5854 | /* vec_vminsh */ |
| 5855 | |
| 5856 | static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, |
| 5857 | vector short __b) { |
| 5858 | return __builtin_altivec_vminsh(__a, __b); |
| 5859 | } |
| 5860 | |
| 5861 | static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, |
| 5862 | vector short __b) { |
| 5863 | return __builtin_altivec_vminsh((vector short)__a, __b); |
| 5864 | } |
| 5865 | |
| 5866 | static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, |
| 5867 | vector bool short __b) { |
| 5868 | return __builtin_altivec_vminsh(__a, (vector short)__b); |
| 5869 | } |
| 5870 | |
| 5871 | /* vec_vminuh */ |
| 5872 | |
| 5873 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5874 | vec_vminuh(vector unsigned short __a, vector unsigned short __b) { |
| 5875 | return __builtin_altivec_vminuh(__a, __b); |
| 5876 | } |
| 5877 | |
| 5878 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5879 | vec_vminuh(vector bool short __a, vector unsigned short __b) { |
| 5880 | return __builtin_altivec_vminuh((vector unsigned short)__a, __b); |
| 5881 | } |
| 5882 | |
| 5883 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5884 | vec_vminuh(vector unsigned short __a, vector bool short __b) { |
| 5885 | return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); |
| 5886 | } |
| 5887 | |
| 5888 | /* vec_vminsw */ |
| 5889 | |
| 5890 | static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, |
| 5891 | vector int __b) { |
| 5892 | return __builtin_altivec_vminsw(__a, __b); |
| 5893 | } |
| 5894 | |
| 5895 | static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, |
| 5896 | vector int __b) { |
| 5897 | return __builtin_altivec_vminsw((vector int)__a, __b); |
| 5898 | } |
| 5899 | |
| 5900 | static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, |
| 5901 | vector bool int __b) { |
| 5902 | return __builtin_altivec_vminsw(__a, (vector int)__b); |
| 5903 | } |
| 5904 | |
| 5905 | /* vec_vminuw */ |
| 5906 | |
| 5907 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5908 | vec_vminuw(vector unsigned int __a, vector unsigned int __b) { |
| 5909 | return __builtin_altivec_vminuw(__a, __b); |
| 5910 | } |
| 5911 | |
| 5912 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5913 | vec_vminuw(vector bool int __a, vector unsigned int __b) { |
| 5914 | return __builtin_altivec_vminuw((vector unsigned int)__a, __b); |
| 5915 | } |
| 5916 | |
| 5917 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 5918 | vec_vminuw(vector unsigned int __a, vector bool int __b) { |
| 5919 | return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); |
| 5920 | } |
| 5921 | |
| 5922 | /* vec_vminfp */ |
| 5923 | |
| 5924 | static __inline__ vector float __attribute__((__always_inline__)) |
| 5925 | vec_vminfp(vector float __a, vector float __b) { |
| 5926 | #ifdef __VSX__ |
| 5927 | return __builtin_vsx_xvminsp(__a, __b); |
| 5928 | #else |
| 5929 | return __builtin_altivec_vminfp(__a, __b); |
| 5930 | #endif |
| 5931 | } |
| 5932 | |
| 5933 | /* vec_mladd */ |
| 5934 | |
| 5935 | #define __builtin_altivec_vmladduhm vec_mladd |
| 5936 | |
| 5937 | static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, |
| 5938 | vector short __b, |
| 5939 | vector short __c) { |
| 5940 | return __a * __b + __c; |
| 5941 | } |
| 5942 | |
| 5943 | static __inline__ vector short __ATTRS_o_ai vec_mladd( |
| 5944 | vector short __a, vector unsigned short __b, vector unsigned short __c) { |
| 5945 | return __a * (vector short)__b + (vector short)__c; |
| 5946 | } |
| 5947 | |
| 5948 | static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, |
| 5949 | vector short __b, |
| 5950 | vector short __c) { |
| 5951 | return (vector short)__a * __b + __c; |
| 5952 | } |
| 5953 | |
| 5954 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5955 | vec_mladd(vector unsigned short __a, vector unsigned short __b, |
| 5956 | vector unsigned short __c) { |
| 5957 | return __a * __b + __c; |
| 5958 | } |
| 5959 | |
| 5960 | /* vec_vmladduhm */ |
| 5961 | |
| 5962 | static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, |
| 5963 | vector short __b, |
| 5964 | vector short __c) { |
| 5965 | return __a * __b + __c; |
| 5966 | } |
| 5967 | |
| 5968 | static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( |
| 5969 | vector short __a, vector unsigned short __b, vector unsigned short __c) { |
| 5970 | return __a * (vector short)__b + (vector short)__c; |
| 5971 | } |
| 5972 | |
| 5973 | static __inline__ vector short __ATTRS_o_ai |
| 5974 | vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { |
| 5975 | return (vector short)__a * __b + __c; |
| 5976 | } |
| 5977 | |
| 5978 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 5979 | vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, |
| 5980 | vector unsigned short __c) { |
| 5981 | return __a * __b + __c; |
| 5982 | } |
| 5983 | |
| 5984 | /* vec_mradds */ |
| 5985 | |
| 5986 | static __inline__ vector short __attribute__((__always_inline__)) |
| 5987 | vec_mradds(vector short __a, vector short __b, vector short __c) { |
| 5988 | return __builtin_altivec_vmhraddshs(__a, __b, __c); |
| 5989 | } |
| 5990 | |
| 5991 | /* vec_vmhraddshs */ |
| 5992 | |
| 5993 | static __inline__ vector short __attribute__((__always_inline__)) |
| 5994 | vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { |
| 5995 | return __builtin_altivec_vmhraddshs(__a, __b, __c); |
| 5996 | } |
| 5997 | |
| 5998 | /* vec_msum */ |
| 5999 | |
| 6000 | static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, |
| 6001 | vector unsigned char __b, |
| 6002 | vector int __c) { |
| 6003 | return __builtin_altivec_vmsummbm(__a, __b, __c); |
| 6004 | } |
| 6005 | |
| 6006 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6007 | vec_msum(vector unsigned char __a, vector unsigned char __b, |
| 6008 | vector unsigned int __c) { |
| 6009 | return __builtin_altivec_vmsumubm(__a, __b, __c); |
| 6010 | } |
| 6011 | |
| 6012 | static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, |
| 6013 | vector short __b, |
| 6014 | vector int __c) { |
| 6015 | return __builtin_altivec_vmsumshm(__a, __b, __c); |
| 6016 | } |
| 6017 | |
| 6018 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6019 | vec_msum(vector unsigned short __a, vector unsigned short __b, |
| 6020 | vector unsigned int __c) { |
| 6021 | return __builtin_altivec_vmsumuhm(__a, __b, __c); |
| 6022 | } |
| 6023 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 6024 | /* vec_msumc */ |
| 6025 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 6026 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 6027 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 6028 | vec_msumc(vector unsigned long long __a, vector unsigned long long __b, |
| 6029 | vector unsigned __int128 __c) { |
| 6030 | return __builtin_altivec_vmsumcud(__a, __b, __c); |
| 6031 | } |
| 6032 | #endif |
| 6033 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6034 | /* vec_vmsummbm */ |
| 6035 | |
| 6036 | static __inline__ vector int __attribute__((__always_inline__)) |
| 6037 | vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { |
| 6038 | return __builtin_altivec_vmsummbm(__a, __b, __c); |
| 6039 | } |
| 6040 | |
| 6041 | /* vec_vmsumubm */ |
| 6042 | |
| 6043 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 6044 | vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, |
| 6045 | vector unsigned int __c) { |
| 6046 | return __builtin_altivec_vmsumubm(__a, __b, __c); |
| 6047 | } |
| 6048 | |
| 6049 | /* vec_vmsumshm */ |
| 6050 | |
| 6051 | static __inline__ vector int __attribute__((__always_inline__)) |
| 6052 | vec_vmsumshm(vector short __a, vector short __b, vector int __c) { |
| 6053 | return __builtin_altivec_vmsumshm(__a, __b, __c); |
| 6054 | } |
| 6055 | |
| 6056 | /* vec_vmsumuhm */ |
| 6057 | |
| 6058 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 6059 | vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, |
| 6060 | vector unsigned int __c) { |
| 6061 | return __builtin_altivec_vmsumuhm(__a, __b, __c); |
| 6062 | } |
| 6063 | |
| 6064 | /* vec_msums */ |
| 6065 | |
| 6066 | static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, |
| 6067 | vector short __b, |
| 6068 | vector int __c) { |
| 6069 | return __builtin_altivec_vmsumshs(__a, __b, __c); |
| 6070 | } |
| 6071 | |
| 6072 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6073 | vec_msums(vector unsigned short __a, vector unsigned short __b, |
| 6074 | vector unsigned int __c) { |
| 6075 | return __builtin_altivec_vmsumuhs(__a, __b, __c); |
| 6076 | } |
| 6077 | |
| 6078 | /* vec_vmsumshs */ |
| 6079 | |
| 6080 | static __inline__ vector int __attribute__((__always_inline__)) |
| 6081 | vec_vmsumshs(vector short __a, vector short __b, vector int __c) { |
| 6082 | return __builtin_altivec_vmsumshs(__a, __b, __c); |
| 6083 | } |
| 6084 | |
| 6085 | /* vec_vmsumuhs */ |
| 6086 | |
| 6087 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 6088 | vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, |
| 6089 | vector unsigned int __c) { |
| 6090 | return __builtin_altivec_vmsumuhs(__a, __b, __c); |
| 6091 | } |
| 6092 | |
| 6093 | /* vec_mtvscr */ |
| 6094 | |
| 6095 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { |
| 6096 | __builtin_altivec_mtvscr((vector int)__a); |
| 6097 | } |
| 6098 | |
| 6099 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { |
| 6100 | __builtin_altivec_mtvscr((vector int)__a); |
| 6101 | } |
| 6102 | |
| 6103 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { |
| 6104 | __builtin_altivec_mtvscr((vector int)__a); |
| 6105 | } |
| 6106 | |
| 6107 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { |
| 6108 | __builtin_altivec_mtvscr((vector int)__a); |
| 6109 | } |
| 6110 | |
| 6111 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { |
| 6112 | __builtin_altivec_mtvscr((vector int)__a); |
| 6113 | } |
| 6114 | |
| 6115 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { |
| 6116 | __builtin_altivec_mtvscr((vector int)__a); |
| 6117 | } |
| 6118 | |
| 6119 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { |
| 6120 | __builtin_altivec_mtvscr((vector int)__a); |
| 6121 | } |
| 6122 | |
| 6123 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { |
| 6124 | __builtin_altivec_mtvscr((vector int)__a); |
| 6125 | } |
| 6126 | |
| 6127 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { |
| 6128 | __builtin_altivec_mtvscr((vector int)__a); |
| 6129 | } |
| 6130 | |
| 6131 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { |
| 6132 | __builtin_altivec_mtvscr((vector int)__a); |
| 6133 | } |
| 6134 | |
| 6135 | static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { |
| 6136 | __builtin_altivec_mtvscr((vector int)__a); |
| 6137 | } |
| 6138 | |
| 6139 | /* vec_mul */ |
| 6140 | |
| 6141 | /* Integer vector multiplication will involve multiplication of the odd/even |
| 6142 | elements separately, then truncating the results and moving to the |
| 6143 | result vector. |
| 6144 | */ |
| 6145 | static __inline__ vector signed char __ATTRS_o_ai |
| 6146 | vec_mul(vector signed char __a, vector signed char __b) { |
| 6147 | return __a * __b; |
| 6148 | } |
| 6149 | |
| 6150 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6151 | vec_mul(vector unsigned char __a, vector unsigned char __b) { |
| 6152 | return __a * __b; |
| 6153 | } |
| 6154 | |
| 6155 | static __inline__ vector signed short __ATTRS_o_ai |
| 6156 | vec_mul(vector signed short __a, vector signed short __b) { |
| 6157 | return __a * __b; |
| 6158 | } |
| 6159 | |
| 6160 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6161 | vec_mul(vector unsigned short __a, vector unsigned short __b) { |
| 6162 | return __a * __b; |
| 6163 | } |
| 6164 | |
| 6165 | static __inline__ vector signed int __ATTRS_o_ai |
| 6166 | vec_mul(vector signed int __a, vector signed int __b) { |
| 6167 | return __a * __b; |
| 6168 | } |
| 6169 | |
| 6170 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6171 | vec_mul(vector unsigned int __a, vector unsigned int __b) { |
| 6172 | return __a * __b; |
| 6173 | } |
| 6174 | |
| 6175 | #ifdef __VSX__ |
| 6176 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6177 | vec_mul(vector signed long long __a, vector signed long long __b) { |
| 6178 | return __a * __b; |
| 6179 | } |
| 6180 | |
| 6181 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6182 | vec_mul(vector unsigned long long __a, vector unsigned long long __b) { |
| 6183 | return __a * __b; |
| 6184 | } |
| 6185 | #endif |
| 6186 | |
| 6187 | static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, |
| 6188 | vector float __b) { |
| 6189 | return __a * __b; |
| 6190 | } |
| 6191 | |
| 6192 | #ifdef __VSX__ |
| 6193 | static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, |
| 6194 | vector double __b) { |
| 6195 | return __a * __b; |
| 6196 | } |
| 6197 | #endif |
| 6198 | |
| 6199 | /* The vmulos* and vmules* instructions have a big endian bias, so |
| 6200 | we must reverse the meaning of "even" and "odd" for little endian. */ |
| 6201 | |
| 6202 | /* vec_mule */ |
| 6203 | |
| 6204 | static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, |
| 6205 | vector signed char __b) { |
| 6206 | #ifdef __LITTLE_ENDIAN__ |
| 6207 | return __builtin_altivec_vmulosb(__a, __b); |
| 6208 | #else |
| 6209 | return __builtin_altivec_vmulesb(__a, __b); |
| 6210 | #endif |
| 6211 | } |
| 6212 | |
| 6213 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6214 | vec_mule(vector unsigned char __a, vector unsigned char __b) { |
| 6215 | #ifdef __LITTLE_ENDIAN__ |
| 6216 | return __builtin_altivec_vmuloub(__a, __b); |
| 6217 | #else |
| 6218 | return __builtin_altivec_vmuleub(__a, __b); |
| 6219 | #endif |
| 6220 | } |
| 6221 | |
| 6222 | static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, |
| 6223 | vector short __b) { |
| 6224 | #ifdef __LITTLE_ENDIAN__ |
| 6225 | return __builtin_altivec_vmulosh(__a, __b); |
| 6226 | #else |
| 6227 | return __builtin_altivec_vmulesh(__a, __b); |
| 6228 | #endif |
| 6229 | } |
| 6230 | |
| 6231 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6232 | vec_mule(vector unsigned short __a, vector unsigned short __b) { |
| 6233 | #ifdef __LITTLE_ENDIAN__ |
| 6234 | return __builtin_altivec_vmulouh(__a, __b); |
| 6235 | #else |
| 6236 | return __builtin_altivec_vmuleuh(__a, __b); |
| 6237 | #endif |
| 6238 | } |
| 6239 | |
| 6240 | #ifdef __POWER8_VECTOR__ |
| 6241 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6242 | vec_mule(vector signed int __a, vector signed int __b) { |
| 6243 | #ifdef __LITTLE_ENDIAN__ |
| 6244 | return __builtin_altivec_vmulosw(__a, __b); |
| 6245 | #else |
| 6246 | return __builtin_altivec_vmulesw(__a, __b); |
| 6247 | #endif |
| 6248 | } |
| 6249 | |
| 6250 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6251 | vec_mule(vector unsigned int __a, vector unsigned int __b) { |
| 6252 | #ifdef __LITTLE_ENDIAN__ |
| 6253 | return __builtin_altivec_vmulouw(__a, __b); |
| 6254 | #else |
| 6255 | return __builtin_altivec_vmuleuw(__a, __b); |
| 6256 | #endif |
| 6257 | } |
| 6258 | #endif |
| 6259 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 6260 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 6261 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 6262 | vec_mule(vector signed long long __a, vector signed long long __b) { |
| 6263 | #ifdef __LITTLE_ENDIAN__ |
| 6264 | return __builtin_altivec_vmulosd(__a, __b); |
| 6265 | #else |
| 6266 | return __builtin_altivec_vmulesd(__a, __b); |
| 6267 | #endif |
| 6268 | } |
| 6269 | |
| 6270 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 6271 | vec_mule(vector unsigned long long __a, vector unsigned long long __b) { |
| 6272 | #ifdef __LITTLE_ENDIAN__ |
| 6273 | return __builtin_altivec_vmuloud(__a, __b); |
| 6274 | #else |
| 6275 | return __builtin_altivec_vmuleud(__a, __b); |
| 6276 | #endif |
| 6277 | } |
| 6278 | #endif |
| 6279 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6280 | /* vec_vmulesb */ |
| 6281 | |
| 6282 | static __inline__ vector short __attribute__((__always_inline__)) |
| 6283 | vec_vmulesb(vector signed char __a, vector signed char __b) { |
| 6284 | #ifdef __LITTLE_ENDIAN__ |
| 6285 | return __builtin_altivec_vmulosb(__a, __b); |
| 6286 | #else |
| 6287 | return __builtin_altivec_vmulesb(__a, __b); |
| 6288 | #endif |
| 6289 | } |
| 6290 | |
| 6291 | /* vec_vmuleub */ |
| 6292 | |
| 6293 | static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| 6294 | vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { |
| 6295 | #ifdef __LITTLE_ENDIAN__ |
| 6296 | return __builtin_altivec_vmuloub(__a, __b); |
| 6297 | #else |
| 6298 | return __builtin_altivec_vmuleub(__a, __b); |
| 6299 | #endif |
| 6300 | } |
| 6301 | |
| 6302 | /* vec_vmulesh */ |
| 6303 | |
| 6304 | static __inline__ vector int __attribute__((__always_inline__)) |
| 6305 | vec_vmulesh(vector short __a, vector short __b) { |
| 6306 | #ifdef __LITTLE_ENDIAN__ |
| 6307 | return __builtin_altivec_vmulosh(__a, __b); |
| 6308 | #else |
| 6309 | return __builtin_altivec_vmulesh(__a, __b); |
| 6310 | #endif |
| 6311 | } |
| 6312 | |
| 6313 | /* vec_vmuleuh */ |
| 6314 | |
| 6315 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 6316 | vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { |
| 6317 | #ifdef __LITTLE_ENDIAN__ |
| 6318 | return __builtin_altivec_vmulouh(__a, __b); |
| 6319 | #else |
| 6320 | return __builtin_altivec_vmuleuh(__a, __b); |
| 6321 | #endif |
| 6322 | } |
| 6323 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 6324 | /* vec_mulh */ |
| 6325 | |
| 6326 | #ifdef __POWER10_VECTOR__ |
| 6327 | static __inline__ vector signed int __ATTRS_o_ai |
| 6328 | vec_mulh(vector signed int __a, vector signed int __b) { |
| 6329 | return __builtin_altivec_vmulhsw(__a, __b); |
| 6330 | } |
| 6331 | |
| 6332 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6333 | vec_mulh(vector unsigned int __a, vector unsigned int __b) { |
| 6334 | return __builtin_altivec_vmulhuw(__a, __b); |
| 6335 | } |
| 6336 | |
| 6337 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6338 | vec_mulh(vector signed long long __a, vector signed long long __b) { |
| 6339 | return __builtin_altivec_vmulhsd(__a, __b); |
| 6340 | } |
| 6341 | |
| 6342 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6343 | vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { |
| 6344 | return __builtin_altivec_vmulhud(__a, __b); |
| 6345 | } |
| 6346 | #endif |
| 6347 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6348 | /* vec_mulo */ |
| 6349 | |
| 6350 | static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, |
| 6351 | vector signed char __b) { |
| 6352 | #ifdef __LITTLE_ENDIAN__ |
| 6353 | return __builtin_altivec_vmulesb(__a, __b); |
| 6354 | #else |
| 6355 | return __builtin_altivec_vmulosb(__a, __b); |
| 6356 | #endif |
| 6357 | } |
| 6358 | |
| 6359 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6360 | vec_mulo(vector unsigned char __a, vector unsigned char __b) { |
| 6361 | #ifdef __LITTLE_ENDIAN__ |
| 6362 | return __builtin_altivec_vmuleub(__a, __b); |
| 6363 | #else |
| 6364 | return __builtin_altivec_vmuloub(__a, __b); |
| 6365 | #endif |
| 6366 | } |
| 6367 | |
| 6368 | static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, |
| 6369 | vector short __b) { |
| 6370 | #ifdef __LITTLE_ENDIAN__ |
| 6371 | return __builtin_altivec_vmulesh(__a, __b); |
| 6372 | #else |
| 6373 | return __builtin_altivec_vmulosh(__a, __b); |
| 6374 | #endif |
| 6375 | } |
| 6376 | |
| 6377 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6378 | vec_mulo(vector unsigned short __a, vector unsigned short __b) { |
| 6379 | #ifdef __LITTLE_ENDIAN__ |
| 6380 | return __builtin_altivec_vmuleuh(__a, __b); |
| 6381 | #else |
| 6382 | return __builtin_altivec_vmulouh(__a, __b); |
| 6383 | #endif |
| 6384 | } |
| 6385 | |
| 6386 | #ifdef __POWER8_VECTOR__ |
| 6387 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6388 | vec_mulo(vector signed int __a, vector signed int __b) { |
| 6389 | #ifdef __LITTLE_ENDIAN__ |
| 6390 | return __builtin_altivec_vmulesw(__a, __b); |
| 6391 | #else |
| 6392 | return __builtin_altivec_vmulosw(__a, __b); |
| 6393 | #endif |
| 6394 | } |
| 6395 | |
| 6396 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6397 | vec_mulo(vector unsigned int __a, vector unsigned int __b) { |
| 6398 | #ifdef __LITTLE_ENDIAN__ |
| 6399 | return __builtin_altivec_vmuleuw(__a, __b); |
| 6400 | #else |
| 6401 | return __builtin_altivec_vmulouw(__a, __b); |
| 6402 | #endif |
| 6403 | } |
| 6404 | #endif |
| 6405 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 6406 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 6407 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 6408 | vec_mulo(vector signed long long __a, vector signed long long __b) { |
| 6409 | #ifdef __LITTLE_ENDIAN__ |
| 6410 | return __builtin_altivec_vmulesd(__a, __b); |
| 6411 | #else |
| 6412 | return __builtin_altivec_vmulosd(__a, __b); |
| 6413 | #endif |
| 6414 | } |
| 6415 | |
| 6416 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 6417 | vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { |
| 6418 | #ifdef __LITTLE_ENDIAN__ |
| 6419 | return __builtin_altivec_vmuleud(__a, __b); |
| 6420 | #else |
| 6421 | return __builtin_altivec_vmuloud(__a, __b); |
| 6422 | #endif |
| 6423 | } |
| 6424 | #endif |
| 6425 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6426 | /* vec_vmulosb */ |
| 6427 | |
| 6428 | static __inline__ vector short __attribute__((__always_inline__)) |
| 6429 | vec_vmulosb(vector signed char __a, vector signed char __b) { |
| 6430 | #ifdef __LITTLE_ENDIAN__ |
| 6431 | return __builtin_altivec_vmulesb(__a, __b); |
| 6432 | #else |
| 6433 | return __builtin_altivec_vmulosb(__a, __b); |
| 6434 | #endif |
| 6435 | } |
| 6436 | |
| 6437 | /* vec_vmuloub */ |
| 6438 | |
| 6439 | static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| 6440 | vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { |
| 6441 | #ifdef __LITTLE_ENDIAN__ |
| 6442 | return __builtin_altivec_vmuleub(__a, __b); |
| 6443 | #else |
| 6444 | return __builtin_altivec_vmuloub(__a, __b); |
| 6445 | #endif |
| 6446 | } |
| 6447 | |
| 6448 | /* vec_vmulosh */ |
| 6449 | |
| 6450 | static __inline__ vector int __attribute__((__always_inline__)) |
| 6451 | vec_vmulosh(vector short __a, vector short __b) { |
| 6452 | #ifdef __LITTLE_ENDIAN__ |
| 6453 | return __builtin_altivec_vmulesh(__a, __b); |
| 6454 | #else |
| 6455 | return __builtin_altivec_vmulosh(__a, __b); |
| 6456 | #endif |
| 6457 | } |
| 6458 | |
| 6459 | /* vec_vmulouh */ |
| 6460 | |
| 6461 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 6462 | vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { |
| 6463 | #ifdef __LITTLE_ENDIAN__ |
| 6464 | return __builtin_altivec_vmuleuh(__a, __b); |
| 6465 | #else |
| 6466 | return __builtin_altivec_vmulouh(__a, __b); |
| 6467 | #endif |
| 6468 | } |
| 6469 | |
| 6470 | /* vec_nand */ |
| 6471 | |
| 6472 | #ifdef __POWER8_VECTOR__ |
| 6473 | static __inline__ vector signed char __ATTRS_o_ai |
| 6474 | vec_nand(vector signed char __a, vector signed char __b) { |
| 6475 | return ~(__a & __b); |
| 6476 | } |
| 6477 | |
| 6478 | static __inline__ vector signed char __ATTRS_o_ai |
| 6479 | vec_nand(vector signed char __a, vector bool char __b) { |
| 6480 | return ~(__a & __b); |
| 6481 | } |
| 6482 | |
| 6483 | static __inline__ vector signed char __ATTRS_o_ai |
| 6484 | vec_nand(vector bool char __a, vector signed char __b) { |
| 6485 | return ~(__a & __b); |
| 6486 | } |
| 6487 | |
| 6488 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6489 | vec_nand(vector unsigned char __a, vector unsigned char __b) { |
| 6490 | return ~(__a & __b); |
| 6491 | } |
| 6492 | |
| 6493 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6494 | vec_nand(vector unsigned char __a, vector bool char __b) { |
| 6495 | return ~(__a & __b); |
| 6496 | } |
| 6497 | |
| 6498 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6499 | vec_nand(vector bool char __a, vector unsigned char __b) { |
| 6500 | return ~(__a & __b); |
| 6501 | } |
| 6502 | |
| 6503 | static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, |
| 6504 | vector bool char __b) { |
| 6505 | return ~(__a & __b); |
| 6506 | } |
| 6507 | |
| 6508 | static __inline__ vector signed short __ATTRS_o_ai |
| 6509 | vec_nand(vector signed short __a, vector signed short __b) { |
| 6510 | return ~(__a & __b); |
| 6511 | } |
| 6512 | |
| 6513 | static __inline__ vector signed short __ATTRS_o_ai |
| 6514 | vec_nand(vector signed short __a, vector bool short __b) { |
| 6515 | return ~(__a & __b); |
| 6516 | } |
| 6517 | |
| 6518 | static __inline__ vector signed short __ATTRS_o_ai |
| 6519 | vec_nand(vector bool short __a, vector signed short __b) { |
| 6520 | return ~(__a & __b); |
| 6521 | } |
| 6522 | |
| 6523 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6524 | vec_nand(vector unsigned short __a, vector unsigned short __b) { |
| 6525 | return ~(__a & __b); |
| 6526 | } |
| 6527 | |
| 6528 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6529 | vec_nand(vector unsigned short __a, vector bool short __b) { |
| 6530 | return ~(__a & __b); |
| 6531 | } |
| 6532 | |
| 6533 | static __inline__ vector bool short __ATTRS_o_ai |
| 6534 | vec_nand(vector bool short __a, vector bool short __b) { |
| 6535 | return ~(__a & __b); |
| 6536 | } |
| 6537 | |
| 6538 | static __inline__ vector signed int __ATTRS_o_ai |
| 6539 | vec_nand(vector signed int __a, vector signed int __b) { |
| 6540 | return ~(__a & __b); |
| 6541 | } |
| 6542 | |
| 6543 | static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, |
| 6544 | vector bool int __b) { |
| 6545 | return ~(__a & __b); |
| 6546 | } |
| 6547 | |
| 6548 | static __inline__ vector signed int __ATTRS_o_ai |
| 6549 | vec_nand(vector bool int __a, vector signed int __b) { |
| 6550 | return ~(__a & __b); |
| 6551 | } |
| 6552 | |
| 6553 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6554 | vec_nand(vector unsigned int __a, vector unsigned int __b) { |
| 6555 | return ~(__a & __b); |
| 6556 | } |
| 6557 | |
| 6558 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6559 | vec_nand(vector unsigned int __a, vector bool int __b) { |
| 6560 | return ~(__a & __b); |
| 6561 | } |
| 6562 | |
| 6563 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6564 | vec_nand(vector bool int __a, vector unsigned int __b) { |
| 6565 | return ~(__a & __b); |
| 6566 | } |
| 6567 | |
| 6568 | static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, |
| 6569 | vector bool int __b) { |
| 6570 | return ~(__a & __b); |
| 6571 | } |
| 6572 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 6573 | static __inline__ vector float __ATTRS_o_ai |
| 6574 | vec_nand(vector float __a, vector float __b) { |
| 6575 | return (vector float)(~((vector unsigned int)__a & |
| 6576 | (vector unsigned int)__b)); |
| 6577 | } |
| 6578 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6579 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6580 | vec_nand(vector signed long long __a, vector signed long long __b) { |
| 6581 | return ~(__a & __b); |
| 6582 | } |
| 6583 | |
| 6584 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6585 | vec_nand(vector signed long long __a, vector bool long long __b) { |
| 6586 | return ~(__a & __b); |
| 6587 | } |
| 6588 | |
| 6589 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6590 | vec_nand(vector bool long long __a, vector signed long long __b) { |
| 6591 | return ~(__a & __b); |
| 6592 | } |
| 6593 | |
| 6594 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6595 | vec_nand(vector unsigned long long __a, vector unsigned long long __b) { |
| 6596 | return ~(__a & __b); |
| 6597 | } |
| 6598 | |
| 6599 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6600 | vec_nand(vector unsigned long long __a, vector bool long long __b) { |
| 6601 | return ~(__a & __b); |
| 6602 | } |
| 6603 | |
| 6604 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6605 | vec_nand(vector bool long long __a, vector unsigned long long __b) { |
| 6606 | return ~(__a & __b); |
| 6607 | } |
| 6608 | |
| 6609 | static __inline__ vector bool long long __ATTRS_o_ai |
| 6610 | vec_nand(vector bool long long __a, vector bool long long __b) { |
| 6611 | return ~(__a & __b); |
| 6612 | } |
| 6613 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 6614 | static __inline__ vector double __ATTRS_o_ai |
| 6615 | vec_nand(vector double __a, vector double __b) { |
| 6616 | return (vector double)(~((vector unsigned long long)__a & |
| 6617 | (vector unsigned long long)__b)); |
| 6618 | } |
| 6619 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6620 | #endif |
| 6621 | |
| 6622 | /* vec_nmadd */ |
| 6623 | |
| 6624 | #ifdef __VSX__ |
| 6625 | static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, |
| 6626 | vector float __b, |
| 6627 | vector float __c) { |
| 6628 | return __builtin_vsx_xvnmaddasp(__a, __b, __c); |
| 6629 | } |
| 6630 | |
| 6631 | static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, |
| 6632 | vector double __b, |
| 6633 | vector double __c) { |
| 6634 | return __builtin_vsx_xvnmaddadp(__a, __b, __c); |
| 6635 | } |
| 6636 | #endif |
| 6637 | |
| 6638 | /* vec_nmsub */ |
| 6639 | |
| 6640 | static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, |
| 6641 | vector float __b, |
| 6642 | vector float __c) { |
| 6643 | #ifdef __VSX__ |
| 6644 | return __builtin_vsx_xvnmsubasp(__a, __b, __c); |
| 6645 | #else |
| 6646 | return __builtin_altivec_vnmsubfp(__a, __b, __c); |
| 6647 | #endif |
| 6648 | } |
| 6649 | |
| 6650 | #ifdef __VSX__ |
| 6651 | static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, |
| 6652 | vector double __b, |
| 6653 | vector double __c) { |
| 6654 | return __builtin_vsx_xvnmsubadp(__a, __b, __c); |
| 6655 | } |
| 6656 | #endif |
| 6657 | |
| 6658 | /* vec_vnmsubfp */ |
| 6659 | |
| 6660 | static __inline__ vector float __attribute__((__always_inline__)) |
| 6661 | vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { |
| 6662 | return __builtin_altivec_vnmsubfp(__a, __b, __c); |
| 6663 | } |
| 6664 | |
| 6665 | /* vec_nor */ |
| 6666 | |
| 6667 | #define __builtin_altivec_vnor vec_nor |
| 6668 | |
| 6669 | static __inline__ vector signed char __ATTRS_o_ai |
| 6670 | vec_nor(vector signed char __a, vector signed char __b) { |
| 6671 | return ~(__a | __b); |
| 6672 | } |
| 6673 | |
| 6674 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6675 | vec_nor(vector unsigned char __a, vector unsigned char __b) { |
| 6676 | return ~(__a | __b); |
| 6677 | } |
| 6678 | |
| 6679 | static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, |
| 6680 | vector bool char __b) { |
| 6681 | return ~(__a | __b); |
| 6682 | } |
| 6683 | |
| 6684 | static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, |
| 6685 | vector short __b) { |
| 6686 | return ~(__a | __b); |
| 6687 | } |
| 6688 | |
| 6689 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6690 | vec_nor(vector unsigned short __a, vector unsigned short __b) { |
| 6691 | return ~(__a | __b); |
| 6692 | } |
| 6693 | |
| 6694 | static __inline__ vector bool short __ATTRS_o_ai |
| 6695 | vec_nor(vector bool short __a, vector bool short __b) { |
| 6696 | return ~(__a | __b); |
| 6697 | } |
| 6698 | |
| 6699 | static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, |
| 6700 | vector int __b) { |
| 6701 | return ~(__a | __b); |
| 6702 | } |
| 6703 | |
| 6704 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6705 | vec_nor(vector unsigned int __a, vector unsigned int __b) { |
| 6706 | return ~(__a | __b); |
| 6707 | } |
| 6708 | |
| 6709 | static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, |
| 6710 | vector bool int __b) { |
| 6711 | return ~(__a | __b); |
| 6712 | } |
| 6713 | |
| 6714 | static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, |
| 6715 | vector float __b) { |
| 6716 | vector unsigned int __res = |
| 6717 | ~((vector unsigned int)__a | (vector unsigned int)__b); |
| 6718 | return (vector float)__res; |
| 6719 | } |
| 6720 | |
| 6721 | #ifdef __VSX__ |
| 6722 | static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, |
| 6723 | vector double __b) { |
| 6724 | vector unsigned long long __res = |
| 6725 | ~((vector unsigned long long)__a | (vector unsigned long long)__b); |
| 6726 | return (vector double)__res; |
| 6727 | } |
| 6728 | #endif |
| 6729 | |
| 6730 | /* vec_vnor */ |
| 6731 | |
| 6732 | static __inline__ vector signed char __ATTRS_o_ai |
| 6733 | vec_vnor(vector signed char __a, vector signed char __b) { |
| 6734 | return ~(__a | __b); |
| 6735 | } |
| 6736 | |
| 6737 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6738 | vec_vnor(vector unsigned char __a, vector unsigned char __b) { |
| 6739 | return ~(__a | __b); |
| 6740 | } |
| 6741 | |
| 6742 | static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, |
| 6743 | vector bool char __b) { |
| 6744 | return ~(__a | __b); |
| 6745 | } |
| 6746 | |
| 6747 | static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, |
| 6748 | vector short __b) { |
| 6749 | return ~(__a | __b); |
| 6750 | } |
| 6751 | |
| 6752 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6753 | vec_vnor(vector unsigned short __a, vector unsigned short __b) { |
| 6754 | return ~(__a | __b); |
| 6755 | } |
| 6756 | |
| 6757 | static __inline__ vector bool short __ATTRS_o_ai |
| 6758 | vec_vnor(vector bool short __a, vector bool short __b) { |
| 6759 | return ~(__a | __b); |
| 6760 | } |
| 6761 | |
| 6762 | static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, |
| 6763 | vector int __b) { |
| 6764 | return ~(__a | __b); |
| 6765 | } |
| 6766 | |
| 6767 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6768 | vec_vnor(vector unsigned int __a, vector unsigned int __b) { |
| 6769 | return ~(__a | __b); |
| 6770 | } |
| 6771 | |
| 6772 | static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, |
| 6773 | vector bool int __b) { |
| 6774 | return ~(__a | __b); |
| 6775 | } |
| 6776 | |
| 6777 | static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, |
| 6778 | vector float __b) { |
| 6779 | vector unsigned int __res = |
| 6780 | ~((vector unsigned int)__a | (vector unsigned int)__b); |
| 6781 | return (vector float)__res; |
| 6782 | } |
| 6783 | |
| 6784 | #ifdef __VSX__ |
| 6785 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6786 | vec_nor(vector signed long long __a, vector signed long long __b) { |
| 6787 | return ~(__a | __b); |
| 6788 | } |
| 6789 | |
| 6790 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6791 | vec_nor(vector unsigned long long __a, vector unsigned long long __b) { |
| 6792 | return ~(__a | __b); |
| 6793 | } |
| 6794 | |
| 6795 | static __inline__ vector bool long long __ATTRS_o_ai |
| 6796 | vec_nor(vector bool long long __a, vector bool long long __b) { |
| 6797 | return ~(__a | __b); |
| 6798 | } |
| 6799 | #endif |
| 6800 | |
| 6801 | /* vec_or */ |
| 6802 | |
| 6803 | #define __builtin_altivec_vor vec_or |
| 6804 | |
| 6805 | static __inline__ vector signed char __ATTRS_o_ai |
| 6806 | vec_or(vector signed char __a, vector signed char __b) { |
| 6807 | return __a | __b; |
| 6808 | } |
| 6809 | |
| 6810 | static __inline__ vector signed char __ATTRS_o_ai |
| 6811 | vec_or(vector bool char __a, vector signed char __b) { |
| 6812 | return (vector signed char)__a | __b; |
| 6813 | } |
| 6814 | |
| 6815 | static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, |
| 6816 | vector bool char __b) { |
| 6817 | return __a | (vector signed char)__b; |
| 6818 | } |
| 6819 | |
| 6820 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6821 | vec_or(vector unsigned char __a, vector unsigned char __b) { |
| 6822 | return __a | __b; |
| 6823 | } |
| 6824 | |
| 6825 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6826 | vec_or(vector bool char __a, vector unsigned char __b) { |
| 6827 | return (vector unsigned char)__a | __b; |
| 6828 | } |
| 6829 | |
| 6830 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 6831 | vec_or(vector unsigned char __a, vector bool char __b) { |
| 6832 | return __a | (vector unsigned char)__b; |
| 6833 | } |
| 6834 | |
| 6835 | static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, |
| 6836 | vector bool char __b) { |
| 6837 | return __a | __b; |
| 6838 | } |
| 6839 | |
| 6840 | static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, |
| 6841 | vector short __b) { |
| 6842 | return __a | __b; |
| 6843 | } |
| 6844 | |
| 6845 | static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, |
| 6846 | vector short __b) { |
| 6847 | return (vector short)__a | __b; |
| 6848 | } |
| 6849 | |
| 6850 | static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, |
| 6851 | vector bool short __b) { |
| 6852 | return __a | (vector short)__b; |
| 6853 | } |
| 6854 | |
| 6855 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6856 | vec_or(vector unsigned short __a, vector unsigned short __b) { |
| 6857 | return __a | __b; |
| 6858 | } |
| 6859 | |
| 6860 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6861 | vec_or(vector bool short __a, vector unsigned short __b) { |
| 6862 | return (vector unsigned short)__a | __b; |
| 6863 | } |
| 6864 | |
| 6865 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 6866 | vec_or(vector unsigned short __a, vector bool short __b) { |
| 6867 | return __a | (vector unsigned short)__b; |
| 6868 | } |
| 6869 | |
| 6870 | static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, |
| 6871 | vector bool short __b) { |
| 6872 | return __a | __b; |
| 6873 | } |
| 6874 | |
| 6875 | static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, |
| 6876 | vector int __b) { |
| 6877 | return __a | __b; |
| 6878 | } |
| 6879 | |
| 6880 | static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, |
| 6881 | vector int __b) { |
| 6882 | return (vector int)__a | __b; |
| 6883 | } |
| 6884 | |
| 6885 | static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, |
| 6886 | vector bool int __b) { |
| 6887 | return __a | (vector int)__b; |
| 6888 | } |
| 6889 | |
| 6890 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6891 | vec_or(vector unsigned int __a, vector unsigned int __b) { |
| 6892 | return __a | __b; |
| 6893 | } |
| 6894 | |
| 6895 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6896 | vec_or(vector bool int __a, vector unsigned int __b) { |
| 6897 | return (vector unsigned int)__a | __b; |
| 6898 | } |
| 6899 | |
| 6900 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 6901 | vec_or(vector unsigned int __a, vector bool int __b) { |
| 6902 | return __a | (vector unsigned int)__b; |
| 6903 | } |
| 6904 | |
| 6905 | static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, |
| 6906 | vector bool int __b) { |
| 6907 | return __a | __b; |
| 6908 | } |
| 6909 | |
| 6910 | static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, |
| 6911 | vector float __b) { |
| 6912 | vector unsigned int __res = |
| 6913 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 6914 | return (vector float)__res; |
| 6915 | } |
| 6916 | |
| 6917 | static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, |
| 6918 | vector float __b) { |
| 6919 | vector unsigned int __res = |
| 6920 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 6921 | return (vector float)__res; |
| 6922 | } |
| 6923 | |
| 6924 | static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, |
| 6925 | vector bool int __b) { |
| 6926 | vector unsigned int __res = |
| 6927 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 6928 | return (vector float)__res; |
| 6929 | } |
| 6930 | |
| 6931 | #ifdef __VSX__ |
| 6932 | static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, |
| 6933 | vector double __b) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 6934 | return (vector double)((vector unsigned long long)__a | |
| 6935 | (vector unsigned long long)__b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6936 | } |
| 6937 | |
| 6938 | static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, |
| 6939 | vector bool long long __b) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 6940 | return (vector double)((vector unsigned long long)__a | |
| 6941 | (vector unsigned long long)__b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6942 | } |
| 6943 | |
| 6944 | static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, |
| 6945 | vector double __b) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 6946 | return (vector double)((vector unsigned long long)__a | |
| 6947 | (vector unsigned long long)__b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6948 | } |
| 6949 | |
| 6950 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6951 | vec_or(vector signed long long __a, vector signed long long __b) { |
| 6952 | return __a | __b; |
| 6953 | } |
| 6954 | |
| 6955 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6956 | vec_or(vector bool long long __a, vector signed long long __b) { |
| 6957 | return (vector signed long long)__a | __b; |
| 6958 | } |
| 6959 | |
| 6960 | static __inline__ vector signed long long __ATTRS_o_ai |
| 6961 | vec_or(vector signed long long __a, vector bool long long __b) { |
| 6962 | return __a | (vector signed long long)__b; |
| 6963 | } |
| 6964 | |
| 6965 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6966 | vec_or(vector unsigned long long __a, vector unsigned long long __b) { |
| 6967 | return __a | __b; |
| 6968 | } |
| 6969 | |
| 6970 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6971 | vec_or(vector bool long long __a, vector unsigned long long __b) { |
| 6972 | return (vector unsigned long long)__a | __b; |
| 6973 | } |
| 6974 | |
| 6975 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 6976 | vec_or(vector unsigned long long __a, vector bool long long __b) { |
| 6977 | return __a | (vector unsigned long long)__b; |
| 6978 | } |
| 6979 | |
| 6980 | static __inline__ vector bool long long __ATTRS_o_ai |
| 6981 | vec_or(vector bool long long __a, vector bool long long __b) { |
| 6982 | return __a | __b; |
| 6983 | } |
| 6984 | #endif |
| 6985 | |
| 6986 | #ifdef __POWER8_VECTOR__ |
| 6987 | static __inline__ vector signed char __ATTRS_o_ai |
| 6988 | vec_orc(vector signed char __a, vector signed char __b) { |
| 6989 | return __a | ~__b; |
| 6990 | } |
| 6991 | |
| 6992 | static __inline__ vector signed char __ATTRS_o_ai |
| 6993 | vec_orc(vector signed char __a, vector bool char __b) { |
| 6994 | return __a | ~__b; |
| 6995 | } |
| 6996 | |
| 6997 | static __inline__ vector signed char __ATTRS_o_ai |
| 6998 | vec_orc(vector bool char __a, vector signed char __b) { |
| 6999 | return __a | ~__b; |
| 7000 | } |
| 7001 | |
| 7002 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7003 | vec_orc(vector unsigned char __a, vector unsigned char __b) { |
| 7004 | return __a | ~__b; |
| 7005 | } |
| 7006 | |
| 7007 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7008 | vec_orc(vector unsigned char __a, vector bool char __b) { |
| 7009 | return __a | ~__b; |
| 7010 | } |
| 7011 | |
| 7012 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7013 | vec_orc(vector bool char __a, vector unsigned char __b) { |
| 7014 | return __a | ~__b; |
| 7015 | } |
| 7016 | |
| 7017 | static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, |
| 7018 | vector bool char __b) { |
| 7019 | return __a | ~__b; |
| 7020 | } |
| 7021 | |
| 7022 | static __inline__ vector signed short __ATTRS_o_ai |
| 7023 | vec_orc(vector signed short __a, vector signed short __b) { |
| 7024 | return __a | ~__b; |
| 7025 | } |
| 7026 | |
| 7027 | static __inline__ vector signed short __ATTRS_o_ai |
| 7028 | vec_orc(vector signed short __a, vector bool short __b) { |
| 7029 | return __a | ~__b; |
| 7030 | } |
| 7031 | |
| 7032 | static __inline__ vector signed short __ATTRS_o_ai |
| 7033 | vec_orc(vector bool short __a, vector signed short __b) { |
| 7034 | return __a | ~__b; |
| 7035 | } |
| 7036 | |
| 7037 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7038 | vec_orc(vector unsigned short __a, vector unsigned short __b) { |
| 7039 | return __a | ~__b; |
| 7040 | } |
| 7041 | |
| 7042 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7043 | vec_orc(vector unsigned short __a, vector bool short __b) { |
| 7044 | return __a | ~__b; |
| 7045 | } |
| 7046 | |
| 7047 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7048 | vec_orc(vector bool short __a, vector unsigned short __b) { |
| 7049 | return __a | ~__b; |
| 7050 | } |
| 7051 | |
| 7052 | static __inline__ vector bool short __ATTRS_o_ai |
| 7053 | vec_orc(vector bool short __a, vector bool short __b) { |
| 7054 | return __a | ~__b; |
| 7055 | } |
| 7056 | |
| 7057 | static __inline__ vector signed int __ATTRS_o_ai |
| 7058 | vec_orc(vector signed int __a, vector signed int __b) { |
| 7059 | return __a | ~__b; |
| 7060 | } |
| 7061 | |
| 7062 | static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, |
| 7063 | vector bool int __b) { |
| 7064 | return __a | ~__b; |
| 7065 | } |
| 7066 | |
| 7067 | static __inline__ vector signed int __ATTRS_o_ai |
| 7068 | vec_orc(vector bool int __a, vector signed int __b) { |
| 7069 | return __a | ~__b; |
| 7070 | } |
| 7071 | |
| 7072 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7073 | vec_orc(vector unsigned int __a, vector unsigned int __b) { |
| 7074 | return __a | ~__b; |
| 7075 | } |
| 7076 | |
| 7077 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7078 | vec_orc(vector unsigned int __a, vector bool int __b) { |
| 7079 | return __a | ~__b; |
| 7080 | } |
| 7081 | |
| 7082 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7083 | vec_orc(vector bool int __a, vector unsigned int __b) { |
| 7084 | return __a | ~__b; |
| 7085 | } |
| 7086 | |
| 7087 | static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, |
| 7088 | vector bool int __b) { |
| 7089 | return __a | ~__b; |
| 7090 | } |
| 7091 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 7092 | static __inline__ vector float __ATTRS_o_ai |
| 7093 | vec_orc(vector bool int __a, vector float __b) { |
| 7094 | return (vector float)(__a | ~(vector unsigned int)__b); |
| 7095 | } |
| 7096 | |
| 7097 | static __inline__ vector float __ATTRS_o_ai |
| 7098 | vec_orc(vector float __a, vector bool int __b) { |
| 7099 | return (vector float)((vector unsigned int)__a | ~__b); |
| 7100 | } |
| 7101 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 7102 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7103 | vec_orc(vector signed long long __a, vector signed long long __b) { |
| 7104 | return __a | ~__b; |
| 7105 | } |
| 7106 | |
| 7107 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7108 | vec_orc(vector signed long long __a, vector bool long long __b) { |
| 7109 | return __a | ~__b; |
| 7110 | } |
| 7111 | |
| 7112 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7113 | vec_orc(vector bool long long __a, vector signed long long __b) { |
| 7114 | return __a | ~__b; |
| 7115 | } |
| 7116 | |
| 7117 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7118 | vec_orc(vector unsigned long long __a, vector unsigned long long __b) { |
| 7119 | return __a | ~__b; |
| 7120 | } |
| 7121 | |
| 7122 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7123 | vec_orc(vector unsigned long long __a, vector bool long long __b) { |
| 7124 | return __a | ~__b; |
| 7125 | } |
| 7126 | |
| 7127 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7128 | vec_orc(vector bool long long __a, vector unsigned long long __b) { |
| 7129 | return __a | ~__b; |
| 7130 | } |
| 7131 | |
| 7132 | static __inline__ vector bool long long __ATTRS_o_ai |
| 7133 | vec_orc(vector bool long long __a, vector bool long long __b) { |
| 7134 | return __a | ~__b; |
| 7135 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 7136 | |
| 7137 | static __inline__ vector double __ATTRS_o_ai |
| 7138 | vec_orc(vector double __a, vector bool long long __b) { |
| 7139 | return (vector double)((vector unsigned long long)__a | ~__b); |
| 7140 | } |
| 7141 | |
| 7142 | static __inline__ vector double __ATTRS_o_ai |
| 7143 | vec_orc(vector bool long long __a, vector double __b) { |
| 7144 | return (vector double)(__a | ~(vector unsigned long long)__b); |
| 7145 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 7146 | #endif |
| 7147 | |
| 7148 | /* vec_vor */ |
| 7149 | |
| 7150 | static __inline__ vector signed char __ATTRS_o_ai |
| 7151 | vec_vor(vector signed char __a, vector signed char __b) { |
| 7152 | return __a | __b; |
| 7153 | } |
| 7154 | |
| 7155 | static __inline__ vector signed char __ATTRS_o_ai |
| 7156 | vec_vor(vector bool char __a, vector signed char __b) { |
| 7157 | return (vector signed char)__a | __b; |
| 7158 | } |
| 7159 | |
| 7160 | static __inline__ vector signed char __ATTRS_o_ai |
| 7161 | vec_vor(vector signed char __a, vector bool char __b) { |
| 7162 | return __a | (vector signed char)__b; |
| 7163 | } |
| 7164 | |
| 7165 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7166 | vec_vor(vector unsigned char __a, vector unsigned char __b) { |
| 7167 | return __a | __b; |
| 7168 | } |
| 7169 | |
| 7170 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7171 | vec_vor(vector bool char __a, vector unsigned char __b) { |
| 7172 | return (vector unsigned char)__a | __b; |
| 7173 | } |
| 7174 | |
| 7175 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7176 | vec_vor(vector unsigned char __a, vector bool char __b) { |
| 7177 | return __a | (vector unsigned char)__b; |
| 7178 | } |
| 7179 | |
| 7180 | static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, |
| 7181 | vector bool char __b) { |
| 7182 | return __a | __b; |
| 7183 | } |
| 7184 | |
| 7185 | static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, |
| 7186 | vector short __b) { |
| 7187 | return __a | __b; |
| 7188 | } |
| 7189 | |
| 7190 | static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, |
| 7191 | vector short __b) { |
| 7192 | return (vector short)__a | __b; |
| 7193 | } |
| 7194 | |
| 7195 | static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, |
| 7196 | vector bool short __b) { |
| 7197 | return __a | (vector short)__b; |
| 7198 | } |
| 7199 | |
| 7200 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7201 | vec_vor(vector unsigned short __a, vector unsigned short __b) { |
| 7202 | return __a | __b; |
| 7203 | } |
| 7204 | |
| 7205 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7206 | vec_vor(vector bool short __a, vector unsigned short __b) { |
| 7207 | return (vector unsigned short)__a | __b; |
| 7208 | } |
| 7209 | |
| 7210 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7211 | vec_vor(vector unsigned short __a, vector bool short __b) { |
| 7212 | return __a | (vector unsigned short)__b; |
| 7213 | } |
| 7214 | |
| 7215 | static __inline__ vector bool short __ATTRS_o_ai |
| 7216 | vec_vor(vector bool short __a, vector bool short __b) { |
| 7217 | return __a | __b; |
| 7218 | } |
| 7219 | |
| 7220 | static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, |
| 7221 | vector int __b) { |
| 7222 | return __a | __b; |
| 7223 | } |
| 7224 | |
| 7225 | static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, |
| 7226 | vector int __b) { |
| 7227 | return (vector int)__a | __b; |
| 7228 | } |
| 7229 | |
| 7230 | static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, |
| 7231 | vector bool int __b) { |
| 7232 | return __a | (vector int)__b; |
| 7233 | } |
| 7234 | |
| 7235 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7236 | vec_vor(vector unsigned int __a, vector unsigned int __b) { |
| 7237 | return __a | __b; |
| 7238 | } |
| 7239 | |
| 7240 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7241 | vec_vor(vector bool int __a, vector unsigned int __b) { |
| 7242 | return (vector unsigned int)__a | __b; |
| 7243 | } |
| 7244 | |
| 7245 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7246 | vec_vor(vector unsigned int __a, vector bool int __b) { |
| 7247 | return __a | (vector unsigned int)__b; |
| 7248 | } |
| 7249 | |
| 7250 | static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, |
| 7251 | vector bool int __b) { |
| 7252 | return __a | __b; |
| 7253 | } |
| 7254 | |
| 7255 | static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, |
| 7256 | vector float __b) { |
| 7257 | vector unsigned int __res = |
| 7258 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 7259 | return (vector float)__res; |
| 7260 | } |
| 7261 | |
| 7262 | static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, |
| 7263 | vector float __b) { |
| 7264 | vector unsigned int __res = |
| 7265 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 7266 | return (vector float)__res; |
| 7267 | } |
| 7268 | |
| 7269 | static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, |
| 7270 | vector bool int __b) { |
| 7271 | vector unsigned int __res = |
| 7272 | (vector unsigned int)__a | (vector unsigned int)__b; |
| 7273 | return (vector float)__res; |
| 7274 | } |
| 7275 | |
| 7276 | #ifdef __VSX__ |
| 7277 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7278 | vec_vor(vector signed long long __a, vector signed long long __b) { |
| 7279 | return __a | __b; |
| 7280 | } |
| 7281 | |
| 7282 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7283 | vec_vor(vector bool long long __a, vector signed long long __b) { |
| 7284 | return (vector signed long long)__a | __b; |
| 7285 | } |
| 7286 | |
| 7287 | static __inline__ vector signed long long __ATTRS_o_ai |
| 7288 | vec_vor(vector signed long long __a, vector bool long long __b) { |
| 7289 | return __a | (vector signed long long)__b; |
| 7290 | } |
| 7291 | |
| 7292 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7293 | vec_vor(vector unsigned long long __a, vector unsigned long long __b) { |
| 7294 | return __a | __b; |
| 7295 | } |
| 7296 | |
| 7297 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7298 | vec_vor(vector bool long long __a, vector unsigned long long __b) { |
| 7299 | return (vector unsigned long long)__a | __b; |
| 7300 | } |
| 7301 | |
| 7302 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 7303 | vec_vor(vector unsigned long long __a, vector bool long long __b) { |
| 7304 | return __a | (vector unsigned long long)__b; |
| 7305 | } |
| 7306 | |
| 7307 | static __inline__ vector bool long long __ATTRS_o_ai |
| 7308 | vec_vor(vector bool long long __a, vector bool long long __b) { |
| 7309 | return __a | __b; |
| 7310 | } |
| 7311 | #endif |
| 7312 | |
| 7313 | /* vec_pack */ |
| 7314 | |
| 7315 | /* The various vector pack instructions have a big-endian bias, so for |
| 7316 | little endian we must handle reversed element numbering. */ |
| 7317 | |
| 7318 | static __inline__ vector signed char __ATTRS_o_ai |
| 7319 | vec_pack(vector signed short __a, vector signed short __b) { |
| 7320 | #ifdef __LITTLE_ENDIAN__ |
| 7321 | return (vector signed char)vec_perm( |
| 7322 | __a, __b, |
| 7323 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7324 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7325 | #else |
| 7326 | return (vector signed char)vec_perm( |
| 7327 | __a, __b, |
| 7328 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7329 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7330 | #endif |
| 7331 | } |
| 7332 | |
| 7333 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7334 | vec_pack(vector unsigned short __a, vector unsigned short __b) { |
| 7335 | #ifdef __LITTLE_ENDIAN__ |
| 7336 | return (vector unsigned char)vec_perm( |
| 7337 | __a, __b, |
| 7338 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7339 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7340 | #else |
| 7341 | return (vector unsigned char)vec_perm( |
| 7342 | __a, __b, |
| 7343 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7344 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7345 | #endif |
| 7346 | } |
| 7347 | |
| 7348 | static __inline__ vector bool char __ATTRS_o_ai |
| 7349 | vec_pack(vector bool short __a, vector bool short __b) { |
| 7350 | #ifdef __LITTLE_ENDIAN__ |
| 7351 | return (vector bool char)vec_perm( |
| 7352 | __a, __b, |
| 7353 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7354 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7355 | #else |
| 7356 | return (vector bool char)vec_perm( |
| 7357 | __a, __b, |
| 7358 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7359 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7360 | #endif |
| 7361 | } |
| 7362 | |
| 7363 | static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, |
| 7364 | vector int __b) { |
| 7365 | #ifdef __LITTLE_ENDIAN__ |
| 7366 | return (vector short)vec_perm( |
| 7367 | __a, __b, |
| 7368 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7369 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7370 | #else |
| 7371 | return (vector short)vec_perm( |
| 7372 | __a, __b, |
| 7373 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7374 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7375 | #endif |
| 7376 | } |
| 7377 | |
| 7378 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7379 | vec_pack(vector unsigned int __a, vector unsigned int __b) { |
| 7380 | #ifdef __LITTLE_ENDIAN__ |
| 7381 | return (vector unsigned short)vec_perm( |
| 7382 | __a, __b, |
| 7383 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7384 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7385 | #else |
| 7386 | return (vector unsigned short)vec_perm( |
| 7387 | __a, __b, |
| 7388 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7389 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7390 | #endif |
| 7391 | } |
| 7392 | |
| 7393 | static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, |
| 7394 | vector bool int __b) { |
| 7395 | #ifdef __LITTLE_ENDIAN__ |
| 7396 | return (vector bool short)vec_perm( |
| 7397 | __a, __b, |
| 7398 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7399 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7400 | #else |
| 7401 | return (vector bool short)vec_perm( |
| 7402 | __a, __b, |
| 7403 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7404 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7405 | #endif |
| 7406 | } |
| 7407 | |
| 7408 | #ifdef __VSX__ |
| 7409 | static __inline__ vector signed int __ATTRS_o_ai |
| 7410 | vec_pack(vector signed long long __a, vector signed long long __b) { |
| 7411 | #ifdef __LITTLE_ENDIAN__ |
| 7412 | return (vector signed int)vec_perm( |
| 7413 | __a, __b, |
| 7414 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7415 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7416 | #else |
| 7417 | return (vector signed int)vec_perm( |
| 7418 | __a, __b, |
| 7419 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7420 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7421 | #endif |
| 7422 | } |
| 7423 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7424 | vec_pack(vector unsigned long long __a, vector unsigned long long __b) { |
| 7425 | #ifdef __LITTLE_ENDIAN__ |
| 7426 | return (vector unsigned int)vec_perm( |
| 7427 | __a, __b, |
| 7428 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7429 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7430 | #else |
| 7431 | return (vector unsigned int)vec_perm( |
| 7432 | __a, __b, |
| 7433 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7434 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7435 | #endif |
| 7436 | } |
| 7437 | |
| 7438 | static __inline__ vector bool int __ATTRS_o_ai |
| 7439 | vec_pack(vector bool long long __a, vector bool long long __b) { |
| 7440 | #ifdef __LITTLE_ENDIAN__ |
| 7441 | return (vector bool int)vec_perm( |
| 7442 | __a, __b, |
| 7443 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7444 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7445 | #else |
| 7446 | return (vector bool int)vec_perm( |
| 7447 | __a, __b, |
| 7448 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7449 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7450 | #endif |
| 7451 | } |
| 7452 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 7453 | static __inline__ vector float __ATTRS_o_ai |
| 7454 | vec_pack(vector double __a, vector double __b) { |
| 7455 | return (vector float) (__a[0], __a[1], __b[0], __b[1]); |
| 7456 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 7457 | #endif |
| 7458 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 7459 | #ifdef __POWER9_VECTOR__ |
| 7460 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7461 | vec_pack_to_short_fp32(vector float __a, vector float __b) { |
| 7462 | vector float __resa = __builtin_vsx_xvcvsphp(__a); |
| 7463 | vector float __resb = __builtin_vsx_xvcvsphp(__b); |
| 7464 | #ifdef __LITTLE_ENDIAN__ |
| 7465 | return (vector unsigned short)vec_mergee(__resa, __resb); |
| 7466 | #else |
| 7467 | return (vector unsigned short)vec_mergeo(__resa, __resb); |
| 7468 | #endif |
| 7469 | } |
| 7470 | |
| 7471 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 7472 | /* vec_vpkuhum */ |
| 7473 | |
| 7474 | #define __builtin_altivec_vpkuhum vec_vpkuhum |
| 7475 | |
| 7476 | static __inline__ vector signed char __ATTRS_o_ai |
| 7477 | vec_vpkuhum(vector signed short __a, vector signed short __b) { |
| 7478 | #ifdef __LITTLE_ENDIAN__ |
| 7479 | return (vector signed char)vec_perm( |
| 7480 | __a, __b, |
| 7481 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7482 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7483 | #else |
| 7484 | return (vector signed char)vec_perm( |
| 7485 | __a, __b, |
| 7486 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7487 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7488 | #endif |
| 7489 | } |
| 7490 | |
| 7491 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7492 | vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { |
| 7493 | #ifdef __LITTLE_ENDIAN__ |
| 7494 | return (vector unsigned char)vec_perm( |
| 7495 | __a, __b, |
| 7496 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7497 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7498 | #else |
| 7499 | return (vector unsigned char)vec_perm( |
| 7500 | __a, __b, |
| 7501 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7502 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7503 | #endif |
| 7504 | } |
| 7505 | |
| 7506 | static __inline__ vector bool char __ATTRS_o_ai |
| 7507 | vec_vpkuhum(vector bool short __a, vector bool short __b) { |
| 7508 | #ifdef __LITTLE_ENDIAN__ |
| 7509 | return (vector bool char)vec_perm( |
| 7510 | __a, __b, |
| 7511 | (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, |
| 7512 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); |
| 7513 | #else |
| 7514 | return (vector bool char)vec_perm( |
| 7515 | __a, __b, |
| 7516 | (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 7517 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 7518 | #endif |
| 7519 | } |
| 7520 | |
| 7521 | /* vec_vpkuwum */ |
| 7522 | |
| 7523 | #define __builtin_altivec_vpkuwum vec_vpkuwum |
| 7524 | |
| 7525 | static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, |
| 7526 | vector int __b) { |
| 7527 | #ifdef __LITTLE_ENDIAN__ |
| 7528 | return (vector short)vec_perm( |
| 7529 | __a, __b, |
| 7530 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7531 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7532 | #else |
| 7533 | return (vector short)vec_perm( |
| 7534 | __a, __b, |
| 7535 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7536 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7537 | #endif |
| 7538 | } |
| 7539 | |
| 7540 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7541 | vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { |
| 7542 | #ifdef __LITTLE_ENDIAN__ |
| 7543 | return (vector unsigned short)vec_perm( |
| 7544 | __a, __b, |
| 7545 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7546 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7547 | #else |
| 7548 | return (vector unsigned short)vec_perm( |
| 7549 | __a, __b, |
| 7550 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7551 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7552 | #endif |
| 7553 | } |
| 7554 | |
| 7555 | static __inline__ vector bool short __ATTRS_o_ai |
| 7556 | vec_vpkuwum(vector bool int __a, vector bool int __b) { |
| 7557 | #ifdef __LITTLE_ENDIAN__ |
| 7558 | return (vector bool short)vec_perm( |
| 7559 | __a, __b, |
| 7560 | (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, |
| 7561 | 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); |
| 7562 | #else |
| 7563 | return (vector bool short)vec_perm( |
| 7564 | __a, __b, |
| 7565 | (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 7566 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 7567 | #endif |
| 7568 | } |
| 7569 | |
| 7570 | /* vec_vpkudum */ |
| 7571 | |
| 7572 | #ifdef __POWER8_VECTOR__ |
| 7573 | #define __builtin_altivec_vpkudum vec_vpkudum |
| 7574 | |
| 7575 | static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, |
| 7576 | vector long long __b) { |
| 7577 | #ifdef __LITTLE_ENDIAN__ |
| 7578 | return (vector int)vec_perm( |
| 7579 | __a, __b, |
| 7580 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7581 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7582 | #else |
| 7583 | return (vector int)vec_perm( |
| 7584 | __a, __b, |
| 7585 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7586 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7587 | #endif |
| 7588 | } |
| 7589 | |
| 7590 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7591 | vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { |
| 7592 | #ifdef __LITTLE_ENDIAN__ |
| 7593 | return (vector unsigned int)vec_perm( |
| 7594 | __a, __b, |
| 7595 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7596 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7597 | #else |
| 7598 | return (vector unsigned int)vec_perm( |
| 7599 | __a, __b, |
| 7600 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7601 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7602 | #endif |
| 7603 | } |
| 7604 | |
| 7605 | static __inline__ vector bool int __ATTRS_o_ai |
| 7606 | vec_vpkudum(vector bool long long __a, vector bool long long __b) { |
| 7607 | #ifdef __LITTLE_ENDIAN__ |
| 7608 | return (vector bool int)vec_perm( |
| 7609 | (vector long long)__a, (vector long long)__b, |
| 7610 | (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, |
| 7611 | 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); |
| 7612 | #else |
| 7613 | return (vector bool int)vec_perm( |
| 7614 | (vector long long)__a, (vector long long)__b, |
| 7615 | (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, |
| 7616 | 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 7617 | #endif |
| 7618 | } |
| 7619 | #endif |
| 7620 | |
| 7621 | /* vec_packpx */ |
| 7622 | |
| 7623 | static __inline__ vector pixel __attribute__((__always_inline__)) |
| 7624 | vec_packpx(vector unsigned int __a, vector unsigned int __b) { |
| 7625 | #ifdef __LITTLE_ENDIAN__ |
| 7626 | return (vector pixel)__builtin_altivec_vpkpx(__b, __a); |
| 7627 | #else |
| 7628 | return (vector pixel)__builtin_altivec_vpkpx(__a, __b); |
| 7629 | #endif |
| 7630 | } |
| 7631 | |
| 7632 | /* vec_vpkpx */ |
| 7633 | |
| 7634 | static __inline__ vector pixel __attribute__((__always_inline__)) |
| 7635 | vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { |
| 7636 | #ifdef __LITTLE_ENDIAN__ |
| 7637 | return (vector pixel)__builtin_altivec_vpkpx(__b, __a); |
| 7638 | #else |
| 7639 | return (vector pixel)__builtin_altivec_vpkpx(__a, __b); |
| 7640 | #endif |
| 7641 | } |
| 7642 | |
| 7643 | /* vec_packs */ |
| 7644 | |
| 7645 | static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, |
| 7646 | vector short __b) { |
| 7647 | #ifdef __LITTLE_ENDIAN__ |
| 7648 | return __builtin_altivec_vpkshss(__b, __a); |
| 7649 | #else |
| 7650 | return __builtin_altivec_vpkshss(__a, __b); |
| 7651 | #endif |
| 7652 | } |
| 7653 | |
| 7654 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7655 | vec_packs(vector unsigned short __a, vector unsigned short __b) { |
| 7656 | #ifdef __LITTLE_ENDIAN__ |
| 7657 | return __builtin_altivec_vpkuhus(__b, __a); |
| 7658 | #else |
| 7659 | return __builtin_altivec_vpkuhus(__a, __b); |
| 7660 | #endif |
| 7661 | } |
| 7662 | |
| 7663 | static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, |
| 7664 | vector int __b) { |
| 7665 | #ifdef __LITTLE_ENDIAN__ |
| 7666 | return __builtin_altivec_vpkswss(__b, __a); |
| 7667 | #else |
| 7668 | return __builtin_altivec_vpkswss(__a, __b); |
| 7669 | #endif |
| 7670 | } |
| 7671 | |
| 7672 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7673 | vec_packs(vector unsigned int __a, vector unsigned int __b) { |
| 7674 | #ifdef __LITTLE_ENDIAN__ |
| 7675 | return __builtin_altivec_vpkuwus(__b, __a); |
| 7676 | #else |
| 7677 | return __builtin_altivec_vpkuwus(__a, __b); |
| 7678 | #endif |
| 7679 | } |
| 7680 | |
| 7681 | #ifdef __POWER8_VECTOR__ |
| 7682 | static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, |
| 7683 | vector long long __b) { |
| 7684 | #ifdef __LITTLE_ENDIAN__ |
| 7685 | return __builtin_altivec_vpksdss(__b, __a); |
| 7686 | #else |
| 7687 | return __builtin_altivec_vpksdss(__a, __b); |
| 7688 | #endif |
| 7689 | } |
| 7690 | |
| 7691 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7692 | vec_packs(vector unsigned long long __a, vector unsigned long long __b) { |
| 7693 | #ifdef __LITTLE_ENDIAN__ |
| 7694 | return __builtin_altivec_vpkudus(__b, __a); |
| 7695 | #else |
| 7696 | return __builtin_altivec_vpkudus(__a, __b); |
| 7697 | #endif |
| 7698 | } |
| 7699 | #endif |
| 7700 | |
| 7701 | /* vec_vpkshss */ |
| 7702 | |
| 7703 | static __inline__ vector signed char __attribute__((__always_inline__)) |
| 7704 | vec_vpkshss(vector short __a, vector short __b) { |
| 7705 | #ifdef __LITTLE_ENDIAN__ |
| 7706 | return __builtin_altivec_vpkshss(__b, __a); |
| 7707 | #else |
| 7708 | return __builtin_altivec_vpkshss(__a, __b); |
| 7709 | #endif |
| 7710 | } |
| 7711 | |
| 7712 | /* vec_vpksdss */ |
| 7713 | |
| 7714 | #ifdef __POWER8_VECTOR__ |
| 7715 | static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, |
| 7716 | vector long long __b) { |
| 7717 | #ifdef __LITTLE_ENDIAN__ |
| 7718 | return __builtin_altivec_vpksdss(__b, __a); |
| 7719 | #else |
| 7720 | return __builtin_altivec_vpksdss(__a, __b); |
| 7721 | #endif |
| 7722 | } |
| 7723 | #endif |
| 7724 | |
| 7725 | /* vec_vpkuhus */ |
| 7726 | |
| 7727 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 7728 | vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { |
| 7729 | #ifdef __LITTLE_ENDIAN__ |
| 7730 | return __builtin_altivec_vpkuhus(__b, __a); |
| 7731 | #else |
| 7732 | return __builtin_altivec_vpkuhus(__a, __b); |
| 7733 | #endif |
| 7734 | } |
| 7735 | |
| 7736 | /* vec_vpkudus */ |
| 7737 | |
| 7738 | #ifdef __POWER8_VECTOR__ |
| 7739 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 7740 | vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { |
| 7741 | #ifdef __LITTLE_ENDIAN__ |
| 7742 | return __builtin_altivec_vpkudus(__b, __a); |
| 7743 | #else |
| 7744 | return __builtin_altivec_vpkudus(__a, __b); |
| 7745 | #endif |
| 7746 | } |
| 7747 | #endif |
| 7748 | |
| 7749 | /* vec_vpkswss */ |
| 7750 | |
| 7751 | static __inline__ vector signed short __attribute__((__always_inline__)) |
| 7752 | vec_vpkswss(vector int __a, vector int __b) { |
| 7753 | #ifdef __LITTLE_ENDIAN__ |
| 7754 | return __builtin_altivec_vpkswss(__b, __a); |
| 7755 | #else |
| 7756 | return __builtin_altivec_vpkswss(__a, __b); |
| 7757 | #endif |
| 7758 | } |
| 7759 | |
| 7760 | /* vec_vpkuwus */ |
| 7761 | |
| 7762 | static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| 7763 | vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { |
| 7764 | #ifdef __LITTLE_ENDIAN__ |
| 7765 | return __builtin_altivec_vpkuwus(__b, __a); |
| 7766 | #else |
| 7767 | return __builtin_altivec_vpkuwus(__a, __b); |
| 7768 | #endif |
| 7769 | } |
| 7770 | |
| 7771 | /* vec_packsu */ |
| 7772 | |
| 7773 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7774 | vec_packsu(vector short __a, vector short __b) { |
| 7775 | #ifdef __LITTLE_ENDIAN__ |
| 7776 | return __builtin_altivec_vpkshus(__b, __a); |
| 7777 | #else |
| 7778 | return __builtin_altivec_vpkshus(__a, __b); |
| 7779 | #endif |
| 7780 | } |
| 7781 | |
| 7782 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7783 | vec_packsu(vector unsigned short __a, vector unsigned short __b) { |
| 7784 | #ifdef __LITTLE_ENDIAN__ |
| 7785 | return __builtin_altivec_vpkuhus(__b, __a); |
| 7786 | #else |
| 7787 | return __builtin_altivec_vpkuhus(__a, __b); |
| 7788 | #endif |
| 7789 | } |
| 7790 | |
| 7791 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7792 | vec_packsu(vector int __a, vector int __b) { |
| 7793 | #ifdef __LITTLE_ENDIAN__ |
| 7794 | return __builtin_altivec_vpkswus(__b, __a); |
| 7795 | #else |
| 7796 | return __builtin_altivec_vpkswus(__a, __b); |
| 7797 | #endif |
| 7798 | } |
| 7799 | |
| 7800 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7801 | vec_packsu(vector unsigned int __a, vector unsigned int __b) { |
| 7802 | #ifdef __LITTLE_ENDIAN__ |
| 7803 | return __builtin_altivec_vpkuwus(__b, __a); |
| 7804 | #else |
| 7805 | return __builtin_altivec_vpkuwus(__a, __b); |
| 7806 | #endif |
| 7807 | } |
| 7808 | |
| 7809 | #ifdef __POWER8_VECTOR__ |
| 7810 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7811 | vec_packsu(vector long long __a, vector long long __b) { |
| 7812 | #ifdef __LITTLE_ENDIAN__ |
| 7813 | return __builtin_altivec_vpksdus(__b, __a); |
| 7814 | #else |
| 7815 | return __builtin_altivec_vpksdus(__a, __b); |
| 7816 | #endif |
| 7817 | } |
| 7818 | |
| 7819 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7820 | vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { |
| 7821 | #ifdef __LITTLE_ENDIAN__ |
| 7822 | return __builtin_altivec_vpkudus(__b, __a); |
| 7823 | #else |
| 7824 | return __builtin_altivec_vpkudus(__a, __b); |
| 7825 | #endif |
| 7826 | } |
| 7827 | #endif |
| 7828 | |
| 7829 | /* vec_vpkshus */ |
| 7830 | |
| 7831 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7832 | vec_vpkshus(vector short __a, vector short __b) { |
| 7833 | #ifdef __LITTLE_ENDIAN__ |
| 7834 | return __builtin_altivec_vpkshus(__b, __a); |
| 7835 | #else |
| 7836 | return __builtin_altivec_vpkshus(__a, __b); |
| 7837 | #endif |
| 7838 | } |
| 7839 | |
| 7840 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7841 | vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { |
| 7842 | #ifdef __LITTLE_ENDIAN__ |
| 7843 | return __builtin_altivec_vpkuhus(__b, __a); |
| 7844 | #else |
| 7845 | return __builtin_altivec_vpkuhus(__a, __b); |
| 7846 | #endif |
| 7847 | } |
| 7848 | |
| 7849 | /* vec_vpkswus */ |
| 7850 | |
| 7851 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7852 | vec_vpkswus(vector int __a, vector int __b) { |
| 7853 | #ifdef __LITTLE_ENDIAN__ |
| 7854 | return __builtin_altivec_vpkswus(__b, __a); |
| 7855 | #else |
| 7856 | return __builtin_altivec_vpkswus(__a, __b); |
| 7857 | #endif |
| 7858 | } |
| 7859 | |
| 7860 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7861 | vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { |
| 7862 | #ifdef __LITTLE_ENDIAN__ |
| 7863 | return __builtin_altivec_vpkuwus(__b, __a); |
| 7864 | #else |
| 7865 | return __builtin_altivec_vpkuwus(__a, __b); |
| 7866 | #endif |
| 7867 | } |
| 7868 | |
| 7869 | /* vec_vpksdus */ |
| 7870 | |
| 7871 | #ifdef __POWER8_VECTOR__ |
| 7872 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 7873 | vec_vpksdus(vector long long __a, vector long long __b) { |
| 7874 | #ifdef __LITTLE_ENDIAN__ |
| 7875 | return __builtin_altivec_vpksdus(__b, __a); |
| 7876 | #else |
| 7877 | return __builtin_altivec_vpksdus(__a, __b); |
| 7878 | #endif |
| 7879 | } |
| 7880 | #endif |
| 7881 | |
| 7882 | /* vec_perm */ |
| 7883 | |
| 7884 | // The vperm instruction is defined architecturally with a big-endian bias. |
| 7885 | // For little endian, we swap the input operands and invert the permute |
| 7886 | // control vector. Only the rightmost 5 bits matter, so we could use |
| 7887 | // a vector of all 31s instead of all 255s to perform the inversion. |
| 7888 | // However, when the PCV is not a constant, using 255 has an advantage |
| 7889 | // in that the vec_xor can be recognized as a vec_nor (and for P8 and |
| 7890 | // later, possibly a vec_nand). |
| 7891 | |
| 7892 | static __inline__ vector signed char __ATTRS_o_ai vec_perm( |
| 7893 | vector signed char __a, vector signed char __b, vector unsigned char __c) { |
| 7894 | #ifdef __LITTLE_ENDIAN__ |
| 7895 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7896 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7897 | __d = vec_xor(__c, __d); |
| 7898 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, |
| 7899 | (vector int)__a, __d); |
| 7900 | #else |
| 7901 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, |
| 7902 | (vector int)__b, __c); |
| 7903 | #endif |
| 7904 | } |
| 7905 | |
| 7906 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 7907 | vec_perm(vector unsigned char __a, vector unsigned char __b, |
| 7908 | vector unsigned char __c) { |
| 7909 | #ifdef __LITTLE_ENDIAN__ |
| 7910 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7911 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7912 | __d = vec_xor(__c, __d); |
| 7913 | return (vector unsigned char)__builtin_altivec_vperm_4si( |
| 7914 | (vector int)__b, (vector int)__a, __d); |
| 7915 | #else |
| 7916 | return (vector unsigned char)__builtin_altivec_vperm_4si( |
| 7917 | (vector int)__a, (vector int)__b, __c); |
| 7918 | #endif |
| 7919 | } |
| 7920 | |
| 7921 | static __inline__ vector bool char __ATTRS_o_ai |
| 7922 | vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { |
| 7923 | #ifdef __LITTLE_ENDIAN__ |
| 7924 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7925 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7926 | __d = vec_xor(__c, __d); |
| 7927 | return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, |
| 7928 | (vector int)__a, __d); |
| 7929 | #else |
| 7930 | return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, |
| 7931 | (vector int)__b, __c); |
| 7932 | #endif |
| 7933 | } |
| 7934 | |
| 7935 | static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, |
| 7936 | vector signed short __b, |
| 7937 | vector unsigned char __c) { |
| 7938 | #ifdef __LITTLE_ENDIAN__ |
| 7939 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7940 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7941 | __d = vec_xor(__c, __d); |
| 7942 | return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, |
| 7943 | (vector int)__a, __d); |
| 7944 | #else |
| 7945 | return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, |
| 7946 | (vector int)__b, __c); |
| 7947 | #endif |
| 7948 | } |
| 7949 | |
| 7950 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 7951 | vec_perm(vector unsigned short __a, vector unsigned short __b, |
| 7952 | vector unsigned char __c) { |
| 7953 | #ifdef __LITTLE_ENDIAN__ |
| 7954 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7955 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7956 | __d = vec_xor(__c, __d); |
| 7957 | return (vector unsigned short)__builtin_altivec_vperm_4si( |
| 7958 | (vector int)__b, (vector int)__a, __d); |
| 7959 | #else |
| 7960 | return (vector unsigned short)__builtin_altivec_vperm_4si( |
| 7961 | (vector int)__a, (vector int)__b, __c); |
| 7962 | #endif |
| 7963 | } |
| 7964 | |
| 7965 | static __inline__ vector bool short __ATTRS_o_ai vec_perm( |
| 7966 | vector bool short __a, vector bool short __b, vector unsigned char __c) { |
| 7967 | #ifdef __LITTLE_ENDIAN__ |
| 7968 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7969 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7970 | __d = vec_xor(__c, __d); |
| 7971 | return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, |
| 7972 | (vector int)__a, __d); |
| 7973 | #else |
| 7974 | return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, |
| 7975 | (vector int)__b, __c); |
| 7976 | #endif |
| 7977 | } |
| 7978 | |
| 7979 | static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, |
| 7980 | vector pixel __b, |
| 7981 | vector unsigned char __c) { |
| 7982 | #ifdef __LITTLE_ENDIAN__ |
| 7983 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7984 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 7985 | __d = vec_xor(__c, __d); |
| 7986 | return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, |
| 7987 | (vector int)__a, __d); |
| 7988 | #else |
| 7989 | return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, |
| 7990 | (vector int)__b, __c); |
| 7991 | #endif |
| 7992 | } |
| 7993 | |
| 7994 | static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, |
| 7995 | vector signed int __b, |
| 7996 | vector unsigned char __c) { |
| 7997 | #ifdef __LITTLE_ENDIAN__ |
| 7998 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 7999 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8000 | __d = vec_xor(__c, __d); |
| 8001 | return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); |
| 8002 | #else |
| 8003 | return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); |
| 8004 | #endif |
| 8005 | } |
| 8006 | |
| 8007 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8008 | vec_perm(vector unsigned int __a, vector unsigned int __b, |
| 8009 | vector unsigned char __c) { |
| 8010 | #ifdef __LITTLE_ENDIAN__ |
| 8011 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8012 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8013 | __d = vec_xor(__c, __d); |
| 8014 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, |
| 8015 | (vector int)__a, __d); |
| 8016 | #else |
| 8017 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, |
| 8018 | (vector int)__b, __c); |
| 8019 | #endif |
| 8020 | } |
| 8021 | |
| 8022 | static __inline__ vector bool int __ATTRS_o_ai |
| 8023 | vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { |
| 8024 | #ifdef __LITTLE_ENDIAN__ |
| 8025 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8026 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8027 | __d = vec_xor(__c, __d); |
| 8028 | return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, |
| 8029 | (vector int)__a, __d); |
| 8030 | #else |
| 8031 | return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, |
| 8032 | (vector int)__b, __c); |
| 8033 | #endif |
| 8034 | } |
| 8035 | |
| 8036 | static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, |
| 8037 | vector float __b, |
| 8038 | vector unsigned char __c) { |
| 8039 | #ifdef __LITTLE_ENDIAN__ |
| 8040 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8041 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8042 | __d = vec_xor(__c, __d); |
| 8043 | return (vector float)__builtin_altivec_vperm_4si((vector int)__b, |
| 8044 | (vector int)__a, __d); |
| 8045 | #else |
| 8046 | return (vector float)__builtin_altivec_vperm_4si((vector int)__a, |
| 8047 | (vector int)__b, __c); |
| 8048 | #endif |
| 8049 | } |
| 8050 | |
| 8051 | #ifdef __VSX__ |
| 8052 | static __inline__ vector long long __ATTRS_o_ai |
| 8053 | vec_perm(vector signed long long __a, vector signed long long __b, |
| 8054 | vector unsigned char __c) { |
| 8055 | #ifdef __LITTLE_ENDIAN__ |
| 8056 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8057 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8058 | __d = vec_xor(__c, __d); |
| 8059 | return (vector signed long long)__builtin_altivec_vperm_4si( |
| 8060 | (vector int)__b, (vector int)__a, __d); |
| 8061 | #else |
| 8062 | return (vector signed long long)__builtin_altivec_vperm_4si( |
| 8063 | (vector int)__a, (vector int)__b, __c); |
| 8064 | #endif |
| 8065 | } |
| 8066 | |
| 8067 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8068 | vec_perm(vector unsigned long long __a, vector unsigned long long __b, |
| 8069 | vector unsigned char __c) { |
| 8070 | #ifdef __LITTLE_ENDIAN__ |
| 8071 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8072 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8073 | __d = vec_xor(__c, __d); |
| 8074 | return (vector unsigned long long)__builtin_altivec_vperm_4si( |
| 8075 | (vector int)__b, (vector int)__a, __d); |
| 8076 | #else |
| 8077 | return (vector unsigned long long)__builtin_altivec_vperm_4si( |
| 8078 | (vector int)__a, (vector int)__b, __c); |
| 8079 | #endif |
| 8080 | } |
| 8081 | |
| 8082 | static __inline__ vector bool long long __ATTRS_o_ai |
| 8083 | vec_perm(vector bool long long __a, vector bool long long __b, |
| 8084 | vector unsigned char __c) { |
| 8085 | #ifdef __LITTLE_ENDIAN__ |
| 8086 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8087 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8088 | __d = vec_xor(__c, __d); |
| 8089 | return (vector bool long long)__builtin_altivec_vperm_4si( |
| 8090 | (vector int)__b, (vector int)__a, __d); |
| 8091 | #else |
| 8092 | return (vector bool long long)__builtin_altivec_vperm_4si( |
| 8093 | (vector int)__a, (vector int)__b, __c); |
| 8094 | #endif |
| 8095 | } |
| 8096 | |
| 8097 | static __inline__ vector double __ATTRS_o_ai |
| 8098 | vec_perm(vector double __a, vector double __b, vector unsigned char __c) { |
| 8099 | #ifdef __LITTLE_ENDIAN__ |
| 8100 | vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, |
| 8101 | 255, 255, 255, 255, 255, 255, 255, 255}; |
| 8102 | __d = vec_xor(__c, __d); |
| 8103 | return (vector double)__builtin_altivec_vperm_4si((vector int)__b, |
| 8104 | (vector int)__a, __d); |
| 8105 | #else |
| 8106 | return (vector double)__builtin_altivec_vperm_4si((vector int)__a, |
| 8107 | (vector int)__b, __c); |
| 8108 | #endif |
| 8109 | } |
| 8110 | #endif |
| 8111 | |
| 8112 | /* vec_vperm */ |
| 8113 | |
| 8114 | static __inline__ vector signed char __ATTRS_o_ai vec_vperm( |
| 8115 | vector signed char __a, vector signed char __b, vector unsigned char __c) { |
| 8116 | return vec_perm(__a, __b, __c); |
| 8117 | } |
| 8118 | |
| 8119 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8120 | vec_vperm(vector unsigned char __a, vector unsigned char __b, |
| 8121 | vector unsigned char __c) { |
| 8122 | return vec_perm(__a, __b, __c); |
| 8123 | } |
| 8124 | |
| 8125 | static __inline__ vector bool char __ATTRS_o_ai vec_vperm( |
| 8126 | vector bool char __a, vector bool char __b, vector unsigned char __c) { |
| 8127 | return vec_perm(__a, __b, __c); |
| 8128 | } |
| 8129 | |
| 8130 | static __inline__ vector short __ATTRS_o_ai |
| 8131 | vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { |
| 8132 | return vec_perm(__a, __b, __c); |
| 8133 | } |
| 8134 | |
| 8135 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8136 | vec_vperm(vector unsigned short __a, vector unsigned short __b, |
| 8137 | vector unsigned char __c) { |
| 8138 | return vec_perm(__a, __b, __c); |
| 8139 | } |
| 8140 | |
| 8141 | static __inline__ vector bool short __ATTRS_o_ai vec_vperm( |
| 8142 | vector bool short __a, vector bool short __b, vector unsigned char __c) { |
| 8143 | return vec_perm(__a, __b, __c); |
| 8144 | } |
| 8145 | |
| 8146 | static __inline__ vector pixel __ATTRS_o_ai |
| 8147 | vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { |
| 8148 | return vec_perm(__a, __b, __c); |
| 8149 | } |
| 8150 | |
| 8151 | static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, |
| 8152 | vector int __b, |
| 8153 | vector unsigned char __c) { |
| 8154 | return vec_perm(__a, __b, __c); |
| 8155 | } |
| 8156 | |
| 8157 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8158 | vec_vperm(vector unsigned int __a, vector unsigned int __b, |
| 8159 | vector unsigned char __c) { |
| 8160 | return vec_perm(__a, __b, __c); |
| 8161 | } |
| 8162 | |
| 8163 | static __inline__ vector bool int __ATTRS_o_ai |
| 8164 | vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { |
| 8165 | return vec_perm(__a, __b, __c); |
| 8166 | } |
| 8167 | |
| 8168 | static __inline__ vector float __ATTRS_o_ai |
| 8169 | vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { |
| 8170 | return vec_perm(__a, __b, __c); |
| 8171 | } |
| 8172 | |
| 8173 | #ifdef __VSX__ |
| 8174 | static __inline__ vector long long __ATTRS_o_ai vec_vperm( |
| 8175 | vector long long __a, vector long long __b, vector unsigned char __c) { |
| 8176 | return vec_perm(__a, __b, __c); |
| 8177 | } |
| 8178 | |
| 8179 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8180 | vec_vperm(vector unsigned long long __a, vector unsigned long long __b, |
| 8181 | vector unsigned char __c) { |
| 8182 | return vec_perm(__a, __b, __c); |
| 8183 | } |
| 8184 | |
| 8185 | static __inline__ vector double __ATTRS_o_ai |
| 8186 | vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { |
| 8187 | return vec_perm(__a, __b, __c); |
| 8188 | } |
| 8189 | #endif |
| 8190 | |
| 8191 | /* vec_re */ |
| 8192 | |
| 8193 | static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { |
| 8194 | #ifdef __VSX__ |
| 8195 | return __builtin_vsx_xvresp(__a); |
| 8196 | #else |
| 8197 | return __builtin_altivec_vrefp(__a); |
| 8198 | #endif |
| 8199 | } |
| 8200 | |
| 8201 | #ifdef __VSX__ |
| 8202 | static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { |
| 8203 | return __builtin_vsx_xvredp(__a); |
| 8204 | } |
| 8205 | #endif |
| 8206 | |
| 8207 | /* vec_vrefp */ |
| 8208 | |
| 8209 | static __inline__ vector float __attribute__((__always_inline__)) |
| 8210 | vec_vrefp(vector float __a) { |
| 8211 | return __builtin_altivec_vrefp(__a); |
| 8212 | } |
| 8213 | |
| 8214 | /* vec_rl */ |
| 8215 | |
| 8216 | static __inline__ vector signed char __ATTRS_o_ai |
| 8217 | vec_rl(vector signed char __a, vector unsigned char __b) { |
| 8218 | return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); |
| 8219 | } |
| 8220 | |
| 8221 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8222 | vec_rl(vector unsigned char __a, vector unsigned char __b) { |
| 8223 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); |
| 8224 | } |
| 8225 | |
| 8226 | static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, |
| 8227 | vector unsigned short __b) { |
| 8228 | return __builtin_altivec_vrlh(__a, __b); |
| 8229 | } |
| 8230 | |
| 8231 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8232 | vec_rl(vector unsigned short __a, vector unsigned short __b) { |
| 8233 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); |
| 8234 | } |
| 8235 | |
| 8236 | static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, |
| 8237 | vector unsigned int __b) { |
| 8238 | return __builtin_altivec_vrlw(__a, __b); |
| 8239 | } |
| 8240 | |
| 8241 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8242 | vec_rl(vector unsigned int __a, vector unsigned int __b) { |
| 8243 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); |
| 8244 | } |
| 8245 | |
| 8246 | #ifdef __POWER8_VECTOR__ |
| 8247 | static __inline__ vector signed long long __ATTRS_o_ai |
| 8248 | vec_rl(vector signed long long __a, vector unsigned long long __b) { |
| 8249 | return __builtin_altivec_vrld(__a, __b); |
| 8250 | } |
| 8251 | |
| 8252 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8253 | vec_rl(vector unsigned long long __a, vector unsigned long long __b) { |
| 8254 | return __builtin_altivec_vrld(__a, __b); |
| 8255 | } |
| 8256 | #endif |
| 8257 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8258 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8259 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 8260 | vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { |
| 8261 | return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); |
| 8262 | } |
| 8263 | |
| 8264 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 8265 | vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 8266 | return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); |
| 8267 | } |
| 8268 | #endif |
| 8269 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8270 | /* vec_rlmi */ |
| 8271 | #ifdef __POWER9_VECTOR__ |
| 8272 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8273 | vec_rlmi(vector unsigned int __a, vector unsigned int __b, |
| 8274 | vector unsigned int __c) { |
| 8275 | return __builtin_altivec_vrlwmi(__a, __c, __b); |
| 8276 | } |
| 8277 | |
| 8278 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8279 | vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, |
| 8280 | vector unsigned long long __c) { |
| 8281 | return __builtin_altivec_vrldmi(__a, __c, __b); |
| 8282 | } |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8283 | #endif |
| 8284 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8285 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8286 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 8287 | vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 8288 | vector unsigned __int128 __c) { |
| 8289 | return __builtin_altivec_vrlqmi(__a, __c, __b); |
| 8290 | } |
| 8291 | |
| 8292 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 8293 | vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, |
| 8294 | vector signed __int128 __c) { |
| 8295 | return __builtin_altivec_vrlqmi(__a, __c, __b); |
| 8296 | } |
| 8297 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8298 | |
| 8299 | /* vec_rlnm */ |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8300 | #ifdef __POWER9_VECTOR__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8301 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8302 | vec_rlnm(vector unsigned int __a, vector unsigned int __b, |
| 8303 | vector unsigned int __c) { |
| 8304 | vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; |
| 8305 | return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); |
| 8306 | } |
| 8307 | |
| 8308 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8309 | vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, |
| 8310 | vector unsigned long long __c) { |
| 8311 | vector unsigned long long OneByte = { 0x8, 0x8 }; |
| 8312 | return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); |
| 8313 | } |
| 8314 | #endif |
| 8315 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8316 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8317 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 8318 | vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 8319 | vector unsigned __int128 __c) { |
| 8320 | // Merge __b and __c using an appropriate shuffle. |
| 8321 | vector unsigned char TmpB = (vector unsigned char)__b; |
| 8322 | vector unsigned char TmpC = (vector unsigned char)__c; |
| 8323 | vector unsigned char MaskAndShift = |
| 8324 | #ifdef __LITTLE_ENDIAN__ |
| 8325 | __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, |
| 8326 | 1, -1, -1, -1, -1, -1); |
| 8327 | #else |
| 8328 | __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, |
| 8329 | -1, -1, -1, -1, -1, -1, -1); |
| 8330 | #endif |
| 8331 | return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); |
| 8332 | } |
| 8333 | |
| 8334 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 8335 | vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, |
| 8336 | vector signed __int128 __c) { |
| 8337 | // Merge __b and __c using an appropriate shuffle. |
| 8338 | vector unsigned char TmpB = (vector unsigned char)__b; |
| 8339 | vector unsigned char TmpC = (vector unsigned char)__c; |
| 8340 | vector unsigned char MaskAndShift = |
| 8341 | #ifdef __LITTLE_ENDIAN__ |
| 8342 | __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, |
| 8343 | 1, -1, -1, -1, -1, -1); |
| 8344 | #else |
| 8345 | __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, |
| 8346 | -1, -1, -1, -1, -1, -1, -1); |
| 8347 | #endif |
| 8348 | return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); |
| 8349 | } |
| 8350 | #endif |
| 8351 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8352 | /* vec_vrlb */ |
| 8353 | |
| 8354 | static __inline__ vector signed char __ATTRS_o_ai |
| 8355 | vec_vrlb(vector signed char __a, vector unsigned char __b) { |
| 8356 | return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); |
| 8357 | } |
| 8358 | |
| 8359 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8360 | vec_vrlb(vector unsigned char __a, vector unsigned char __b) { |
| 8361 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); |
| 8362 | } |
| 8363 | |
| 8364 | /* vec_vrlh */ |
| 8365 | |
| 8366 | static __inline__ vector short __ATTRS_o_ai |
| 8367 | vec_vrlh(vector short __a, vector unsigned short __b) { |
| 8368 | return __builtin_altivec_vrlh(__a, __b); |
| 8369 | } |
| 8370 | |
| 8371 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8372 | vec_vrlh(vector unsigned short __a, vector unsigned short __b) { |
| 8373 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); |
| 8374 | } |
| 8375 | |
| 8376 | /* vec_vrlw */ |
| 8377 | |
| 8378 | static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, |
| 8379 | vector unsigned int __b) { |
| 8380 | return __builtin_altivec_vrlw(__a, __b); |
| 8381 | } |
| 8382 | |
| 8383 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8384 | vec_vrlw(vector unsigned int __a, vector unsigned int __b) { |
| 8385 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); |
| 8386 | } |
| 8387 | |
| 8388 | /* vec_round */ |
| 8389 | |
| 8390 | static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8391 | return __builtin_altivec_vrfin(__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8392 | } |
| 8393 | |
| 8394 | #ifdef __VSX__ |
| 8395 | static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { |
| 8396 | return __builtin_vsx_xvrdpi(__a); |
| 8397 | } |
| 8398 | |
| 8399 | /* vec_rint */ |
| 8400 | |
| 8401 | static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { |
| 8402 | return __builtin_vsx_xvrspic(__a); |
| 8403 | } |
| 8404 | |
| 8405 | static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { |
| 8406 | return __builtin_vsx_xvrdpic(__a); |
| 8407 | } |
| 8408 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8409 | /* vec_roundc */ |
| 8410 | |
| 8411 | static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { |
| 8412 | return __builtin_vsx_xvrspic(__a); |
| 8413 | } |
| 8414 | |
| 8415 | static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { |
| 8416 | return __builtin_vsx_xvrdpic(__a); |
| 8417 | } |
| 8418 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8419 | /* vec_nearbyint */ |
| 8420 | |
| 8421 | static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { |
| 8422 | return __builtin_vsx_xvrspi(__a); |
| 8423 | } |
| 8424 | |
| 8425 | static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { |
| 8426 | return __builtin_vsx_xvrdpi(__a); |
| 8427 | } |
| 8428 | #endif |
| 8429 | |
| 8430 | /* vec_vrfin */ |
| 8431 | |
| 8432 | static __inline__ vector float __attribute__((__always_inline__)) |
| 8433 | vec_vrfin(vector float __a) { |
| 8434 | return __builtin_altivec_vrfin(__a); |
| 8435 | } |
| 8436 | |
| 8437 | /* vec_sqrt */ |
| 8438 | |
| 8439 | #ifdef __VSX__ |
| 8440 | static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { |
| 8441 | return __builtin_vsx_xvsqrtsp(__a); |
| 8442 | } |
| 8443 | |
| 8444 | static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { |
| 8445 | return __builtin_vsx_xvsqrtdp(__a); |
| 8446 | } |
| 8447 | #endif |
| 8448 | |
| 8449 | /* vec_rsqrte */ |
| 8450 | |
| 8451 | static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { |
| 8452 | #ifdef __VSX__ |
| 8453 | return __builtin_vsx_xvrsqrtesp(__a); |
| 8454 | #else |
| 8455 | return __builtin_altivec_vrsqrtefp(__a); |
| 8456 | #endif |
| 8457 | } |
| 8458 | |
| 8459 | #ifdef __VSX__ |
| 8460 | static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { |
| 8461 | return __builtin_vsx_xvrsqrtedp(__a); |
| 8462 | } |
| 8463 | #endif |
| 8464 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8465 | static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { |
| 8466 | return __builtin_ppc_rsqrtf(__a); |
| 8467 | } |
| 8468 | |
| 8469 | #ifdef __VSX__ |
| 8470 | static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { |
| 8471 | return __builtin_ppc_rsqrtd(__a); |
| 8472 | } |
| 8473 | #endif |
| 8474 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8475 | /* vec_vrsqrtefp */ |
| 8476 | |
| 8477 | static __inline__ __vector float __attribute__((__always_inline__)) |
| 8478 | vec_vrsqrtefp(vector float __a) { |
| 8479 | return __builtin_altivec_vrsqrtefp(__a); |
| 8480 | } |
| 8481 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 8482 | /* vec_xvtsqrt */ |
| 8483 | |
| 8484 | #ifdef __VSX__ |
| 8485 | static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { |
| 8486 | return __builtin_vsx_xvtsqrtdp(__a); |
| 8487 | } |
| 8488 | |
| 8489 | static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { |
| 8490 | return __builtin_vsx_xvtsqrtsp(__a); |
| 8491 | } |
| 8492 | #endif |
| 8493 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8494 | /* vec_sel */ |
| 8495 | |
| 8496 | #define __builtin_altivec_vsel_4si vec_sel |
| 8497 | |
| 8498 | static __inline__ vector signed char __ATTRS_o_ai vec_sel( |
| 8499 | vector signed char __a, vector signed char __b, vector unsigned char __c) { |
| 8500 | return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); |
| 8501 | } |
| 8502 | |
| 8503 | static __inline__ vector signed char __ATTRS_o_ai |
| 8504 | vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { |
| 8505 | return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); |
| 8506 | } |
| 8507 | |
| 8508 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8509 | vec_sel(vector unsigned char __a, vector unsigned char __b, |
| 8510 | vector unsigned char __c) { |
| 8511 | return (__a & ~__c) | (__b & __c); |
| 8512 | } |
| 8513 | |
| 8514 | static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( |
| 8515 | vector unsigned char __a, vector unsigned char __b, vector bool char __c) { |
| 8516 | return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); |
| 8517 | } |
| 8518 | |
| 8519 | static __inline__ vector bool char __ATTRS_o_ai |
| 8520 | vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { |
| 8521 | return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); |
| 8522 | } |
| 8523 | |
| 8524 | static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, |
| 8525 | vector bool char __b, |
| 8526 | vector bool char __c) { |
| 8527 | return (__a & ~__c) | (__b & __c); |
| 8528 | } |
| 8529 | |
| 8530 | static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, |
| 8531 | vector short __b, |
| 8532 | vector unsigned short __c) { |
| 8533 | return (__a & ~(vector short)__c) | (__b & (vector short)__c); |
| 8534 | } |
| 8535 | |
| 8536 | static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, |
| 8537 | vector short __b, |
| 8538 | vector bool short __c) { |
| 8539 | return (__a & ~(vector short)__c) | (__b & (vector short)__c); |
| 8540 | } |
| 8541 | |
| 8542 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8543 | vec_sel(vector unsigned short __a, vector unsigned short __b, |
| 8544 | vector unsigned short __c) { |
| 8545 | return (__a & ~__c) | (__b & __c); |
| 8546 | } |
| 8547 | |
| 8548 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8549 | vec_sel(vector unsigned short __a, vector unsigned short __b, |
| 8550 | vector bool short __c) { |
| 8551 | return (__a & ~(vector unsigned short)__c) | |
| 8552 | (__b & (vector unsigned short)__c); |
| 8553 | } |
| 8554 | |
| 8555 | static __inline__ vector bool short __ATTRS_o_ai vec_sel( |
| 8556 | vector bool short __a, vector bool short __b, vector unsigned short __c) { |
| 8557 | return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); |
| 8558 | } |
| 8559 | |
| 8560 | static __inline__ vector bool short __ATTRS_o_ai |
| 8561 | vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { |
| 8562 | return (__a & ~__c) | (__b & __c); |
| 8563 | } |
| 8564 | |
| 8565 | static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, |
| 8566 | vector int __b, |
| 8567 | vector unsigned int __c) { |
| 8568 | return (__a & ~(vector int)__c) | (__b & (vector int)__c); |
| 8569 | } |
| 8570 | |
| 8571 | static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, |
| 8572 | vector int __b, |
| 8573 | vector bool int __c) { |
| 8574 | return (__a & ~(vector int)__c) | (__b & (vector int)__c); |
| 8575 | } |
| 8576 | |
| 8577 | static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( |
| 8578 | vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { |
| 8579 | return (__a & ~__c) | (__b & __c); |
| 8580 | } |
| 8581 | |
| 8582 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8583 | vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { |
| 8584 | return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); |
| 8585 | } |
| 8586 | |
| 8587 | static __inline__ vector bool int __ATTRS_o_ai |
| 8588 | vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { |
| 8589 | return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); |
| 8590 | } |
| 8591 | |
| 8592 | static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, |
| 8593 | vector bool int __b, |
| 8594 | vector bool int __c) { |
| 8595 | return (__a & ~__c) | (__b & __c); |
| 8596 | } |
| 8597 | |
| 8598 | static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, |
| 8599 | vector float __b, |
| 8600 | vector unsigned int __c) { |
| 8601 | vector int __res = ((vector int)__a & ~(vector int)__c) | |
| 8602 | ((vector int)__b & (vector int)__c); |
| 8603 | return (vector float)__res; |
| 8604 | } |
| 8605 | |
| 8606 | static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, |
| 8607 | vector float __b, |
| 8608 | vector bool int __c) { |
| 8609 | vector int __res = ((vector int)__a & ~(vector int)__c) | |
| 8610 | ((vector int)__b & (vector int)__c); |
| 8611 | return (vector float)__res; |
| 8612 | } |
| 8613 | |
| 8614 | #ifdef __VSX__ |
| 8615 | static __inline__ vector double __ATTRS_o_ai |
| 8616 | vec_sel(vector double __a, vector double __b, vector bool long long __c) { |
| 8617 | vector long long __res = ((vector long long)__a & ~(vector long long)__c) | |
| 8618 | ((vector long long)__b & (vector long long)__c); |
| 8619 | return (vector double)__res; |
| 8620 | } |
| 8621 | |
| 8622 | static __inline__ vector double __ATTRS_o_ai |
| 8623 | vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { |
| 8624 | vector long long __res = ((vector long long)__a & ~(vector long long)__c) | |
| 8625 | ((vector long long)__b & (vector long long)__c); |
| 8626 | return (vector double)__res; |
| 8627 | } |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 8628 | |
| 8629 | static __inline__ vector bool long long __ATTRS_o_ai |
| 8630 | vec_sel(vector bool long long __a, vector bool long long __b, |
| 8631 | vector bool long long __c) { |
| 8632 | return (__a & ~__c) | (__b & __c); |
| 8633 | } |
| 8634 | |
| 8635 | static __inline__ vector bool long long __ATTRS_o_ai |
| 8636 | vec_sel(vector bool long long __a, vector bool long long __b, |
| 8637 | vector unsigned long long __c) { |
| 8638 | return (__a & ~(vector bool long long)__c) | |
| 8639 | (__b & (vector bool long long)__c); |
| 8640 | } |
| 8641 | |
| 8642 | static __inline__ vector signed long long __ATTRS_o_ai |
| 8643 | vec_sel(vector signed long long __a, vector signed long long __b, |
| 8644 | vector bool long long __c) { |
| 8645 | return (__a & ~(vector signed long long)__c) | |
| 8646 | (__b & (vector signed long long)__c); |
| 8647 | } |
| 8648 | |
| 8649 | static __inline__ vector signed long long __ATTRS_o_ai |
| 8650 | vec_sel(vector signed long long __a, vector signed long long __b, |
| 8651 | vector unsigned long long __c) { |
| 8652 | return (__a & ~(vector signed long long)__c) | |
| 8653 | (__b & (vector signed long long)__c); |
| 8654 | } |
| 8655 | |
| 8656 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8657 | vec_sel(vector unsigned long long __a, vector unsigned long long __b, |
| 8658 | vector bool long long __c) { |
| 8659 | return (__a & ~(vector unsigned long long)__c) | |
| 8660 | (__b & (vector unsigned long long)__c); |
| 8661 | } |
| 8662 | |
| 8663 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8664 | vec_sel(vector unsigned long long __a, vector unsigned long long __b, |
| 8665 | vector unsigned long long __c) { |
| 8666 | return (__a & ~__c) | (__b & __c); |
| 8667 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8668 | #endif |
| 8669 | |
| 8670 | /* vec_vsel */ |
| 8671 | |
| 8672 | static __inline__ vector signed char __ATTRS_o_ai vec_vsel( |
| 8673 | vector signed char __a, vector signed char __b, vector unsigned char __c) { |
| 8674 | return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); |
| 8675 | } |
| 8676 | |
| 8677 | static __inline__ vector signed char __ATTRS_o_ai |
| 8678 | vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { |
| 8679 | return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); |
| 8680 | } |
| 8681 | |
| 8682 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8683 | vec_vsel(vector unsigned char __a, vector unsigned char __b, |
| 8684 | vector unsigned char __c) { |
| 8685 | return (__a & ~__c) | (__b & __c); |
| 8686 | } |
| 8687 | |
| 8688 | static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( |
| 8689 | vector unsigned char __a, vector unsigned char __b, vector bool char __c) { |
| 8690 | return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); |
| 8691 | } |
| 8692 | |
| 8693 | static __inline__ vector bool char __ATTRS_o_ai |
| 8694 | vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { |
| 8695 | return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); |
| 8696 | } |
| 8697 | |
| 8698 | static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, |
| 8699 | vector bool char __b, |
| 8700 | vector bool char __c) { |
| 8701 | return (__a & ~__c) | (__b & __c); |
| 8702 | } |
| 8703 | |
| 8704 | static __inline__ vector short __ATTRS_o_ai |
| 8705 | vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { |
| 8706 | return (__a & ~(vector short)__c) | (__b & (vector short)__c); |
| 8707 | } |
| 8708 | |
| 8709 | static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, |
| 8710 | vector short __b, |
| 8711 | vector bool short __c) { |
| 8712 | return (__a & ~(vector short)__c) | (__b & (vector short)__c); |
| 8713 | } |
| 8714 | |
| 8715 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8716 | vec_vsel(vector unsigned short __a, vector unsigned short __b, |
| 8717 | vector unsigned short __c) { |
| 8718 | return (__a & ~__c) | (__b & __c); |
| 8719 | } |
| 8720 | |
| 8721 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8722 | vec_vsel(vector unsigned short __a, vector unsigned short __b, |
| 8723 | vector bool short __c) { |
| 8724 | return (__a & ~(vector unsigned short)__c) | |
| 8725 | (__b & (vector unsigned short)__c); |
| 8726 | } |
| 8727 | |
| 8728 | static __inline__ vector bool short __ATTRS_o_ai vec_vsel( |
| 8729 | vector bool short __a, vector bool short __b, vector unsigned short __c) { |
| 8730 | return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); |
| 8731 | } |
| 8732 | |
| 8733 | static __inline__ vector bool short __ATTRS_o_ai |
| 8734 | vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { |
| 8735 | return (__a & ~__c) | (__b & __c); |
| 8736 | } |
| 8737 | |
| 8738 | static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, |
| 8739 | vector int __b, |
| 8740 | vector unsigned int __c) { |
| 8741 | return (__a & ~(vector int)__c) | (__b & (vector int)__c); |
| 8742 | } |
| 8743 | |
| 8744 | static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, |
| 8745 | vector int __b, |
| 8746 | vector bool int __c) { |
| 8747 | return (__a & ~(vector int)__c) | (__b & (vector int)__c); |
| 8748 | } |
| 8749 | |
| 8750 | static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( |
| 8751 | vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { |
| 8752 | return (__a & ~__c) | (__b & __c); |
| 8753 | } |
| 8754 | |
| 8755 | static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( |
| 8756 | vector unsigned int __a, vector unsigned int __b, vector bool int __c) { |
| 8757 | return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); |
| 8758 | } |
| 8759 | |
| 8760 | static __inline__ vector bool int __ATTRS_o_ai |
| 8761 | vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { |
| 8762 | return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); |
| 8763 | } |
| 8764 | |
| 8765 | static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, |
| 8766 | vector bool int __b, |
| 8767 | vector bool int __c) { |
| 8768 | return (__a & ~__c) | (__b & __c); |
| 8769 | } |
| 8770 | |
| 8771 | static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, |
| 8772 | vector float __b, |
| 8773 | vector unsigned int __c) { |
| 8774 | vector int __res = ((vector int)__a & ~(vector int)__c) | |
| 8775 | ((vector int)__b & (vector int)__c); |
| 8776 | return (vector float)__res; |
| 8777 | } |
| 8778 | |
| 8779 | static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, |
| 8780 | vector float __b, |
| 8781 | vector bool int __c) { |
| 8782 | vector int __res = ((vector int)__a & ~(vector int)__c) | |
| 8783 | ((vector int)__b & (vector int)__c); |
| 8784 | return (vector float)__res; |
| 8785 | } |
| 8786 | |
| 8787 | /* vec_sl */ |
| 8788 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8789 | // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more |
| 8790 | // than the length of __a. |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8791 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8792 | vec_sl(vector unsigned char __a, vector unsigned char __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8793 | return __a << (__b % |
| 8794 | (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8795 | } |
| 8796 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8797 | static __inline__ vector signed char __ATTRS_o_ai |
| 8798 | vec_sl(vector signed char __a, vector unsigned char __b) { |
| 8799 | return (vector signed char)vec_sl((vector unsigned char)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8800 | } |
| 8801 | |
| 8802 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8803 | vec_sl(vector unsigned short __a, vector unsigned short __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8804 | return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * |
| 8805 | __CHAR_BIT__)); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8806 | } |
| 8807 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8808 | static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, |
| 8809 | vector unsigned short __b) { |
| 8810 | return (vector short)vec_sl((vector unsigned short)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8811 | } |
| 8812 | |
| 8813 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8814 | vec_sl(vector unsigned int __a, vector unsigned int __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8815 | return __a << (__b % |
| 8816 | (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); |
| 8817 | } |
| 8818 | |
| 8819 | static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, |
| 8820 | vector unsigned int __b) { |
| 8821 | return (vector int)vec_sl((vector unsigned int)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8822 | } |
| 8823 | |
| 8824 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8825 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8826 | vec_sl(vector unsigned long long __a, vector unsigned long long __b) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 8827 | return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * |
| 8828 | __CHAR_BIT__)); |
| 8829 | } |
| 8830 | |
| 8831 | static __inline__ vector long long __ATTRS_o_ai |
| 8832 | vec_sl(vector long long __a, vector unsigned long long __b) { |
| 8833 | return (vector long long)vec_sl((vector unsigned long long)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8834 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 8835 | #else |
| 8836 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8837 | vec_vspltb(vector unsigned char __a, unsigned char __b); |
| 8838 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 8839 | vec_sl(vector unsigned long long __a, vector unsigned long long __b) { |
| 8840 | __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); |
| 8841 | |
| 8842 | // Big endian element one (the right doubleword) can be left shifted as-is. |
| 8843 | // The other element needs to be swapped into the right doubleword and |
| 8844 | // shifted. Then the right doublewords of the two result vectors are merged. |
| 8845 | vector signed long long __rightelt = |
| 8846 | (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, |
| 8847 | (vector signed int)__b); |
| 8848 | #ifdef __LITTLE_ENDIAN__ |
| 8849 | __rightelt = (vector signed long long)__builtin_altivec_vsl( |
| 8850 | (vector signed int)__rightelt, |
| 8851 | (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); |
| 8852 | #else |
| 8853 | __rightelt = (vector signed long long)__builtin_altivec_vsl( |
| 8854 | (vector signed int)__rightelt, |
| 8855 | (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); |
| 8856 | #endif |
| 8857 | __a = __builtin_shufflevector(__a, __a, 1, 0); |
| 8858 | __b = __builtin_shufflevector(__b, __b, 1, 0); |
| 8859 | vector signed long long __leftelt = |
| 8860 | (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, |
| 8861 | (vector signed int)__b); |
| 8862 | #ifdef __LITTLE_ENDIAN__ |
| 8863 | __leftelt = (vector signed long long)__builtin_altivec_vsl( |
| 8864 | (vector signed int)__leftelt, |
| 8865 | (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); |
| 8866 | return (vector unsigned long long)__builtin_shufflevector(__rightelt, |
| 8867 | __leftelt, 0, 2); |
| 8868 | #else |
| 8869 | __leftelt = (vector signed long long)__builtin_altivec_vsl( |
| 8870 | (vector signed int)__leftelt, |
| 8871 | (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); |
| 8872 | return (vector unsigned long long)__builtin_shufflevector(__leftelt, |
| 8873 | __rightelt, 1, 3); |
| 8874 | #endif |
| 8875 | } |
| 8876 | |
| 8877 | static __inline__ vector long long __ATTRS_o_ai |
| 8878 | vec_sl(vector long long __a, vector unsigned long long __b) { |
| 8879 | return (vector long long)vec_sl((vector unsigned long long)__a, __b); |
| 8880 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 8881 | #endif |
| 8882 | |
| 8883 | /* vec_vslb */ |
| 8884 | |
| 8885 | #define __builtin_altivec_vslb vec_vslb |
| 8886 | |
| 8887 | static __inline__ vector signed char __ATTRS_o_ai |
| 8888 | vec_vslb(vector signed char __a, vector unsigned char __b) { |
| 8889 | return vec_sl(__a, __b); |
| 8890 | } |
| 8891 | |
| 8892 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8893 | vec_vslb(vector unsigned char __a, vector unsigned char __b) { |
| 8894 | return vec_sl(__a, __b); |
| 8895 | } |
| 8896 | |
| 8897 | /* vec_vslh */ |
| 8898 | |
| 8899 | #define __builtin_altivec_vslh vec_vslh |
| 8900 | |
| 8901 | static __inline__ vector short __ATTRS_o_ai |
| 8902 | vec_vslh(vector short __a, vector unsigned short __b) { |
| 8903 | return vec_sl(__a, __b); |
| 8904 | } |
| 8905 | |
| 8906 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 8907 | vec_vslh(vector unsigned short __a, vector unsigned short __b) { |
| 8908 | return vec_sl(__a, __b); |
| 8909 | } |
| 8910 | |
| 8911 | /* vec_vslw */ |
| 8912 | |
| 8913 | #define __builtin_altivec_vslw vec_vslw |
| 8914 | |
| 8915 | static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, |
| 8916 | vector unsigned int __b) { |
| 8917 | return vec_sl(__a, __b); |
| 8918 | } |
| 8919 | |
| 8920 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 8921 | vec_vslw(vector unsigned int __a, vector unsigned int __b) { |
| 8922 | return vec_sl(__a, __b); |
| 8923 | } |
| 8924 | |
| 8925 | /* vec_sld */ |
| 8926 | |
| 8927 | #define __builtin_altivec_vsldoi_4si vec_sld |
| 8928 | |
| 8929 | static __inline__ vector signed char __ATTRS_o_ai vec_sld( |
| 8930 | vector signed char __a, vector signed char __b, unsigned const int __c) { |
| 8931 | unsigned char __d = __c & 0x0F; |
| 8932 | #ifdef __LITTLE_ENDIAN__ |
| 8933 | return vec_perm( |
| 8934 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 8935 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 8936 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 8937 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 8938 | #else |
| 8939 | return vec_perm( |
| 8940 | __a, __b, |
| 8941 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 8942 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 8943 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 8944 | #endif |
| 8945 | } |
| 8946 | |
| 8947 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 8948 | vec_sld(vector unsigned char __a, vector unsigned char __b, |
| 8949 | unsigned const int __c) { |
| 8950 | unsigned char __d = __c & 0x0F; |
| 8951 | #ifdef __LITTLE_ENDIAN__ |
| 8952 | return vec_perm( |
| 8953 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 8954 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 8955 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 8956 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 8957 | #else |
| 8958 | return vec_perm( |
| 8959 | __a, __b, |
| 8960 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 8961 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 8962 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 8963 | #endif |
| 8964 | } |
| 8965 | |
| 8966 | static __inline__ vector bool char __ATTRS_o_ai |
| 8967 | vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { |
| 8968 | unsigned char __d = __c & 0x0F; |
| 8969 | #ifdef __LITTLE_ENDIAN__ |
| 8970 | return vec_perm( |
| 8971 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 8972 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 8973 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 8974 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 8975 | #else |
| 8976 | return vec_perm( |
| 8977 | __a, __b, |
| 8978 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 8979 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 8980 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 8981 | #endif |
| 8982 | } |
| 8983 | |
| 8984 | static __inline__ vector signed short __ATTRS_o_ai vec_sld( |
| 8985 | vector signed short __a, vector signed short __b, unsigned const int __c) { |
| 8986 | unsigned char __d = __c & 0x0F; |
| 8987 | #ifdef __LITTLE_ENDIAN__ |
| 8988 | return vec_perm( |
| 8989 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 8990 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 8991 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 8992 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 8993 | #else |
| 8994 | return vec_perm( |
| 8995 | __a, __b, |
| 8996 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 8997 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 8998 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 8999 | #endif |
| 9000 | } |
| 9001 | |
| 9002 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9003 | vec_sld(vector unsigned short __a, vector unsigned short __b, |
| 9004 | unsigned const int __c) { |
| 9005 | unsigned char __d = __c & 0x0F; |
| 9006 | #ifdef __LITTLE_ENDIAN__ |
| 9007 | return vec_perm( |
| 9008 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9009 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9010 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9011 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9012 | #else |
| 9013 | return vec_perm( |
| 9014 | __a, __b, |
| 9015 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9016 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9017 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9018 | #endif |
| 9019 | } |
| 9020 | |
| 9021 | static __inline__ vector bool short __ATTRS_o_ai |
| 9022 | vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { |
| 9023 | unsigned char __d = __c & 0x0F; |
| 9024 | #ifdef __LITTLE_ENDIAN__ |
| 9025 | return vec_perm( |
| 9026 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9027 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9028 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9029 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9030 | #else |
| 9031 | return vec_perm( |
| 9032 | __a, __b, |
| 9033 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9034 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9035 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9036 | #endif |
| 9037 | } |
| 9038 | |
| 9039 | static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, |
| 9040 | vector pixel __b, |
| 9041 | unsigned const int __c) { |
| 9042 | unsigned char __d = __c & 0x0F; |
| 9043 | #ifdef __LITTLE_ENDIAN__ |
| 9044 | return vec_perm( |
| 9045 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9046 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9047 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9048 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9049 | #else |
| 9050 | return vec_perm( |
| 9051 | __a, __b, |
| 9052 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9053 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9054 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9055 | #endif |
| 9056 | } |
| 9057 | |
| 9058 | static __inline__ vector signed int __ATTRS_o_ai |
| 9059 | vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { |
| 9060 | unsigned char __d = __c & 0x0F; |
| 9061 | #ifdef __LITTLE_ENDIAN__ |
| 9062 | return vec_perm( |
| 9063 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9064 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9065 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9066 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9067 | #else |
| 9068 | return vec_perm( |
| 9069 | __a, __b, |
| 9070 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9071 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9072 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9073 | #endif |
| 9074 | } |
| 9075 | |
| 9076 | static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( |
| 9077 | vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { |
| 9078 | unsigned char __d = __c & 0x0F; |
| 9079 | #ifdef __LITTLE_ENDIAN__ |
| 9080 | return vec_perm( |
| 9081 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9082 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9083 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9084 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9085 | #else |
| 9086 | return vec_perm( |
| 9087 | __a, __b, |
| 9088 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9089 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9090 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9091 | #endif |
| 9092 | } |
| 9093 | |
| 9094 | static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, |
| 9095 | vector bool int __b, |
| 9096 | unsigned const int __c) { |
| 9097 | unsigned char __d = __c & 0x0F; |
| 9098 | #ifdef __LITTLE_ENDIAN__ |
| 9099 | return vec_perm( |
| 9100 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9101 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9102 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9103 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9104 | #else |
| 9105 | return vec_perm( |
| 9106 | __a, __b, |
| 9107 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9108 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9109 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9110 | #endif |
| 9111 | } |
| 9112 | |
| 9113 | static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, |
| 9114 | vector float __b, |
| 9115 | unsigned const int __c) { |
| 9116 | unsigned char __d = __c & 0x0F; |
| 9117 | #ifdef __LITTLE_ENDIAN__ |
| 9118 | return vec_perm( |
| 9119 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9120 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9121 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9122 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9123 | #else |
| 9124 | return vec_perm( |
| 9125 | __a, __b, |
| 9126 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9127 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9128 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9129 | #endif |
| 9130 | } |
| 9131 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 9132 | #ifdef __VSX__ |
| 9133 | static __inline__ vector bool long long __ATTRS_o_ai |
| 9134 | vec_sld(vector bool long long __a, vector bool long long __b, |
| 9135 | unsigned const int __c) { |
| 9136 | unsigned char __d = __c & 0x0F; |
| 9137 | #ifdef __LITTLE_ENDIAN__ |
| 9138 | return vec_perm( |
| 9139 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9140 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9141 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9142 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9143 | #else |
| 9144 | return vec_perm( |
| 9145 | __a, __b, |
| 9146 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9147 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9148 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9149 | #endif |
| 9150 | } |
| 9151 | |
| 9152 | static __inline__ vector signed long long __ATTRS_o_ai |
| 9153 | vec_sld(vector signed long long __a, vector signed long long __b, |
| 9154 | unsigned const int __c) { |
| 9155 | unsigned char __d = __c & 0x0F; |
| 9156 | #ifdef __LITTLE_ENDIAN__ |
| 9157 | return vec_perm( |
| 9158 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9159 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9160 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9161 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9162 | #else |
| 9163 | return vec_perm( |
| 9164 | __a, __b, |
| 9165 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9166 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9167 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9168 | #endif |
| 9169 | } |
| 9170 | |
| 9171 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 9172 | vec_sld(vector unsigned long long __a, vector unsigned long long __b, |
| 9173 | unsigned const int __c) { |
| 9174 | unsigned char __d = __c & 0x0F; |
| 9175 | #ifdef __LITTLE_ENDIAN__ |
| 9176 | return vec_perm( |
| 9177 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9178 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9179 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9180 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9181 | #else |
| 9182 | return vec_perm( |
| 9183 | __a, __b, |
| 9184 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9185 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9186 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9187 | #endif |
| 9188 | } |
| 9189 | |
| 9190 | static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, |
| 9191 | vector double __b, |
| 9192 | unsigned const int __c) { |
| 9193 | unsigned char __d = __c & 0x0F; |
| 9194 | #ifdef __LITTLE_ENDIAN__ |
| 9195 | return vec_perm( |
| 9196 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9197 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9198 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9199 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9200 | #else |
| 9201 | return vec_perm( |
| 9202 | __a, __b, |
| 9203 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9204 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9205 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9206 | #endif |
| 9207 | } |
| 9208 | #endif |
| 9209 | |
| 9210 | /* vec_sldw */ |
| 9211 | static __inline__ vector signed char __ATTRS_o_ai vec_sldw( |
| 9212 | vector signed char __a, vector signed char __b, unsigned const int __c) { |
| 9213 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9214 | } |
| 9215 | |
| 9216 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9217 | vec_sldw(vector unsigned char __a, vector unsigned char __b, |
| 9218 | unsigned const int __c) { |
| 9219 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9220 | } |
| 9221 | |
| 9222 | static __inline__ vector signed short __ATTRS_o_ai vec_sldw( |
| 9223 | vector signed short __a, vector signed short __b, unsigned const int __c) { |
| 9224 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9225 | } |
| 9226 | |
| 9227 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9228 | vec_sldw(vector unsigned short __a, vector unsigned short __b, |
| 9229 | unsigned const int __c) { |
| 9230 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9231 | } |
| 9232 | |
| 9233 | static __inline__ vector signed int __ATTRS_o_ai |
| 9234 | vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { |
| 9235 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9236 | } |
| 9237 | |
| 9238 | static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( |
| 9239 | vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { |
| 9240 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9241 | } |
| 9242 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 9243 | static __inline__ vector float __ATTRS_o_ai vec_sldw( |
| 9244 | vector float __a, vector float __b, unsigned const int __c) { |
| 9245 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9246 | } |
| 9247 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 9248 | #ifdef __VSX__ |
| 9249 | static __inline__ vector signed long long __ATTRS_o_ai |
| 9250 | vec_sldw(vector signed long long __a, vector signed long long __b, |
| 9251 | unsigned const int __c) { |
| 9252 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9253 | } |
| 9254 | |
| 9255 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 9256 | vec_sldw(vector unsigned long long __a, vector unsigned long long __b, |
| 9257 | unsigned const int __c) { |
| 9258 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9259 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 9260 | |
| 9261 | static __inline__ vector double __ATTRS_o_ai vec_sldw( |
| 9262 | vector double __a, vector double __b, unsigned const int __c) { |
| 9263 | return vec_sld(__a, __b, ((__c << 2) & 0x0F)); |
| 9264 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 9265 | #endif |
| 9266 | |
| 9267 | #ifdef __POWER9_VECTOR__ |
| 9268 | /* vec_slv */ |
| 9269 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9270 | vec_slv(vector unsigned char __a, vector unsigned char __b) { |
| 9271 | return __builtin_altivec_vslv(__a, __b); |
| 9272 | } |
| 9273 | |
| 9274 | /* vec_srv */ |
| 9275 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9276 | vec_srv(vector unsigned char __a, vector unsigned char __b) { |
| 9277 | return __builtin_altivec_vsrv(__a, __b); |
| 9278 | } |
| 9279 | #endif |
| 9280 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 9281 | /* vec_vsldoi */ |
| 9282 | |
| 9283 | static __inline__ vector signed char __ATTRS_o_ai |
| 9284 | vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { |
| 9285 | unsigned char __d = __c & 0x0F; |
| 9286 | #ifdef __LITTLE_ENDIAN__ |
| 9287 | return vec_perm( |
| 9288 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9289 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9290 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9291 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9292 | #else |
| 9293 | return vec_perm( |
| 9294 | __a, __b, |
| 9295 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9296 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9297 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9298 | #endif |
| 9299 | } |
| 9300 | |
| 9301 | static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( |
| 9302 | vector unsigned char __a, vector unsigned char __b, unsigned char __c) { |
| 9303 | unsigned char __d = __c & 0x0F; |
| 9304 | #ifdef __LITTLE_ENDIAN__ |
| 9305 | return vec_perm( |
| 9306 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9307 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9308 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9309 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9310 | #else |
| 9311 | return vec_perm( |
| 9312 | __a, __b, |
| 9313 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9314 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9315 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9316 | #endif |
| 9317 | } |
| 9318 | |
| 9319 | static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, |
| 9320 | vector short __b, |
| 9321 | unsigned char __c) { |
| 9322 | unsigned char __d = __c & 0x0F; |
| 9323 | #ifdef __LITTLE_ENDIAN__ |
| 9324 | return vec_perm( |
| 9325 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9326 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9327 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9328 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9329 | #else |
| 9330 | return vec_perm( |
| 9331 | __a, __b, |
| 9332 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9333 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9334 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9335 | #endif |
| 9336 | } |
| 9337 | |
| 9338 | static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( |
| 9339 | vector unsigned short __a, vector unsigned short __b, unsigned char __c) { |
| 9340 | unsigned char __d = __c & 0x0F; |
| 9341 | #ifdef __LITTLE_ENDIAN__ |
| 9342 | return vec_perm( |
| 9343 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9344 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9345 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9346 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9347 | #else |
| 9348 | return vec_perm( |
| 9349 | __a, __b, |
| 9350 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9351 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9352 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9353 | #endif |
| 9354 | } |
| 9355 | |
| 9356 | static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, |
| 9357 | vector pixel __b, |
| 9358 | unsigned char __c) { |
| 9359 | unsigned char __d = __c & 0x0F; |
| 9360 | #ifdef __LITTLE_ENDIAN__ |
| 9361 | return vec_perm( |
| 9362 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9363 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9364 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9365 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9366 | #else |
| 9367 | return vec_perm( |
| 9368 | __a, __b, |
| 9369 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9370 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9371 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9372 | #endif |
| 9373 | } |
| 9374 | |
| 9375 | static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, |
| 9376 | vector int __b, |
| 9377 | unsigned char __c) { |
| 9378 | unsigned char __d = __c & 0x0F; |
| 9379 | #ifdef __LITTLE_ENDIAN__ |
| 9380 | return vec_perm( |
| 9381 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9382 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9383 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9384 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9385 | #else |
| 9386 | return vec_perm( |
| 9387 | __a, __b, |
| 9388 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9389 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9390 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9391 | #endif |
| 9392 | } |
| 9393 | |
| 9394 | static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( |
| 9395 | vector unsigned int __a, vector unsigned int __b, unsigned char __c) { |
| 9396 | unsigned char __d = __c & 0x0F; |
| 9397 | #ifdef __LITTLE_ENDIAN__ |
| 9398 | return vec_perm( |
| 9399 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9400 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9401 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9402 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9403 | #else |
| 9404 | return vec_perm( |
| 9405 | __a, __b, |
| 9406 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9407 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9408 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9409 | #endif |
| 9410 | } |
| 9411 | |
| 9412 | static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, |
| 9413 | vector float __b, |
| 9414 | unsigned char __c) { |
| 9415 | unsigned char __d = __c & 0x0F; |
| 9416 | #ifdef __LITTLE_ENDIAN__ |
| 9417 | return vec_perm( |
| 9418 | __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, |
| 9419 | 20 - __d, 21 - __d, 22 - __d, 23 - __d, |
| 9420 | 24 - __d, 25 - __d, 26 - __d, 27 - __d, |
| 9421 | 28 - __d, 29 - __d, 30 - __d, 31 - __d)); |
| 9422 | #else |
| 9423 | return vec_perm( |
| 9424 | __a, __b, |
| 9425 | (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, |
| 9426 | __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, |
| 9427 | __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); |
| 9428 | #endif |
| 9429 | } |
| 9430 | |
| 9431 | /* vec_sll */ |
| 9432 | |
| 9433 | static __inline__ vector signed char __ATTRS_o_ai |
| 9434 | vec_sll(vector signed char __a, vector unsigned char __b) { |
| 9435 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9436 | (vector int)__b); |
| 9437 | } |
| 9438 | |
| 9439 | static __inline__ vector signed char __ATTRS_o_ai |
| 9440 | vec_sll(vector signed char __a, vector unsigned short __b) { |
| 9441 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9442 | (vector int)__b); |
| 9443 | } |
| 9444 | |
| 9445 | static __inline__ vector signed char __ATTRS_o_ai |
| 9446 | vec_sll(vector signed char __a, vector unsigned int __b) { |
| 9447 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9448 | (vector int)__b); |
| 9449 | } |
| 9450 | |
| 9451 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9452 | vec_sll(vector unsigned char __a, vector unsigned char __b) { |
| 9453 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9454 | (vector int)__b); |
| 9455 | } |
| 9456 | |
| 9457 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9458 | vec_sll(vector unsigned char __a, vector unsigned short __b) { |
| 9459 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9460 | (vector int)__b); |
| 9461 | } |
| 9462 | |
| 9463 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9464 | vec_sll(vector unsigned char __a, vector unsigned int __b) { |
| 9465 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9466 | (vector int)__b); |
| 9467 | } |
| 9468 | |
| 9469 | static __inline__ vector bool char __ATTRS_o_ai |
| 9470 | vec_sll(vector bool char __a, vector unsigned char __b) { |
| 9471 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9472 | (vector int)__b); |
| 9473 | } |
| 9474 | |
| 9475 | static __inline__ vector bool char __ATTRS_o_ai |
| 9476 | vec_sll(vector bool char __a, vector unsigned short __b) { |
| 9477 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9478 | (vector int)__b); |
| 9479 | } |
| 9480 | |
| 9481 | static __inline__ vector bool char __ATTRS_o_ai |
| 9482 | vec_sll(vector bool char __a, vector unsigned int __b) { |
| 9483 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9484 | (vector int)__b); |
| 9485 | } |
| 9486 | |
| 9487 | static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, |
| 9488 | vector unsigned char __b) { |
| 9489 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9490 | } |
| 9491 | |
| 9492 | static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, |
| 9493 | vector unsigned short __b) { |
| 9494 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9495 | } |
| 9496 | |
| 9497 | static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, |
| 9498 | vector unsigned int __b) { |
| 9499 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9500 | } |
| 9501 | |
| 9502 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9503 | vec_sll(vector unsigned short __a, vector unsigned char __b) { |
| 9504 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9505 | (vector int)__b); |
| 9506 | } |
| 9507 | |
| 9508 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9509 | vec_sll(vector unsigned short __a, vector unsigned short __b) { |
| 9510 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9511 | (vector int)__b); |
| 9512 | } |
| 9513 | |
| 9514 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9515 | vec_sll(vector unsigned short __a, vector unsigned int __b) { |
| 9516 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9517 | (vector int)__b); |
| 9518 | } |
| 9519 | |
| 9520 | static __inline__ vector bool short __ATTRS_o_ai |
| 9521 | vec_sll(vector bool short __a, vector unsigned char __b) { |
| 9522 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9523 | (vector int)__b); |
| 9524 | } |
| 9525 | |
| 9526 | static __inline__ vector bool short __ATTRS_o_ai |
| 9527 | vec_sll(vector bool short __a, vector unsigned short __b) { |
| 9528 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9529 | (vector int)__b); |
| 9530 | } |
| 9531 | |
| 9532 | static __inline__ vector bool short __ATTRS_o_ai |
| 9533 | vec_sll(vector bool short __a, vector unsigned int __b) { |
| 9534 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9535 | (vector int)__b); |
| 9536 | } |
| 9537 | |
| 9538 | static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, |
| 9539 | vector unsigned char __b) { |
| 9540 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9541 | } |
| 9542 | |
| 9543 | static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, |
| 9544 | vector unsigned short __b) { |
| 9545 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9546 | } |
| 9547 | |
| 9548 | static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, |
| 9549 | vector unsigned int __b) { |
| 9550 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9551 | } |
| 9552 | |
| 9553 | static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, |
| 9554 | vector unsigned char __b) { |
| 9555 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9556 | } |
| 9557 | |
| 9558 | static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, |
| 9559 | vector unsigned short __b) { |
| 9560 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9561 | } |
| 9562 | |
| 9563 | static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, |
| 9564 | vector unsigned int __b) { |
| 9565 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9566 | } |
| 9567 | |
| 9568 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9569 | vec_sll(vector unsigned int __a, vector unsigned char __b) { |
| 9570 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9571 | (vector int)__b); |
| 9572 | } |
| 9573 | |
| 9574 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9575 | vec_sll(vector unsigned int __a, vector unsigned short __b) { |
| 9576 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9577 | (vector int)__b); |
| 9578 | } |
| 9579 | |
| 9580 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9581 | vec_sll(vector unsigned int __a, vector unsigned int __b) { |
| 9582 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9583 | (vector int)__b); |
| 9584 | } |
| 9585 | |
| 9586 | static __inline__ vector bool int __ATTRS_o_ai |
| 9587 | vec_sll(vector bool int __a, vector unsigned char __b) { |
| 9588 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9589 | (vector int)__b); |
| 9590 | } |
| 9591 | |
| 9592 | static __inline__ vector bool int __ATTRS_o_ai |
| 9593 | vec_sll(vector bool int __a, vector unsigned short __b) { |
| 9594 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9595 | (vector int)__b); |
| 9596 | } |
| 9597 | |
| 9598 | static __inline__ vector bool int __ATTRS_o_ai |
| 9599 | vec_sll(vector bool int __a, vector unsigned int __b) { |
| 9600 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9601 | (vector int)__b); |
| 9602 | } |
| 9603 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 9604 | #ifdef __VSX__ |
| 9605 | static __inline__ vector signed long long __ATTRS_o_ai |
| 9606 | vec_sll(vector signed long long __a, vector unsigned char __b) { |
| 9607 | return (vector signed long long)__builtin_altivec_vsl((vector int)__a, |
| 9608 | (vector int)__b); |
| 9609 | } |
| 9610 | |
| 9611 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 9612 | vec_sll(vector unsigned long long __a, vector unsigned char __b) { |
| 9613 | return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, |
| 9614 | (vector int)__b); |
| 9615 | } |
| 9616 | #endif |
| 9617 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 9618 | /* vec_vsl */ |
| 9619 | |
| 9620 | static __inline__ vector signed char __ATTRS_o_ai |
| 9621 | vec_vsl(vector signed char __a, vector unsigned char __b) { |
| 9622 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9623 | (vector int)__b); |
| 9624 | } |
| 9625 | |
| 9626 | static __inline__ vector signed char __ATTRS_o_ai |
| 9627 | vec_vsl(vector signed char __a, vector unsigned short __b) { |
| 9628 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9629 | (vector int)__b); |
| 9630 | } |
| 9631 | |
| 9632 | static __inline__ vector signed char __ATTRS_o_ai |
| 9633 | vec_vsl(vector signed char __a, vector unsigned int __b) { |
| 9634 | return (vector signed char)__builtin_altivec_vsl((vector int)__a, |
| 9635 | (vector int)__b); |
| 9636 | } |
| 9637 | |
| 9638 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9639 | vec_vsl(vector unsigned char __a, vector unsigned char __b) { |
| 9640 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9641 | (vector int)__b); |
| 9642 | } |
| 9643 | |
| 9644 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9645 | vec_vsl(vector unsigned char __a, vector unsigned short __b) { |
| 9646 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9647 | (vector int)__b); |
| 9648 | } |
| 9649 | |
| 9650 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9651 | vec_vsl(vector unsigned char __a, vector unsigned int __b) { |
| 9652 | return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, |
| 9653 | (vector int)__b); |
| 9654 | } |
| 9655 | |
| 9656 | static __inline__ vector bool char __ATTRS_o_ai |
| 9657 | vec_vsl(vector bool char __a, vector unsigned char __b) { |
| 9658 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9659 | (vector int)__b); |
| 9660 | } |
| 9661 | |
| 9662 | static __inline__ vector bool char __ATTRS_o_ai |
| 9663 | vec_vsl(vector bool char __a, vector unsigned short __b) { |
| 9664 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9665 | (vector int)__b); |
| 9666 | } |
| 9667 | |
| 9668 | static __inline__ vector bool char __ATTRS_o_ai |
| 9669 | vec_vsl(vector bool char __a, vector unsigned int __b) { |
| 9670 | return (vector bool char)__builtin_altivec_vsl((vector int)__a, |
| 9671 | (vector int)__b); |
| 9672 | } |
| 9673 | |
| 9674 | static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, |
| 9675 | vector unsigned char __b) { |
| 9676 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9677 | } |
| 9678 | |
| 9679 | static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, |
| 9680 | vector unsigned short __b) { |
| 9681 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9682 | } |
| 9683 | |
| 9684 | static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, |
| 9685 | vector unsigned int __b) { |
| 9686 | return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9687 | } |
| 9688 | |
| 9689 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9690 | vec_vsl(vector unsigned short __a, vector unsigned char __b) { |
| 9691 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9692 | (vector int)__b); |
| 9693 | } |
| 9694 | |
| 9695 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9696 | vec_vsl(vector unsigned short __a, vector unsigned short __b) { |
| 9697 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9698 | (vector int)__b); |
| 9699 | } |
| 9700 | |
| 9701 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9702 | vec_vsl(vector unsigned short __a, vector unsigned int __b) { |
| 9703 | return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, |
| 9704 | (vector int)__b); |
| 9705 | } |
| 9706 | |
| 9707 | static __inline__ vector bool short __ATTRS_o_ai |
| 9708 | vec_vsl(vector bool short __a, vector unsigned char __b) { |
| 9709 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9710 | (vector int)__b); |
| 9711 | } |
| 9712 | |
| 9713 | static __inline__ vector bool short __ATTRS_o_ai |
| 9714 | vec_vsl(vector bool short __a, vector unsigned short __b) { |
| 9715 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9716 | (vector int)__b); |
| 9717 | } |
| 9718 | |
| 9719 | static __inline__ vector bool short __ATTRS_o_ai |
| 9720 | vec_vsl(vector bool short __a, vector unsigned int __b) { |
| 9721 | return (vector bool short)__builtin_altivec_vsl((vector int)__a, |
| 9722 | (vector int)__b); |
| 9723 | } |
| 9724 | |
| 9725 | static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, |
| 9726 | vector unsigned char __b) { |
| 9727 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9728 | } |
| 9729 | |
| 9730 | static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, |
| 9731 | vector unsigned short __b) { |
| 9732 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9733 | } |
| 9734 | |
| 9735 | static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, |
| 9736 | vector unsigned int __b) { |
| 9737 | return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); |
| 9738 | } |
| 9739 | |
| 9740 | static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, |
| 9741 | vector unsigned char __b) { |
| 9742 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9743 | } |
| 9744 | |
| 9745 | static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, |
| 9746 | vector unsigned short __b) { |
| 9747 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9748 | } |
| 9749 | |
| 9750 | static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, |
| 9751 | vector unsigned int __b) { |
| 9752 | return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); |
| 9753 | } |
| 9754 | |
| 9755 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9756 | vec_vsl(vector unsigned int __a, vector unsigned char __b) { |
| 9757 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9758 | (vector int)__b); |
| 9759 | } |
| 9760 | |
| 9761 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9762 | vec_vsl(vector unsigned int __a, vector unsigned short __b) { |
| 9763 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9764 | (vector int)__b); |
| 9765 | } |
| 9766 | |
| 9767 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9768 | vec_vsl(vector unsigned int __a, vector unsigned int __b) { |
| 9769 | return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, |
| 9770 | (vector int)__b); |
| 9771 | } |
| 9772 | |
| 9773 | static __inline__ vector bool int __ATTRS_o_ai |
| 9774 | vec_vsl(vector bool int __a, vector unsigned char __b) { |
| 9775 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9776 | (vector int)__b); |
| 9777 | } |
| 9778 | |
| 9779 | static __inline__ vector bool int __ATTRS_o_ai |
| 9780 | vec_vsl(vector bool int __a, vector unsigned short __b) { |
| 9781 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9782 | (vector int)__b); |
| 9783 | } |
| 9784 | |
| 9785 | static __inline__ vector bool int __ATTRS_o_ai |
| 9786 | vec_vsl(vector bool int __a, vector unsigned int __b) { |
| 9787 | return (vector bool int)__builtin_altivec_vsl((vector int)__a, |
| 9788 | (vector int)__b); |
| 9789 | } |
| 9790 | |
| 9791 | /* vec_slo */ |
| 9792 | |
| 9793 | static __inline__ vector signed char __ATTRS_o_ai |
| 9794 | vec_slo(vector signed char __a, vector signed char __b) { |
| 9795 | return (vector signed char)__builtin_altivec_vslo((vector int)__a, |
| 9796 | (vector int)__b); |
| 9797 | } |
| 9798 | |
| 9799 | static __inline__ vector signed char __ATTRS_o_ai |
| 9800 | vec_slo(vector signed char __a, vector unsigned char __b) { |
| 9801 | return (vector signed char)__builtin_altivec_vslo((vector int)__a, |
| 9802 | (vector int)__b); |
| 9803 | } |
| 9804 | |
| 9805 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9806 | vec_slo(vector unsigned char __a, vector signed char __b) { |
| 9807 | return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, |
| 9808 | (vector int)__b); |
| 9809 | } |
| 9810 | |
| 9811 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9812 | vec_slo(vector unsigned char __a, vector unsigned char __b) { |
| 9813 | return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, |
| 9814 | (vector int)__b); |
| 9815 | } |
| 9816 | |
| 9817 | static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, |
| 9818 | vector signed char __b) { |
| 9819 | return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9820 | } |
| 9821 | |
| 9822 | static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, |
| 9823 | vector unsigned char __b) { |
| 9824 | return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9825 | } |
| 9826 | |
| 9827 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9828 | vec_slo(vector unsigned short __a, vector signed char __b) { |
| 9829 | return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, |
| 9830 | (vector int)__b); |
| 9831 | } |
| 9832 | |
| 9833 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9834 | vec_slo(vector unsigned short __a, vector unsigned char __b) { |
| 9835 | return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, |
| 9836 | (vector int)__b); |
| 9837 | } |
| 9838 | |
| 9839 | static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, |
| 9840 | vector signed char __b) { |
| 9841 | return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9842 | } |
| 9843 | |
| 9844 | static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, |
| 9845 | vector unsigned char __b) { |
| 9846 | return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9847 | } |
| 9848 | |
| 9849 | static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, |
| 9850 | vector signed char __b) { |
| 9851 | return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); |
| 9852 | } |
| 9853 | |
| 9854 | static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, |
| 9855 | vector unsigned char __b) { |
| 9856 | return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); |
| 9857 | } |
| 9858 | |
| 9859 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9860 | vec_slo(vector unsigned int __a, vector signed char __b) { |
| 9861 | return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, |
| 9862 | (vector int)__b); |
| 9863 | } |
| 9864 | |
| 9865 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9866 | vec_slo(vector unsigned int __a, vector unsigned char __b) { |
| 9867 | return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, |
| 9868 | (vector int)__b); |
| 9869 | } |
| 9870 | |
| 9871 | static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, |
| 9872 | vector signed char __b) { |
| 9873 | return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9874 | } |
| 9875 | |
| 9876 | static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, |
| 9877 | vector unsigned char __b) { |
| 9878 | return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9879 | } |
| 9880 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 9881 | #ifdef __VSX__ |
| 9882 | static __inline__ vector signed long long __ATTRS_o_ai |
| 9883 | vec_slo(vector signed long long __a, vector signed char __b) { |
| 9884 | return (vector signed long long)__builtin_altivec_vslo((vector int)__a, |
| 9885 | (vector int)__b); |
| 9886 | } |
| 9887 | |
| 9888 | static __inline__ vector signed long long __ATTRS_o_ai |
| 9889 | vec_slo(vector signed long long __a, vector unsigned char __b) { |
| 9890 | return (vector signed long long)__builtin_altivec_vslo((vector int)__a, |
| 9891 | (vector int)__b); |
| 9892 | } |
| 9893 | |
| 9894 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 9895 | vec_slo(vector unsigned long long __a, vector signed char __b) { |
| 9896 | return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, |
| 9897 | (vector int)__b); |
| 9898 | } |
| 9899 | |
| 9900 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 9901 | vec_slo(vector unsigned long long __a, vector unsigned char __b) { |
| 9902 | return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, |
| 9903 | (vector int)__b); |
| 9904 | } |
| 9905 | #endif |
| 9906 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 9907 | /* vec_vslo */ |
| 9908 | |
| 9909 | static __inline__ vector signed char __ATTRS_o_ai |
| 9910 | vec_vslo(vector signed char __a, vector signed char __b) { |
| 9911 | return (vector signed char)__builtin_altivec_vslo((vector int)__a, |
| 9912 | (vector int)__b); |
| 9913 | } |
| 9914 | |
| 9915 | static __inline__ vector signed char __ATTRS_o_ai |
| 9916 | vec_vslo(vector signed char __a, vector unsigned char __b) { |
| 9917 | return (vector signed char)__builtin_altivec_vslo((vector int)__a, |
| 9918 | (vector int)__b); |
| 9919 | } |
| 9920 | |
| 9921 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9922 | vec_vslo(vector unsigned char __a, vector signed char __b) { |
| 9923 | return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, |
| 9924 | (vector int)__b); |
| 9925 | } |
| 9926 | |
| 9927 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 9928 | vec_vslo(vector unsigned char __a, vector unsigned char __b) { |
| 9929 | return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, |
| 9930 | (vector int)__b); |
| 9931 | } |
| 9932 | |
| 9933 | static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, |
| 9934 | vector signed char __b) { |
| 9935 | return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9936 | } |
| 9937 | |
| 9938 | static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, |
| 9939 | vector unsigned char __b) { |
| 9940 | return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9941 | } |
| 9942 | |
| 9943 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9944 | vec_vslo(vector unsigned short __a, vector signed char __b) { |
| 9945 | return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, |
| 9946 | (vector int)__b); |
| 9947 | } |
| 9948 | |
| 9949 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 9950 | vec_vslo(vector unsigned short __a, vector unsigned char __b) { |
| 9951 | return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, |
| 9952 | (vector int)__b); |
| 9953 | } |
| 9954 | |
| 9955 | static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, |
| 9956 | vector signed char __b) { |
| 9957 | return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9958 | } |
| 9959 | |
| 9960 | static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, |
| 9961 | vector unsigned char __b) { |
| 9962 | return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9963 | } |
| 9964 | |
| 9965 | static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, |
| 9966 | vector signed char __b) { |
| 9967 | return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); |
| 9968 | } |
| 9969 | |
| 9970 | static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, |
| 9971 | vector unsigned char __b) { |
| 9972 | return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); |
| 9973 | } |
| 9974 | |
| 9975 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9976 | vec_vslo(vector unsigned int __a, vector signed char __b) { |
| 9977 | return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, |
| 9978 | (vector int)__b); |
| 9979 | } |
| 9980 | |
| 9981 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 9982 | vec_vslo(vector unsigned int __a, vector unsigned char __b) { |
| 9983 | return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, |
| 9984 | (vector int)__b); |
| 9985 | } |
| 9986 | |
| 9987 | static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, |
| 9988 | vector signed char __b) { |
| 9989 | return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9990 | } |
| 9991 | |
| 9992 | static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, |
| 9993 | vector unsigned char __b) { |
| 9994 | return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); |
| 9995 | } |
| 9996 | |
| 9997 | /* vec_splat */ |
| 9998 | |
| 9999 | static __inline__ vector signed char __ATTRS_o_ai |
| 10000 | vec_splat(vector signed char __a, unsigned const int __b) { |
| 10001 | return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); |
| 10002 | } |
| 10003 | |
| 10004 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10005 | vec_splat(vector unsigned char __a, unsigned const int __b) { |
| 10006 | return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); |
| 10007 | } |
| 10008 | |
| 10009 | static __inline__ vector bool char __ATTRS_o_ai |
| 10010 | vec_splat(vector bool char __a, unsigned const int __b) { |
| 10011 | return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); |
| 10012 | } |
| 10013 | |
| 10014 | static __inline__ vector signed short __ATTRS_o_ai |
| 10015 | vec_splat(vector signed short __a, unsigned const int __b) { |
| 10016 | unsigned char b0 = (__b & 0x07) * 2; |
| 10017 | unsigned char b1 = b0 + 1; |
| 10018 | return vec_perm(__a, __a, |
| 10019 | (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, |
| 10020 | b0, b1, b0, b1, b0, b1)); |
| 10021 | } |
| 10022 | |
| 10023 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10024 | vec_splat(vector unsigned short __a, unsigned const int __b) { |
| 10025 | unsigned char b0 = (__b & 0x07) * 2; |
| 10026 | unsigned char b1 = b0 + 1; |
| 10027 | return vec_perm(__a, __a, |
| 10028 | (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, |
| 10029 | b0, b1, b0, b1, b0, b1)); |
| 10030 | } |
| 10031 | |
| 10032 | static __inline__ vector bool short __ATTRS_o_ai |
| 10033 | vec_splat(vector bool short __a, unsigned const int __b) { |
| 10034 | unsigned char b0 = (__b & 0x07) * 2; |
| 10035 | unsigned char b1 = b0 + 1; |
| 10036 | return vec_perm(__a, __a, |
| 10037 | (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, |
| 10038 | b0, b1, b0, b1, b0, b1)); |
| 10039 | } |
| 10040 | |
| 10041 | static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, |
| 10042 | unsigned const int __b) { |
| 10043 | unsigned char b0 = (__b & 0x07) * 2; |
| 10044 | unsigned char b1 = b0 + 1; |
| 10045 | return vec_perm(__a, __a, |
| 10046 | (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, |
| 10047 | b0, b1, b0, b1, b0, b1)); |
| 10048 | } |
| 10049 | |
| 10050 | static __inline__ vector signed int __ATTRS_o_ai |
| 10051 | vec_splat(vector signed int __a, unsigned const int __b) { |
| 10052 | unsigned char b0 = (__b & 0x03) * 4; |
| 10053 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; |
| 10054 | return vec_perm(__a, __a, |
| 10055 | (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, |
| 10056 | b2, b3, b0, b1, b2, b3)); |
| 10057 | } |
| 10058 | |
| 10059 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10060 | vec_splat(vector unsigned int __a, unsigned const int __b) { |
| 10061 | unsigned char b0 = (__b & 0x03) * 4; |
| 10062 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; |
| 10063 | return vec_perm(__a, __a, |
| 10064 | (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, |
| 10065 | b2, b3, b0, b1, b2, b3)); |
| 10066 | } |
| 10067 | |
| 10068 | static __inline__ vector bool int __ATTRS_o_ai |
| 10069 | vec_splat(vector bool int __a, unsigned const int __b) { |
| 10070 | unsigned char b0 = (__b & 0x03) * 4; |
| 10071 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; |
| 10072 | return vec_perm(__a, __a, |
| 10073 | (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, |
| 10074 | b2, b3, b0, b1, b2, b3)); |
| 10075 | } |
| 10076 | |
| 10077 | static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, |
| 10078 | unsigned const int __b) { |
| 10079 | unsigned char b0 = (__b & 0x03) * 4; |
| 10080 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; |
| 10081 | return vec_perm(__a, __a, |
| 10082 | (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, |
| 10083 | b2, b3, b0, b1, b2, b3)); |
| 10084 | } |
| 10085 | |
| 10086 | #ifdef __VSX__ |
| 10087 | static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, |
| 10088 | unsigned const int __b) { |
| 10089 | unsigned char b0 = (__b & 0x01) * 8; |
| 10090 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, |
| 10091 | b6 = b0 + 6, b7 = b0 + 7; |
| 10092 | return vec_perm(__a, __a, |
| 10093 | (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, |
| 10094 | b2, b3, b4, b5, b6, b7)); |
| 10095 | } |
| 10096 | static __inline__ vector bool long long __ATTRS_o_ai |
| 10097 | vec_splat(vector bool long long __a, unsigned const int __b) { |
| 10098 | unsigned char b0 = (__b & 0x01) * 8; |
| 10099 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, |
| 10100 | b6 = b0 + 6, b7 = b0 + 7; |
| 10101 | return vec_perm(__a, __a, |
| 10102 | (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, |
| 10103 | b2, b3, b4, b5, b6, b7)); |
| 10104 | } |
| 10105 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10106 | vec_splat(vector signed long long __a, unsigned const int __b) { |
| 10107 | unsigned char b0 = (__b & 0x01) * 8; |
| 10108 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, |
| 10109 | b6 = b0 + 6, b7 = b0 + 7; |
| 10110 | return vec_perm(__a, __a, |
| 10111 | (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, |
| 10112 | b2, b3, b4, b5, b6, b7)); |
| 10113 | } |
| 10114 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10115 | vec_splat(vector unsigned long long __a, unsigned const int __b) { |
| 10116 | unsigned char b0 = (__b & 0x01) * 8; |
| 10117 | unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, |
| 10118 | b6 = b0 + 6, b7 = b0 + 7; |
| 10119 | return vec_perm(__a, __a, |
| 10120 | (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, |
| 10121 | b2, b3, b4, b5, b6, b7)); |
| 10122 | } |
| 10123 | #endif |
| 10124 | |
| 10125 | /* vec_vspltb */ |
| 10126 | |
| 10127 | #define __builtin_altivec_vspltb vec_vspltb |
| 10128 | |
| 10129 | static __inline__ vector signed char __ATTRS_o_ai |
| 10130 | vec_vspltb(vector signed char __a, unsigned char __b) { |
| 10131 | return vec_perm(__a, __a, (vector unsigned char)(__b)); |
| 10132 | } |
| 10133 | |
| 10134 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10135 | vec_vspltb(vector unsigned char __a, unsigned char __b) { |
| 10136 | return vec_perm(__a, __a, (vector unsigned char)(__b)); |
| 10137 | } |
| 10138 | |
| 10139 | static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, |
| 10140 | unsigned char __b) { |
| 10141 | return vec_perm(__a, __a, (vector unsigned char)(__b)); |
| 10142 | } |
| 10143 | |
| 10144 | /* vec_vsplth */ |
| 10145 | |
| 10146 | #define __builtin_altivec_vsplth vec_vsplth |
| 10147 | |
| 10148 | static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, |
| 10149 | unsigned char __b) { |
| 10150 | __b *= 2; |
| 10151 | unsigned char b1 = __b + 1; |
| 10152 | return vec_perm(__a, __a, |
| 10153 | (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, |
| 10154 | __b, b1, __b, b1, __b, b1, __b, b1)); |
| 10155 | } |
| 10156 | |
| 10157 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10158 | vec_vsplth(vector unsigned short __a, unsigned char __b) { |
| 10159 | __b *= 2; |
| 10160 | unsigned char b1 = __b + 1; |
| 10161 | return vec_perm(__a, __a, |
| 10162 | (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, |
| 10163 | __b, b1, __b, b1, __b, b1, __b, b1)); |
| 10164 | } |
| 10165 | |
| 10166 | static __inline__ vector bool short __ATTRS_o_ai |
| 10167 | vec_vsplth(vector bool short __a, unsigned char __b) { |
| 10168 | __b *= 2; |
| 10169 | unsigned char b1 = __b + 1; |
| 10170 | return vec_perm(__a, __a, |
| 10171 | (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, |
| 10172 | __b, b1, __b, b1, __b, b1, __b, b1)); |
| 10173 | } |
| 10174 | |
| 10175 | static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, |
| 10176 | unsigned char __b) { |
| 10177 | __b *= 2; |
| 10178 | unsigned char b1 = __b + 1; |
| 10179 | return vec_perm(__a, __a, |
| 10180 | (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, |
| 10181 | __b, b1, __b, b1, __b, b1, __b, b1)); |
| 10182 | } |
| 10183 | |
| 10184 | /* vec_vspltw */ |
| 10185 | |
| 10186 | #define __builtin_altivec_vspltw vec_vspltw |
| 10187 | |
| 10188 | static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, |
| 10189 | unsigned char __b) { |
| 10190 | __b *= 4; |
| 10191 | unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; |
| 10192 | return vec_perm(__a, __a, |
| 10193 | (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, |
| 10194 | b1, b2, b3, __b, b1, b2, b3)); |
| 10195 | } |
| 10196 | |
| 10197 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10198 | vec_vspltw(vector unsigned int __a, unsigned char __b) { |
| 10199 | __b *= 4; |
| 10200 | unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; |
| 10201 | return vec_perm(__a, __a, |
| 10202 | (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, |
| 10203 | b1, b2, b3, __b, b1, b2, b3)); |
| 10204 | } |
| 10205 | |
| 10206 | static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, |
| 10207 | unsigned char __b) { |
| 10208 | __b *= 4; |
| 10209 | unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; |
| 10210 | return vec_perm(__a, __a, |
| 10211 | (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, |
| 10212 | b1, b2, b3, __b, b1, b2, b3)); |
| 10213 | } |
| 10214 | |
| 10215 | static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, |
| 10216 | unsigned char __b) { |
| 10217 | __b *= 4; |
| 10218 | unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; |
| 10219 | return vec_perm(__a, __a, |
| 10220 | (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, |
| 10221 | b1, b2, b3, __b, b1, b2, b3)); |
| 10222 | } |
| 10223 | |
| 10224 | /* vec_splat_s8 */ |
| 10225 | |
| 10226 | #define __builtin_altivec_vspltisb vec_splat_s8 |
| 10227 | |
| 10228 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10229 | static __inline__ vector signed char __ATTRS_o_ai |
| 10230 | vec_splat_s8(signed char __a) { |
| 10231 | return (vector signed char)(__a); |
| 10232 | } |
| 10233 | |
| 10234 | /* vec_vspltisb */ |
| 10235 | |
| 10236 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10237 | static __inline__ vector signed char __ATTRS_o_ai |
| 10238 | vec_vspltisb(signed char __a) { |
| 10239 | return (vector signed char)(__a); |
| 10240 | } |
| 10241 | |
| 10242 | /* vec_splat_s16 */ |
| 10243 | |
| 10244 | #define __builtin_altivec_vspltish vec_splat_s16 |
| 10245 | |
| 10246 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10247 | static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { |
| 10248 | return (vector short)(__a); |
| 10249 | } |
| 10250 | |
| 10251 | /* vec_vspltish */ |
| 10252 | |
| 10253 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10254 | static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { |
| 10255 | return (vector short)(__a); |
| 10256 | } |
| 10257 | |
| 10258 | /* vec_splat_s32 */ |
| 10259 | |
| 10260 | #define __builtin_altivec_vspltisw vec_splat_s32 |
| 10261 | |
| 10262 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10263 | static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { |
| 10264 | return (vector int)(__a); |
| 10265 | } |
| 10266 | |
| 10267 | /* vec_vspltisw */ |
| 10268 | |
| 10269 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10270 | static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { |
| 10271 | return (vector int)(__a); |
| 10272 | } |
| 10273 | |
| 10274 | /* vec_splat_u8 */ |
| 10275 | |
| 10276 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10277 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10278 | vec_splat_u8(unsigned char __a) { |
| 10279 | return (vector unsigned char)(__a); |
| 10280 | } |
| 10281 | |
| 10282 | /* vec_splat_u16 */ |
| 10283 | |
| 10284 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10285 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10286 | vec_splat_u16(signed char __a) { |
| 10287 | return (vector unsigned short)(__a); |
| 10288 | } |
| 10289 | |
| 10290 | /* vec_splat_u32 */ |
| 10291 | |
| 10292 | // FIXME: parameter should be treated as 5-bit signed literal |
| 10293 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10294 | vec_splat_u32(signed char __a) { |
| 10295 | return (vector unsigned int)(__a); |
| 10296 | } |
| 10297 | |
| 10298 | /* vec_sr */ |
| 10299 | |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10300 | // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more |
| 10301 | // than the length of __a. |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10302 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10303 | vec_sr(vector unsigned char __a, vector unsigned char __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10304 | return __a >> |
| 10305 | (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10306 | } |
| 10307 | |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10308 | static __inline__ vector signed char __ATTRS_o_ai |
| 10309 | vec_sr(vector signed char __a, vector unsigned char __b) { |
| 10310 | return (vector signed char)vec_sr((vector unsigned char)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10311 | } |
| 10312 | |
| 10313 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10314 | vec_sr(vector unsigned short __a, vector unsigned short __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10315 | return __a >> |
| 10316 | (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10317 | } |
| 10318 | |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10319 | static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, |
| 10320 | vector unsigned short __b) { |
| 10321 | return (vector short)vec_sr((vector unsigned short)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10322 | } |
| 10323 | |
| 10324 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10325 | vec_sr(vector unsigned int __a, vector unsigned int __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10326 | return __a >> |
| 10327 | (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); |
| 10328 | } |
| 10329 | |
| 10330 | static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, |
| 10331 | vector unsigned int __b) { |
| 10332 | return (vector int)vec_sr((vector unsigned int)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10333 | } |
| 10334 | |
| 10335 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10336 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10337 | vec_sr(vector unsigned long long __a, vector unsigned long long __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10338 | return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * |
| 10339 | __CHAR_BIT__)); |
| 10340 | } |
| 10341 | |
| 10342 | static __inline__ vector long long __ATTRS_o_ai |
| 10343 | vec_sr(vector long long __a, vector unsigned long long __b) { |
| 10344 | return (vector long long)vec_sr((vector unsigned long long)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10345 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 10346 | #else |
| 10347 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10348 | vec_sr(vector unsigned long long __a, vector unsigned long long __b) { |
| 10349 | __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); |
| 10350 | |
| 10351 | // Big endian element zero (the left doubleword) can be right shifted as-is. |
| 10352 | // However the shift amount must be in the right doubleword. |
| 10353 | // The other element needs to be swapped into the left doubleword and |
| 10354 | // shifted. Then the left doublewords of the two result vectors are merged. |
| 10355 | vector unsigned long long __swapshift = |
| 10356 | __builtin_shufflevector(__b, __b, 1, 0); |
| 10357 | vector unsigned long long __leftelt = |
| 10358 | (vector unsigned long long)__builtin_altivec_vsro( |
| 10359 | (vector signed int)__a, (vector signed int)__swapshift); |
| 10360 | #ifdef __LITTLE_ENDIAN__ |
| 10361 | __leftelt = (vector unsigned long long)__builtin_altivec_vsr( |
| 10362 | (vector signed int)__leftelt, |
| 10363 | (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); |
| 10364 | #else |
| 10365 | __leftelt = (vector unsigned long long)__builtin_altivec_vsr( |
| 10366 | (vector signed int)__leftelt, |
| 10367 | (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); |
| 10368 | #endif |
| 10369 | __a = __builtin_shufflevector(__a, __a, 1, 0); |
| 10370 | vector unsigned long long __rightelt = |
| 10371 | (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, |
| 10372 | (vector signed int)__b); |
| 10373 | #ifdef __LITTLE_ENDIAN__ |
| 10374 | __rightelt = (vector unsigned long long)__builtin_altivec_vsr( |
| 10375 | (vector signed int)__rightelt, |
| 10376 | (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); |
| 10377 | return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); |
| 10378 | #else |
| 10379 | __rightelt = (vector unsigned long long)__builtin_altivec_vsr( |
| 10380 | (vector signed int)__rightelt, |
| 10381 | (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); |
| 10382 | return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); |
| 10383 | #endif |
| 10384 | } |
| 10385 | |
| 10386 | static __inline__ vector long long __ATTRS_o_ai |
| 10387 | vec_sr(vector long long __a, vector unsigned long long __b) { |
| 10388 | return (vector long long)vec_sr((vector unsigned long long)__a, __b); |
| 10389 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10390 | #endif |
| 10391 | |
| 10392 | /* vec_vsrb */ |
| 10393 | |
| 10394 | #define __builtin_altivec_vsrb vec_vsrb |
| 10395 | |
| 10396 | static __inline__ vector signed char __ATTRS_o_ai |
| 10397 | vec_vsrb(vector signed char __a, vector unsigned char __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10398 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10399 | } |
| 10400 | |
| 10401 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10402 | vec_vsrb(vector unsigned char __a, vector unsigned char __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10403 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10404 | } |
| 10405 | |
| 10406 | /* vec_vsrh */ |
| 10407 | |
| 10408 | #define __builtin_altivec_vsrh vec_vsrh |
| 10409 | |
| 10410 | static __inline__ vector short __ATTRS_o_ai |
| 10411 | vec_vsrh(vector short __a, vector unsigned short __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10412 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10413 | } |
| 10414 | |
| 10415 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10416 | vec_vsrh(vector unsigned short __a, vector unsigned short __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10417 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10418 | } |
| 10419 | |
| 10420 | /* vec_vsrw */ |
| 10421 | |
| 10422 | #define __builtin_altivec_vsrw vec_vsrw |
| 10423 | |
| 10424 | static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, |
| 10425 | vector unsigned int __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10426 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10427 | } |
| 10428 | |
| 10429 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10430 | vec_vsrw(vector unsigned int __a, vector unsigned int __b) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 10431 | return vec_sr(__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10432 | } |
| 10433 | |
| 10434 | /* vec_sra */ |
| 10435 | |
| 10436 | static __inline__ vector signed char __ATTRS_o_ai |
| 10437 | vec_sra(vector signed char __a, vector unsigned char __b) { |
| 10438 | return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); |
| 10439 | } |
| 10440 | |
| 10441 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10442 | vec_sra(vector unsigned char __a, vector unsigned char __b) { |
| 10443 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); |
| 10444 | } |
| 10445 | |
| 10446 | static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, |
| 10447 | vector unsigned short __b) { |
| 10448 | return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); |
| 10449 | } |
| 10450 | |
| 10451 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10452 | vec_sra(vector unsigned short __a, vector unsigned short __b) { |
| 10453 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); |
| 10454 | } |
| 10455 | |
| 10456 | static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, |
| 10457 | vector unsigned int __b) { |
| 10458 | return __builtin_altivec_vsraw(__a, __b); |
| 10459 | } |
| 10460 | |
| 10461 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10462 | vec_sra(vector unsigned int __a, vector unsigned int __b) { |
| 10463 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); |
| 10464 | } |
| 10465 | |
| 10466 | #ifdef __POWER8_VECTOR__ |
| 10467 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10468 | vec_sra(vector signed long long __a, vector unsigned long long __b) { |
| 10469 | return __a >> __b; |
| 10470 | } |
| 10471 | |
| 10472 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10473 | vec_sra(vector unsigned long long __a, vector unsigned long long __b) { |
| 10474 | return (vector unsigned long long)((vector signed long long)__a >> __b); |
| 10475 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 10476 | #else |
| 10477 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10478 | vec_sra(vector signed long long __a, vector unsigned long long __b) { |
| 10479 | __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); |
| 10480 | return __a >> __b; |
| 10481 | } |
| 10482 | |
| 10483 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10484 | vec_sra(vector unsigned long long __a, vector unsigned long long __b) { |
| 10485 | __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); |
| 10486 | return (vector unsigned long long)((vector signed long long)__a >> __b); |
| 10487 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10488 | #endif |
| 10489 | |
| 10490 | /* vec_vsrab */ |
| 10491 | |
| 10492 | static __inline__ vector signed char __ATTRS_o_ai |
| 10493 | vec_vsrab(vector signed char __a, vector unsigned char __b) { |
| 10494 | return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); |
| 10495 | } |
| 10496 | |
| 10497 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10498 | vec_vsrab(vector unsigned char __a, vector unsigned char __b) { |
| 10499 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); |
| 10500 | } |
| 10501 | |
| 10502 | /* vec_vsrah */ |
| 10503 | |
| 10504 | static __inline__ vector short __ATTRS_o_ai |
| 10505 | vec_vsrah(vector short __a, vector unsigned short __b) { |
| 10506 | return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); |
| 10507 | } |
| 10508 | |
| 10509 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10510 | vec_vsrah(vector unsigned short __a, vector unsigned short __b) { |
| 10511 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); |
| 10512 | } |
| 10513 | |
| 10514 | /* vec_vsraw */ |
| 10515 | |
| 10516 | static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, |
| 10517 | vector unsigned int __b) { |
| 10518 | return __builtin_altivec_vsraw(__a, __b); |
| 10519 | } |
| 10520 | |
| 10521 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10522 | vec_vsraw(vector unsigned int __a, vector unsigned int __b) { |
| 10523 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); |
| 10524 | } |
| 10525 | |
| 10526 | /* vec_srl */ |
| 10527 | |
| 10528 | static __inline__ vector signed char __ATTRS_o_ai |
| 10529 | vec_srl(vector signed char __a, vector unsigned char __b) { |
| 10530 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10531 | (vector int)__b); |
| 10532 | } |
| 10533 | |
| 10534 | static __inline__ vector signed char __ATTRS_o_ai |
| 10535 | vec_srl(vector signed char __a, vector unsigned short __b) { |
| 10536 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10537 | (vector int)__b); |
| 10538 | } |
| 10539 | |
| 10540 | static __inline__ vector signed char __ATTRS_o_ai |
| 10541 | vec_srl(vector signed char __a, vector unsigned int __b) { |
| 10542 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10543 | (vector int)__b); |
| 10544 | } |
| 10545 | |
| 10546 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10547 | vec_srl(vector unsigned char __a, vector unsigned char __b) { |
| 10548 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10549 | (vector int)__b); |
| 10550 | } |
| 10551 | |
| 10552 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10553 | vec_srl(vector unsigned char __a, vector unsigned short __b) { |
| 10554 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10555 | (vector int)__b); |
| 10556 | } |
| 10557 | |
| 10558 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10559 | vec_srl(vector unsigned char __a, vector unsigned int __b) { |
| 10560 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10561 | (vector int)__b); |
| 10562 | } |
| 10563 | |
| 10564 | static __inline__ vector bool char __ATTRS_o_ai |
| 10565 | vec_srl(vector bool char __a, vector unsigned char __b) { |
| 10566 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10567 | (vector int)__b); |
| 10568 | } |
| 10569 | |
| 10570 | static __inline__ vector bool char __ATTRS_o_ai |
| 10571 | vec_srl(vector bool char __a, vector unsigned short __b) { |
| 10572 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10573 | (vector int)__b); |
| 10574 | } |
| 10575 | |
| 10576 | static __inline__ vector bool char __ATTRS_o_ai |
| 10577 | vec_srl(vector bool char __a, vector unsigned int __b) { |
| 10578 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10579 | (vector int)__b); |
| 10580 | } |
| 10581 | |
| 10582 | static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, |
| 10583 | vector unsigned char __b) { |
| 10584 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10585 | } |
| 10586 | |
| 10587 | static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, |
| 10588 | vector unsigned short __b) { |
| 10589 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10590 | } |
| 10591 | |
| 10592 | static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, |
| 10593 | vector unsigned int __b) { |
| 10594 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10595 | } |
| 10596 | |
| 10597 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10598 | vec_srl(vector unsigned short __a, vector unsigned char __b) { |
| 10599 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10600 | (vector int)__b); |
| 10601 | } |
| 10602 | |
| 10603 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10604 | vec_srl(vector unsigned short __a, vector unsigned short __b) { |
| 10605 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10606 | (vector int)__b); |
| 10607 | } |
| 10608 | |
| 10609 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10610 | vec_srl(vector unsigned short __a, vector unsigned int __b) { |
| 10611 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10612 | (vector int)__b); |
| 10613 | } |
| 10614 | |
| 10615 | static __inline__ vector bool short __ATTRS_o_ai |
| 10616 | vec_srl(vector bool short __a, vector unsigned char __b) { |
| 10617 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10618 | (vector int)__b); |
| 10619 | } |
| 10620 | |
| 10621 | static __inline__ vector bool short __ATTRS_o_ai |
| 10622 | vec_srl(vector bool short __a, vector unsigned short __b) { |
| 10623 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10624 | (vector int)__b); |
| 10625 | } |
| 10626 | |
| 10627 | static __inline__ vector bool short __ATTRS_o_ai |
| 10628 | vec_srl(vector bool short __a, vector unsigned int __b) { |
| 10629 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10630 | (vector int)__b); |
| 10631 | } |
| 10632 | |
| 10633 | static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, |
| 10634 | vector unsigned char __b) { |
| 10635 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10636 | } |
| 10637 | |
| 10638 | static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, |
| 10639 | vector unsigned short __b) { |
| 10640 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10641 | } |
| 10642 | |
| 10643 | static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, |
| 10644 | vector unsigned int __b) { |
| 10645 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10646 | } |
| 10647 | |
| 10648 | static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, |
| 10649 | vector unsigned char __b) { |
| 10650 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10651 | } |
| 10652 | |
| 10653 | static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, |
| 10654 | vector unsigned short __b) { |
| 10655 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10656 | } |
| 10657 | |
| 10658 | static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, |
| 10659 | vector unsigned int __b) { |
| 10660 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10661 | } |
| 10662 | |
| 10663 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10664 | vec_srl(vector unsigned int __a, vector unsigned char __b) { |
| 10665 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10666 | (vector int)__b); |
| 10667 | } |
| 10668 | |
| 10669 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10670 | vec_srl(vector unsigned int __a, vector unsigned short __b) { |
| 10671 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10672 | (vector int)__b); |
| 10673 | } |
| 10674 | |
| 10675 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10676 | vec_srl(vector unsigned int __a, vector unsigned int __b) { |
| 10677 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10678 | (vector int)__b); |
| 10679 | } |
| 10680 | |
| 10681 | static __inline__ vector bool int __ATTRS_o_ai |
| 10682 | vec_srl(vector bool int __a, vector unsigned char __b) { |
| 10683 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10684 | (vector int)__b); |
| 10685 | } |
| 10686 | |
| 10687 | static __inline__ vector bool int __ATTRS_o_ai |
| 10688 | vec_srl(vector bool int __a, vector unsigned short __b) { |
| 10689 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10690 | (vector int)__b); |
| 10691 | } |
| 10692 | |
| 10693 | static __inline__ vector bool int __ATTRS_o_ai |
| 10694 | vec_srl(vector bool int __a, vector unsigned int __b) { |
| 10695 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10696 | (vector int)__b); |
| 10697 | } |
| 10698 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 10699 | #ifdef __VSX__ |
| 10700 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10701 | vec_srl(vector signed long long __a, vector unsigned char __b) { |
| 10702 | return (vector signed long long)__builtin_altivec_vsr((vector int)__a, |
| 10703 | (vector int)__b); |
| 10704 | } |
| 10705 | |
| 10706 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10707 | vec_srl(vector unsigned long long __a, vector unsigned char __b) { |
| 10708 | return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, |
| 10709 | (vector int)__b); |
| 10710 | } |
| 10711 | #endif |
| 10712 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 10713 | /* vec_vsr */ |
| 10714 | |
| 10715 | static __inline__ vector signed char __ATTRS_o_ai |
| 10716 | vec_vsr(vector signed char __a, vector unsigned char __b) { |
| 10717 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10718 | (vector int)__b); |
| 10719 | } |
| 10720 | |
| 10721 | static __inline__ vector signed char __ATTRS_o_ai |
| 10722 | vec_vsr(vector signed char __a, vector unsigned short __b) { |
| 10723 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10724 | (vector int)__b); |
| 10725 | } |
| 10726 | |
| 10727 | static __inline__ vector signed char __ATTRS_o_ai |
| 10728 | vec_vsr(vector signed char __a, vector unsigned int __b) { |
| 10729 | return (vector signed char)__builtin_altivec_vsr((vector int)__a, |
| 10730 | (vector int)__b); |
| 10731 | } |
| 10732 | |
| 10733 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10734 | vec_vsr(vector unsigned char __a, vector unsigned char __b) { |
| 10735 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10736 | (vector int)__b); |
| 10737 | } |
| 10738 | |
| 10739 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10740 | vec_vsr(vector unsigned char __a, vector unsigned short __b) { |
| 10741 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10742 | (vector int)__b); |
| 10743 | } |
| 10744 | |
| 10745 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10746 | vec_vsr(vector unsigned char __a, vector unsigned int __b) { |
| 10747 | return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, |
| 10748 | (vector int)__b); |
| 10749 | } |
| 10750 | |
| 10751 | static __inline__ vector bool char __ATTRS_o_ai |
| 10752 | vec_vsr(vector bool char __a, vector unsigned char __b) { |
| 10753 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10754 | (vector int)__b); |
| 10755 | } |
| 10756 | |
| 10757 | static __inline__ vector bool char __ATTRS_o_ai |
| 10758 | vec_vsr(vector bool char __a, vector unsigned short __b) { |
| 10759 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10760 | (vector int)__b); |
| 10761 | } |
| 10762 | |
| 10763 | static __inline__ vector bool char __ATTRS_o_ai |
| 10764 | vec_vsr(vector bool char __a, vector unsigned int __b) { |
| 10765 | return (vector bool char)__builtin_altivec_vsr((vector int)__a, |
| 10766 | (vector int)__b); |
| 10767 | } |
| 10768 | |
| 10769 | static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, |
| 10770 | vector unsigned char __b) { |
| 10771 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10772 | } |
| 10773 | |
| 10774 | static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, |
| 10775 | vector unsigned short __b) { |
| 10776 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10777 | } |
| 10778 | |
| 10779 | static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, |
| 10780 | vector unsigned int __b) { |
| 10781 | return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10782 | } |
| 10783 | |
| 10784 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10785 | vec_vsr(vector unsigned short __a, vector unsigned char __b) { |
| 10786 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10787 | (vector int)__b); |
| 10788 | } |
| 10789 | |
| 10790 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10791 | vec_vsr(vector unsigned short __a, vector unsigned short __b) { |
| 10792 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10793 | (vector int)__b); |
| 10794 | } |
| 10795 | |
| 10796 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10797 | vec_vsr(vector unsigned short __a, vector unsigned int __b) { |
| 10798 | return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, |
| 10799 | (vector int)__b); |
| 10800 | } |
| 10801 | |
| 10802 | static __inline__ vector bool short __ATTRS_o_ai |
| 10803 | vec_vsr(vector bool short __a, vector unsigned char __b) { |
| 10804 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10805 | (vector int)__b); |
| 10806 | } |
| 10807 | |
| 10808 | static __inline__ vector bool short __ATTRS_o_ai |
| 10809 | vec_vsr(vector bool short __a, vector unsigned short __b) { |
| 10810 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10811 | (vector int)__b); |
| 10812 | } |
| 10813 | |
| 10814 | static __inline__ vector bool short __ATTRS_o_ai |
| 10815 | vec_vsr(vector bool short __a, vector unsigned int __b) { |
| 10816 | return (vector bool short)__builtin_altivec_vsr((vector int)__a, |
| 10817 | (vector int)__b); |
| 10818 | } |
| 10819 | |
| 10820 | static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, |
| 10821 | vector unsigned char __b) { |
| 10822 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10823 | } |
| 10824 | |
| 10825 | static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, |
| 10826 | vector unsigned short __b) { |
| 10827 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10828 | } |
| 10829 | |
| 10830 | static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, |
| 10831 | vector unsigned int __b) { |
| 10832 | return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); |
| 10833 | } |
| 10834 | |
| 10835 | static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, |
| 10836 | vector unsigned char __b) { |
| 10837 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10838 | } |
| 10839 | |
| 10840 | static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, |
| 10841 | vector unsigned short __b) { |
| 10842 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10843 | } |
| 10844 | |
| 10845 | static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, |
| 10846 | vector unsigned int __b) { |
| 10847 | return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); |
| 10848 | } |
| 10849 | |
| 10850 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10851 | vec_vsr(vector unsigned int __a, vector unsigned char __b) { |
| 10852 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10853 | (vector int)__b); |
| 10854 | } |
| 10855 | |
| 10856 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10857 | vec_vsr(vector unsigned int __a, vector unsigned short __b) { |
| 10858 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10859 | (vector int)__b); |
| 10860 | } |
| 10861 | |
| 10862 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10863 | vec_vsr(vector unsigned int __a, vector unsigned int __b) { |
| 10864 | return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, |
| 10865 | (vector int)__b); |
| 10866 | } |
| 10867 | |
| 10868 | static __inline__ vector bool int __ATTRS_o_ai |
| 10869 | vec_vsr(vector bool int __a, vector unsigned char __b) { |
| 10870 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10871 | (vector int)__b); |
| 10872 | } |
| 10873 | |
| 10874 | static __inline__ vector bool int __ATTRS_o_ai |
| 10875 | vec_vsr(vector bool int __a, vector unsigned short __b) { |
| 10876 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10877 | (vector int)__b); |
| 10878 | } |
| 10879 | |
| 10880 | static __inline__ vector bool int __ATTRS_o_ai |
| 10881 | vec_vsr(vector bool int __a, vector unsigned int __b) { |
| 10882 | return (vector bool int)__builtin_altivec_vsr((vector int)__a, |
| 10883 | (vector int)__b); |
| 10884 | } |
| 10885 | |
| 10886 | /* vec_sro */ |
| 10887 | |
| 10888 | static __inline__ vector signed char __ATTRS_o_ai |
| 10889 | vec_sro(vector signed char __a, vector signed char __b) { |
| 10890 | return (vector signed char)__builtin_altivec_vsro((vector int)__a, |
| 10891 | (vector int)__b); |
| 10892 | } |
| 10893 | |
| 10894 | static __inline__ vector signed char __ATTRS_o_ai |
| 10895 | vec_sro(vector signed char __a, vector unsigned char __b) { |
| 10896 | return (vector signed char)__builtin_altivec_vsro((vector int)__a, |
| 10897 | (vector int)__b); |
| 10898 | } |
| 10899 | |
| 10900 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10901 | vec_sro(vector unsigned char __a, vector signed char __b) { |
| 10902 | return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, |
| 10903 | (vector int)__b); |
| 10904 | } |
| 10905 | |
| 10906 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 10907 | vec_sro(vector unsigned char __a, vector unsigned char __b) { |
| 10908 | return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, |
| 10909 | (vector int)__b); |
| 10910 | } |
| 10911 | |
| 10912 | static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, |
| 10913 | vector signed char __b) { |
| 10914 | return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10915 | } |
| 10916 | |
| 10917 | static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, |
| 10918 | vector unsigned char __b) { |
| 10919 | return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10920 | } |
| 10921 | |
| 10922 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10923 | vec_sro(vector unsigned short __a, vector signed char __b) { |
| 10924 | return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, |
| 10925 | (vector int)__b); |
| 10926 | } |
| 10927 | |
| 10928 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 10929 | vec_sro(vector unsigned short __a, vector unsigned char __b) { |
| 10930 | return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, |
| 10931 | (vector int)__b); |
| 10932 | } |
| 10933 | |
| 10934 | static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, |
| 10935 | vector signed char __b) { |
| 10936 | return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10937 | } |
| 10938 | |
| 10939 | static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, |
| 10940 | vector unsigned char __b) { |
| 10941 | return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10942 | } |
| 10943 | |
| 10944 | static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, |
| 10945 | vector signed char __b) { |
| 10946 | return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); |
| 10947 | } |
| 10948 | |
| 10949 | static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, |
| 10950 | vector unsigned char __b) { |
| 10951 | return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); |
| 10952 | } |
| 10953 | |
| 10954 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10955 | vec_sro(vector unsigned int __a, vector signed char __b) { |
| 10956 | return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, |
| 10957 | (vector int)__b); |
| 10958 | } |
| 10959 | |
| 10960 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 10961 | vec_sro(vector unsigned int __a, vector unsigned char __b) { |
| 10962 | return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, |
| 10963 | (vector int)__b); |
| 10964 | } |
| 10965 | |
| 10966 | static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, |
| 10967 | vector signed char __b) { |
| 10968 | return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10969 | } |
| 10970 | |
| 10971 | static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, |
| 10972 | vector unsigned char __b) { |
| 10973 | return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 10974 | } |
| 10975 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 10976 | #ifdef __VSX__ |
| 10977 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10978 | vec_sro(vector signed long long __a, vector signed char __b) { |
| 10979 | return (vector signed long long)__builtin_altivec_vsro((vector int)__a, |
| 10980 | (vector int)__b); |
| 10981 | } |
| 10982 | |
| 10983 | static __inline__ vector signed long long __ATTRS_o_ai |
| 10984 | vec_sro(vector signed long long __a, vector unsigned char __b) { |
| 10985 | return (vector signed long long)__builtin_altivec_vsro((vector int)__a, |
| 10986 | (vector int)__b); |
| 10987 | } |
| 10988 | |
| 10989 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10990 | vec_sro(vector unsigned long long __a, vector signed char __b) { |
| 10991 | return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, |
| 10992 | (vector int)__b); |
| 10993 | } |
| 10994 | |
| 10995 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 10996 | vec_sro(vector unsigned long long __a, vector unsigned char __b) { |
| 10997 | return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, |
| 10998 | (vector int)__b); |
| 10999 | } |
| 11000 | #endif |
| 11001 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11002 | /* vec_vsro */ |
| 11003 | |
| 11004 | static __inline__ vector signed char __ATTRS_o_ai |
| 11005 | vec_vsro(vector signed char __a, vector signed char __b) { |
| 11006 | return (vector signed char)__builtin_altivec_vsro((vector int)__a, |
| 11007 | (vector int)__b); |
| 11008 | } |
| 11009 | |
| 11010 | static __inline__ vector signed char __ATTRS_o_ai |
| 11011 | vec_vsro(vector signed char __a, vector unsigned char __b) { |
| 11012 | return (vector signed char)__builtin_altivec_vsro((vector int)__a, |
| 11013 | (vector int)__b); |
| 11014 | } |
| 11015 | |
| 11016 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11017 | vec_vsro(vector unsigned char __a, vector signed char __b) { |
| 11018 | return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, |
| 11019 | (vector int)__b); |
| 11020 | } |
| 11021 | |
| 11022 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11023 | vec_vsro(vector unsigned char __a, vector unsigned char __b) { |
| 11024 | return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, |
| 11025 | (vector int)__b); |
| 11026 | } |
| 11027 | |
| 11028 | static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, |
| 11029 | vector signed char __b) { |
| 11030 | return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11031 | } |
| 11032 | |
| 11033 | static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, |
| 11034 | vector unsigned char __b) { |
| 11035 | return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11036 | } |
| 11037 | |
| 11038 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11039 | vec_vsro(vector unsigned short __a, vector signed char __b) { |
| 11040 | return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, |
| 11041 | (vector int)__b); |
| 11042 | } |
| 11043 | |
| 11044 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11045 | vec_vsro(vector unsigned short __a, vector unsigned char __b) { |
| 11046 | return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, |
| 11047 | (vector int)__b); |
| 11048 | } |
| 11049 | |
| 11050 | static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, |
| 11051 | vector signed char __b) { |
| 11052 | return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11053 | } |
| 11054 | |
| 11055 | static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, |
| 11056 | vector unsigned char __b) { |
| 11057 | return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11058 | } |
| 11059 | |
| 11060 | static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, |
| 11061 | vector signed char __b) { |
| 11062 | return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); |
| 11063 | } |
| 11064 | |
| 11065 | static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, |
| 11066 | vector unsigned char __b) { |
| 11067 | return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); |
| 11068 | } |
| 11069 | |
| 11070 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11071 | vec_vsro(vector unsigned int __a, vector signed char __b) { |
| 11072 | return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, |
| 11073 | (vector int)__b); |
| 11074 | } |
| 11075 | |
| 11076 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11077 | vec_vsro(vector unsigned int __a, vector unsigned char __b) { |
| 11078 | return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, |
| 11079 | (vector int)__b); |
| 11080 | } |
| 11081 | |
| 11082 | static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, |
| 11083 | vector signed char __b) { |
| 11084 | return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11085 | } |
| 11086 | |
| 11087 | static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, |
| 11088 | vector unsigned char __b) { |
| 11089 | return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); |
| 11090 | } |
| 11091 | |
| 11092 | /* vec_st */ |
| 11093 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11094 | static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11095 | vector signed char *__c) { |
| 11096 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11097 | } |
| 11098 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11099 | static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11100 | signed char *__c) { |
| 11101 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11102 | } |
| 11103 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11104 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11105 | vector unsigned char *__c) { |
| 11106 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11107 | } |
| 11108 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11109 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11110 | unsigned char *__c) { |
| 11111 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11112 | } |
| 11113 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11114 | static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11115 | signed char *__c) { |
| 11116 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11117 | } |
| 11118 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11119 | static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11120 | unsigned char *__c) { |
| 11121 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11122 | } |
| 11123 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11124 | static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11125 | vector bool char *__c) { |
| 11126 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11127 | } |
| 11128 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11129 | static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11130 | vector short *__c) { |
| 11131 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11132 | } |
| 11133 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11134 | static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11135 | short *__c) { |
| 11136 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11137 | } |
| 11138 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11139 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11140 | vector unsigned short *__c) { |
| 11141 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11142 | } |
| 11143 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11144 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11145 | unsigned short *__c) { |
| 11146 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11147 | } |
| 11148 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11149 | static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11150 | short *__c) { |
| 11151 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11152 | } |
| 11153 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11154 | static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11155 | unsigned short *__c) { |
| 11156 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11157 | } |
| 11158 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11159 | static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11160 | vector bool short *__c) { |
| 11161 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11162 | } |
| 11163 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11164 | static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11165 | short *__c) { |
| 11166 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11167 | } |
| 11168 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11169 | static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11170 | unsigned short *__c) { |
| 11171 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11172 | } |
| 11173 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11174 | static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11175 | vector pixel *__c) { |
| 11176 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11177 | } |
| 11178 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11179 | static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11180 | vector int *__c) { |
| 11181 | __builtin_altivec_stvx(__a, __b, __c); |
| 11182 | } |
| 11183 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11184 | static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11185 | __builtin_altivec_stvx(__a, __b, __c); |
| 11186 | } |
| 11187 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11188 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11189 | vector unsigned int *__c) { |
| 11190 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11191 | } |
| 11192 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11193 | static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11194 | unsigned int *__c) { |
| 11195 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11196 | } |
| 11197 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11198 | static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11199 | int *__c) { |
| 11200 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11201 | } |
| 11202 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11203 | static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11204 | unsigned int *__c) { |
| 11205 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11206 | } |
| 11207 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11208 | static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11209 | vector bool int *__c) { |
| 11210 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11211 | } |
| 11212 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11213 | static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11214 | vector float *__c) { |
| 11215 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11216 | } |
| 11217 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11218 | static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11219 | float *__c) { |
| 11220 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11221 | } |
| 11222 | |
| 11223 | /* vec_stvx */ |
| 11224 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11225 | static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11226 | vector signed char *__c) { |
| 11227 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11228 | } |
| 11229 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11230 | static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11231 | signed char *__c) { |
| 11232 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11233 | } |
| 11234 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11235 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11236 | vector unsigned char *__c) { |
| 11237 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11238 | } |
| 11239 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11240 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11241 | unsigned char *__c) { |
| 11242 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11243 | } |
| 11244 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11245 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11246 | signed char *__c) { |
| 11247 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11248 | } |
| 11249 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11250 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11251 | unsigned char *__c) { |
| 11252 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11253 | } |
| 11254 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11255 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11256 | vector bool char *__c) { |
| 11257 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11258 | } |
| 11259 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11260 | static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11261 | vector short *__c) { |
| 11262 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11263 | } |
| 11264 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11265 | static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11266 | short *__c) { |
| 11267 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11268 | } |
| 11269 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11270 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11271 | vector unsigned short *__c) { |
| 11272 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11273 | } |
| 11274 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11275 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11276 | unsigned short *__c) { |
| 11277 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11278 | } |
| 11279 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11280 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11281 | short *__c) { |
| 11282 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11283 | } |
| 11284 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11285 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11286 | unsigned short *__c) { |
| 11287 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11288 | } |
| 11289 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11290 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11291 | vector bool short *__c) { |
| 11292 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11293 | } |
| 11294 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11295 | static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11296 | short *__c) { |
| 11297 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11298 | } |
| 11299 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11300 | static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11301 | unsigned short *__c) { |
| 11302 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11303 | } |
| 11304 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11305 | static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11306 | vector pixel *__c) { |
| 11307 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11308 | } |
| 11309 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11310 | static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11311 | vector int *__c) { |
| 11312 | __builtin_altivec_stvx(__a, __b, __c); |
| 11313 | } |
| 11314 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11315 | static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11316 | int *__c) { |
| 11317 | __builtin_altivec_stvx(__a, __b, __c); |
| 11318 | } |
| 11319 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11320 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11321 | vector unsigned int *__c) { |
| 11322 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11323 | } |
| 11324 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11325 | static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11326 | unsigned int *__c) { |
| 11327 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11328 | } |
| 11329 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11330 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11331 | int *__c) { |
| 11332 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11333 | } |
| 11334 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11335 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11336 | unsigned int *__c) { |
| 11337 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11338 | } |
| 11339 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11340 | static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11341 | vector bool int *__c) { |
| 11342 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11343 | } |
| 11344 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11345 | static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11346 | vector float *__c) { |
| 11347 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11348 | } |
| 11349 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11350 | static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11351 | float *__c) { |
| 11352 | __builtin_altivec_stvx((vector int)__a, __b, __c); |
| 11353 | } |
| 11354 | |
| 11355 | /* vec_ste */ |
| 11356 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11357 | static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11358 | signed char *__c) { |
| 11359 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11360 | } |
| 11361 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11362 | static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11363 | unsigned char *__c) { |
| 11364 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11365 | } |
| 11366 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11367 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11368 | signed char *__c) { |
| 11369 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11370 | } |
| 11371 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11372 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11373 | unsigned char *__c) { |
| 11374 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11375 | } |
| 11376 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11377 | static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11378 | short *__c) { |
| 11379 | __builtin_altivec_stvehx(__a, __b, __c); |
| 11380 | } |
| 11381 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11382 | static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11383 | unsigned short *__c) { |
| 11384 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11385 | } |
| 11386 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11387 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11388 | short *__c) { |
| 11389 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11390 | } |
| 11391 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11392 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11393 | unsigned short *__c) { |
| 11394 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11395 | } |
| 11396 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11397 | static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11398 | short *__c) { |
| 11399 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11400 | } |
| 11401 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11402 | static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11403 | unsigned short *__c) { |
| 11404 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11405 | } |
| 11406 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11407 | static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11408 | __builtin_altivec_stvewx(__a, __b, __c); |
| 11409 | } |
| 11410 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11411 | static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11412 | unsigned int *__c) { |
| 11413 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11414 | } |
| 11415 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11416 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11417 | int *__c) { |
| 11418 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11419 | } |
| 11420 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11421 | static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11422 | unsigned int *__c) { |
| 11423 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11424 | } |
| 11425 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11426 | static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11427 | float *__c) { |
| 11428 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11429 | } |
| 11430 | |
| 11431 | /* vec_stvebx */ |
| 11432 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11433 | static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11434 | signed char *__c) { |
| 11435 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11436 | } |
| 11437 | |
| 11438 | static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11439 | long __b, unsigned char *__c) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11440 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11441 | } |
| 11442 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11443 | static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11444 | signed char *__c) { |
| 11445 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11446 | } |
| 11447 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11448 | static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11449 | unsigned char *__c) { |
| 11450 | __builtin_altivec_stvebx((vector char)__a, __b, __c); |
| 11451 | } |
| 11452 | |
| 11453 | /* vec_stvehx */ |
| 11454 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11455 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11456 | short *__c) { |
| 11457 | __builtin_altivec_stvehx(__a, __b, __c); |
| 11458 | } |
| 11459 | |
| 11460 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11461 | long __b, unsigned short *__c) { |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11462 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11463 | } |
| 11464 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11465 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11466 | short *__c) { |
| 11467 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11468 | } |
| 11469 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11470 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11471 | unsigned short *__c) { |
| 11472 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11473 | } |
| 11474 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11475 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11476 | short *__c) { |
| 11477 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11478 | } |
| 11479 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11480 | static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11481 | unsigned short *__c) { |
| 11482 | __builtin_altivec_stvehx((vector short)__a, __b, __c); |
| 11483 | } |
| 11484 | |
| 11485 | /* vec_stvewx */ |
| 11486 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11487 | static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11488 | int *__c) { |
| 11489 | __builtin_altivec_stvewx(__a, __b, __c); |
| 11490 | } |
| 11491 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11492 | static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11493 | unsigned int *__c) { |
| 11494 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11495 | } |
| 11496 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11497 | static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11498 | int *__c) { |
| 11499 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11500 | } |
| 11501 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11502 | static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11503 | unsigned int *__c) { |
| 11504 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11505 | } |
| 11506 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 11507 | static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b, |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11508 | float *__c) { |
| 11509 | __builtin_altivec_stvewx((vector int)__a, __b, __c); |
| 11510 | } |
| 11511 | |
| 11512 | /* vec_stl */ |
| 11513 | |
| 11514 | static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, |
| 11515 | vector signed char *__c) { |
| 11516 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11517 | } |
| 11518 | |
| 11519 | static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, |
| 11520 | signed char *__c) { |
| 11521 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11522 | } |
| 11523 | |
| 11524 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, |
| 11525 | vector unsigned char *__c) { |
| 11526 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11527 | } |
| 11528 | |
| 11529 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, |
| 11530 | unsigned char *__c) { |
| 11531 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11532 | } |
| 11533 | |
| 11534 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, |
| 11535 | signed char *__c) { |
| 11536 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11537 | } |
| 11538 | |
| 11539 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, |
| 11540 | unsigned char *__c) { |
| 11541 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11542 | } |
| 11543 | |
| 11544 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, |
| 11545 | vector bool char *__c) { |
| 11546 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11547 | } |
| 11548 | |
| 11549 | static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, |
| 11550 | vector short *__c) { |
| 11551 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11552 | } |
| 11553 | |
| 11554 | static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, |
| 11555 | short *__c) { |
| 11556 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11557 | } |
| 11558 | |
| 11559 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, |
| 11560 | vector unsigned short *__c) { |
| 11561 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11562 | } |
| 11563 | |
| 11564 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, |
| 11565 | unsigned short *__c) { |
| 11566 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11567 | } |
| 11568 | |
| 11569 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, |
| 11570 | short *__c) { |
| 11571 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11572 | } |
| 11573 | |
| 11574 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, |
| 11575 | unsigned short *__c) { |
| 11576 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11577 | } |
| 11578 | |
| 11579 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, |
| 11580 | vector bool short *__c) { |
| 11581 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11582 | } |
| 11583 | |
| 11584 | static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, |
| 11585 | short *__c) { |
| 11586 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11587 | } |
| 11588 | |
| 11589 | static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, |
| 11590 | unsigned short *__c) { |
| 11591 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11592 | } |
| 11593 | |
| 11594 | static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, |
| 11595 | vector pixel *__c) { |
| 11596 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11597 | } |
| 11598 | |
| 11599 | static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, |
| 11600 | vector int *__c) { |
| 11601 | __builtin_altivec_stvxl(__a, __b, __c); |
| 11602 | } |
| 11603 | |
| 11604 | static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { |
| 11605 | __builtin_altivec_stvxl(__a, __b, __c); |
| 11606 | } |
| 11607 | |
| 11608 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, |
| 11609 | vector unsigned int *__c) { |
| 11610 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11611 | } |
| 11612 | |
| 11613 | static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, |
| 11614 | unsigned int *__c) { |
| 11615 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11616 | } |
| 11617 | |
| 11618 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, |
| 11619 | int *__c) { |
| 11620 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11621 | } |
| 11622 | |
| 11623 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, |
| 11624 | unsigned int *__c) { |
| 11625 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11626 | } |
| 11627 | |
| 11628 | static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, |
| 11629 | vector bool int *__c) { |
| 11630 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11631 | } |
| 11632 | |
| 11633 | static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, |
| 11634 | vector float *__c) { |
| 11635 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11636 | } |
| 11637 | |
| 11638 | static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, |
| 11639 | float *__c) { |
| 11640 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11641 | } |
| 11642 | |
| 11643 | /* vec_stvxl */ |
| 11644 | |
| 11645 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, |
| 11646 | vector signed char *__c) { |
| 11647 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11648 | } |
| 11649 | |
| 11650 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, |
| 11651 | signed char *__c) { |
| 11652 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11653 | } |
| 11654 | |
| 11655 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, |
| 11656 | vector unsigned char *__c) { |
| 11657 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11658 | } |
| 11659 | |
| 11660 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, |
| 11661 | unsigned char *__c) { |
| 11662 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11663 | } |
| 11664 | |
| 11665 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, |
| 11666 | signed char *__c) { |
| 11667 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11668 | } |
| 11669 | |
| 11670 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, |
| 11671 | unsigned char *__c) { |
| 11672 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11673 | } |
| 11674 | |
| 11675 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, |
| 11676 | vector bool char *__c) { |
| 11677 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11678 | } |
| 11679 | |
| 11680 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, |
| 11681 | vector short *__c) { |
| 11682 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11683 | } |
| 11684 | |
| 11685 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, |
| 11686 | short *__c) { |
| 11687 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11688 | } |
| 11689 | |
| 11690 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, |
| 11691 | int __b, |
| 11692 | vector unsigned short *__c) { |
| 11693 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11694 | } |
| 11695 | |
| 11696 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, |
| 11697 | int __b, unsigned short *__c) { |
| 11698 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11699 | } |
| 11700 | |
| 11701 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, |
| 11702 | short *__c) { |
| 11703 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11704 | } |
| 11705 | |
| 11706 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, |
| 11707 | unsigned short *__c) { |
| 11708 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11709 | } |
| 11710 | |
| 11711 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, |
| 11712 | vector bool short *__c) { |
| 11713 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11714 | } |
| 11715 | |
| 11716 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, |
| 11717 | short *__c) { |
| 11718 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11719 | } |
| 11720 | |
| 11721 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, |
| 11722 | unsigned short *__c) { |
| 11723 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11724 | } |
| 11725 | |
| 11726 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, |
| 11727 | vector pixel *__c) { |
| 11728 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11729 | } |
| 11730 | |
| 11731 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, |
| 11732 | vector int *__c) { |
| 11733 | __builtin_altivec_stvxl(__a, __b, __c); |
| 11734 | } |
| 11735 | |
| 11736 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, |
| 11737 | int *__c) { |
| 11738 | __builtin_altivec_stvxl(__a, __b, __c); |
| 11739 | } |
| 11740 | |
| 11741 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, |
| 11742 | vector unsigned int *__c) { |
| 11743 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11744 | } |
| 11745 | |
| 11746 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, |
| 11747 | unsigned int *__c) { |
| 11748 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11749 | } |
| 11750 | |
| 11751 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, |
| 11752 | int *__c) { |
| 11753 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11754 | } |
| 11755 | |
| 11756 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, |
| 11757 | unsigned int *__c) { |
| 11758 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11759 | } |
| 11760 | |
| 11761 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, |
| 11762 | vector bool int *__c) { |
| 11763 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11764 | } |
| 11765 | |
| 11766 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, |
| 11767 | vector float *__c) { |
| 11768 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11769 | } |
| 11770 | |
| 11771 | static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, |
| 11772 | float *__c) { |
| 11773 | __builtin_altivec_stvxl((vector int)__a, __b, __c); |
| 11774 | } |
| 11775 | |
| 11776 | /* vec_sub */ |
| 11777 | |
| 11778 | static __inline__ vector signed char __ATTRS_o_ai |
| 11779 | vec_sub(vector signed char __a, vector signed char __b) { |
| 11780 | return __a - __b; |
| 11781 | } |
| 11782 | |
| 11783 | static __inline__ vector signed char __ATTRS_o_ai |
| 11784 | vec_sub(vector bool char __a, vector signed char __b) { |
| 11785 | return (vector signed char)__a - __b; |
| 11786 | } |
| 11787 | |
| 11788 | static __inline__ vector signed char __ATTRS_o_ai |
| 11789 | vec_sub(vector signed char __a, vector bool char __b) { |
| 11790 | return __a - (vector signed char)__b; |
| 11791 | } |
| 11792 | |
| 11793 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11794 | vec_sub(vector unsigned char __a, vector unsigned char __b) { |
| 11795 | return __a - __b; |
| 11796 | } |
| 11797 | |
| 11798 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11799 | vec_sub(vector bool char __a, vector unsigned char __b) { |
| 11800 | return (vector unsigned char)__a - __b; |
| 11801 | } |
| 11802 | |
| 11803 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11804 | vec_sub(vector unsigned char __a, vector bool char __b) { |
| 11805 | return __a - (vector unsigned char)__b; |
| 11806 | } |
| 11807 | |
| 11808 | static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, |
| 11809 | vector short __b) { |
| 11810 | return __a - __b; |
| 11811 | } |
| 11812 | |
| 11813 | static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, |
| 11814 | vector short __b) { |
| 11815 | return (vector short)__a - __b; |
| 11816 | } |
| 11817 | |
| 11818 | static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, |
| 11819 | vector bool short __b) { |
| 11820 | return __a - (vector short)__b; |
| 11821 | } |
| 11822 | |
| 11823 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11824 | vec_sub(vector unsigned short __a, vector unsigned short __b) { |
| 11825 | return __a - __b; |
| 11826 | } |
| 11827 | |
| 11828 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11829 | vec_sub(vector bool short __a, vector unsigned short __b) { |
| 11830 | return (vector unsigned short)__a - __b; |
| 11831 | } |
| 11832 | |
| 11833 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11834 | vec_sub(vector unsigned short __a, vector bool short __b) { |
| 11835 | return __a - (vector unsigned short)__b; |
| 11836 | } |
| 11837 | |
| 11838 | static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, |
| 11839 | vector int __b) { |
| 11840 | return __a - __b; |
| 11841 | } |
| 11842 | |
| 11843 | static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, |
| 11844 | vector int __b) { |
| 11845 | return (vector int)__a - __b; |
| 11846 | } |
| 11847 | |
| 11848 | static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, |
| 11849 | vector bool int __b) { |
| 11850 | return __a - (vector int)__b; |
| 11851 | } |
| 11852 | |
| 11853 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11854 | vec_sub(vector unsigned int __a, vector unsigned int __b) { |
| 11855 | return __a - __b; |
| 11856 | } |
| 11857 | |
| 11858 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11859 | vec_sub(vector bool int __a, vector unsigned int __b) { |
| 11860 | return (vector unsigned int)__a - __b; |
| 11861 | } |
| 11862 | |
| 11863 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11864 | vec_sub(vector unsigned int __a, vector bool int __b) { |
| 11865 | return __a - (vector unsigned int)__b; |
| 11866 | } |
| 11867 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 11868 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 11869 | defined(__SIZEOF_INT128__) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11870 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 11871 | vec_sub(vector signed __int128 __a, vector signed __int128 __b) { |
| 11872 | return __a - __b; |
| 11873 | } |
| 11874 | |
| 11875 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 11876 | vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 11877 | return __a - __b; |
| 11878 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 11879 | #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && |
| 11880 | // defined(__SIZEOF_INT128__) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 11881 | |
| 11882 | #ifdef __VSX__ |
| 11883 | static __inline__ vector signed long long __ATTRS_o_ai |
| 11884 | vec_sub(vector signed long long __a, vector signed long long __b) { |
| 11885 | return __a - __b; |
| 11886 | } |
| 11887 | |
| 11888 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 11889 | vec_sub(vector unsigned long long __a, vector unsigned long long __b) { |
| 11890 | return __a - __b; |
| 11891 | } |
| 11892 | |
| 11893 | static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, |
| 11894 | vector double __b) { |
| 11895 | return __a - __b; |
| 11896 | } |
| 11897 | #endif |
| 11898 | |
| 11899 | static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, |
| 11900 | vector float __b) { |
| 11901 | return __a - __b; |
| 11902 | } |
| 11903 | |
| 11904 | /* vec_vsububm */ |
| 11905 | |
| 11906 | #define __builtin_altivec_vsububm vec_vsububm |
| 11907 | |
| 11908 | static __inline__ vector signed char __ATTRS_o_ai |
| 11909 | vec_vsububm(vector signed char __a, vector signed char __b) { |
| 11910 | return __a - __b; |
| 11911 | } |
| 11912 | |
| 11913 | static __inline__ vector signed char __ATTRS_o_ai |
| 11914 | vec_vsububm(vector bool char __a, vector signed char __b) { |
| 11915 | return (vector signed char)__a - __b; |
| 11916 | } |
| 11917 | |
| 11918 | static __inline__ vector signed char __ATTRS_o_ai |
| 11919 | vec_vsububm(vector signed char __a, vector bool char __b) { |
| 11920 | return __a - (vector signed char)__b; |
| 11921 | } |
| 11922 | |
| 11923 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11924 | vec_vsububm(vector unsigned char __a, vector unsigned char __b) { |
| 11925 | return __a - __b; |
| 11926 | } |
| 11927 | |
| 11928 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11929 | vec_vsububm(vector bool char __a, vector unsigned char __b) { |
| 11930 | return (vector unsigned char)__a - __b; |
| 11931 | } |
| 11932 | |
| 11933 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 11934 | vec_vsububm(vector unsigned char __a, vector bool char __b) { |
| 11935 | return __a - (vector unsigned char)__b; |
| 11936 | } |
| 11937 | |
| 11938 | /* vec_vsubuhm */ |
| 11939 | |
| 11940 | #define __builtin_altivec_vsubuhm vec_vsubuhm |
| 11941 | |
| 11942 | static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, |
| 11943 | vector short __b) { |
| 11944 | return __a - __b; |
| 11945 | } |
| 11946 | |
| 11947 | static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, |
| 11948 | vector short __b) { |
| 11949 | return (vector short)__a - __b; |
| 11950 | } |
| 11951 | |
| 11952 | static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, |
| 11953 | vector bool short __b) { |
| 11954 | return __a - (vector short)__b; |
| 11955 | } |
| 11956 | |
| 11957 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11958 | vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { |
| 11959 | return __a - __b; |
| 11960 | } |
| 11961 | |
| 11962 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11963 | vec_vsubuhm(vector bool short __a, vector unsigned short __b) { |
| 11964 | return (vector unsigned short)__a - __b; |
| 11965 | } |
| 11966 | |
| 11967 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 11968 | vec_vsubuhm(vector unsigned short __a, vector bool short __b) { |
| 11969 | return __a - (vector unsigned short)__b; |
| 11970 | } |
| 11971 | |
| 11972 | /* vec_vsubuwm */ |
| 11973 | |
| 11974 | #define __builtin_altivec_vsubuwm vec_vsubuwm |
| 11975 | |
| 11976 | static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, |
| 11977 | vector int __b) { |
| 11978 | return __a - __b; |
| 11979 | } |
| 11980 | |
| 11981 | static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, |
| 11982 | vector int __b) { |
| 11983 | return (vector int)__a - __b; |
| 11984 | } |
| 11985 | |
| 11986 | static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, |
| 11987 | vector bool int __b) { |
| 11988 | return __a - (vector int)__b; |
| 11989 | } |
| 11990 | |
| 11991 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11992 | vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { |
| 11993 | return __a - __b; |
| 11994 | } |
| 11995 | |
| 11996 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 11997 | vec_vsubuwm(vector bool int __a, vector unsigned int __b) { |
| 11998 | return (vector unsigned int)__a - __b; |
| 11999 | } |
| 12000 | |
| 12001 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12002 | vec_vsubuwm(vector unsigned int __a, vector bool int __b) { |
| 12003 | return __a - (vector unsigned int)__b; |
| 12004 | } |
| 12005 | |
| 12006 | /* vec_vsubfp */ |
| 12007 | |
| 12008 | #define __builtin_altivec_vsubfp vec_vsubfp |
| 12009 | |
| 12010 | static __inline__ vector float __attribute__((__always_inline__)) |
| 12011 | vec_vsubfp(vector float __a, vector float __b) { |
| 12012 | return __a - __b; |
| 12013 | } |
| 12014 | |
| 12015 | /* vec_subc */ |
| 12016 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12017 | static __inline__ vector signed int __ATTRS_o_ai |
| 12018 | vec_subc(vector signed int __a, vector signed int __b) { |
| 12019 | return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, |
| 12020 | (vector unsigned int) __b); |
| 12021 | } |
| 12022 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12023 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12024 | vec_subc(vector unsigned int __a, vector unsigned int __b) { |
| 12025 | return __builtin_altivec_vsubcuw(__a, __b); |
| 12026 | } |
| 12027 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12028 | #ifdef __POWER8_VECTOR__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12029 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12030 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12031 | vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 12032 | return __builtin_altivec_vsubcuq(__a, __b); |
| 12033 | } |
| 12034 | |
| 12035 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12036 | vec_subc(vector signed __int128 __a, vector signed __int128 __b) { |
| 12037 | return __builtin_altivec_vsubcuq(__a, __b); |
| 12038 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12039 | #endif |
| 12040 | |
| 12041 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 12042 | vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { |
| 12043 | return (vector unsigned char)__builtin_altivec_vsubcuq(__a, __b); |
| 12044 | } |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12045 | #endif // __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12046 | |
| 12047 | /* vec_vsubcuw */ |
| 12048 | |
| 12049 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 12050 | vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { |
| 12051 | return __builtin_altivec_vsubcuw(__a, __b); |
| 12052 | } |
| 12053 | |
| 12054 | /* vec_subs */ |
| 12055 | |
| 12056 | static __inline__ vector signed char __ATTRS_o_ai |
| 12057 | vec_subs(vector signed char __a, vector signed char __b) { |
| 12058 | return __builtin_altivec_vsubsbs(__a, __b); |
| 12059 | } |
| 12060 | |
| 12061 | static __inline__ vector signed char __ATTRS_o_ai |
| 12062 | vec_subs(vector bool char __a, vector signed char __b) { |
| 12063 | return __builtin_altivec_vsubsbs((vector signed char)__a, __b); |
| 12064 | } |
| 12065 | |
| 12066 | static __inline__ vector signed char __ATTRS_o_ai |
| 12067 | vec_subs(vector signed char __a, vector bool char __b) { |
| 12068 | return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); |
| 12069 | } |
| 12070 | |
| 12071 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12072 | vec_subs(vector unsigned char __a, vector unsigned char __b) { |
| 12073 | return __builtin_altivec_vsububs(__a, __b); |
| 12074 | } |
| 12075 | |
| 12076 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12077 | vec_subs(vector bool char __a, vector unsigned char __b) { |
| 12078 | return __builtin_altivec_vsububs((vector unsigned char)__a, __b); |
| 12079 | } |
| 12080 | |
| 12081 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12082 | vec_subs(vector unsigned char __a, vector bool char __b) { |
| 12083 | return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); |
| 12084 | } |
| 12085 | |
| 12086 | static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, |
| 12087 | vector short __b) { |
| 12088 | return __builtin_altivec_vsubshs(__a, __b); |
| 12089 | } |
| 12090 | |
| 12091 | static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, |
| 12092 | vector short __b) { |
| 12093 | return __builtin_altivec_vsubshs((vector short)__a, __b); |
| 12094 | } |
| 12095 | |
| 12096 | static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, |
| 12097 | vector bool short __b) { |
| 12098 | return __builtin_altivec_vsubshs(__a, (vector short)__b); |
| 12099 | } |
| 12100 | |
| 12101 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12102 | vec_subs(vector unsigned short __a, vector unsigned short __b) { |
| 12103 | return __builtin_altivec_vsubuhs(__a, __b); |
| 12104 | } |
| 12105 | |
| 12106 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12107 | vec_subs(vector bool short __a, vector unsigned short __b) { |
| 12108 | return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); |
| 12109 | } |
| 12110 | |
| 12111 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12112 | vec_subs(vector unsigned short __a, vector bool short __b) { |
| 12113 | return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); |
| 12114 | } |
| 12115 | |
| 12116 | static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, |
| 12117 | vector int __b) { |
| 12118 | return __builtin_altivec_vsubsws(__a, __b); |
| 12119 | } |
| 12120 | |
| 12121 | static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, |
| 12122 | vector int __b) { |
| 12123 | return __builtin_altivec_vsubsws((vector int)__a, __b); |
| 12124 | } |
| 12125 | |
| 12126 | static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, |
| 12127 | vector bool int __b) { |
| 12128 | return __builtin_altivec_vsubsws(__a, (vector int)__b); |
| 12129 | } |
| 12130 | |
| 12131 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12132 | vec_subs(vector unsigned int __a, vector unsigned int __b) { |
| 12133 | return __builtin_altivec_vsubuws(__a, __b); |
| 12134 | } |
| 12135 | |
| 12136 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12137 | vec_subs(vector bool int __a, vector unsigned int __b) { |
| 12138 | return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); |
| 12139 | } |
| 12140 | |
| 12141 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12142 | vec_subs(vector unsigned int __a, vector bool int __b) { |
| 12143 | return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); |
| 12144 | } |
| 12145 | |
| 12146 | /* vec_vsubsbs */ |
| 12147 | |
| 12148 | static __inline__ vector signed char __ATTRS_o_ai |
| 12149 | vec_vsubsbs(vector signed char __a, vector signed char __b) { |
| 12150 | return __builtin_altivec_vsubsbs(__a, __b); |
| 12151 | } |
| 12152 | |
| 12153 | static __inline__ vector signed char __ATTRS_o_ai |
| 12154 | vec_vsubsbs(vector bool char __a, vector signed char __b) { |
| 12155 | return __builtin_altivec_vsubsbs((vector signed char)__a, __b); |
| 12156 | } |
| 12157 | |
| 12158 | static __inline__ vector signed char __ATTRS_o_ai |
| 12159 | vec_vsubsbs(vector signed char __a, vector bool char __b) { |
| 12160 | return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); |
| 12161 | } |
| 12162 | |
| 12163 | /* vec_vsububs */ |
| 12164 | |
| 12165 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12166 | vec_vsububs(vector unsigned char __a, vector unsigned char __b) { |
| 12167 | return __builtin_altivec_vsububs(__a, __b); |
| 12168 | } |
| 12169 | |
| 12170 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12171 | vec_vsububs(vector bool char __a, vector unsigned char __b) { |
| 12172 | return __builtin_altivec_vsububs((vector unsigned char)__a, __b); |
| 12173 | } |
| 12174 | |
| 12175 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12176 | vec_vsububs(vector unsigned char __a, vector bool char __b) { |
| 12177 | return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); |
| 12178 | } |
| 12179 | |
| 12180 | /* vec_vsubshs */ |
| 12181 | |
| 12182 | static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, |
| 12183 | vector short __b) { |
| 12184 | return __builtin_altivec_vsubshs(__a, __b); |
| 12185 | } |
| 12186 | |
| 12187 | static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, |
| 12188 | vector short __b) { |
| 12189 | return __builtin_altivec_vsubshs((vector short)__a, __b); |
| 12190 | } |
| 12191 | |
| 12192 | static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, |
| 12193 | vector bool short __b) { |
| 12194 | return __builtin_altivec_vsubshs(__a, (vector short)__b); |
| 12195 | } |
| 12196 | |
| 12197 | /* vec_vsubuhs */ |
| 12198 | |
| 12199 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12200 | vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { |
| 12201 | return __builtin_altivec_vsubuhs(__a, __b); |
| 12202 | } |
| 12203 | |
| 12204 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12205 | vec_vsubuhs(vector bool short __a, vector unsigned short __b) { |
| 12206 | return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); |
| 12207 | } |
| 12208 | |
| 12209 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12210 | vec_vsubuhs(vector unsigned short __a, vector bool short __b) { |
| 12211 | return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); |
| 12212 | } |
| 12213 | |
| 12214 | /* vec_vsubsws */ |
| 12215 | |
| 12216 | static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, |
| 12217 | vector int __b) { |
| 12218 | return __builtin_altivec_vsubsws(__a, __b); |
| 12219 | } |
| 12220 | |
| 12221 | static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, |
| 12222 | vector int __b) { |
| 12223 | return __builtin_altivec_vsubsws((vector int)__a, __b); |
| 12224 | } |
| 12225 | |
| 12226 | static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, |
| 12227 | vector bool int __b) { |
| 12228 | return __builtin_altivec_vsubsws(__a, (vector int)__b); |
| 12229 | } |
| 12230 | |
| 12231 | /* vec_vsubuws */ |
| 12232 | |
| 12233 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12234 | vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { |
| 12235 | return __builtin_altivec_vsubuws(__a, __b); |
| 12236 | } |
| 12237 | |
| 12238 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12239 | vec_vsubuws(vector bool int __a, vector unsigned int __b) { |
| 12240 | return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); |
| 12241 | } |
| 12242 | |
| 12243 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12244 | vec_vsubuws(vector unsigned int __a, vector bool int __b) { |
| 12245 | return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); |
| 12246 | } |
| 12247 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12248 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12249 | /* vec_vsubuqm */ |
| 12250 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12251 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12252 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12253 | vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { |
| 12254 | return __a - __b; |
| 12255 | } |
| 12256 | |
| 12257 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12258 | vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 12259 | return __a - __b; |
| 12260 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12261 | #endif |
| 12262 | |
| 12263 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 12264 | vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { |
| 12265 | return __builtin_altivec_vsubuqm(__a, __b); |
| 12266 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12267 | |
| 12268 | /* vec_vsubeuqm */ |
| 12269 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12270 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12271 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12272 | vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, |
| 12273 | vector signed __int128 __c) { |
| 12274 | return __builtin_altivec_vsubeuqm(__a, __b, __c); |
| 12275 | } |
| 12276 | |
| 12277 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12278 | vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 12279 | vector unsigned __int128 __c) { |
| 12280 | return __builtin_altivec_vsubeuqm(__a, __b, __c); |
| 12281 | } |
| 12282 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12283 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12284 | vec_sube(vector signed __int128 __a, vector signed __int128 __b, |
| 12285 | vector signed __int128 __c) { |
| 12286 | return __builtin_altivec_vsubeuqm(__a, __b, __c); |
| 12287 | } |
| 12288 | |
| 12289 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12290 | vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 12291 | vector unsigned __int128 __c) { |
| 12292 | return __builtin_altivec_vsubeuqm(__a, __b, __c); |
| 12293 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12294 | #endif |
| 12295 | |
| 12296 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 12297 | vec_sube_u128(vector unsigned char __a, vector unsigned char __b, |
| 12298 | vector unsigned char __c) { |
| 12299 | return (vector unsigned char)__builtin_altivec_vsubeuqm(__a, __b, __c); |
| 12300 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12301 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12302 | /* vec_vsubcuq */ |
| 12303 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12304 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12305 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12306 | vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { |
| 12307 | return __builtin_altivec_vsubcuq(__a, __b); |
| 12308 | } |
| 12309 | |
| 12310 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12311 | vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 12312 | return __builtin_altivec_vsubcuq(__a, __b); |
| 12313 | } |
| 12314 | |
| 12315 | /* vec_vsubecuq */ |
| 12316 | |
| 12317 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12318 | vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, |
| 12319 | vector signed __int128 __c) { |
| 12320 | return __builtin_altivec_vsubecuq(__a, __b, __c); |
| 12321 | } |
| 12322 | |
| 12323 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12324 | vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 12325 | vector unsigned __int128 __c) { |
| 12326 | return __builtin_altivec_vsubecuq(__a, __b, __c); |
| 12327 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12328 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12329 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12330 | #ifdef __powerpc64__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12331 | static __inline__ vector signed int __ATTRS_o_ai |
| 12332 | vec_subec(vector signed int __a, vector signed int __b, |
| 12333 | vector signed int __c) { |
| 12334 | return vec_addec(__a, ~__b, __c); |
| 12335 | } |
| 12336 | |
| 12337 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12338 | vec_subec(vector unsigned int __a, vector unsigned int __b, |
| 12339 | vector unsigned int __c) { |
| 12340 | return vec_addec(__a, ~__b, __c); |
| 12341 | } |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12342 | #endif |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12343 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12344 | #ifdef __SIZEOF_INT128__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12345 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 12346 | vec_subec(vector signed __int128 __a, vector signed __int128 __b, |
| 12347 | vector signed __int128 __c) { |
| 12348 | return __builtin_altivec_vsubecuq(__a, __b, __c); |
| 12349 | } |
| 12350 | |
| 12351 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 12352 | vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| 12353 | vector unsigned __int128 __c) { |
| 12354 | return __builtin_altivec_vsubecuq(__a, __b, __c); |
| 12355 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12356 | #endif |
| 12357 | |
| 12358 | static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| 12359 | vec_subec_u128(vector unsigned char __a, vector unsigned char __b, |
| 12360 | vector unsigned char __c) { |
| 12361 | return (vector unsigned char)__builtin_altivec_vsubecuq(__a, __b, __c); |
| 12362 | } |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 12363 | #endif // __POWER8_VECTOR__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12364 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12365 | static __inline__ vector signed int __ATTRS_o_ai |
| 12366 | vec_sube(vector signed int __a, vector signed int __b, |
| 12367 | vector signed int __c) { |
| 12368 | vector signed int __mask = {1, 1, 1, 1}; |
| 12369 | vector signed int __carry = __c & __mask; |
| 12370 | return vec_adde(__a, ~__b, __carry); |
| 12371 | } |
| 12372 | |
| 12373 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12374 | vec_sube(vector unsigned int __a, vector unsigned int __b, |
| 12375 | vector unsigned int __c) { |
| 12376 | vector unsigned int __mask = {1, 1, 1, 1}; |
| 12377 | vector unsigned int __carry = __c & __mask; |
| 12378 | return vec_adde(__a, ~__b, __carry); |
| 12379 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12380 | /* vec_sum4s */ |
| 12381 | |
| 12382 | static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, |
| 12383 | vector int __b) { |
| 12384 | return __builtin_altivec_vsum4sbs(__a, __b); |
| 12385 | } |
| 12386 | |
| 12387 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12388 | vec_sum4s(vector unsigned char __a, vector unsigned int __b) { |
| 12389 | return __builtin_altivec_vsum4ubs(__a, __b); |
| 12390 | } |
| 12391 | |
| 12392 | static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, |
| 12393 | vector int __b) { |
| 12394 | return __builtin_altivec_vsum4shs(__a, __b); |
| 12395 | } |
| 12396 | |
| 12397 | /* vec_vsum4sbs */ |
| 12398 | |
| 12399 | static __inline__ vector int __attribute__((__always_inline__)) |
| 12400 | vec_vsum4sbs(vector signed char __a, vector int __b) { |
| 12401 | return __builtin_altivec_vsum4sbs(__a, __b); |
| 12402 | } |
| 12403 | |
| 12404 | /* vec_vsum4ubs */ |
| 12405 | |
| 12406 | static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| 12407 | vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { |
| 12408 | return __builtin_altivec_vsum4ubs(__a, __b); |
| 12409 | } |
| 12410 | |
| 12411 | /* vec_vsum4shs */ |
| 12412 | |
| 12413 | static __inline__ vector int __attribute__((__always_inline__)) |
| 12414 | vec_vsum4shs(vector signed short __a, vector int __b) { |
| 12415 | return __builtin_altivec_vsum4shs(__a, __b); |
| 12416 | } |
| 12417 | |
| 12418 | /* vec_sum2s */ |
| 12419 | |
| 12420 | /* The vsum2sws instruction has a big-endian bias, so that the second |
| 12421 | input vector and the result always reference big-endian elements |
| 12422 | 1 and 3 (little-endian element 0 and 2). For ease of porting the |
| 12423 | programmer wants elements 1 and 3 in both cases, so for little |
| 12424 | endian we must perform some permutes. */ |
| 12425 | |
| 12426 | static __inline__ vector signed int __attribute__((__always_inline__)) |
| 12427 | vec_sum2s(vector int __a, vector int __b) { |
| 12428 | #ifdef __LITTLE_ENDIAN__ |
| 12429 | vector int __c = (vector signed int)vec_perm( |
| 12430 | __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, |
| 12431 | 8, 9, 10, 11)); |
| 12432 | __c = __builtin_altivec_vsum2sws(__a, __c); |
| 12433 | return (vector signed int)vec_perm( |
| 12434 | __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, |
| 12435 | 8, 9, 10, 11)); |
| 12436 | #else |
| 12437 | return __builtin_altivec_vsum2sws(__a, __b); |
| 12438 | #endif |
| 12439 | } |
| 12440 | |
| 12441 | /* vec_vsum2sws */ |
| 12442 | |
| 12443 | static __inline__ vector signed int __attribute__((__always_inline__)) |
| 12444 | vec_vsum2sws(vector int __a, vector int __b) { |
| 12445 | #ifdef __LITTLE_ENDIAN__ |
| 12446 | vector int __c = (vector signed int)vec_perm( |
| 12447 | __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, |
| 12448 | 8, 9, 10, 11)); |
| 12449 | __c = __builtin_altivec_vsum2sws(__a, __c); |
| 12450 | return (vector signed int)vec_perm( |
| 12451 | __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, |
| 12452 | 8, 9, 10, 11)); |
| 12453 | #else |
| 12454 | return __builtin_altivec_vsum2sws(__a, __b); |
| 12455 | #endif |
| 12456 | } |
| 12457 | |
| 12458 | /* vec_sums */ |
| 12459 | |
| 12460 | /* The vsumsws instruction has a big-endian bias, so that the second |
| 12461 | input vector and the result always reference big-endian element 3 |
| 12462 | (little-endian element 0). For ease of porting the programmer |
| 12463 | wants element 3 in both cases, so for little endian we must perform |
| 12464 | some permutes. */ |
| 12465 | |
| 12466 | static __inline__ vector signed int __attribute__((__always_inline__)) |
| 12467 | vec_sums(vector signed int __a, vector signed int __b) { |
| 12468 | #ifdef __LITTLE_ENDIAN__ |
| 12469 | __b = (vector signed int)vec_splat(__b, 3); |
| 12470 | __b = __builtin_altivec_vsumsws(__a, __b); |
| 12471 | return (vector signed int)(0, 0, 0, __b[0]); |
| 12472 | #else |
| 12473 | return __builtin_altivec_vsumsws(__a, __b); |
| 12474 | #endif |
| 12475 | } |
| 12476 | |
| 12477 | /* vec_vsumsws */ |
| 12478 | |
| 12479 | static __inline__ vector signed int __attribute__((__always_inline__)) |
| 12480 | vec_vsumsws(vector signed int __a, vector signed int __b) { |
| 12481 | #ifdef __LITTLE_ENDIAN__ |
| 12482 | __b = (vector signed int)vec_splat(__b, 3); |
| 12483 | __b = __builtin_altivec_vsumsws(__a, __b); |
| 12484 | return (vector signed int)(0, 0, 0, __b[0]); |
| 12485 | #else |
| 12486 | return __builtin_altivec_vsumsws(__a, __b); |
| 12487 | #endif |
| 12488 | } |
| 12489 | |
| 12490 | /* vec_trunc */ |
| 12491 | |
| 12492 | static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { |
| 12493 | #ifdef __VSX__ |
| 12494 | return __builtin_vsx_xvrspiz(__a); |
| 12495 | #else |
| 12496 | return __builtin_altivec_vrfiz(__a); |
| 12497 | #endif |
| 12498 | } |
| 12499 | |
| 12500 | #ifdef __VSX__ |
| 12501 | static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { |
| 12502 | return __builtin_vsx_xvrdpiz(__a); |
| 12503 | } |
| 12504 | #endif |
| 12505 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12506 | /* vec_roundz */ |
| 12507 | static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { |
| 12508 | return vec_trunc(__a); |
| 12509 | } |
| 12510 | |
| 12511 | #ifdef __VSX__ |
| 12512 | static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { |
| 12513 | return vec_trunc(__a); |
| 12514 | } |
| 12515 | #endif |
| 12516 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12517 | /* vec_vrfiz */ |
| 12518 | |
| 12519 | static __inline__ vector float __attribute__((__always_inline__)) |
| 12520 | vec_vrfiz(vector float __a) { |
| 12521 | return __builtin_altivec_vrfiz(__a); |
| 12522 | } |
| 12523 | |
| 12524 | /* vec_unpackh */ |
| 12525 | |
| 12526 | /* The vector unpack instructions all have a big-endian bias, so for |
| 12527 | little endian we must reverse the meanings of "high" and "low." */ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 12528 | #ifdef __LITTLE_ENDIAN__ |
| 12529 | #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) |
| 12530 | #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) |
| 12531 | #else |
| 12532 | #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) |
| 12533 | #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) |
| 12534 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12535 | |
| 12536 | static __inline__ vector short __ATTRS_o_ai |
| 12537 | vec_unpackh(vector signed char __a) { |
| 12538 | #ifdef __LITTLE_ENDIAN__ |
| 12539 | return __builtin_altivec_vupklsb((vector char)__a); |
| 12540 | #else |
| 12541 | return __builtin_altivec_vupkhsb((vector char)__a); |
| 12542 | #endif |
| 12543 | } |
| 12544 | |
| 12545 | static __inline__ vector bool short __ATTRS_o_ai |
| 12546 | vec_unpackh(vector bool char __a) { |
| 12547 | #ifdef __LITTLE_ENDIAN__ |
| 12548 | return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); |
| 12549 | #else |
| 12550 | return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); |
| 12551 | #endif |
| 12552 | } |
| 12553 | |
| 12554 | static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { |
| 12555 | #ifdef __LITTLE_ENDIAN__ |
| 12556 | return __builtin_altivec_vupklsh(__a); |
| 12557 | #else |
| 12558 | return __builtin_altivec_vupkhsh(__a); |
| 12559 | #endif |
| 12560 | } |
| 12561 | |
| 12562 | static __inline__ vector bool int __ATTRS_o_ai |
| 12563 | vec_unpackh(vector bool short __a) { |
| 12564 | #ifdef __LITTLE_ENDIAN__ |
| 12565 | return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); |
| 12566 | #else |
| 12567 | return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); |
| 12568 | #endif |
| 12569 | } |
| 12570 | |
| 12571 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12572 | vec_unpackh(vector pixel __a) { |
| 12573 | #ifdef __LITTLE_ENDIAN__ |
| 12574 | return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); |
| 12575 | #else |
| 12576 | return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); |
| 12577 | #endif |
| 12578 | } |
| 12579 | |
| 12580 | #ifdef __POWER8_VECTOR__ |
| 12581 | static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { |
| 12582 | #ifdef __LITTLE_ENDIAN__ |
| 12583 | return __builtin_altivec_vupklsw(__a); |
| 12584 | #else |
| 12585 | return __builtin_altivec_vupkhsw(__a); |
| 12586 | #endif |
| 12587 | } |
| 12588 | |
| 12589 | static __inline__ vector bool long long __ATTRS_o_ai |
| 12590 | vec_unpackh(vector bool int __a) { |
| 12591 | #ifdef __LITTLE_ENDIAN__ |
| 12592 | return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); |
| 12593 | #else |
| 12594 | return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); |
| 12595 | #endif |
| 12596 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12597 | |
| 12598 | static __inline__ vector double __ATTRS_o_ai |
| 12599 | vec_unpackh(vector float __a) { |
| 12600 | return (vector double)(__a[0], __a[1]); |
| 12601 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12602 | #endif |
| 12603 | |
| 12604 | /* vec_vupkhsb */ |
| 12605 | |
| 12606 | static __inline__ vector short __ATTRS_o_ai |
| 12607 | vec_vupkhsb(vector signed char __a) { |
| 12608 | #ifdef __LITTLE_ENDIAN__ |
| 12609 | return __builtin_altivec_vupklsb((vector char)__a); |
| 12610 | #else |
| 12611 | return __builtin_altivec_vupkhsb((vector char)__a); |
| 12612 | #endif |
| 12613 | } |
| 12614 | |
| 12615 | static __inline__ vector bool short __ATTRS_o_ai |
| 12616 | vec_vupkhsb(vector bool char __a) { |
| 12617 | #ifdef __LITTLE_ENDIAN__ |
| 12618 | return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); |
| 12619 | #else |
| 12620 | return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); |
| 12621 | #endif |
| 12622 | } |
| 12623 | |
| 12624 | /* vec_vupkhsh */ |
| 12625 | |
| 12626 | static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { |
| 12627 | #ifdef __LITTLE_ENDIAN__ |
| 12628 | return __builtin_altivec_vupklsh(__a); |
| 12629 | #else |
| 12630 | return __builtin_altivec_vupkhsh(__a); |
| 12631 | #endif |
| 12632 | } |
| 12633 | |
| 12634 | static __inline__ vector bool int __ATTRS_o_ai |
| 12635 | vec_vupkhsh(vector bool short __a) { |
| 12636 | #ifdef __LITTLE_ENDIAN__ |
| 12637 | return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); |
| 12638 | #else |
| 12639 | return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); |
| 12640 | #endif |
| 12641 | } |
| 12642 | |
| 12643 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12644 | vec_vupkhsh(vector pixel __a) { |
| 12645 | #ifdef __LITTLE_ENDIAN__ |
| 12646 | return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); |
| 12647 | #else |
| 12648 | return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); |
| 12649 | #endif |
| 12650 | } |
| 12651 | |
| 12652 | /* vec_vupkhsw */ |
| 12653 | |
| 12654 | #ifdef __POWER8_VECTOR__ |
| 12655 | static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { |
| 12656 | #ifdef __LITTLE_ENDIAN__ |
| 12657 | return __builtin_altivec_vupklsw(__a); |
| 12658 | #else |
| 12659 | return __builtin_altivec_vupkhsw(__a); |
| 12660 | #endif |
| 12661 | } |
| 12662 | |
| 12663 | static __inline__ vector bool long long __ATTRS_o_ai |
| 12664 | vec_vupkhsw(vector bool int __a) { |
| 12665 | #ifdef __LITTLE_ENDIAN__ |
| 12666 | return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); |
| 12667 | #else |
| 12668 | return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); |
| 12669 | #endif |
| 12670 | } |
| 12671 | #endif |
| 12672 | |
| 12673 | /* vec_unpackl */ |
| 12674 | |
| 12675 | static __inline__ vector short __ATTRS_o_ai |
| 12676 | vec_unpackl(vector signed char __a) { |
| 12677 | #ifdef __LITTLE_ENDIAN__ |
| 12678 | return __builtin_altivec_vupkhsb((vector char)__a); |
| 12679 | #else |
| 12680 | return __builtin_altivec_vupklsb((vector char)__a); |
| 12681 | #endif |
| 12682 | } |
| 12683 | |
| 12684 | static __inline__ vector bool short __ATTRS_o_ai |
| 12685 | vec_unpackl(vector bool char __a) { |
| 12686 | #ifdef __LITTLE_ENDIAN__ |
| 12687 | return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); |
| 12688 | #else |
| 12689 | return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); |
| 12690 | #endif |
| 12691 | } |
| 12692 | |
| 12693 | static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { |
| 12694 | #ifdef __LITTLE_ENDIAN__ |
| 12695 | return __builtin_altivec_vupkhsh(__a); |
| 12696 | #else |
| 12697 | return __builtin_altivec_vupklsh(__a); |
| 12698 | #endif |
| 12699 | } |
| 12700 | |
| 12701 | static __inline__ vector bool int __ATTRS_o_ai |
| 12702 | vec_unpackl(vector bool short __a) { |
| 12703 | #ifdef __LITTLE_ENDIAN__ |
| 12704 | return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); |
| 12705 | #else |
| 12706 | return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); |
| 12707 | #endif |
| 12708 | } |
| 12709 | |
| 12710 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12711 | vec_unpackl(vector pixel __a) { |
| 12712 | #ifdef __LITTLE_ENDIAN__ |
| 12713 | return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); |
| 12714 | #else |
| 12715 | return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); |
| 12716 | #endif |
| 12717 | } |
| 12718 | |
| 12719 | #ifdef __POWER8_VECTOR__ |
| 12720 | static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { |
| 12721 | #ifdef __LITTLE_ENDIAN__ |
| 12722 | return __builtin_altivec_vupkhsw(__a); |
| 12723 | #else |
| 12724 | return __builtin_altivec_vupklsw(__a); |
| 12725 | #endif |
| 12726 | } |
| 12727 | |
| 12728 | static __inline__ vector bool long long __ATTRS_o_ai |
| 12729 | vec_unpackl(vector bool int __a) { |
| 12730 | #ifdef __LITTLE_ENDIAN__ |
| 12731 | return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); |
| 12732 | #else |
| 12733 | return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); |
| 12734 | #endif |
| 12735 | } |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 12736 | |
| 12737 | static __inline__ vector double __ATTRS_o_ai |
| 12738 | vec_unpackl(vector float __a) { |
| 12739 | return (vector double)(__a[2], __a[3]); |
| 12740 | } |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 12741 | #endif |
| 12742 | |
| 12743 | /* vec_vupklsb */ |
| 12744 | |
| 12745 | static __inline__ vector short __ATTRS_o_ai |
| 12746 | vec_vupklsb(vector signed char __a) { |
| 12747 | #ifdef __LITTLE_ENDIAN__ |
| 12748 | return __builtin_altivec_vupkhsb((vector char)__a); |
| 12749 | #else |
| 12750 | return __builtin_altivec_vupklsb((vector char)__a); |
| 12751 | #endif |
| 12752 | } |
| 12753 | |
| 12754 | static __inline__ vector bool short __ATTRS_o_ai |
| 12755 | vec_vupklsb(vector bool char __a) { |
| 12756 | #ifdef __LITTLE_ENDIAN__ |
| 12757 | return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); |
| 12758 | #else |
| 12759 | return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); |
| 12760 | #endif |
| 12761 | } |
| 12762 | |
| 12763 | /* vec_vupklsh */ |
| 12764 | |
| 12765 | static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { |
| 12766 | #ifdef __LITTLE_ENDIAN__ |
| 12767 | return __builtin_altivec_vupkhsh(__a); |
| 12768 | #else |
| 12769 | return __builtin_altivec_vupklsh(__a); |
| 12770 | #endif |
| 12771 | } |
| 12772 | |
| 12773 | static __inline__ vector bool int __ATTRS_o_ai |
| 12774 | vec_vupklsh(vector bool short __a) { |
| 12775 | #ifdef __LITTLE_ENDIAN__ |
| 12776 | return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); |
| 12777 | #else |
| 12778 | return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); |
| 12779 | #endif |
| 12780 | } |
| 12781 | |
| 12782 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12783 | vec_vupklsh(vector pixel __a) { |
| 12784 | #ifdef __LITTLE_ENDIAN__ |
| 12785 | return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); |
| 12786 | #else |
| 12787 | return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); |
| 12788 | #endif |
| 12789 | } |
| 12790 | |
| 12791 | /* vec_vupklsw */ |
| 12792 | |
| 12793 | #ifdef __POWER8_VECTOR__ |
| 12794 | static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { |
| 12795 | #ifdef __LITTLE_ENDIAN__ |
| 12796 | return __builtin_altivec_vupkhsw(__a); |
| 12797 | #else |
| 12798 | return __builtin_altivec_vupklsw(__a); |
| 12799 | #endif |
| 12800 | } |
| 12801 | |
| 12802 | static __inline__ vector bool long long __ATTRS_o_ai |
| 12803 | vec_vupklsw(vector bool int __a) { |
| 12804 | #ifdef __LITTLE_ENDIAN__ |
| 12805 | return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); |
| 12806 | #else |
| 12807 | return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); |
| 12808 | #endif |
| 12809 | } |
| 12810 | #endif |
| 12811 | |
| 12812 | /* vec_vsx_ld */ |
| 12813 | |
| 12814 | #ifdef __VSX__ |
| 12815 | |
| 12816 | static __inline__ vector bool int __ATTRS_o_ai |
| 12817 | vec_vsx_ld(int __a, const vector bool int *__b) { |
| 12818 | return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); |
| 12819 | } |
| 12820 | |
| 12821 | static __inline__ vector signed int __ATTRS_o_ai |
| 12822 | vec_vsx_ld(int __a, const vector signed int *__b) { |
| 12823 | return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); |
| 12824 | } |
| 12825 | |
| 12826 | static __inline__ vector signed int __ATTRS_o_ai |
| 12827 | vec_vsx_ld(int __a, const signed int *__b) { |
| 12828 | return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); |
| 12829 | } |
| 12830 | |
| 12831 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12832 | vec_vsx_ld(int __a, const vector unsigned int *__b) { |
| 12833 | return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); |
| 12834 | } |
| 12835 | |
| 12836 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 12837 | vec_vsx_ld(int __a, const unsigned int *__b) { |
| 12838 | return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); |
| 12839 | } |
| 12840 | |
| 12841 | static __inline__ vector float __ATTRS_o_ai |
| 12842 | vec_vsx_ld(int __a, const vector float *__b) { |
| 12843 | return (vector float)__builtin_vsx_lxvw4x(__a, __b); |
| 12844 | } |
| 12845 | |
| 12846 | static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, |
| 12847 | const float *__b) { |
| 12848 | return (vector float)__builtin_vsx_lxvw4x(__a, __b); |
| 12849 | } |
| 12850 | |
| 12851 | static __inline__ vector signed long long __ATTRS_o_ai |
| 12852 | vec_vsx_ld(int __a, const vector signed long long *__b) { |
| 12853 | return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); |
| 12854 | } |
| 12855 | |
| 12856 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 12857 | vec_vsx_ld(int __a, const vector unsigned long long *__b) { |
| 12858 | return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); |
| 12859 | } |
| 12860 | |
| 12861 | static __inline__ vector double __ATTRS_o_ai |
| 12862 | vec_vsx_ld(int __a, const vector double *__b) { |
| 12863 | return (vector double)__builtin_vsx_lxvd2x(__a, __b); |
| 12864 | } |
| 12865 | |
| 12866 | static __inline__ vector double __ATTRS_o_ai |
| 12867 | vec_vsx_ld(int __a, const double *__b) { |
| 12868 | return (vector double)__builtin_vsx_lxvd2x(__a, __b); |
| 12869 | } |
| 12870 | |
| 12871 | static __inline__ vector bool short __ATTRS_o_ai |
| 12872 | vec_vsx_ld(int __a, const vector bool short *__b) { |
| 12873 | return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); |
| 12874 | } |
| 12875 | |
| 12876 | static __inline__ vector signed short __ATTRS_o_ai |
| 12877 | vec_vsx_ld(int __a, const vector signed short *__b) { |
| 12878 | return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); |
| 12879 | } |
| 12880 | |
| 12881 | static __inline__ vector signed short __ATTRS_o_ai |
| 12882 | vec_vsx_ld(int __a, const signed short *__b) { |
| 12883 | return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); |
| 12884 | } |
| 12885 | |
| 12886 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12887 | vec_vsx_ld(int __a, const vector unsigned short *__b) { |
| 12888 | return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); |
| 12889 | } |
| 12890 | |
| 12891 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 12892 | vec_vsx_ld(int __a, const unsigned short *__b) { |
| 12893 | return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); |
| 12894 | } |
| 12895 | |
| 12896 | static __inline__ vector bool char __ATTRS_o_ai |
| 12897 | vec_vsx_ld(int __a, const vector bool char *__b) { |
| 12898 | return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); |
| 12899 | } |
| 12900 | |
| 12901 | static __inline__ vector signed char __ATTRS_o_ai |
| 12902 | vec_vsx_ld(int __a, const vector signed char *__b) { |
| 12903 | return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); |
| 12904 | } |
| 12905 | |
| 12906 | static __inline__ vector signed char __ATTRS_o_ai |
| 12907 | vec_vsx_ld(int __a, const signed char *__b) { |
| 12908 | return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); |
| 12909 | } |
| 12910 | |
| 12911 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12912 | vec_vsx_ld(int __a, const vector unsigned char *__b) { |
| 12913 | return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); |
| 12914 | } |
| 12915 | |
| 12916 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 12917 | vec_vsx_ld(int __a, const unsigned char *__b) { |
| 12918 | return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); |
| 12919 | } |
| 12920 | |
| 12921 | #endif |
| 12922 | |
| 12923 | /* vec_vsx_st */ |
| 12924 | |
| 12925 | #ifdef __VSX__ |
| 12926 | |
| 12927 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, |
| 12928 | vector bool int *__c) { |
| 12929 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12930 | } |
| 12931 | |
| 12932 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, |
| 12933 | signed int *__c) { |
| 12934 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12935 | } |
| 12936 | |
| 12937 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, |
| 12938 | unsigned int *__c) { |
| 12939 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12940 | } |
| 12941 | |
| 12942 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, |
| 12943 | vector signed int *__c) { |
| 12944 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12945 | } |
| 12946 | |
| 12947 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, |
| 12948 | signed int *__c) { |
| 12949 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12950 | } |
| 12951 | |
| 12952 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, |
| 12953 | vector unsigned int *__c) { |
| 12954 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12955 | } |
| 12956 | |
| 12957 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, |
| 12958 | unsigned int *__c) { |
| 12959 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12960 | } |
| 12961 | |
| 12962 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, |
| 12963 | vector float *__c) { |
| 12964 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12965 | } |
| 12966 | |
| 12967 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, |
| 12968 | float *__c) { |
| 12969 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12970 | } |
| 12971 | |
| 12972 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, |
| 12973 | int __b, |
| 12974 | vector signed long long *__c) { |
| 12975 | __builtin_vsx_stxvd2x((vector double)__a, __b, __c); |
| 12976 | } |
| 12977 | |
| 12978 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, |
| 12979 | int __b, |
| 12980 | vector unsigned long long *__c) { |
| 12981 | __builtin_vsx_stxvd2x((vector double)__a, __b, __c); |
| 12982 | } |
| 12983 | |
| 12984 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, |
| 12985 | vector double *__c) { |
| 12986 | __builtin_vsx_stxvd2x((vector double)__a, __b, __c); |
| 12987 | } |
| 12988 | |
| 12989 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, |
| 12990 | double *__c) { |
| 12991 | __builtin_vsx_stxvd2x((vector double)__a, __b, __c); |
| 12992 | } |
| 12993 | |
| 12994 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, |
| 12995 | vector bool short *__c) { |
| 12996 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 12997 | } |
| 12998 | |
| 12999 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, |
| 13000 | signed short *__c) { |
| 13001 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13002 | } |
| 13003 | |
| 13004 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, |
| 13005 | unsigned short *__c) { |
| 13006 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13007 | } |
| 13008 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, |
| 13009 | vector signed short *__c) { |
| 13010 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13011 | } |
| 13012 | |
| 13013 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, |
| 13014 | signed short *__c) { |
| 13015 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13016 | } |
| 13017 | |
| 13018 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, |
| 13019 | int __b, |
| 13020 | vector unsigned short *__c) { |
| 13021 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13022 | } |
| 13023 | |
| 13024 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, |
| 13025 | int __b, unsigned short *__c) { |
| 13026 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13027 | } |
| 13028 | |
| 13029 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, |
| 13030 | vector bool char *__c) { |
| 13031 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13032 | } |
| 13033 | |
| 13034 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, |
| 13035 | signed char *__c) { |
| 13036 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13037 | } |
| 13038 | |
| 13039 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, |
| 13040 | unsigned char *__c) { |
| 13041 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13042 | } |
| 13043 | |
| 13044 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, |
| 13045 | vector signed char *__c) { |
| 13046 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13047 | } |
| 13048 | |
| 13049 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, |
| 13050 | signed char *__c) { |
| 13051 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13052 | } |
| 13053 | |
| 13054 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, |
| 13055 | int __b, |
| 13056 | vector unsigned char *__c) { |
| 13057 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13058 | } |
| 13059 | |
| 13060 | static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, |
| 13061 | int __b, unsigned char *__c) { |
| 13062 | __builtin_vsx_stxvw4x((vector int)__a, __b, __c); |
| 13063 | } |
| 13064 | |
| 13065 | #endif |
| 13066 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 13067 | #ifdef __VSX__ |
| 13068 | #define vec_xxpermdi __builtin_vsx_xxpermdi |
| 13069 | #define vec_xxsldwi __builtin_vsx_xxsldwi |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13070 | #define vec_permi(__a, __b, __c) \ |
| 13071 | _Generic((__a), vector signed long long \ |
| 13072 | : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ |
| 13073 | (((__c)&0x1) + 2)), \ |
| 13074 | vector unsigned long long \ |
| 13075 | : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ |
| 13076 | (((__c)&0x1) + 2)), \ |
| 13077 | vector double \ |
| 13078 | : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ |
| 13079 | (((__c)&0x1) + 2))) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 13080 | #endif |
| 13081 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13082 | /* vec_xor */ |
| 13083 | |
| 13084 | #define __builtin_altivec_vxor vec_xor |
| 13085 | |
| 13086 | static __inline__ vector signed char __ATTRS_o_ai |
| 13087 | vec_xor(vector signed char __a, vector signed char __b) { |
| 13088 | return __a ^ __b; |
| 13089 | } |
| 13090 | |
| 13091 | static __inline__ vector signed char __ATTRS_o_ai |
| 13092 | vec_xor(vector bool char __a, vector signed char __b) { |
| 13093 | return (vector signed char)__a ^ __b; |
| 13094 | } |
| 13095 | |
| 13096 | static __inline__ vector signed char __ATTRS_o_ai |
| 13097 | vec_xor(vector signed char __a, vector bool char __b) { |
| 13098 | return __a ^ (vector signed char)__b; |
| 13099 | } |
| 13100 | |
| 13101 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13102 | vec_xor(vector unsigned char __a, vector unsigned char __b) { |
| 13103 | return __a ^ __b; |
| 13104 | } |
| 13105 | |
| 13106 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13107 | vec_xor(vector bool char __a, vector unsigned char __b) { |
| 13108 | return (vector unsigned char)__a ^ __b; |
| 13109 | } |
| 13110 | |
| 13111 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13112 | vec_xor(vector unsigned char __a, vector bool char __b) { |
| 13113 | return __a ^ (vector unsigned char)__b; |
| 13114 | } |
| 13115 | |
| 13116 | static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, |
| 13117 | vector bool char __b) { |
| 13118 | return __a ^ __b; |
| 13119 | } |
| 13120 | |
| 13121 | static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, |
| 13122 | vector short __b) { |
| 13123 | return __a ^ __b; |
| 13124 | } |
| 13125 | |
| 13126 | static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, |
| 13127 | vector short __b) { |
| 13128 | return (vector short)__a ^ __b; |
| 13129 | } |
| 13130 | |
| 13131 | static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, |
| 13132 | vector bool short __b) { |
| 13133 | return __a ^ (vector short)__b; |
| 13134 | } |
| 13135 | |
| 13136 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13137 | vec_xor(vector unsigned short __a, vector unsigned short __b) { |
| 13138 | return __a ^ __b; |
| 13139 | } |
| 13140 | |
| 13141 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13142 | vec_xor(vector bool short __a, vector unsigned short __b) { |
| 13143 | return (vector unsigned short)__a ^ __b; |
| 13144 | } |
| 13145 | |
| 13146 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13147 | vec_xor(vector unsigned short __a, vector bool short __b) { |
| 13148 | return __a ^ (vector unsigned short)__b; |
| 13149 | } |
| 13150 | |
| 13151 | static __inline__ vector bool short __ATTRS_o_ai |
| 13152 | vec_xor(vector bool short __a, vector bool short __b) { |
| 13153 | return __a ^ __b; |
| 13154 | } |
| 13155 | |
| 13156 | static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, |
| 13157 | vector int __b) { |
| 13158 | return __a ^ __b; |
| 13159 | } |
| 13160 | |
| 13161 | static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, |
| 13162 | vector int __b) { |
| 13163 | return (vector int)__a ^ __b; |
| 13164 | } |
| 13165 | |
| 13166 | static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, |
| 13167 | vector bool int __b) { |
| 13168 | return __a ^ (vector int)__b; |
| 13169 | } |
| 13170 | |
| 13171 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13172 | vec_xor(vector unsigned int __a, vector unsigned int __b) { |
| 13173 | return __a ^ __b; |
| 13174 | } |
| 13175 | |
| 13176 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13177 | vec_xor(vector bool int __a, vector unsigned int __b) { |
| 13178 | return (vector unsigned int)__a ^ __b; |
| 13179 | } |
| 13180 | |
| 13181 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13182 | vec_xor(vector unsigned int __a, vector bool int __b) { |
| 13183 | return __a ^ (vector unsigned int)__b; |
| 13184 | } |
| 13185 | |
| 13186 | static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, |
| 13187 | vector bool int __b) { |
| 13188 | return __a ^ __b; |
| 13189 | } |
| 13190 | |
| 13191 | static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, |
| 13192 | vector float __b) { |
| 13193 | vector unsigned int __res = |
| 13194 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13195 | return (vector float)__res; |
| 13196 | } |
| 13197 | |
| 13198 | static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, |
| 13199 | vector float __b) { |
| 13200 | vector unsigned int __res = |
| 13201 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13202 | return (vector float)__res; |
| 13203 | } |
| 13204 | |
| 13205 | static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, |
| 13206 | vector bool int __b) { |
| 13207 | vector unsigned int __res = |
| 13208 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13209 | return (vector float)__res; |
| 13210 | } |
| 13211 | |
| 13212 | #ifdef __VSX__ |
| 13213 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13214 | vec_xor(vector signed long long __a, vector signed long long __b) { |
| 13215 | return __a ^ __b; |
| 13216 | } |
| 13217 | |
| 13218 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13219 | vec_xor(vector bool long long __a, vector signed long long __b) { |
| 13220 | return (vector signed long long)__a ^ __b; |
| 13221 | } |
| 13222 | |
| 13223 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13224 | vec_xor(vector signed long long __a, vector bool long long __b) { |
| 13225 | return __a ^ (vector signed long long)__b; |
| 13226 | } |
| 13227 | |
| 13228 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13229 | vec_xor(vector unsigned long long __a, vector unsigned long long __b) { |
| 13230 | return __a ^ __b; |
| 13231 | } |
| 13232 | |
| 13233 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13234 | vec_xor(vector bool long long __a, vector unsigned long long __b) { |
| 13235 | return (vector unsigned long long)__a ^ __b; |
| 13236 | } |
| 13237 | |
| 13238 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13239 | vec_xor(vector unsigned long long __a, vector bool long long __b) { |
| 13240 | return __a ^ (vector unsigned long long)__b; |
| 13241 | } |
| 13242 | |
| 13243 | static __inline__ vector bool long long __ATTRS_o_ai |
| 13244 | vec_xor(vector bool long long __a, vector bool long long __b) { |
| 13245 | return __a ^ __b; |
| 13246 | } |
| 13247 | |
| 13248 | static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, |
| 13249 | vector double __b) { |
| 13250 | return (vector double)((vector unsigned long long)__a ^ |
| 13251 | (vector unsigned long long)__b); |
| 13252 | } |
| 13253 | |
| 13254 | static __inline__ vector double __ATTRS_o_ai |
| 13255 | vec_xor(vector double __a, vector bool long long __b) { |
| 13256 | return (vector double)((vector unsigned long long)__a ^ |
| 13257 | (vector unsigned long long)__b); |
| 13258 | } |
| 13259 | |
| 13260 | static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, |
| 13261 | vector double __b) { |
| 13262 | return (vector double)((vector unsigned long long)__a ^ |
| 13263 | (vector unsigned long long)__b); |
| 13264 | } |
| 13265 | #endif |
| 13266 | |
| 13267 | /* vec_vxor */ |
| 13268 | |
| 13269 | static __inline__ vector signed char __ATTRS_o_ai |
| 13270 | vec_vxor(vector signed char __a, vector signed char __b) { |
| 13271 | return __a ^ __b; |
| 13272 | } |
| 13273 | |
| 13274 | static __inline__ vector signed char __ATTRS_o_ai |
| 13275 | vec_vxor(vector bool char __a, vector signed char __b) { |
| 13276 | return (vector signed char)__a ^ __b; |
| 13277 | } |
| 13278 | |
| 13279 | static __inline__ vector signed char __ATTRS_o_ai |
| 13280 | vec_vxor(vector signed char __a, vector bool char __b) { |
| 13281 | return __a ^ (vector signed char)__b; |
| 13282 | } |
| 13283 | |
| 13284 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13285 | vec_vxor(vector unsigned char __a, vector unsigned char __b) { |
| 13286 | return __a ^ __b; |
| 13287 | } |
| 13288 | |
| 13289 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13290 | vec_vxor(vector bool char __a, vector unsigned char __b) { |
| 13291 | return (vector unsigned char)__a ^ __b; |
| 13292 | } |
| 13293 | |
| 13294 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13295 | vec_vxor(vector unsigned char __a, vector bool char __b) { |
| 13296 | return __a ^ (vector unsigned char)__b; |
| 13297 | } |
| 13298 | |
| 13299 | static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, |
| 13300 | vector bool char __b) { |
| 13301 | return __a ^ __b; |
| 13302 | } |
| 13303 | |
| 13304 | static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, |
| 13305 | vector short __b) { |
| 13306 | return __a ^ __b; |
| 13307 | } |
| 13308 | |
| 13309 | static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, |
| 13310 | vector short __b) { |
| 13311 | return (vector short)__a ^ __b; |
| 13312 | } |
| 13313 | |
| 13314 | static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, |
| 13315 | vector bool short __b) { |
| 13316 | return __a ^ (vector short)__b; |
| 13317 | } |
| 13318 | |
| 13319 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13320 | vec_vxor(vector unsigned short __a, vector unsigned short __b) { |
| 13321 | return __a ^ __b; |
| 13322 | } |
| 13323 | |
| 13324 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13325 | vec_vxor(vector bool short __a, vector unsigned short __b) { |
| 13326 | return (vector unsigned short)__a ^ __b; |
| 13327 | } |
| 13328 | |
| 13329 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13330 | vec_vxor(vector unsigned short __a, vector bool short __b) { |
| 13331 | return __a ^ (vector unsigned short)__b; |
| 13332 | } |
| 13333 | |
| 13334 | static __inline__ vector bool short __ATTRS_o_ai |
| 13335 | vec_vxor(vector bool short __a, vector bool short __b) { |
| 13336 | return __a ^ __b; |
| 13337 | } |
| 13338 | |
| 13339 | static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, |
| 13340 | vector int __b) { |
| 13341 | return __a ^ __b; |
| 13342 | } |
| 13343 | |
| 13344 | static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, |
| 13345 | vector int __b) { |
| 13346 | return (vector int)__a ^ __b; |
| 13347 | } |
| 13348 | |
| 13349 | static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, |
| 13350 | vector bool int __b) { |
| 13351 | return __a ^ (vector int)__b; |
| 13352 | } |
| 13353 | |
| 13354 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13355 | vec_vxor(vector unsigned int __a, vector unsigned int __b) { |
| 13356 | return __a ^ __b; |
| 13357 | } |
| 13358 | |
| 13359 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13360 | vec_vxor(vector bool int __a, vector unsigned int __b) { |
| 13361 | return (vector unsigned int)__a ^ __b; |
| 13362 | } |
| 13363 | |
| 13364 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13365 | vec_vxor(vector unsigned int __a, vector bool int __b) { |
| 13366 | return __a ^ (vector unsigned int)__b; |
| 13367 | } |
| 13368 | |
| 13369 | static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, |
| 13370 | vector bool int __b) { |
| 13371 | return __a ^ __b; |
| 13372 | } |
| 13373 | |
| 13374 | static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, |
| 13375 | vector float __b) { |
| 13376 | vector unsigned int __res = |
| 13377 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13378 | return (vector float)__res; |
| 13379 | } |
| 13380 | |
| 13381 | static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, |
| 13382 | vector float __b) { |
| 13383 | vector unsigned int __res = |
| 13384 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13385 | return (vector float)__res; |
| 13386 | } |
| 13387 | |
| 13388 | static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, |
| 13389 | vector bool int __b) { |
| 13390 | vector unsigned int __res = |
| 13391 | (vector unsigned int)__a ^ (vector unsigned int)__b; |
| 13392 | return (vector float)__res; |
| 13393 | } |
| 13394 | |
| 13395 | #ifdef __VSX__ |
| 13396 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13397 | vec_vxor(vector signed long long __a, vector signed long long __b) { |
| 13398 | return __a ^ __b; |
| 13399 | } |
| 13400 | |
| 13401 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13402 | vec_vxor(vector bool long long __a, vector signed long long __b) { |
| 13403 | return (vector signed long long)__a ^ __b; |
| 13404 | } |
| 13405 | |
| 13406 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13407 | vec_vxor(vector signed long long __a, vector bool long long __b) { |
| 13408 | return __a ^ (vector signed long long)__b; |
| 13409 | } |
| 13410 | |
| 13411 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13412 | vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { |
| 13413 | return __a ^ __b; |
| 13414 | } |
| 13415 | |
| 13416 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13417 | vec_vxor(vector bool long long __a, vector unsigned long long __b) { |
| 13418 | return (vector unsigned long long)__a ^ __b; |
| 13419 | } |
| 13420 | |
| 13421 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13422 | vec_vxor(vector unsigned long long __a, vector bool long long __b) { |
| 13423 | return __a ^ (vector unsigned long long)__b; |
| 13424 | } |
| 13425 | |
| 13426 | static __inline__ vector bool long long __ATTRS_o_ai |
| 13427 | vec_vxor(vector bool long long __a, vector bool long long __b) { |
| 13428 | return __a ^ __b; |
| 13429 | } |
| 13430 | #endif |
| 13431 | |
| 13432 | /* ------------------------ extensions for CBEA ----------------------------- */ |
| 13433 | |
| 13434 | /* vec_extract */ |
| 13435 | |
| 13436 | static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13437 | unsigned int __b) { |
| 13438 | return __a[__b & 0xf]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13439 | } |
| 13440 | |
| 13441 | static __inline__ unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13442 | vec_extract(vector unsigned char __a, unsigned int __b) { |
| 13443 | return __a[__b & 0xf]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13444 | } |
| 13445 | |
| 13446 | static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13447 | unsigned int __b) { |
| 13448 | return __a[__b & 0xf]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13449 | } |
| 13450 | |
| 13451 | static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13452 | unsigned int __b) { |
| 13453 | return __a[__b & 0x7]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13454 | } |
| 13455 | |
| 13456 | static __inline__ unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13457 | vec_extract(vector unsigned short __a, unsigned int __b) { |
| 13458 | return __a[__b & 0x7]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13459 | } |
| 13460 | |
| 13461 | static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13462 | unsigned int __b) { |
| 13463 | return __a[__b & 0x7]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13464 | } |
| 13465 | |
| 13466 | static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13467 | unsigned int __b) { |
| 13468 | return __a[__b & 0x3]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13469 | } |
| 13470 | |
| 13471 | static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13472 | unsigned int __b) { |
| 13473 | return __a[__b & 0x3]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13474 | } |
| 13475 | |
| 13476 | static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13477 | unsigned int __b) { |
| 13478 | return __a[__b & 0x3]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13479 | } |
| 13480 | |
| 13481 | #ifdef __VSX__ |
| 13482 | static __inline__ signed long long __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13483 | vec_extract(vector signed long long __a, unsigned int __b) { |
| 13484 | return __a[__b & 0x1]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13485 | } |
| 13486 | |
| 13487 | static __inline__ unsigned long long __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13488 | vec_extract(vector unsigned long long __a, unsigned int __b) { |
| 13489 | return __a[__b & 0x1]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13490 | } |
| 13491 | |
| 13492 | static __inline__ unsigned long long __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13493 | vec_extract(vector bool long long __a, unsigned int __b) { |
| 13494 | return __a[__b & 0x1]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13495 | } |
| 13496 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13497 | static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, |
| 13498 | unsigned int __b) { |
| 13499 | return __a[__b & 0x1]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13500 | } |
| 13501 | #endif |
| 13502 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 13503 | static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, |
| 13504 | unsigned int __b) { |
| 13505 | return __a[__b & 0x3]; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13506 | } |
| 13507 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 13508 | #ifdef __POWER9_VECTOR__ |
| 13509 | |
| 13510 | #define vec_insert4b __builtin_vsx_insertword |
| 13511 | #define vec_extract4b __builtin_vsx_extractuword |
| 13512 | |
| 13513 | /* vec_extract_exp */ |
| 13514 | |
| 13515 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13516 | vec_extract_exp(vector float __a) { |
| 13517 | return __builtin_vsx_xvxexpsp(__a); |
| 13518 | } |
| 13519 | |
| 13520 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13521 | vec_extract_exp(vector double __a) { |
| 13522 | return __builtin_vsx_xvxexpdp(__a); |
| 13523 | } |
| 13524 | |
| 13525 | /* vec_extract_sig */ |
| 13526 | |
| 13527 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13528 | vec_extract_sig(vector float __a) { |
| 13529 | return __builtin_vsx_xvxsigsp(__a); |
| 13530 | } |
| 13531 | |
| 13532 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13533 | vec_extract_sig (vector double __a) { |
| 13534 | return __builtin_vsx_xvxsigdp(__a); |
| 13535 | } |
| 13536 | |
| 13537 | static __inline__ vector float __ATTRS_o_ai |
| 13538 | vec_extract_fp32_from_shorth(vector unsigned short __a) { |
| 13539 | vector unsigned short __b = |
| 13540 | #ifdef __LITTLE_ENDIAN__ |
| 13541 | __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); |
| 13542 | #else |
| 13543 | __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); |
| 13544 | #endif |
| 13545 | return __builtin_vsx_xvcvhpsp(__b); |
| 13546 | } |
| 13547 | |
| 13548 | static __inline__ vector float __ATTRS_o_ai |
| 13549 | vec_extract_fp32_from_shortl(vector unsigned short __a) { |
| 13550 | vector unsigned short __b = |
| 13551 | #ifdef __LITTLE_ENDIAN__ |
| 13552 | __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); |
| 13553 | #else |
| 13554 | __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); |
| 13555 | #endif |
| 13556 | return __builtin_vsx_xvcvhpsp(__b); |
| 13557 | } |
| 13558 | #endif /* __POWER9_VECTOR__ */ |
| 13559 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 13560 | /* vec_insert */ |
| 13561 | |
| 13562 | static __inline__ vector signed char __ATTRS_o_ai |
| 13563 | vec_insert(signed char __a, vector signed char __b, int __c) { |
| 13564 | __b[__c] = __a; |
| 13565 | return __b; |
| 13566 | } |
| 13567 | |
| 13568 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13569 | vec_insert(unsigned char __a, vector unsigned char __b, int __c) { |
| 13570 | __b[__c] = __a; |
| 13571 | return __b; |
| 13572 | } |
| 13573 | |
| 13574 | static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, |
| 13575 | vector bool char __b, |
| 13576 | int __c) { |
| 13577 | __b[__c] = __a; |
| 13578 | return __b; |
| 13579 | } |
| 13580 | |
| 13581 | static __inline__ vector signed short __ATTRS_o_ai |
| 13582 | vec_insert(signed short __a, vector signed short __b, int __c) { |
| 13583 | __b[__c] = __a; |
| 13584 | return __b; |
| 13585 | } |
| 13586 | |
| 13587 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13588 | vec_insert(unsigned short __a, vector unsigned short __b, int __c) { |
| 13589 | __b[__c] = __a; |
| 13590 | return __b; |
| 13591 | } |
| 13592 | |
| 13593 | static __inline__ vector bool short __ATTRS_o_ai |
| 13594 | vec_insert(unsigned short __a, vector bool short __b, int __c) { |
| 13595 | __b[__c] = __a; |
| 13596 | return __b; |
| 13597 | } |
| 13598 | |
| 13599 | static __inline__ vector signed int __ATTRS_o_ai |
| 13600 | vec_insert(signed int __a, vector signed int __b, int __c) { |
| 13601 | __b[__c] = __a; |
| 13602 | return __b; |
| 13603 | } |
| 13604 | |
| 13605 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13606 | vec_insert(unsigned int __a, vector unsigned int __b, int __c) { |
| 13607 | __b[__c] = __a; |
| 13608 | return __b; |
| 13609 | } |
| 13610 | |
| 13611 | static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, |
| 13612 | vector bool int __b, |
| 13613 | int __c) { |
| 13614 | __b[__c] = __a; |
| 13615 | return __b; |
| 13616 | } |
| 13617 | |
| 13618 | #ifdef __VSX__ |
| 13619 | static __inline__ vector signed long long __ATTRS_o_ai |
| 13620 | vec_insert(signed long long __a, vector signed long long __b, int __c) { |
| 13621 | __b[__c] = __a; |
| 13622 | return __b; |
| 13623 | } |
| 13624 | |
| 13625 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 13626 | vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { |
| 13627 | __b[__c] = __a; |
| 13628 | return __b; |
| 13629 | } |
| 13630 | |
| 13631 | static __inline__ vector bool long long __ATTRS_o_ai |
| 13632 | vec_insert(unsigned long long __a, vector bool long long __b, int __c) { |
| 13633 | __b[__c] = __a; |
| 13634 | return __b; |
| 13635 | } |
| 13636 | static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, |
| 13637 | vector double __b, |
| 13638 | int __c) { |
| 13639 | __b[__c] = __a; |
| 13640 | return __b; |
| 13641 | } |
| 13642 | #endif |
| 13643 | |
| 13644 | static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, |
| 13645 | vector float __b, |
| 13646 | int __c) { |
| 13647 | __b[__c] = __a; |
| 13648 | return __b; |
| 13649 | } |
| 13650 | |
| 13651 | /* vec_lvlx */ |
| 13652 | |
| 13653 | static __inline__ vector signed char __ATTRS_o_ai |
| 13654 | vec_lvlx(int __a, const signed char *__b) { |
| 13655 | return vec_perm(vec_ld(__a, __b), (vector signed char)(0), |
| 13656 | vec_lvsl(__a, __b)); |
| 13657 | } |
| 13658 | |
| 13659 | static __inline__ vector signed char __ATTRS_o_ai |
| 13660 | vec_lvlx(int __a, const vector signed char *__b) { |
| 13661 | return vec_perm(vec_ld(__a, __b), (vector signed char)(0), |
| 13662 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13663 | } |
| 13664 | |
| 13665 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13666 | vec_lvlx(int __a, const unsigned char *__b) { |
| 13667 | return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), |
| 13668 | vec_lvsl(__a, __b)); |
| 13669 | } |
| 13670 | |
| 13671 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13672 | vec_lvlx(int __a, const vector unsigned char *__b) { |
| 13673 | return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), |
| 13674 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13675 | } |
| 13676 | |
| 13677 | static __inline__ vector bool char __ATTRS_o_ai |
| 13678 | vec_lvlx(int __a, const vector bool char *__b) { |
| 13679 | return vec_perm(vec_ld(__a, __b), (vector bool char)(0), |
| 13680 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13681 | } |
| 13682 | |
| 13683 | static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, |
| 13684 | const short *__b) { |
| 13685 | return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); |
| 13686 | } |
| 13687 | |
| 13688 | static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, |
| 13689 | const vector short *__b) { |
| 13690 | return vec_perm(vec_ld(__a, __b), (vector short)(0), |
| 13691 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13692 | } |
| 13693 | |
| 13694 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13695 | vec_lvlx(int __a, const unsigned short *__b) { |
| 13696 | return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), |
| 13697 | vec_lvsl(__a, __b)); |
| 13698 | } |
| 13699 | |
| 13700 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13701 | vec_lvlx(int __a, const vector unsigned short *__b) { |
| 13702 | return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), |
| 13703 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13704 | } |
| 13705 | |
| 13706 | static __inline__ vector bool short __ATTRS_o_ai |
| 13707 | vec_lvlx(int __a, const vector bool short *__b) { |
| 13708 | return vec_perm(vec_ld(__a, __b), (vector bool short)(0), |
| 13709 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13710 | } |
| 13711 | |
| 13712 | static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, |
| 13713 | const vector pixel *__b) { |
| 13714 | return vec_perm(vec_ld(__a, __b), (vector pixel)(0), |
| 13715 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13716 | } |
| 13717 | |
| 13718 | static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { |
| 13719 | return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); |
| 13720 | } |
| 13721 | |
| 13722 | static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, |
| 13723 | const vector int *__b) { |
| 13724 | return vec_perm(vec_ld(__a, __b), (vector int)(0), |
| 13725 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13726 | } |
| 13727 | |
| 13728 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13729 | vec_lvlx(int __a, const unsigned int *__b) { |
| 13730 | return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), |
| 13731 | vec_lvsl(__a, __b)); |
| 13732 | } |
| 13733 | |
| 13734 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13735 | vec_lvlx(int __a, const vector unsigned int *__b) { |
| 13736 | return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), |
| 13737 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13738 | } |
| 13739 | |
| 13740 | static __inline__ vector bool int __ATTRS_o_ai |
| 13741 | vec_lvlx(int __a, const vector bool int *__b) { |
| 13742 | return vec_perm(vec_ld(__a, __b), (vector bool int)(0), |
| 13743 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13744 | } |
| 13745 | |
| 13746 | static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, |
| 13747 | const float *__b) { |
| 13748 | return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); |
| 13749 | } |
| 13750 | |
| 13751 | static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, |
| 13752 | const vector float *__b) { |
| 13753 | return vec_perm(vec_ld(__a, __b), (vector float)(0), |
| 13754 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13755 | } |
| 13756 | |
| 13757 | /* vec_lvlxl */ |
| 13758 | |
| 13759 | static __inline__ vector signed char __ATTRS_o_ai |
| 13760 | vec_lvlxl(int __a, const signed char *__b) { |
| 13761 | return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), |
| 13762 | vec_lvsl(__a, __b)); |
| 13763 | } |
| 13764 | |
| 13765 | static __inline__ vector signed char __ATTRS_o_ai |
| 13766 | vec_lvlxl(int __a, const vector signed char *__b) { |
| 13767 | return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), |
| 13768 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13769 | } |
| 13770 | |
| 13771 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13772 | vec_lvlxl(int __a, const unsigned char *__b) { |
| 13773 | return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), |
| 13774 | vec_lvsl(__a, __b)); |
| 13775 | } |
| 13776 | |
| 13777 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13778 | vec_lvlxl(int __a, const vector unsigned char *__b) { |
| 13779 | return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), |
| 13780 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13781 | } |
| 13782 | |
| 13783 | static __inline__ vector bool char __ATTRS_o_ai |
| 13784 | vec_lvlxl(int __a, const vector bool char *__b) { |
| 13785 | return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), |
| 13786 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13787 | } |
| 13788 | |
| 13789 | static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, |
| 13790 | const short *__b) { |
| 13791 | return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); |
| 13792 | } |
| 13793 | |
| 13794 | static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, |
| 13795 | const vector short *__b) { |
| 13796 | return vec_perm(vec_ldl(__a, __b), (vector short)(0), |
| 13797 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13798 | } |
| 13799 | |
| 13800 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13801 | vec_lvlxl(int __a, const unsigned short *__b) { |
| 13802 | return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), |
| 13803 | vec_lvsl(__a, __b)); |
| 13804 | } |
| 13805 | |
| 13806 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13807 | vec_lvlxl(int __a, const vector unsigned short *__b) { |
| 13808 | return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), |
| 13809 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13810 | } |
| 13811 | |
| 13812 | static __inline__ vector bool short __ATTRS_o_ai |
| 13813 | vec_lvlxl(int __a, const vector bool short *__b) { |
| 13814 | return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), |
| 13815 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13816 | } |
| 13817 | |
| 13818 | static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, |
| 13819 | const vector pixel *__b) { |
| 13820 | return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), |
| 13821 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13822 | } |
| 13823 | |
| 13824 | static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { |
| 13825 | return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); |
| 13826 | } |
| 13827 | |
| 13828 | static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, |
| 13829 | const vector int *__b) { |
| 13830 | return vec_perm(vec_ldl(__a, __b), (vector int)(0), |
| 13831 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13832 | } |
| 13833 | |
| 13834 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13835 | vec_lvlxl(int __a, const unsigned int *__b) { |
| 13836 | return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), |
| 13837 | vec_lvsl(__a, __b)); |
| 13838 | } |
| 13839 | |
| 13840 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13841 | vec_lvlxl(int __a, const vector unsigned int *__b) { |
| 13842 | return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), |
| 13843 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13844 | } |
| 13845 | |
| 13846 | static __inline__ vector bool int __ATTRS_o_ai |
| 13847 | vec_lvlxl(int __a, const vector bool int *__b) { |
| 13848 | return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), |
| 13849 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13850 | } |
| 13851 | |
| 13852 | static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, |
| 13853 | const float *__b) { |
| 13854 | return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); |
| 13855 | } |
| 13856 | |
| 13857 | static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, |
| 13858 | vector float *__b) { |
| 13859 | return vec_perm(vec_ldl(__a, __b), (vector float)(0), |
| 13860 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13861 | } |
| 13862 | |
| 13863 | /* vec_lvrx */ |
| 13864 | |
| 13865 | static __inline__ vector signed char __ATTRS_o_ai |
| 13866 | vec_lvrx(int __a, const signed char *__b) { |
| 13867 | return vec_perm((vector signed char)(0), vec_ld(__a, __b), |
| 13868 | vec_lvsl(__a, __b)); |
| 13869 | } |
| 13870 | |
| 13871 | static __inline__ vector signed char __ATTRS_o_ai |
| 13872 | vec_lvrx(int __a, const vector signed char *__b) { |
| 13873 | return vec_perm((vector signed char)(0), vec_ld(__a, __b), |
| 13874 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13875 | } |
| 13876 | |
| 13877 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13878 | vec_lvrx(int __a, const unsigned char *__b) { |
| 13879 | return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), |
| 13880 | vec_lvsl(__a, __b)); |
| 13881 | } |
| 13882 | |
| 13883 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13884 | vec_lvrx(int __a, const vector unsigned char *__b) { |
| 13885 | return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), |
| 13886 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13887 | } |
| 13888 | |
| 13889 | static __inline__ vector bool char __ATTRS_o_ai |
| 13890 | vec_lvrx(int __a, const vector bool char *__b) { |
| 13891 | return vec_perm((vector bool char)(0), vec_ld(__a, __b), |
| 13892 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13893 | } |
| 13894 | |
| 13895 | static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, |
| 13896 | const short *__b) { |
| 13897 | return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); |
| 13898 | } |
| 13899 | |
| 13900 | static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, |
| 13901 | const vector short *__b) { |
| 13902 | return vec_perm((vector short)(0), vec_ld(__a, __b), |
| 13903 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13904 | } |
| 13905 | |
| 13906 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13907 | vec_lvrx(int __a, const unsigned short *__b) { |
| 13908 | return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), |
| 13909 | vec_lvsl(__a, __b)); |
| 13910 | } |
| 13911 | |
| 13912 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 13913 | vec_lvrx(int __a, const vector unsigned short *__b) { |
| 13914 | return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), |
| 13915 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13916 | } |
| 13917 | |
| 13918 | static __inline__ vector bool short __ATTRS_o_ai |
| 13919 | vec_lvrx(int __a, const vector bool short *__b) { |
| 13920 | return vec_perm((vector bool short)(0), vec_ld(__a, __b), |
| 13921 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13922 | } |
| 13923 | |
| 13924 | static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, |
| 13925 | const vector pixel *__b) { |
| 13926 | return vec_perm((vector pixel)(0), vec_ld(__a, __b), |
| 13927 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13928 | } |
| 13929 | |
| 13930 | static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { |
| 13931 | return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); |
| 13932 | } |
| 13933 | |
| 13934 | static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, |
| 13935 | const vector int *__b) { |
| 13936 | return vec_perm((vector int)(0), vec_ld(__a, __b), |
| 13937 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13938 | } |
| 13939 | |
| 13940 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13941 | vec_lvrx(int __a, const unsigned int *__b) { |
| 13942 | return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), |
| 13943 | vec_lvsl(__a, __b)); |
| 13944 | } |
| 13945 | |
| 13946 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 13947 | vec_lvrx(int __a, const vector unsigned int *__b) { |
| 13948 | return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), |
| 13949 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13950 | } |
| 13951 | |
| 13952 | static __inline__ vector bool int __ATTRS_o_ai |
| 13953 | vec_lvrx(int __a, const vector bool int *__b) { |
| 13954 | return vec_perm((vector bool int)(0), vec_ld(__a, __b), |
| 13955 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13956 | } |
| 13957 | |
| 13958 | static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, |
| 13959 | const float *__b) { |
| 13960 | return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); |
| 13961 | } |
| 13962 | |
| 13963 | static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, |
| 13964 | const vector float *__b) { |
| 13965 | return vec_perm((vector float)(0), vec_ld(__a, __b), |
| 13966 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13967 | } |
| 13968 | |
| 13969 | /* vec_lvrxl */ |
| 13970 | |
| 13971 | static __inline__ vector signed char __ATTRS_o_ai |
| 13972 | vec_lvrxl(int __a, const signed char *__b) { |
| 13973 | return vec_perm((vector signed char)(0), vec_ldl(__a, __b), |
| 13974 | vec_lvsl(__a, __b)); |
| 13975 | } |
| 13976 | |
| 13977 | static __inline__ vector signed char __ATTRS_o_ai |
| 13978 | vec_lvrxl(int __a, const vector signed char *__b) { |
| 13979 | return vec_perm((vector signed char)(0), vec_ldl(__a, __b), |
| 13980 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13981 | } |
| 13982 | |
| 13983 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13984 | vec_lvrxl(int __a, const unsigned char *__b) { |
| 13985 | return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), |
| 13986 | vec_lvsl(__a, __b)); |
| 13987 | } |
| 13988 | |
| 13989 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 13990 | vec_lvrxl(int __a, const vector unsigned char *__b) { |
| 13991 | return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), |
| 13992 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13993 | } |
| 13994 | |
| 13995 | static __inline__ vector bool char __ATTRS_o_ai |
| 13996 | vec_lvrxl(int __a, const vector bool char *__b) { |
| 13997 | return vec_perm((vector bool char)(0), vec_ldl(__a, __b), |
| 13998 | vec_lvsl(__a, (unsigned char *)__b)); |
| 13999 | } |
| 14000 | |
| 14001 | static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, |
| 14002 | const short *__b) { |
| 14003 | return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); |
| 14004 | } |
| 14005 | |
| 14006 | static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, |
| 14007 | const vector short *__b) { |
| 14008 | return vec_perm((vector short)(0), vec_ldl(__a, __b), |
| 14009 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14010 | } |
| 14011 | |
| 14012 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 14013 | vec_lvrxl(int __a, const unsigned short *__b) { |
| 14014 | return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), |
| 14015 | vec_lvsl(__a, __b)); |
| 14016 | } |
| 14017 | |
| 14018 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 14019 | vec_lvrxl(int __a, const vector unsigned short *__b) { |
| 14020 | return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), |
| 14021 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14022 | } |
| 14023 | |
| 14024 | static __inline__ vector bool short __ATTRS_o_ai |
| 14025 | vec_lvrxl(int __a, const vector bool short *__b) { |
| 14026 | return vec_perm((vector bool short)(0), vec_ldl(__a, __b), |
| 14027 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14028 | } |
| 14029 | |
| 14030 | static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, |
| 14031 | const vector pixel *__b) { |
| 14032 | return vec_perm((vector pixel)(0), vec_ldl(__a, __b), |
| 14033 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14034 | } |
| 14035 | |
| 14036 | static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { |
| 14037 | return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); |
| 14038 | } |
| 14039 | |
| 14040 | static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, |
| 14041 | const vector int *__b) { |
| 14042 | return vec_perm((vector int)(0), vec_ldl(__a, __b), |
| 14043 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14044 | } |
| 14045 | |
| 14046 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 14047 | vec_lvrxl(int __a, const unsigned int *__b) { |
| 14048 | return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), |
| 14049 | vec_lvsl(__a, __b)); |
| 14050 | } |
| 14051 | |
| 14052 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 14053 | vec_lvrxl(int __a, const vector unsigned int *__b) { |
| 14054 | return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), |
| 14055 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14056 | } |
| 14057 | |
| 14058 | static __inline__ vector bool int __ATTRS_o_ai |
| 14059 | vec_lvrxl(int __a, const vector bool int *__b) { |
| 14060 | return vec_perm((vector bool int)(0), vec_ldl(__a, __b), |
| 14061 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14062 | } |
| 14063 | |
| 14064 | static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, |
| 14065 | const float *__b) { |
| 14066 | return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); |
| 14067 | } |
| 14068 | |
| 14069 | static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, |
| 14070 | const vector float *__b) { |
| 14071 | return vec_perm((vector float)(0), vec_ldl(__a, __b), |
| 14072 | vec_lvsl(__a, (unsigned char *)__b)); |
| 14073 | } |
| 14074 | |
| 14075 | /* vec_stvlx */ |
| 14076 | |
| 14077 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, |
| 14078 | signed char *__c) { |
| 14079 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14080 | __c); |
| 14081 | } |
| 14082 | |
| 14083 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, |
| 14084 | vector signed char *__c) { |
| 14085 | return vec_st( |
| 14086 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14087 | __b, __c); |
| 14088 | } |
| 14089 | |
| 14090 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, |
| 14091 | unsigned char *__c) { |
| 14092 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14093 | __c); |
| 14094 | } |
| 14095 | |
| 14096 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, |
| 14097 | vector unsigned char *__c) { |
| 14098 | return vec_st( |
| 14099 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14100 | __b, __c); |
| 14101 | } |
| 14102 | |
| 14103 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, |
| 14104 | vector bool char *__c) { |
| 14105 | return vec_st( |
| 14106 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14107 | __b, __c); |
| 14108 | } |
| 14109 | |
| 14110 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, |
| 14111 | short *__c) { |
| 14112 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14113 | __c); |
| 14114 | } |
| 14115 | |
| 14116 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, |
| 14117 | vector short *__c) { |
| 14118 | return vec_st( |
| 14119 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14120 | __b, __c); |
| 14121 | } |
| 14122 | |
| 14123 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, |
| 14124 | int __b, unsigned short *__c) { |
| 14125 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14126 | __c); |
| 14127 | } |
| 14128 | |
| 14129 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, |
| 14130 | int __b, |
| 14131 | vector unsigned short *__c) { |
| 14132 | return vec_st( |
| 14133 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14134 | __b, __c); |
| 14135 | } |
| 14136 | |
| 14137 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, |
| 14138 | vector bool short *__c) { |
| 14139 | return vec_st( |
| 14140 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14141 | __b, __c); |
| 14142 | } |
| 14143 | |
| 14144 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, |
| 14145 | vector pixel *__c) { |
| 14146 | return vec_st( |
| 14147 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14148 | __b, __c); |
| 14149 | } |
| 14150 | |
| 14151 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, |
| 14152 | int *__c) { |
| 14153 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14154 | __c); |
| 14155 | } |
| 14156 | |
| 14157 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, |
| 14158 | vector int *__c) { |
| 14159 | return vec_st( |
| 14160 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14161 | __b, __c); |
| 14162 | } |
| 14163 | |
| 14164 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, |
| 14165 | unsigned int *__c) { |
| 14166 | return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14167 | __c); |
| 14168 | } |
| 14169 | |
| 14170 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, |
| 14171 | vector unsigned int *__c) { |
| 14172 | return vec_st( |
| 14173 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14174 | __b, __c); |
| 14175 | } |
| 14176 | |
| 14177 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, |
| 14178 | vector bool int *__c) { |
| 14179 | return vec_st( |
| 14180 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14181 | __b, __c); |
| 14182 | } |
| 14183 | |
| 14184 | static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, |
| 14185 | vector float *__c) { |
| 14186 | return vec_st( |
| 14187 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14188 | __b, __c); |
| 14189 | } |
| 14190 | |
| 14191 | /* vec_stvlxl */ |
| 14192 | |
| 14193 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, |
| 14194 | signed char *__c) { |
| 14195 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14196 | __c); |
| 14197 | } |
| 14198 | |
| 14199 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, |
| 14200 | vector signed char *__c) { |
| 14201 | return vec_stl( |
| 14202 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14203 | __b, __c); |
| 14204 | } |
| 14205 | |
| 14206 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, |
| 14207 | int __b, unsigned char *__c) { |
| 14208 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14209 | __c); |
| 14210 | } |
| 14211 | |
| 14212 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, |
| 14213 | int __b, |
| 14214 | vector unsigned char *__c) { |
| 14215 | return vec_stl( |
| 14216 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14217 | __b, __c); |
| 14218 | } |
| 14219 | |
| 14220 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, |
| 14221 | vector bool char *__c) { |
| 14222 | return vec_stl( |
| 14223 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14224 | __b, __c); |
| 14225 | } |
| 14226 | |
| 14227 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, |
| 14228 | short *__c) { |
| 14229 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14230 | __c); |
| 14231 | } |
| 14232 | |
| 14233 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, |
| 14234 | vector short *__c) { |
| 14235 | return vec_stl( |
| 14236 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14237 | __b, __c); |
| 14238 | } |
| 14239 | |
| 14240 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, |
| 14241 | int __b, unsigned short *__c) { |
| 14242 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14243 | __c); |
| 14244 | } |
| 14245 | |
| 14246 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, |
| 14247 | int __b, |
| 14248 | vector unsigned short *__c) { |
| 14249 | return vec_stl( |
| 14250 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14251 | __b, __c); |
| 14252 | } |
| 14253 | |
| 14254 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, |
| 14255 | vector bool short *__c) { |
| 14256 | return vec_stl( |
| 14257 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14258 | __b, __c); |
| 14259 | } |
| 14260 | |
| 14261 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, |
| 14262 | vector pixel *__c) { |
| 14263 | return vec_stl( |
| 14264 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14265 | __b, __c); |
| 14266 | } |
| 14267 | |
| 14268 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, |
| 14269 | int *__c) { |
| 14270 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14271 | __c); |
| 14272 | } |
| 14273 | |
| 14274 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, |
| 14275 | vector int *__c) { |
| 14276 | return vec_stl( |
| 14277 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14278 | __b, __c); |
| 14279 | } |
| 14280 | |
| 14281 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, |
| 14282 | unsigned int *__c) { |
| 14283 | return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, |
| 14284 | __c); |
| 14285 | } |
| 14286 | |
| 14287 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, |
| 14288 | vector unsigned int *__c) { |
| 14289 | return vec_stl( |
| 14290 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14291 | __b, __c); |
| 14292 | } |
| 14293 | |
| 14294 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, |
| 14295 | vector bool int *__c) { |
| 14296 | return vec_stl( |
| 14297 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14298 | __b, __c); |
| 14299 | } |
| 14300 | |
| 14301 | static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, |
| 14302 | vector float *__c) { |
| 14303 | return vec_stl( |
| 14304 | vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), |
| 14305 | __b, __c); |
| 14306 | } |
| 14307 | |
| 14308 | /* vec_stvrx */ |
| 14309 | |
| 14310 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, |
| 14311 | signed char *__c) { |
| 14312 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14313 | __c); |
| 14314 | } |
| 14315 | |
| 14316 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, |
| 14317 | vector signed char *__c) { |
| 14318 | return vec_st( |
| 14319 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14320 | __b, __c); |
| 14321 | } |
| 14322 | |
| 14323 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, |
| 14324 | unsigned char *__c) { |
| 14325 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14326 | __c); |
| 14327 | } |
| 14328 | |
| 14329 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, |
| 14330 | vector unsigned char *__c) { |
| 14331 | return vec_st( |
| 14332 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14333 | __b, __c); |
| 14334 | } |
| 14335 | |
| 14336 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, |
| 14337 | vector bool char *__c) { |
| 14338 | return vec_st( |
| 14339 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14340 | __b, __c); |
| 14341 | } |
| 14342 | |
| 14343 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, |
| 14344 | short *__c) { |
| 14345 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14346 | __c); |
| 14347 | } |
| 14348 | |
| 14349 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, |
| 14350 | vector short *__c) { |
| 14351 | return vec_st( |
| 14352 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14353 | __b, __c); |
| 14354 | } |
| 14355 | |
| 14356 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, |
| 14357 | int __b, unsigned short *__c) { |
| 14358 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14359 | __c); |
| 14360 | } |
| 14361 | |
| 14362 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, |
| 14363 | int __b, |
| 14364 | vector unsigned short *__c) { |
| 14365 | return vec_st( |
| 14366 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14367 | __b, __c); |
| 14368 | } |
| 14369 | |
| 14370 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, |
| 14371 | vector bool short *__c) { |
| 14372 | return vec_st( |
| 14373 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14374 | __b, __c); |
| 14375 | } |
| 14376 | |
| 14377 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, |
| 14378 | vector pixel *__c) { |
| 14379 | return vec_st( |
| 14380 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14381 | __b, __c); |
| 14382 | } |
| 14383 | |
| 14384 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, |
| 14385 | int *__c) { |
| 14386 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14387 | __c); |
| 14388 | } |
| 14389 | |
| 14390 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, |
| 14391 | vector int *__c) { |
| 14392 | return vec_st( |
| 14393 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14394 | __b, __c); |
| 14395 | } |
| 14396 | |
| 14397 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, |
| 14398 | unsigned int *__c) { |
| 14399 | return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14400 | __c); |
| 14401 | } |
| 14402 | |
| 14403 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, |
| 14404 | vector unsigned int *__c) { |
| 14405 | return vec_st( |
| 14406 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14407 | __b, __c); |
| 14408 | } |
| 14409 | |
| 14410 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, |
| 14411 | vector bool int *__c) { |
| 14412 | return vec_st( |
| 14413 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14414 | __b, __c); |
| 14415 | } |
| 14416 | |
| 14417 | static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, |
| 14418 | vector float *__c) { |
| 14419 | return vec_st( |
| 14420 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14421 | __b, __c); |
| 14422 | } |
| 14423 | |
| 14424 | /* vec_stvrxl */ |
| 14425 | |
| 14426 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, |
| 14427 | signed char *__c) { |
| 14428 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14429 | __c); |
| 14430 | } |
| 14431 | |
| 14432 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, |
| 14433 | vector signed char *__c) { |
| 14434 | return vec_stl( |
| 14435 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14436 | __b, __c); |
| 14437 | } |
| 14438 | |
| 14439 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, |
| 14440 | int __b, unsigned char *__c) { |
| 14441 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14442 | __c); |
| 14443 | } |
| 14444 | |
| 14445 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, |
| 14446 | int __b, |
| 14447 | vector unsigned char *__c) { |
| 14448 | return vec_stl( |
| 14449 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14450 | __b, __c); |
| 14451 | } |
| 14452 | |
| 14453 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, |
| 14454 | vector bool char *__c) { |
| 14455 | return vec_stl( |
| 14456 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14457 | __b, __c); |
| 14458 | } |
| 14459 | |
| 14460 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, |
| 14461 | short *__c) { |
| 14462 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14463 | __c); |
| 14464 | } |
| 14465 | |
| 14466 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, |
| 14467 | vector short *__c) { |
| 14468 | return vec_stl( |
| 14469 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14470 | __b, __c); |
| 14471 | } |
| 14472 | |
| 14473 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, |
| 14474 | int __b, unsigned short *__c) { |
| 14475 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14476 | __c); |
| 14477 | } |
| 14478 | |
| 14479 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, |
| 14480 | int __b, |
| 14481 | vector unsigned short *__c) { |
| 14482 | return vec_stl( |
| 14483 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14484 | __b, __c); |
| 14485 | } |
| 14486 | |
| 14487 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, |
| 14488 | vector bool short *__c) { |
| 14489 | return vec_stl( |
| 14490 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14491 | __b, __c); |
| 14492 | } |
| 14493 | |
| 14494 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, |
| 14495 | vector pixel *__c) { |
| 14496 | return vec_stl( |
| 14497 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14498 | __b, __c); |
| 14499 | } |
| 14500 | |
| 14501 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, |
| 14502 | int *__c) { |
| 14503 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14504 | __c); |
| 14505 | } |
| 14506 | |
| 14507 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, |
| 14508 | vector int *__c) { |
| 14509 | return vec_stl( |
| 14510 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14511 | __b, __c); |
| 14512 | } |
| 14513 | |
| 14514 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, |
| 14515 | unsigned int *__c) { |
| 14516 | return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, |
| 14517 | __c); |
| 14518 | } |
| 14519 | |
| 14520 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, |
| 14521 | vector unsigned int *__c) { |
| 14522 | return vec_stl( |
| 14523 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14524 | __b, __c); |
| 14525 | } |
| 14526 | |
| 14527 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, |
| 14528 | vector bool int *__c) { |
| 14529 | return vec_stl( |
| 14530 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14531 | __b, __c); |
| 14532 | } |
| 14533 | |
| 14534 | static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, |
| 14535 | vector float *__c) { |
| 14536 | return vec_stl( |
| 14537 | vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), |
| 14538 | __b, __c); |
| 14539 | } |
| 14540 | |
| 14541 | /* vec_promote */ |
| 14542 | |
| 14543 | static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, |
| 14544 | int __b) { |
| 14545 | vector signed char __res = (vector signed char)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14546 | __res[__b & 0x7] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14547 | return __res; |
| 14548 | } |
| 14549 | |
| 14550 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 14551 | vec_promote(unsigned char __a, int __b) { |
| 14552 | vector unsigned char __res = (vector unsigned char)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14553 | __res[__b & 0x7] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14554 | return __res; |
| 14555 | } |
| 14556 | |
| 14557 | static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { |
| 14558 | vector short __res = (vector short)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14559 | __res[__b & 0x7] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14560 | return __res; |
| 14561 | } |
| 14562 | |
| 14563 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 14564 | vec_promote(unsigned short __a, int __b) { |
| 14565 | vector unsigned short __res = (vector unsigned short)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14566 | __res[__b & 0x7] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14567 | return __res; |
| 14568 | } |
| 14569 | |
| 14570 | static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { |
| 14571 | vector int __res = (vector int)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14572 | __res[__b & 0x3] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14573 | return __res; |
| 14574 | } |
| 14575 | |
| 14576 | static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, |
| 14577 | int __b) { |
| 14578 | vector unsigned int __res = (vector unsigned int)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14579 | __res[__b & 0x3] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14580 | return __res; |
| 14581 | } |
| 14582 | |
| 14583 | static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { |
| 14584 | vector float __res = (vector float)(0); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14585 | __res[__b & 0x3] = __a; |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14586 | return __res; |
| 14587 | } |
| 14588 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14589 | #ifdef __VSX__ |
| 14590 | static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { |
| 14591 | vector double __res = (vector double)(0); |
| 14592 | __res[__b & 0x1] = __a; |
| 14593 | return __res; |
| 14594 | } |
| 14595 | |
| 14596 | static __inline__ vector signed long long __ATTRS_o_ai |
| 14597 | vec_promote(signed long long __a, int __b) { |
| 14598 | vector signed long long __res = (vector signed long long)(0); |
| 14599 | __res[__b & 0x1] = __a; |
| 14600 | return __res; |
| 14601 | } |
| 14602 | |
| 14603 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 14604 | vec_promote(unsigned long long __a, int __b) { |
| 14605 | vector unsigned long long __res = (vector unsigned long long)(0); |
| 14606 | __res[__b & 0x1] = __a; |
| 14607 | return __res; |
| 14608 | } |
| 14609 | #endif |
| 14610 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14611 | /* vec_splats */ |
| 14612 | |
| 14613 | static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { |
| 14614 | return (vector signed char)(__a); |
| 14615 | } |
| 14616 | |
| 14617 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 14618 | vec_splats(unsigned char __a) { |
| 14619 | return (vector unsigned char)(__a); |
| 14620 | } |
| 14621 | |
| 14622 | static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { |
| 14623 | return (vector short)(__a); |
| 14624 | } |
| 14625 | |
| 14626 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 14627 | vec_splats(unsigned short __a) { |
| 14628 | return (vector unsigned short)(__a); |
| 14629 | } |
| 14630 | |
| 14631 | static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { |
| 14632 | return (vector int)(__a); |
| 14633 | } |
| 14634 | |
| 14635 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 14636 | vec_splats(unsigned int __a) { |
| 14637 | return (vector unsigned int)(__a); |
| 14638 | } |
| 14639 | |
| 14640 | #ifdef __VSX__ |
| 14641 | static __inline__ vector signed long long __ATTRS_o_ai |
| 14642 | vec_splats(signed long long __a) { |
| 14643 | return (vector signed long long)(__a); |
| 14644 | } |
| 14645 | |
| 14646 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 14647 | vec_splats(unsigned long long __a) { |
| 14648 | return (vector unsigned long long)(__a); |
| 14649 | } |
| 14650 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14651 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 14652 | defined(__SIZEOF_INT128__) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14653 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 14654 | vec_splats(signed __int128 __a) { |
| 14655 | return (vector signed __int128)(__a); |
| 14656 | } |
| 14657 | |
| 14658 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 14659 | vec_splats(unsigned __int128 __a) { |
| 14660 | return (vector unsigned __int128)(__a); |
| 14661 | } |
| 14662 | |
| 14663 | #endif |
| 14664 | |
| 14665 | static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { |
| 14666 | return (vector double)(__a); |
| 14667 | } |
| 14668 | #endif |
| 14669 | |
| 14670 | static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { |
| 14671 | return (vector float)(__a); |
| 14672 | } |
| 14673 | |
| 14674 | /* ----------------------------- predicates --------------------------------- */ |
| 14675 | |
| 14676 | /* vec_all_eq */ |
| 14677 | |
| 14678 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, |
| 14679 | vector signed char __b) { |
| 14680 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14681 | (vector char)__b); |
| 14682 | } |
| 14683 | |
| 14684 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, |
| 14685 | vector bool char __b) { |
| 14686 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14687 | (vector char)__b); |
| 14688 | } |
| 14689 | |
| 14690 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, |
| 14691 | vector unsigned char __b) { |
| 14692 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14693 | (vector char)__b); |
| 14694 | } |
| 14695 | |
| 14696 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, |
| 14697 | vector bool char __b) { |
| 14698 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14699 | (vector char)__b); |
| 14700 | } |
| 14701 | |
| 14702 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, |
| 14703 | vector signed char __b) { |
| 14704 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14705 | (vector char)__b); |
| 14706 | } |
| 14707 | |
| 14708 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, |
| 14709 | vector unsigned char __b) { |
| 14710 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14711 | (vector char)__b); |
| 14712 | } |
| 14713 | |
| 14714 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, |
| 14715 | vector bool char __b) { |
| 14716 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, |
| 14717 | (vector char)__b); |
| 14718 | } |
| 14719 | |
| 14720 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, |
| 14721 | vector short __b) { |
| 14722 | return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); |
| 14723 | } |
| 14724 | |
| 14725 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, |
| 14726 | vector bool short __b) { |
| 14727 | return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); |
| 14728 | } |
| 14729 | |
| 14730 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, |
| 14731 | vector unsigned short __b) { |
| 14732 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14733 | (vector short)__b); |
| 14734 | } |
| 14735 | |
| 14736 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, |
| 14737 | vector bool short __b) { |
| 14738 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14739 | (vector short)__b); |
| 14740 | } |
| 14741 | |
| 14742 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, |
| 14743 | vector short __b) { |
| 14744 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14745 | (vector short)__b); |
| 14746 | } |
| 14747 | |
| 14748 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, |
| 14749 | vector unsigned short __b) { |
| 14750 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14751 | (vector short)__b); |
| 14752 | } |
| 14753 | |
| 14754 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, |
| 14755 | vector bool short __b) { |
| 14756 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14757 | (vector short)__b); |
| 14758 | } |
| 14759 | |
| 14760 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, |
| 14761 | vector pixel __b) { |
| 14762 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, |
| 14763 | (vector short)__b); |
| 14764 | } |
| 14765 | |
| 14766 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { |
| 14767 | return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); |
| 14768 | } |
| 14769 | |
| 14770 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, |
| 14771 | vector bool int __b) { |
| 14772 | return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); |
| 14773 | } |
| 14774 | |
| 14775 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, |
| 14776 | vector unsigned int __b) { |
| 14777 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, |
| 14778 | (vector int)__b); |
| 14779 | } |
| 14780 | |
| 14781 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, |
| 14782 | vector bool int __b) { |
| 14783 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, |
| 14784 | (vector int)__b); |
| 14785 | } |
| 14786 | |
| 14787 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, |
| 14788 | vector int __b) { |
| 14789 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, |
| 14790 | (vector int)__b); |
| 14791 | } |
| 14792 | |
| 14793 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, |
| 14794 | vector unsigned int __b) { |
| 14795 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, |
| 14796 | (vector int)__b); |
| 14797 | } |
| 14798 | |
| 14799 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, |
| 14800 | vector bool int __b) { |
| 14801 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, |
| 14802 | (vector int)__b); |
| 14803 | } |
| 14804 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14805 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14806 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, |
| 14807 | vector signed long long __b) { |
| 14808 | return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); |
| 14809 | } |
| 14810 | |
| 14811 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, |
| 14812 | vector bool long long __b) { |
| 14813 | return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); |
| 14814 | } |
| 14815 | |
| 14816 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, |
| 14817 | vector unsigned long long __b) { |
| 14818 | return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, |
| 14819 | (vector long long)__b); |
| 14820 | } |
| 14821 | |
| 14822 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, |
| 14823 | vector bool long long __b) { |
| 14824 | return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, |
| 14825 | (vector long long)__b); |
| 14826 | } |
| 14827 | |
| 14828 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, |
| 14829 | vector long long __b) { |
| 14830 | return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, |
| 14831 | (vector long long)__b); |
| 14832 | } |
| 14833 | |
| 14834 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, |
| 14835 | vector unsigned long long __b) { |
| 14836 | return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, |
| 14837 | (vector long long)__b); |
| 14838 | } |
| 14839 | |
| 14840 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, |
| 14841 | vector bool long long __b) { |
| 14842 | return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, |
| 14843 | (vector long long)__b); |
| 14844 | } |
| 14845 | #endif |
| 14846 | |
| 14847 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, |
| 14848 | vector float __b) { |
| 14849 | #ifdef __VSX__ |
| 14850 | return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); |
| 14851 | #else |
| 14852 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); |
| 14853 | #endif |
| 14854 | } |
| 14855 | |
| 14856 | #ifdef __VSX__ |
| 14857 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, |
| 14858 | vector double __b) { |
| 14859 | return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); |
| 14860 | } |
| 14861 | #endif |
| 14862 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14863 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 14864 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, |
| 14865 | vector signed __int128 __b) { |
| 14866 | return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); |
| 14867 | } |
| 14868 | |
| 14869 | static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, |
| 14870 | vector unsigned __int128 __b) { |
| 14871 | return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); |
| 14872 | } |
| 14873 | #endif |
| 14874 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14875 | /* vec_all_ge */ |
| 14876 | |
| 14877 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, |
| 14878 | vector signed char __b) { |
| 14879 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); |
| 14880 | } |
| 14881 | |
| 14882 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, |
| 14883 | vector bool char __b) { |
| 14884 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); |
| 14885 | } |
| 14886 | |
| 14887 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, |
| 14888 | vector unsigned char __b) { |
| 14889 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); |
| 14890 | } |
| 14891 | |
| 14892 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, |
| 14893 | vector bool char __b) { |
| 14894 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); |
| 14895 | } |
| 14896 | |
| 14897 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, |
| 14898 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 14899 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14900 | } |
| 14901 | |
| 14902 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, |
| 14903 | vector unsigned char __b) { |
| 14904 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); |
| 14905 | } |
| 14906 | |
| 14907 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, |
| 14908 | vector bool char __b) { |
| 14909 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, |
| 14910 | (vector unsigned char)__a); |
| 14911 | } |
| 14912 | |
| 14913 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, |
| 14914 | vector short __b) { |
| 14915 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); |
| 14916 | } |
| 14917 | |
| 14918 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, |
| 14919 | vector bool short __b) { |
| 14920 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); |
| 14921 | } |
| 14922 | |
| 14923 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, |
| 14924 | vector unsigned short __b) { |
| 14925 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); |
| 14926 | } |
| 14927 | |
| 14928 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, |
| 14929 | vector bool short __b) { |
| 14930 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, |
| 14931 | __a); |
| 14932 | } |
| 14933 | |
| 14934 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, |
| 14935 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 14936 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14937 | } |
| 14938 | |
| 14939 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, |
| 14940 | vector unsigned short __b) { |
| 14941 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, |
| 14942 | (vector unsigned short)__a); |
| 14943 | } |
| 14944 | |
| 14945 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, |
| 14946 | vector bool short __b) { |
| 14947 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, |
| 14948 | (vector unsigned short)__a); |
| 14949 | } |
| 14950 | |
| 14951 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { |
| 14952 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); |
| 14953 | } |
| 14954 | |
| 14955 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, |
| 14956 | vector bool int __b) { |
| 14957 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); |
| 14958 | } |
| 14959 | |
| 14960 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, |
| 14961 | vector unsigned int __b) { |
| 14962 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); |
| 14963 | } |
| 14964 | |
| 14965 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, |
| 14966 | vector bool int __b) { |
| 14967 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); |
| 14968 | } |
| 14969 | |
| 14970 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, |
| 14971 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 14972 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14973 | } |
| 14974 | |
| 14975 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, |
| 14976 | vector unsigned int __b) { |
| 14977 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); |
| 14978 | } |
| 14979 | |
| 14980 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, |
| 14981 | vector bool int __b) { |
| 14982 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, |
| 14983 | (vector unsigned int)__a); |
| 14984 | } |
| 14985 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 14986 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 14987 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, |
| 14988 | vector signed long long __b) { |
| 14989 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); |
| 14990 | } |
| 14991 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, |
| 14992 | vector bool long long __b) { |
| 14993 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, |
| 14994 | __a); |
| 14995 | } |
| 14996 | |
| 14997 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, |
| 14998 | vector unsigned long long __b) { |
| 14999 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); |
| 15000 | } |
| 15001 | |
| 15002 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, |
| 15003 | vector bool long long __b) { |
| 15004 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, |
| 15005 | __a); |
| 15006 | } |
| 15007 | |
| 15008 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, |
| 15009 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15010 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, |
| 15011 | (vector signed long long)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15012 | } |
| 15013 | |
| 15014 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, |
| 15015 | vector unsigned long long __b) { |
| 15016 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, |
| 15017 | (vector unsigned long long)__a); |
| 15018 | } |
| 15019 | |
| 15020 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, |
| 15021 | vector bool long long __b) { |
| 15022 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, |
| 15023 | (vector unsigned long long)__a); |
| 15024 | } |
| 15025 | #endif |
| 15026 | |
| 15027 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, |
| 15028 | vector float __b) { |
| 15029 | #ifdef __VSX__ |
| 15030 | return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); |
| 15031 | #else |
| 15032 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); |
| 15033 | #endif |
| 15034 | } |
| 15035 | |
| 15036 | #ifdef __VSX__ |
| 15037 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, |
| 15038 | vector double __b) { |
| 15039 | return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); |
| 15040 | } |
| 15041 | #endif |
| 15042 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15043 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 15044 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, |
| 15045 | vector signed __int128 __b) { |
| 15046 | return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); |
| 15047 | } |
| 15048 | |
| 15049 | static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, |
| 15050 | vector unsigned __int128 __b) { |
| 15051 | return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); |
| 15052 | } |
| 15053 | #endif |
| 15054 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15055 | /* vec_all_gt */ |
| 15056 | |
| 15057 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, |
| 15058 | vector signed char __b) { |
| 15059 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); |
| 15060 | } |
| 15061 | |
| 15062 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, |
| 15063 | vector bool char __b) { |
| 15064 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); |
| 15065 | } |
| 15066 | |
| 15067 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, |
| 15068 | vector unsigned char __b) { |
| 15069 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); |
| 15070 | } |
| 15071 | |
| 15072 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, |
| 15073 | vector bool char __b) { |
| 15074 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); |
| 15075 | } |
| 15076 | |
| 15077 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, |
| 15078 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15079 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15080 | } |
| 15081 | |
| 15082 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, |
| 15083 | vector unsigned char __b) { |
| 15084 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); |
| 15085 | } |
| 15086 | |
| 15087 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, |
| 15088 | vector bool char __b) { |
| 15089 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, |
| 15090 | (vector unsigned char)__b); |
| 15091 | } |
| 15092 | |
| 15093 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, |
| 15094 | vector short __b) { |
| 15095 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); |
| 15096 | } |
| 15097 | |
| 15098 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, |
| 15099 | vector bool short __b) { |
| 15100 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); |
| 15101 | } |
| 15102 | |
| 15103 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, |
| 15104 | vector unsigned short __b) { |
| 15105 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); |
| 15106 | } |
| 15107 | |
| 15108 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, |
| 15109 | vector bool short __b) { |
| 15110 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, |
| 15111 | (vector unsigned short)__b); |
| 15112 | } |
| 15113 | |
| 15114 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, |
| 15115 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15116 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15117 | } |
| 15118 | |
| 15119 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, |
| 15120 | vector unsigned short __b) { |
| 15121 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, |
| 15122 | __b); |
| 15123 | } |
| 15124 | |
| 15125 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, |
| 15126 | vector bool short __b) { |
| 15127 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, |
| 15128 | (vector unsigned short)__b); |
| 15129 | } |
| 15130 | |
| 15131 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { |
| 15132 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); |
| 15133 | } |
| 15134 | |
| 15135 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, |
| 15136 | vector bool int __b) { |
| 15137 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); |
| 15138 | } |
| 15139 | |
| 15140 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, |
| 15141 | vector unsigned int __b) { |
| 15142 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); |
| 15143 | } |
| 15144 | |
| 15145 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, |
| 15146 | vector bool int __b) { |
| 15147 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); |
| 15148 | } |
| 15149 | |
| 15150 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, |
| 15151 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15152 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15153 | } |
| 15154 | |
| 15155 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, |
| 15156 | vector unsigned int __b) { |
| 15157 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); |
| 15158 | } |
| 15159 | |
| 15160 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, |
| 15161 | vector bool int __b) { |
| 15162 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, |
| 15163 | (vector unsigned int)__b); |
| 15164 | } |
| 15165 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15166 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15167 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, |
| 15168 | vector signed long long __b) { |
| 15169 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); |
| 15170 | } |
| 15171 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, |
| 15172 | vector bool long long __b) { |
| 15173 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, |
| 15174 | (vector signed long long)__b); |
| 15175 | } |
| 15176 | |
| 15177 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, |
| 15178 | vector unsigned long long __b) { |
| 15179 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); |
| 15180 | } |
| 15181 | |
| 15182 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, |
| 15183 | vector bool long long __b) { |
| 15184 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, |
| 15185 | (vector unsigned long long)__b); |
| 15186 | } |
| 15187 | |
| 15188 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, |
| 15189 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15190 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a, |
| 15191 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15192 | } |
| 15193 | |
| 15194 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, |
| 15195 | vector unsigned long long __b) { |
| 15196 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, |
| 15197 | __b); |
| 15198 | } |
| 15199 | |
| 15200 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, |
| 15201 | vector bool long long __b) { |
| 15202 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, |
| 15203 | (vector unsigned long long)__b); |
| 15204 | } |
| 15205 | #endif |
| 15206 | |
| 15207 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, |
| 15208 | vector float __b) { |
| 15209 | #ifdef __VSX__ |
| 15210 | return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); |
| 15211 | #else |
| 15212 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); |
| 15213 | #endif |
| 15214 | } |
| 15215 | |
| 15216 | #ifdef __VSX__ |
| 15217 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, |
| 15218 | vector double __b) { |
| 15219 | return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); |
| 15220 | } |
| 15221 | #endif |
| 15222 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15223 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 15224 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, |
| 15225 | vector signed __int128 __b) { |
| 15226 | return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); |
| 15227 | } |
| 15228 | |
| 15229 | static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, |
| 15230 | vector unsigned __int128 __b) { |
| 15231 | return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); |
| 15232 | } |
| 15233 | #endif |
| 15234 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15235 | /* vec_all_in */ |
| 15236 | |
| 15237 | static __inline__ int __attribute__((__always_inline__)) |
| 15238 | vec_all_in(vector float __a, vector float __b) { |
| 15239 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); |
| 15240 | } |
| 15241 | |
| 15242 | /* vec_all_le */ |
| 15243 | |
| 15244 | static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, |
| 15245 | vector signed char __b) { |
| 15246 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); |
| 15247 | } |
| 15248 | |
| 15249 | static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, |
| 15250 | vector bool char __b) { |
| 15251 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); |
| 15252 | } |
| 15253 | |
| 15254 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, |
| 15255 | vector unsigned char __b) { |
| 15256 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); |
| 15257 | } |
| 15258 | |
| 15259 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, |
| 15260 | vector bool char __b) { |
| 15261 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); |
| 15262 | } |
| 15263 | |
| 15264 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, |
| 15265 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15266 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15267 | } |
| 15268 | |
| 15269 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, |
| 15270 | vector unsigned char __b) { |
| 15271 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); |
| 15272 | } |
| 15273 | |
| 15274 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, |
| 15275 | vector bool char __b) { |
| 15276 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, |
| 15277 | (vector unsigned char)__b); |
| 15278 | } |
| 15279 | |
| 15280 | static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, |
| 15281 | vector short __b) { |
| 15282 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); |
| 15283 | } |
| 15284 | |
| 15285 | static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, |
| 15286 | vector bool short __b) { |
| 15287 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); |
| 15288 | } |
| 15289 | |
| 15290 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, |
| 15291 | vector unsigned short __b) { |
| 15292 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); |
| 15293 | } |
| 15294 | |
| 15295 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, |
| 15296 | vector bool short __b) { |
| 15297 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, |
| 15298 | (vector unsigned short)__b); |
| 15299 | } |
| 15300 | |
| 15301 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, |
| 15302 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15303 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15304 | } |
| 15305 | |
| 15306 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, |
| 15307 | vector unsigned short __b) { |
| 15308 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, |
| 15309 | __b); |
| 15310 | } |
| 15311 | |
| 15312 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, |
| 15313 | vector bool short __b) { |
| 15314 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, |
| 15315 | (vector unsigned short)__b); |
| 15316 | } |
| 15317 | |
| 15318 | static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { |
| 15319 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); |
| 15320 | } |
| 15321 | |
| 15322 | static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, |
| 15323 | vector bool int __b) { |
| 15324 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); |
| 15325 | } |
| 15326 | |
| 15327 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, |
| 15328 | vector unsigned int __b) { |
| 15329 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); |
| 15330 | } |
| 15331 | |
| 15332 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, |
| 15333 | vector bool int __b) { |
| 15334 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); |
| 15335 | } |
| 15336 | |
| 15337 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, |
| 15338 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15339 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15340 | } |
| 15341 | |
| 15342 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, |
| 15343 | vector unsigned int __b) { |
| 15344 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); |
| 15345 | } |
| 15346 | |
| 15347 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, |
| 15348 | vector bool int __b) { |
| 15349 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, |
| 15350 | (vector unsigned int)__b); |
| 15351 | } |
| 15352 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15353 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15354 | static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, |
| 15355 | vector signed long long __b) { |
| 15356 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); |
| 15357 | } |
| 15358 | |
| 15359 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, |
| 15360 | vector unsigned long long __b) { |
| 15361 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); |
| 15362 | } |
| 15363 | |
| 15364 | static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, |
| 15365 | vector bool long long __b) { |
| 15366 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, |
| 15367 | (vector signed long long)__b); |
| 15368 | } |
| 15369 | |
| 15370 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, |
| 15371 | vector bool long long __b) { |
| 15372 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, |
| 15373 | (vector unsigned long long)__b); |
| 15374 | } |
| 15375 | |
| 15376 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, |
| 15377 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15378 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a, |
| 15379 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15380 | } |
| 15381 | |
| 15382 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, |
| 15383 | vector unsigned long long __b) { |
| 15384 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, |
| 15385 | __b); |
| 15386 | } |
| 15387 | |
| 15388 | static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, |
| 15389 | vector bool long long __b) { |
| 15390 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, |
| 15391 | (vector unsigned long long)__b); |
| 15392 | } |
| 15393 | #endif |
| 15394 | |
| 15395 | static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, |
| 15396 | vector float __b) { |
| 15397 | #ifdef __VSX__ |
| 15398 | return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); |
| 15399 | #else |
| 15400 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); |
| 15401 | #endif |
| 15402 | } |
| 15403 | |
| 15404 | #ifdef __VSX__ |
| 15405 | static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, |
| 15406 | vector double __b) { |
| 15407 | return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); |
| 15408 | } |
| 15409 | #endif |
| 15410 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15411 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 15412 | static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, |
| 15413 | vector signed __int128 __b) { |
| 15414 | return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); |
| 15415 | } |
| 15416 | |
| 15417 | static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, |
| 15418 | vector unsigned __int128 __b) { |
| 15419 | return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); |
| 15420 | } |
| 15421 | #endif |
| 15422 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15423 | /* vec_all_lt */ |
| 15424 | |
| 15425 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, |
| 15426 | vector signed char __b) { |
| 15427 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); |
| 15428 | } |
| 15429 | |
| 15430 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, |
| 15431 | vector bool char __b) { |
| 15432 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); |
| 15433 | } |
| 15434 | |
| 15435 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, |
| 15436 | vector unsigned char __b) { |
| 15437 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); |
| 15438 | } |
| 15439 | |
| 15440 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, |
| 15441 | vector bool char __b) { |
| 15442 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); |
| 15443 | } |
| 15444 | |
| 15445 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, |
| 15446 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15447 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15448 | } |
| 15449 | |
| 15450 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, |
| 15451 | vector unsigned char __b) { |
| 15452 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); |
| 15453 | } |
| 15454 | |
| 15455 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, |
| 15456 | vector bool char __b) { |
| 15457 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, |
| 15458 | (vector unsigned char)__a); |
| 15459 | } |
| 15460 | |
| 15461 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, |
| 15462 | vector short __b) { |
| 15463 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); |
| 15464 | } |
| 15465 | |
| 15466 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, |
| 15467 | vector bool short __b) { |
| 15468 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); |
| 15469 | } |
| 15470 | |
| 15471 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, |
| 15472 | vector unsigned short __b) { |
| 15473 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); |
| 15474 | } |
| 15475 | |
| 15476 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, |
| 15477 | vector bool short __b) { |
| 15478 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, |
| 15479 | __a); |
| 15480 | } |
| 15481 | |
| 15482 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, |
| 15483 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15484 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15485 | } |
| 15486 | |
| 15487 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, |
| 15488 | vector unsigned short __b) { |
| 15489 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, |
| 15490 | (vector unsigned short)__a); |
| 15491 | } |
| 15492 | |
| 15493 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, |
| 15494 | vector bool short __b) { |
| 15495 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, |
| 15496 | (vector unsigned short)__a); |
| 15497 | } |
| 15498 | |
| 15499 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { |
| 15500 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); |
| 15501 | } |
| 15502 | |
| 15503 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, |
| 15504 | vector bool int __b) { |
| 15505 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); |
| 15506 | } |
| 15507 | |
| 15508 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, |
| 15509 | vector unsigned int __b) { |
| 15510 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); |
| 15511 | } |
| 15512 | |
| 15513 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, |
| 15514 | vector bool int __b) { |
| 15515 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); |
| 15516 | } |
| 15517 | |
| 15518 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, |
| 15519 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15520 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15521 | } |
| 15522 | |
| 15523 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, |
| 15524 | vector unsigned int __b) { |
| 15525 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); |
| 15526 | } |
| 15527 | |
| 15528 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, |
| 15529 | vector bool int __b) { |
| 15530 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, |
| 15531 | (vector unsigned int)__a); |
| 15532 | } |
| 15533 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15534 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15535 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, |
| 15536 | vector signed long long __b) { |
| 15537 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); |
| 15538 | } |
| 15539 | |
| 15540 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, |
| 15541 | vector unsigned long long __b) { |
| 15542 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); |
| 15543 | } |
| 15544 | |
| 15545 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, |
| 15546 | vector bool long long __b) { |
| 15547 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, |
| 15548 | __a); |
| 15549 | } |
| 15550 | |
| 15551 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, |
| 15552 | vector bool long long __b) { |
| 15553 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, |
| 15554 | __a); |
| 15555 | } |
| 15556 | |
| 15557 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, |
| 15558 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 15559 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, |
| 15560 | (vector signed long long)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15561 | } |
| 15562 | |
| 15563 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, |
| 15564 | vector unsigned long long __b) { |
| 15565 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, |
| 15566 | (vector unsigned long long)__a); |
| 15567 | } |
| 15568 | |
| 15569 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, |
| 15570 | vector bool long long __b) { |
| 15571 | return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, |
| 15572 | (vector unsigned long long)__a); |
| 15573 | } |
| 15574 | #endif |
| 15575 | |
| 15576 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, |
| 15577 | vector float __b) { |
| 15578 | #ifdef __VSX__ |
| 15579 | return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); |
| 15580 | #else |
| 15581 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); |
| 15582 | #endif |
| 15583 | } |
| 15584 | |
| 15585 | #ifdef __VSX__ |
| 15586 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, |
| 15587 | vector double __b) { |
| 15588 | return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); |
| 15589 | } |
| 15590 | #endif |
| 15591 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15592 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 15593 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, |
| 15594 | vector signed __int128 __b) { |
| 15595 | return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); |
| 15596 | } |
| 15597 | |
| 15598 | static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, |
| 15599 | vector unsigned __int128 __b) { |
| 15600 | return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); |
| 15601 | } |
| 15602 | #endif |
| 15603 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15604 | /* vec_all_nan */ |
| 15605 | |
| 15606 | static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { |
| 15607 | #ifdef __VSX__ |
| 15608 | return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); |
| 15609 | #else |
| 15610 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); |
| 15611 | #endif |
| 15612 | } |
| 15613 | |
| 15614 | #ifdef __VSX__ |
| 15615 | static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { |
| 15616 | return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); |
| 15617 | } |
| 15618 | #endif |
| 15619 | |
| 15620 | /* vec_all_ne */ |
| 15621 | |
| 15622 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, |
| 15623 | vector signed char __b) { |
| 15624 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15625 | (vector char)__b); |
| 15626 | } |
| 15627 | |
| 15628 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, |
| 15629 | vector bool char __b) { |
| 15630 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15631 | (vector char)__b); |
| 15632 | } |
| 15633 | |
| 15634 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, |
| 15635 | vector unsigned char __b) { |
| 15636 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15637 | (vector char)__b); |
| 15638 | } |
| 15639 | |
| 15640 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, |
| 15641 | vector bool char __b) { |
| 15642 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15643 | (vector char)__b); |
| 15644 | } |
| 15645 | |
| 15646 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, |
| 15647 | vector signed char __b) { |
| 15648 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15649 | (vector char)__b); |
| 15650 | } |
| 15651 | |
| 15652 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, |
| 15653 | vector unsigned char __b) { |
| 15654 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15655 | (vector char)__b); |
| 15656 | } |
| 15657 | |
| 15658 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, |
| 15659 | vector bool char __b) { |
| 15660 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, |
| 15661 | (vector char)__b); |
| 15662 | } |
| 15663 | |
| 15664 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, |
| 15665 | vector short __b) { |
| 15666 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); |
| 15667 | } |
| 15668 | |
| 15669 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, |
| 15670 | vector bool short __b) { |
| 15671 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); |
| 15672 | } |
| 15673 | |
| 15674 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, |
| 15675 | vector unsigned short __b) { |
| 15676 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15677 | (vector short)__b); |
| 15678 | } |
| 15679 | |
| 15680 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, |
| 15681 | vector bool short __b) { |
| 15682 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15683 | (vector short)__b); |
| 15684 | } |
| 15685 | |
| 15686 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, |
| 15687 | vector short __b) { |
| 15688 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15689 | (vector short)__b); |
| 15690 | } |
| 15691 | |
| 15692 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, |
| 15693 | vector unsigned short __b) { |
| 15694 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15695 | (vector short)__b); |
| 15696 | } |
| 15697 | |
| 15698 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, |
| 15699 | vector bool short __b) { |
| 15700 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15701 | (vector short)__b); |
| 15702 | } |
| 15703 | |
| 15704 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, |
| 15705 | vector pixel __b) { |
| 15706 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, |
| 15707 | (vector short)__b); |
| 15708 | } |
| 15709 | |
| 15710 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { |
| 15711 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); |
| 15712 | } |
| 15713 | |
| 15714 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, |
| 15715 | vector bool int __b) { |
| 15716 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); |
| 15717 | } |
| 15718 | |
| 15719 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, |
| 15720 | vector unsigned int __b) { |
| 15721 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, |
| 15722 | (vector int)__b); |
| 15723 | } |
| 15724 | |
| 15725 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, |
| 15726 | vector bool int __b) { |
| 15727 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, |
| 15728 | (vector int)__b); |
| 15729 | } |
| 15730 | |
| 15731 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, |
| 15732 | vector int __b) { |
| 15733 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, |
| 15734 | (vector int)__b); |
| 15735 | } |
| 15736 | |
| 15737 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, |
| 15738 | vector unsigned int __b) { |
| 15739 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, |
| 15740 | (vector int)__b); |
| 15741 | } |
| 15742 | |
| 15743 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, |
| 15744 | vector bool int __b) { |
| 15745 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, |
| 15746 | (vector int)__b); |
| 15747 | } |
| 15748 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15749 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15750 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, |
| 15751 | vector signed long long __b) { |
| 15752 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); |
| 15753 | } |
| 15754 | |
| 15755 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, |
| 15756 | vector unsigned long long __b) { |
| 15757 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, |
| 15758 | (vector long long)__b); |
| 15759 | } |
| 15760 | |
| 15761 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, |
| 15762 | vector bool long long __b) { |
| 15763 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, |
| 15764 | (vector signed long long)__b); |
| 15765 | } |
| 15766 | |
| 15767 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, |
| 15768 | vector bool long long __b) { |
| 15769 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, |
| 15770 | (vector signed long long)__b); |
| 15771 | } |
| 15772 | |
| 15773 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, |
| 15774 | vector signed long long __b) { |
| 15775 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, |
| 15776 | (vector signed long long)__b); |
| 15777 | } |
| 15778 | |
| 15779 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, |
| 15780 | vector unsigned long long __b) { |
| 15781 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, |
| 15782 | (vector signed long long)__b); |
| 15783 | } |
| 15784 | |
| 15785 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, |
| 15786 | vector bool long long __b) { |
| 15787 | return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, |
| 15788 | (vector signed long long)__b); |
| 15789 | } |
| 15790 | #endif |
| 15791 | |
| 15792 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, |
| 15793 | vector float __b) { |
| 15794 | #ifdef __VSX__ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 15795 | return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15796 | #else |
| 15797 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); |
| 15798 | #endif |
| 15799 | } |
| 15800 | |
| 15801 | #ifdef __VSX__ |
| 15802 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, |
| 15803 | vector double __b) { |
| 15804 | return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); |
| 15805 | } |
| 15806 | #endif |
| 15807 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15808 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 15809 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, |
| 15810 | vector signed __int128 __b) { |
| 15811 | return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); |
| 15812 | } |
| 15813 | |
| 15814 | static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, |
| 15815 | vector unsigned __int128 __b) { |
| 15816 | return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); |
| 15817 | } |
| 15818 | #endif |
| 15819 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15820 | /* vec_all_nge */ |
| 15821 | |
| 15822 | static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, |
| 15823 | vector float __b) { |
| 15824 | #ifdef __VSX__ |
| 15825 | return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); |
| 15826 | #else |
| 15827 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); |
| 15828 | #endif |
| 15829 | } |
| 15830 | |
| 15831 | #ifdef __VSX__ |
| 15832 | static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, |
| 15833 | vector double __b) { |
| 15834 | return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); |
| 15835 | } |
| 15836 | #endif |
| 15837 | |
| 15838 | /* vec_all_ngt */ |
| 15839 | |
| 15840 | static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, |
| 15841 | vector float __b) { |
| 15842 | #ifdef __VSX__ |
| 15843 | return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); |
| 15844 | #else |
| 15845 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); |
| 15846 | #endif |
| 15847 | } |
| 15848 | |
| 15849 | #ifdef __VSX__ |
| 15850 | static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, |
| 15851 | vector double __b) { |
| 15852 | return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); |
| 15853 | } |
| 15854 | #endif |
| 15855 | |
| 15856 | /* vec_all_nle */ |
| 15857 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15858 | static __inline__ int __ATTRS_o_ai |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15859 | vec_all_nle(vector float __a, vector float __b) { |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15860 | #ifdef __VSX__ |
| 15861 | return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); |
| 15862 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15863 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15864 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15865 | } |
| 15866 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15867 | #ifdef __VSX__ |
| 15868 | static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, |
| 15869 | vector double __b) { |
| 15870 | return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); |
| 15871 | } |
| 15872 | #endif |
| 15873 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15874 | /* vec_all_nlt */ |
| 15875 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15876 | static __inline__ int __ATTRS_o_ai |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15877 | vec_all_nlt(vector float __a, vector float __b) { |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15878 | #ifdef __VSX__ |
| 15879 | return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); |
| 15880 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15881 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15882 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15883 | } |
| 15884 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15885 | #ifdef __VSX__ |
| 15886 | static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, |
| 15887 | vector double __b) { |
| 15888 | return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); |
| 15889 | } |
| 15890 | #endif |
| 15891 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15892 | /* vec_all_numeric */ |
| 15893 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15894 | static __inline__ int __ATTRS_o_ai |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15895 | vec_all_numeric(vector float __a) { |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15896 | #ifdef __VSX__ |
| 15897 | return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); |
| 15898 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15899 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15900 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15901 | } |
| 15902 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 15903 | #ifdef __VSX__ |
| 15904 | static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { |
| 15905 | return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); |
| 15906 | } |
| 15907 | #endif |
| 15908 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 15909 | /* vec_any_eq */ |
| 15910 | |
| 15911 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, |
| 15912 | vector signed char __b) { |
| 15913 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15914 | (vector char)__b); |
| 15915 | } |
| 15916 | |
| 15917 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, |
| 15918 | vector bool char __b) { |
| 15919 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15920 | (vector char)__b); |
| 15921 | } |
| 15922 | |
| 15923 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, |
| 15924 | vector unsigned char __b) { |
| 15925 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15926 | (vector char)__b); |
| 15927 | } |
| 15928 | |
| 15929 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, |
| 15930 | vector bool char __b) { |
| 15931 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15932 | (vector char)__b); |
| 15933 | } |
| 15934 | |
| 15935 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, |
| 15936 | vector signed char __b) { |
| 15937 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15938 | (vector char)__b); |
| 15939 | } |
| 15940 | |
| 15941 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, |
| 15942 | vector unsigned char __b) { |
| 15943 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15944 | (vector char)__b); |
| 15945 | } |
| 15946 | |
| 15947 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, |
| 15948 | vector bool char __b) { |
| 15949 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, |
| 15950 | (vector char)__b); |
| 15951 | } |
| 15952 | |
| 15953 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, |
| 15954 | vector short __b) { |
| 15955 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); |
| 15956 | } |
| 15957 | |
| 15958 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, |
| 15959 | vector bool short __b) { |
| 15960 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); |
| 15961 | } |
| 15962 | |
| 15963 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, |
| 15964 | vector unsigned short __b) { |
| 15965 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15966 | (vector short)__b); |
| 15967 | } |
| 15968 | |
| 15969 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, |
| 15970 | vector bool short __b) { |
| 15971 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15972 | (vector short)__b); |
| 15973 | } |
| 15974 | |
| 15975 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, |
| 15976 | vector short __b) { |
| 15977 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15978 | (vector short)__b); |
| 15979 | } |
| 15980 | |
| 15981 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, |
| 15982 | vector unsigned short __b) { |
| 15983 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15984 | (vector short)__b); |
| 15985 | } |
| 15986 | |
| 15987 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, |
| 15988 | vector bool short __b) { |
| 15989 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15990 | (vector short)__b); |
| 15991 | } |
| 15992 | |
| 15993 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, |
| 15994 | vector pixel __b) { |
| 15995 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, |
| 15996 | (vector short)__b); |
| 15997 | } |
| 15998 | |
| 15999 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { |
| 16000 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); |
| 16001 | } |
| 16002 | |
| 16003 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, |
| 16004 | vector bool int __b) { |
| 16005 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); |
| 16006 | } |
| 16007 | |
| 16008 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, |
| 16009 | vector unsigned int __b) { |
| 16010 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, |
| 16011 | (vector int)__b); |
| 16012 | } |
| 16013 | |
| 16014 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, |
| 16015 | vector bool int __b) { |
| 16016 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, |
| 16017 | (vector int)__b); |
| 16018 | } |
| 16019 | |
| 16020 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, |
| 16021 | vector int __b) { |
| 16022 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, |
| 16023 | (vector int)__b); |
| 16024 | } |
| 16025 | |
| 16026 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, |
| 16027 | vector unsigned int __b) { |
| 16028 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, |
| 16029 | (vector int)__b); |
| 16030 | } |
| 16031 | |
| 16032 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, |
| 16033 | vector bool int __b) { |
| 16034 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, |
| 16035 | (vector int)__b); |
| 16036 | } |
| 16037 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16038 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16039 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, |
| 16040 | vector signed long long __b) { |
| 16041 | return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); |
| 16042 | } |
| 16043 | |
| 16044 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, |
| 16045 | vector unsigned long long __b) { |
| 16046 | return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, |
| 16047 | (vector long long)__b); |
| 16048 | } |
| 16049 | |
| 16050 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, |
| 16051 | vector bool long long __b) { |
| 16052 | return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, |
| 16053 | (vector signed long long)__b); |
| 16054 | } |
| 16055 | |
| 16056 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, |
| 16057 | vector bool long long __b) { |
| 16058 | return __builtin_altivec_vcmpequd_p( |
| 16059 | __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 16060 | } |
| 16061 | |
| 16062 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, |
| 16063 | vector signed long long __b) { |
| 16064 | return __builtin_altivec_vcmpequd_p( |
| 16065 | __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 16066 | } |
| 16067 | |
| 16068 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, |
| 16069 | vector unsigned long long __b) { |
| 16070 | return __builtin_altivec_vcmpequd_p( |
| 16071 | __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 16072 | } |
| 16073 | |
| 16074 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, |
| 16075 | vector bool long long __b) { |
| 16076 | return __builtin_altivec_vcmpequd_p( |
| 16077 | __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 16078 | } |
| 16079 | #endif |
| 16080 | |
| 16081 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, |
| 16082 | vector float __b) { |
| 16083 | #ifdef __VSX__ |
| 16084 | return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); |
| 16085 | #else |
| 16086 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); |
| 16087 | #endif |
| 16088 | } |
| 16089 | |
| 16090 | #ifdef __VSX__ |
| 16091 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, |
| 16092 | vector double __b) { |
| 16093 | return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); |
| 16094 | } |
| 16095 | #endif |
| 16096 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16097 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 16098 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, |
| 16099 | vector signed __int128 __b) { |
| 16100 | return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); |
| 16101 | } |
| 16102 | |
| 16103 | static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, |
| 16104 | vector unsigned __int128 __b) { |
| 16105 | return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); |
| 16106 | } |
| 16107 | #endif |
| 16108 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16109 | /* vec_any_ge */ |
| 16110 | |
| 16111 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, |
| 16112 | vector signed char __b) { |
| 16113 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); |
| 16114 | } |
| 16115 | |
| 16116 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, |
| 16117 | vector bool char __b) { |
| 16118 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, |
| 16119 | __a); |
| 16120 | } |
| 16121 | |
| 16122 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, |
| 16123 | vector unsigned char __b) { |
| 16124 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); |
| 16125 | } |
| 16126 | |
| 16127 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, |
| 16128 | vector bool char __b) { |
| 16129 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, |
| 16130 | __a); |
| 16131 | } |
| 16132 | |
| 16133 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, |
| 16134 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16135 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, |
| 16136 | (vector signed char)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16137 | } |
| 16138 | |
| 16139 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, |
| 16140 | vector unsigned char __b) { |
| 16141 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, |
| 16142 | (vector unsigned char)__a); |
| 16143 | } |
| 16144 | |
| 16145 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, |
| 16146 | vector bool char __b) { |
| 16147 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, |
| 16148 | (vector unsigned char)__a); |
| 16149 | } |
| 16150 | |
| 16151 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, |
| 16152 | vector short __b) { |
| 16153 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); |
| 16154 | } |
| 16155 | |
| 16156 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, |
| 16157 | vector bool short __b) { |
| 16158 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); |
| 16159 | } |
| 16160 | |
| 16161 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, |
| 16162 | vector unsigned short __b) { |
| 16163 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); |
| 16164 | } |
| 16165 | |
| 16166 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, |
| 16167 | vector bool short __b) { |
| 16168 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, |
| 16169 | __a); |
| 16170 | } |
| 16171 | |
| 16172 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, |
| 16173 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16174 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, |
| 16175 | (vector signed short)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16176 | } |
| 16177 | |
| 16178 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, |
| 16179 | vector unsigned short __b) { |
| 16180 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, |
| 16181 | (vector unsigned short)__a); |
| 16182 | } |
| 16183 | |
| 16184 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, |
| 16185 | vector bool short __b) { |
| 16186 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, |
| 16187 | (vector unsigned short)__a); |
| 16188 | } |
| 16189 | |
| 16190 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { |
| 16191 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); |
| 16192 | } |
| 16193 | |
| 16194 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, |
| 16195 | vector bool int __b) { |
| 16196 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); |
| 16197 | } |
| 16198 | |
| 16199 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, |
| 16200 | vector unsigned int __b) { |
| 16201 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); |
| 16202 | } |
| 16203 | |
| 16204 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, |
| 16205 | vector bool int __b) { |
| 16206 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, |
| 16207 | __a); |
| 16208 | } |
| 16209 | |
| 16210 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, |
| 16211 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16212 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, |
| 16213 | (vector signed int)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16214 | } |
| 16215 | |
| 16216 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, |
| 16217 | vector unsigned int __b) { |
| 16218 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, |
| 16219 | (vector unsigned int)__a); |
| 16220 | } |
| 16221 | |
| 16222 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, |
| 16223 | vector bool int __b) { |
| 16224 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, |
| 16225 | (vector unsigned int)__a); |
| 16226 | } |
| 16227 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16228 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16229 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, |
| 16230 | vector signed long long __b) { |
| 16231 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); |
| 16232 | } |
| 16233 | |
| 16234 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, |
| 16235 | vector unsigned long long __b) { |
| 16236 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); |
| 16237 | } |
| 16238 | |
| 16239 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, |
| 16240 | vector bool long long __b) { |
| 16241 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, |
| 16242 | (vector signed long long)__b, __a); |
| 16243 | } |
| 16244 | |
| 16245 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, |
| 16246 | vector bool long long __b) { |
| 16247 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, |
| 16248 | (vector unsigned long long)__b, __a); |
| 16249 | } |
| 16250 | |
| 16251 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, |
| 16252 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16253 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, |
| 16254 | (vector signed long long)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16255 | } |
| 16256 | |
| 16257 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, |
| 16258 | vector unsigned long long __b) { |
| 16259 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, |
| 16260 | (vector unsigned long long)__a); |
| 16261 | } |
| 16262 | |
| 16263 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, |
| 16264 | vector bool long long __b) { |
| 16265 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, |
| 16266 | (vector unsigned long long)__b, |
| 16267 | (vector unsigned long long)__a); |
| 16268 | } |
| 16269 | #endif |
| 16270 | |
| 16271 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, |
| 16272 | vector float __b) { |
| 16273 | #ifdef __VSX__ |
| 16274 | return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); |
| 16275 | #else |
| 16276 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); |
| 16277 | #endif |
| 16278 | } |
| 16279 | |
| 16280 | #ifdef __VSX__ |
| 16281 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, |
| 16282 | vector double __b) { |
| 16283 | return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); |
| 16284 | } |
| 16285 | #endif |
| 16286 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16287 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 16288 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, |
| 16289 | vector signed __int128 __b) { |
| 16290 | return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); |
| 16291 | } |
| 16292 | |
| 16293 | static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, |
| 16294 | vector unsigned __int128 __b) { |
| 16295 | return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); |
| 16296 | } |
| 16297 | #endif |
| 16298 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16299 | /* vec_any_gt */ |
| 16300 | |
| 16301 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, |
| 16302 | vector signed char __b) { |
| 16303 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); |
| 16304 | } |
| 16305 | |
| 16306 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, |
| 16307 | vector bool char __b) { |
| 16308 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, |
| 16309 | (vector signed char)__b); |
| 16310 | } |
| 16311 | |
| 16312 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, |
| 16313 | vector unsigned char __b) { |
| 16314 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); |
| 16315 | } |
| 16316 | |
| 16317 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, |
| 16318 | vector bool char __b) { |
| 16319 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, |
| 16320 | (vector unsigned char)__b); |
| 16321 | } |
| 16322 | |
| 16323 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, |
| 16324 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16325 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a, |
| 16326 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16327 | } |
| 16328 | |
| 16329 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, |
| 16330 | vector unsigned char __b) { |
| 16331 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, |
| 16332 | __b); |
| 16333 | } |
| 16334 | |
| 16335 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, |
| 16336 | vector bool char __b) { |
| 16337 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, |
| 16338 | (vector unsigned char)__b); |
| 16339 | } |
| 16340 | |
| 16341 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, |
| 16342 | vector short __b) { |
| 16343 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); |
| 16344 | } |
| 16345 | |
| 16346 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, |
| 16347 | vector bool short __b) { |
| 16348 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); |
| 16349 | } |
| 16350 | |
| 16351 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, |
| 16352 | vector unsigned short __b) { |
| 16353 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); |
| 16354 | } |
| 16355 | |
| 16356 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, |
| 16357 | vector bool short __b) { |
| 16358 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, |
| 16359 | (vector unsigned short)__b); |
| 16360 | } |
| 16361 | |
| 16362 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, |
| 16363 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16364 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a, |
| 16365 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16366 | } |
| 16367 | |
| 16368 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, |
| 16369 | vector unsigned short __b) { |
| 16370 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, |
| 16371 | __b); |
| 16372 | } |
| 16373 | |
| 16374 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, |
| 16375 | vector bool short __b) { |
| 16376 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, |
| 16377 | (vector unsigned short)__b); |
| 16378 | } |
| 16379 | |
| 16380 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { |
| 16381 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); |
| 16382 | } |
| 16383 | |
| 16384 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, |
| 16385 | vector bool int __b) { |
| 16386 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); |
| 16387 | } |
| 16388 | |
| 16389 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, |
| 16390 | vector unsigned int __b) { |
| 16391 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); |
| 16392 | } |
| 16393 | |
| 16394 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, |
| 16395 | vector bool int __b) { |
| 16396 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, |
| 16397 | (vector unsigned int)__b); |
| 16398 | } |
| 16399 | |
| 16400 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, |
| 16401 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16402 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a, |
| 16403 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16404 | } |
| 16405 | |
| 16406 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, |
| 16407 | vector unsigned int __b) { |
| 16408 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, |
| 16409 | __b); |
| 16410 | } |
| 16411 | |
| 16412 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, |
| 16413 | vector bool int __b) { |
| 16414 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, |
| 16415 | (vector unsigned int)__b); |
| 16416 | } |
| 16417 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16418 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16419 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, |
| 16420 | vector signed long long __b) { |
| 16421 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); |
| 16422 | } |
| 16423 | |
| 16424 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, |
| 16425 | vector unsigned long long __b) { |
| 16426 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); |
| 16427 | } |
| 16428 | |
| 16429 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, |
| 16430 | vector bool long long __b) { |
| 16431 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, |
| 16432 | (vector signed long long)__b); |
| 16433 | } |
| 16434 | |
| 16435 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, |
| 16436 | vector bool long long __b) { |
| 16437 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, |
| 16438 | (vector unsigned long long)__b); |
| 16439 | } |
| 16440 | |
| 16441 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, |
| 16442 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16443 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, |
| 16444 | (vector signed long long)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16445 | } |
| 16446 | |
| 16447 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, |
| 16448 | vector unsigned long long __b) { |
| 16449 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, |
| 16450 | (vector unsigned long long)__a, __b); |
| 16451 | } |
| 16452 | |
| 16453 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, |
| 16454 | vector bool long long __b) { |
| 16455 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, |
| 16456 | (vector unsigned long long)__a, |
| 16457 | (vector unsigned long long)__b); |
| 16458 | } |
| 16459 | #endif |
| 16460 | |
| 16461 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, |
| 16462 | vector float __b) { |
| 16463 | #ifdef __VSX__ |
| 16464 | return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); |
| 16465 | #else |
| 16466 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); |
| 16467 | #endif |
| 16468 | } |
| 16469 | |
| 16470 | #ifdef __VSX__ |
| 16471 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, |
| 16472 | vector double __b) { |
| 16473 | return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); |
| 16474 | } |
| 16475 | #endif |
| 16476 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16477 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 16478 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, |
| 16479 | vector signed __int128 __b) { |
| 16480 | return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); |
| 16481 | } |
| 16482 | |
| 16483 | static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, |
| 16484 | vector unsigned __int128 __b) { |
| 16485 | return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); |
| 16486 | } |
| 16487 | #endif |
| 16488 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16489 | /* vec_any_le */ |
| 16490 | |
| 16491 | static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, |
| 16492 | vector signed char __b) { |
| 16493 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); |
| 16494 | } |
| 16495 | |
| 16496 | static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, |
| 16497 | vector bool char __b) { |
| 16498 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, |
| 16499 | (vector signed char)__b); |
| 16500 | } |
| 16501 | |
| 16502 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, |
| 16503 | vector unsigned char __b) { |
| 16504 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); |
| 16505 | } |
| 16506 | |
| 16507 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, |
| 16508 | vector bool char __b) { |
| 16509 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, |
| 16510 | (vector unsigned char)__b); |
| 16511 | } |
| 16512 | |
| 16513 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, |
| 16514 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16515 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a, |
| 16516 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16517 | } |
| 16518 | |
| 16519 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, |
| 16520 | vector unsigned char __b) { |
| 16521 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, |
| 16522 | __b); |
| 16523 | } |
| 16524 | |
| 16525 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, |
| 16526 | vector bool char __b) { |
| 16527 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, |
| 16528 | (vector unsigned char)__b); |
| 16529 | } |
| 16530 | |
| 16531 | static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, |
| 16532 | vector short __b) { |
| 16533 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); |
| 16534 | } |
| 16535 | |
| 16536 | static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, |
| 16537 | vector bool short __b) { |
| 16538 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); |
| 16539 | } |
| 16540 | |
| 16541 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, |
| 16542 | vector unsigned short __b) { |
| 16543 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); |
| 16544 | } |
| 16545 | |
| 16546 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, |
| 16547 | vector bool short __b) { |
| 16548 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, |
| 16549 | (vector unsigned short)__b); |
| 16550 | } |
| 16551 | |
| 16552 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, |
| 16553 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16554 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a, |
| 16555 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16556 | } |
| 16557 | |
| 16558 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, |
| 16559 | vector unsigned short __b) { |
| 16560 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, |
| 16561 | __b); |
| 16562 | } |
| 16563 | |
| 16564 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, |
| 16565 | vector bool short __b) { |
| 16566 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, |
| 16567 | (vector unsigned short)__b); |
| 16568 | } |
| 16569 | |
| 16570 | static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { |
| 16571 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); |
| 16572 | } |
| 16573 | |
| 16574 | static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, |
| 16575 | vector bool int __b) { |
| 16576 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); |
| 16577 | } |
| 16578 | |
| 16579 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, |
| 16580 | vector unsigned int __b) { |
| 16581 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); |
| 16582 | } |
| 16583 | |
| 16584 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, |
| 16585 | vector bool int __b) { |
| 16586 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, |
| 16587 | (vector unsigned int)__b); |
| 16588 | } |
| 16589 | |
| 16590 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, |
| 16591 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16592 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a, |
| 16593 | __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16594 | } |
| 16595 | |
| 16596 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, |
| 16597 | vector unsigned int __b) { |
| 16598 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, |
| 16599 | __b); |
| 16600 | } |
| 16601 | |
| 16602 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, |
| 16603 | vector bool int __b) { |
| 16604 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, |
| 16605 | (vector unsigned int)__b); |
| 16606 | } |
| 16607 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16608 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16609 | static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, |
| 16610 | vector signed long long __b) { |
| 16611 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); |
| 16612 | } |
| 16613 | |
| 16614 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, |
| 16615 | vector unsigned long long __b) { |
| 16616 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); |
| 16617 | } |
| 16618 | |
| 16619 | static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, |
| 16620 | vector bool long long __b) { |
| 16621 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, |
| 16622 | (vector signed long long)__b); |
| 16623 | } |
| 16624 | |
| 16625 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, |
| 16626 | vector bool long long __b) { |
| 16627 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, |
| 16628 | (vector unsigned long long)__b); |
| 16629 | } |
| 16630 | |
| 16631 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, |
| 16632 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16633 | return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, |
| 16634 | (vector signed long long)__a, __b); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16635 | } |
| 16636 | |
| 16637 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, |
| 16638 | vector unsigned long long __b) { |
| 16639 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, |
| 16640 | (vector unsigned long long)__a, __b); |
| 16641 | } |
| 16642 | |
| 16643 | static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, |
| 16644 | vector bool long long __b) { |
| 16645 | return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, |
| 16646 | (vector unsigned long long)__a, |
| 16647 | (vector unsigned long long)__b); |
| 16648 | } |
| 16649 | #endif |
| 16650 | |
| 16651 | static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, |
| 16652 | vector float __b) { |
| 16653 | #ifdef __VSX__ |
| 16654 | return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); |
| 16655 | #else |
| 16656 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); |
| 16657 | #endif |
| 16658 | } |
| 16659 | |
| 16660 | #ifdef __VSX__ |
| 16661 | static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, |
| 16662 | vector double __b) { |
| 16663 | return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); |
| 16664 | } |
| 16665 | #endif |
| 16666 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16667 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 16668 | static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, |
| 16669 | vector signed __int128 __b) { |
| 16670 | return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); |
| 16671 | } |
| 16672 | |
| 16673 | static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, |
| 16674 | vector unsigned __int128 __b) { |
| 16675 | return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); |
| 16676 | } |
| 16677 | #endif |
| 16678 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16679 | /* vec_any_lt */ |
| 16680 | |
| 16681 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, |
| 16682 | vector signed char __b) { |
| 16683 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); |
| 16684 | } |
| 16685 | |
| 16686 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, |
| 16687 | vector bool char __b) { |
| 16688 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, |
| 16689 | __a); |
| 16690 | } |
| 16691 | |
| 16692 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, |
| 16693 | vector unsigned char __b) { |
| 16694 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); |
| 16695 | } |
| 16696 | |
| 16697 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, |
| 16698 | vector bool char __b) { |
| 16699 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, |
| 16700 | __a); |
| 16701 | } |
| 16702 | |
| 16703 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, |
| 16704 | vector signed char __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16705 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, |
| 16706 | (vector signed char)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16707 | } |
| 16708 | |
| 16709 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, |
| 16710 | vector unsigned char __b) { |
| 16711 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, |
| 16712 | (vector unsigned char)__a); |
| 16713 | } |
| 16714 | |
| 16715 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, |
| 16716 | vector bool char __b) { |
| 16717 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, |
| 16718 | (vector unsigned char)__a); |
| 16719 | } |
| 16720 | |
| 16721 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, |
| 16722 | vector short __b) { |
| 16723 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); |
| 16724 | } |
| 16725 | |
| 16726 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, |
| 16727 | vector bool short __b) { |
| 16728 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); |
| 16729 | } |
| 16730 | |
| 16731 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, |
| 16732 | vector unsigned short __b) { |
| 16733 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); |
| 16734 | } |
| 16735 | |
| 16736 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, |
| 16737 | vector bool short __b) { |
| 16738 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, |
| 16739 | __a); |
| 16740 | } |
| 16741 | |
| 16742 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, |
| 16743 | vector short __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16744 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, |
| 16745 | (vector signed short)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16746 | } |
| 16747 | |
| 16748 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, |
| 16749 | vector unsigned short __b) { |
| 16750 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, |
| 16751 | (vector unsigned short)__a); |
| 16752 | } |
| 16753 | |
| 16754 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, |
| 16755 | vector bool short __b) { |
| 16756 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, |
| 16757 | (vector unsigned short)__a); |
| 16758 | } |
| 16759 | |
| 16760 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { |
| 16761 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); |
| 16762 | } |
| 16763 | |
| 16764 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, |
| 16765 | vector bool int __b) { |
| 16766 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); |
| 16767 | } |
| 16768 | |
| 16769 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, |
| 16770 | vector unsigned int __b) { |
| 16771 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); |
| 16772 | } |
| 16773 | |
| 16774 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, |
| 16775 | vector bool int __b) { |
| 16776 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, |
| 16777 | __a); |
| 16778 | } |
| 16779 | |
| 16780 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, |
| 16781 | vector int __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16782 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, |
| 16783 | (vector signed int)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16784 | } |
| 16785 | |
| 16786 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, |
| 16787 | vector unsigned int __b) { |
| 16788 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, |
| 16789 | (vector unsigned int)__a); |
| 16790 | } |
| 16791 | |
| 16792 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, |
| 16793 | vector bool int __b) { |
| 16794 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, |
| 16795 | (vector unsigned int)__a); |
| 16796 | } |
| 16797 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16798 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16799 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, |
| 16800 | vector signed long long __b) { |
| 16801 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); |
| 16802 | } |
| 16803 | |
| 16804 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, |
| 16805 | vector unsigned long long __b) { |
| 16806 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); |
| 16807 | } |
| 16808 | |
| 16809 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, |
| 16810 | vector bool long long __b) { |
| 16811 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, |
| 16812 | (vector signed long long)__b, __a); |
| 16813 | } |
| 16814 | |
| 16815 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, |
| 16816 | vector bool long long __b) { |
| 16817 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, |
| 16818 | (vector unsigned long long)__b, __a); |
| 16819 | } |
| 16820 | |
| 16821 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, |
| 16822 | vector signed long long __b) { |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 16823 | return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, |
| 16824 | (vector signed long long)__a); |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16825 | } |
| 16826 | |
| 16827 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, |
| 16828 | vector unsigned long long __b) { |
| 16829 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, |
| 16830 | (vector unsigned long long)__a); |
| 16831 | } |
| 16832 | |
| 16833 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, |
| 16834 | vector bool long long __b) { |
| 16835 | return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, |
| 16836 | (vector unsigned long long)__b, |
| 16837 | (vector unsigned long long)__a); |
| 16838 | } |
| 16839 | #endif |
| 16840 | |
| 16841 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, |
| 16842 | vector float __b) { |
| 16843 | #ifdef __VSX__ |
| 16844 | return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); |
| 16845 | #else |
| 16846 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); |
| 16847 | #endif |
| 16848 | } |
| 16849 | |
| 16850 | #ifdef __VSX__ |
| 16851 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, |
| 16852 | vector double __b) { |
| 16853 | return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); |
| 16854 | } |
| 16855 | #endif |
| 16856 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16857 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 16858 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, |
| 16859 | vector signed __int128 __b) { |
| 16860 | return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); |
| 16861 | } |
| 16862 | |
| 16863 | static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, |
| 16864 | vector unsigned __int128 __b) { |
| 16865 | return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); |
| 16866 | } |
| 16867 | #endif |
| 16868 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16869 | /* vec_any_nan */ |
| 16870 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16871 | static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { |
| 16872 | #ifdef __VSX__ |
| 16873 | return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); |
| 16874 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16875 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16876 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16877 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 16878 | #ifdef __VSX__ |
| 16879 | static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { |
| 16880 | return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); |
| 16881 | } |
| 16882 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 16883 | |
| 16884 | /* vec_any_ne */ |
| 16885 | |
| 16886 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, |
| 16887 | vector signed char __b) { |
| 16888 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16889 | (vector char)__b); |
| 16890 | } |
| 16891 | |
| 16892 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, |
| 16893 | vector bool char __b) { |
| 16894 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16895 | (vector char)__b); |
| 16896 | } |
| 16897 | |
| 16898 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, |
| 16899 | vector unsigned char __b) { |
| 16900 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16901 | (vector char)__b); |
| 16902 | } |
| 16903 | |
| 16904 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, |
| 16905 | vector bool char __b) { |
| 16906 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16907 | (vector char)__b); |
| 16908 | } |
| 16909 | |
| 16910 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, |
| 16911 | vector signed char __b) { |
| 16912 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16913 | (vector char)__b); |
| 16914 | } |
| 16915 | |
| 16916 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, |
| 16917 | vector unsigned char __b) { |
| 16918 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16919 | (vector char)__b); |
| 16920 | } |
| 16921 | |
| 16922 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, |
| 16923 | vector bool char __b) { |
| 16924 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, |
| 16925 | (vector char)__b); |
| 16926 | } |
| 16927 | |
| 16928 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, |
| 16929 | vector short __b) { |
| 16930 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); |
| 16931 | } |
| 16932 | |
| 16933 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, |
| 16934 | vector bool short __b) { |
| 16935 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); |
| 16936 | } |
| 16937 | |
| 16938 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, |
| 16939 | vector unsigned short __b) { |
| 16940 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16941 | (vector short)__b); |
| 16942 | } |
| 16943 | |
| 16944 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, |
| 16945 | vector bool short __b) { |
| 16946 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16947 | (vector short)__b); |
| 16948 | } |
| 16949 | |
| 16950 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, |
| 16951 | vector short __b) { |
| 16952 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16953 | (vector short)__b); |
| 16954 | } |
| 16955 | |
| 16956 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, |
| 16957 | vector unsigned short __b) { |
| 16958 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16959 | (vector short)__b); |
| 16960 | } |
| 16961 | |
| 16962 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, |
| 16963 | vector bool short __b) { |
| 16964 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16965 | (vector short)__b); |
| 16966 | } |
| 16967 | |
| 16968 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, |
| 16969 | vector pixel __b) { |
| 16970 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, |
| 16971 | (vector short)__b); |
| 16972 | } |
| 16973 | |
| 16974 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { |
| 16975 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); |
| 16976 | } |
| 16977 | |
| 16978 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, |
| 16979 | vector bool int __b) { |
| 16980 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); |
| 16981 | } |
| 16982 | |
| 16983 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, |
| 16984 | vector unsigned int __b) { |
| 16985 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, |
| 16986 | (vector int)__b); |
| 16987 | } |
| 16988 | |
| 16989 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, |
| 16990 | vector bool int __b) { |
| 16991 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, |
| 16992 | (vector int)__b); |
| 16993 | } |
| 16994 | |
| 16995 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, |
| 16996 | vector int __b) { |
| 16997 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, |
| 16998 | (vector int)__b); |
| 16999 | } |
| 17000 | |
| 17001 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, |
| 17002 | vector unsigned int __b) { |
| 17003 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, |
| 17004 | (vector int)__b); |
| 17005 | } |
| 17006 | |
| 17007 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, |
| 17008 | vector bool int __b) { |
| 17009 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, |
| 17010 | (vector int)__b); |
| 17011 | } |
| 17012 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17013 | #ifdef __VSX__ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17014 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, |
| 17015 | vector signed long long __b) { |
| 17016 | return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); |
| 17017 | } |
| 17018 | |
| 17019 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, |
| 17020 | vector unsigned long long __b) { |
| 17021 | return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, |
| 17022 | (vector long long)__b); |
| 17023 | } |
| 17024 | |
| 17025 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, |
| 17026 | vector bool long long __b) { |
| 17027 | return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, |
| 17028 | (vector signed long long)__b); |
| 17029 | } |
| 17030 | |
| 17031 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, |
| 17032 | vector bool long long __b) { |
| 17033 | return __builtin_altivec_vcmpequd_p( |
| 17034 | __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 17035 | } |
| 17036 | |
| 17037 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, |
| 17038 | vector signed long long __b) { |
| 17039 | return __builtin_altivec_vcmpequd_p( |
| 17040 | __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 17041 | } |
| 17042 | |
| 17043 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, |
| 17044 | vector unsigned long long __b) { |
| 17045 | return __builtin_altivec_vcmpequd_p( |
| 17046 | __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 17047 | } |
| 17048 | |
| 17049 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, |
| 17050 | vector bool long long __b) { |
| 17051 | return __builtin_altivec_vcmpequd_p( |
| 17052 | __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); |
| 17053 | } |
| 17054 | #endif |
| 17055 | |
| 17056 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, |
| 17057 | vector float __b) { |
| 17058 | #ifdef __VSX__ |
| 17059 | return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); |
| 17060 | #else |
| 17061 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); |
| 17062 | #endif |
| 17063 | } |
| 17064 | |
| 17065 | #ifdef __VSX__ |
| 17066 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, |
| 17067 | vector double __b) { |
| 17068 | return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); |
| 17069 | } |
| 17070 | #endif |
| 17071 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17072 | #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17073 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, |
| 17074 | vector signed __int128 __b) { |
| 17075 | return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); |
| 17076 | } |
| 17077 | |
| 17078 | static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, |
| 17079 | vector unsigned __int128 __b) { |
| 17080 | return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); |
| 17081 | } |
| 17082 | #endif |
| 17083 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17084 | /* vec_any_nge */ |
| 17085 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17086 | static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, |
| 17087 | vector float __b) { |
| 17088 | #ifdef __VSX__ |
| 17089 | return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); |
| 17090 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17091 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17092 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17093 | } |
| 17094 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17095 | #ifdef __VSX__ |
| 17096 | static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, |
| 17097 | vector double __b) { |
| 17098 | return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); |
| 17099 | } |
| 17100 | #endif |
| 17101 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17102 | /* vec_any_ngt */ |
| 17103 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17104 | static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, |
| 17105 | vector float __b) { |
| 17106 | #ifdef __VSX__ |
| 17107 | return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); |
| 17108 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17109 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17110 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17111 | } |
| 17112 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17113 | #ifdef __VSX__ |
| 17114 | static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, |
| 17115 | vector double __b) { |
| 17116 | return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); |
| 17117 | } |
| 17118 | #endif |
| 17119 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17120 | /* vec_any_nle */ |
| 17121 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17122 | static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, |
| 17123 | vector float __b) { |
| 17124 | #ifdef __VSX__ |
| 17125 | return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); |
| 17126 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17127 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17128 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17129 | } |
| 17130 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17131 | #ifdef __VSX__ |
| 17132 | static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, |
| 17133 | vector double __b) { |
| 17134 | return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); |
| 17135 | } |
| 17136 | #endif |
| 17137 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17138 | /* vec_any_nlt */ |
| 17139 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17140 | static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, |
| 17141 | vector float __b) { |
| 17142 | #ifdef __VSX__ |
| 17143 | return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); |
| 17144 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17145 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17146 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17147 | } |
| 17148 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17149 | #ifdef __VSX__ |
| 17150 | static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, |
| 17151 | vector double __b) { |
| 17152 | return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); |
| 17153 | } |
| 17154 | #endif |
| 17155 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17156 | /* vec_any_numeric */ |
| 17157 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17158 | static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { |
| 17159 | #ifdef __VSX__ |
| 17160 | return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); |
| 17161 | #else |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17162 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17163 | #endif |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17164 | } |
| 17165 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17166 | #ifdef __VSX__ |
| 17167 | static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { |
| 17168 | return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); |
| 17169 | } |
| 17170 | #endif |
| 17171 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17172 | /* vec_any_out */ |
| 17173 | |
| 17174 | static __inline__ int __attribute__((__always_inline__)) |
| 17175 | vec_any_out(vector float __a, vector float __b) { |
| 17176 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); |
| 17177 | } |
| 17178 | |
| 17179 | /* Power 8 Crypto functions |
| 17180 | Note: We diverge from the current GCC implementation with regard |
| 17181 | to cryptography and related functions as follows: |
| 17182 | - Only the SHA and AES instructions and builtins are disabled by -mno-crypto |
| 17183 | - The remaining ones are only available on Power8 and up so |
| 17184 | require -mpower8-vector |
| 17185 | The justification for this is that export requirements require that |
| 17186 | Category:Vector.Crypto is optional (i.e. compliant hardware may not provide |
| 17187 | support). As a result, we need to be able to turn off support for those. |
| 17188 | The remaining ones (currently controlled by -mcrypto for GCC) still |
| 17189 | need to be provided on compliant hardware even if Vector.Crypto is not |
| 17190 | provided. |
| 17191 | */ |
| 17192 | #ifdef __CRYPTO__ |
| 17193 | #define vec_sbox_be __builtin_altivec_crypto_vsbox |
| 17194 | #define vec_cipher_be __builtin_altivec_crypto_vcipher |
| 17195 | #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast |
| 17196 | #define vec_ncipher_be __builtin_altivec_crypto_vncipher |
| 17197 | #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast |
| 17198 | |
| 17199 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17200 | __builtin_crypto_vsbox(vector unsigned long long __a) { |
| 17201 | return __builtin_altivec_crypto_vsbox(__a); |
| 17202 | } |
| 17203 | |
| 17204 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17205 | __builtin_crypto_vcipher(vector unsigned long long __a, |
| 17206 | vector unsigned long long __b) { |
| 17207 | return __builtin_altivec_crypto_vcipher(__a, __b); |
| 17208 | } |
| 17209 | |
| 17210 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17211 | __builtin_crypto_vcipherlast(vector unsigned long long __a, |
| 17212 | vector unsigned long long __b) { |
| 17213 | return __builtin_altivec_crypto_vcipherlast(__a, __b); |
| 17214 | } |
| 17215 | |
| 17216 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17217 | __builtin_crypto_vncipher(vector unsigned long long __a, |
| 17218 | vector unsigned long long __b) { |
| 17219 | return __builtin_altivec_crypto_vncipher(__a, __b); |
| 17220 | } |
| 17221 | |
| 17222 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17223 | __builtin_crypto_vncipherlast(vector unsigned long long __a, |
| 17224 | vector unsigned long long __b) { |
| 17225 | return __builtin_altivec_crypto_vncipherlast(__a, __b); |
| 17226 | } |
| 17227 | |
| 17228 | #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad |
| 17229 | #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw |
| 17230 | |
| 17231 | #define vec_shasigma_be(X, Y, Z) \ |
| 17232 | _Generic((X), vector unsigned int \ |
| 17233 | : __builtin_crypto_vshasigmaw, vector unsigned long long \ |
| 17234 | : __builtin_crypto_vshasigmad)((X), (Y), (Z)) |
| 17235 | #endif |
| 17236 | |
| 17237 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17238 | static __inline__ vector bool char __ATTRS_o_ai |
| 17239 | vec_permxor(vector bool char __a, vector bool char __b, |
| 17240 | vector bool char __c) { |
| 17241 | return __builtin_altivec_crypto_vpermxor(__a, __b, __c); |
| 17242 | } |
| 17243 | |
| 17244 | static __inline__ vector signed char __ATTRS_o_ai |
| 17245 | vec_permxor(vector signed char __a, vector signed char __b, |
| 17246 | vector signed char __c) { |
| 17247 | return __builtin_altivec_crypto_vpermxor(__a, __b, __c); |
| 17248 | } |
| 17249 | |
| 17250 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 17251 | vec_permxor(vector unsigned char __a, vector unsigned char __b, |
| 17252 | vector unsigned char __c) { |
| 17253 | return __builtin_altivec_crypto_vpermxor(__a, __b, __c); |
| 17254 | } |
| 17255 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17256 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 17257 | __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, |
| 17258 | vector unsigned char __c) { |
| 17259 | return __builtin_altivec_crypto_vpermxor(__a, __b, __c); |
| 17260 | } |
| 17261 | |
| 17262 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 17263 | __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, |
| 17264 | vector unsigned short __c) { |
| 17265 | return (vector unsigned short)__builtin_altivec_crypto_vpermxor( |
| 17266 | (vector unsigned char)__a, (vector unsigned char)__b, |
| 17267 | (vector unsigned char)__c); |
| 17268 | } |
| 17269 | |
| 17270 | static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( |
| 17271 | vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { |
| 17272 | return (vector unsigned int)__builtin_altivec_crypto_vpermxor( |
| 17273 | (vector unsigned char)__a, (vector unsigned char)__b, |
| 17274 | (vector unsigned char)__c); |
| 17275 | } |
| 17276 | |
| 17277 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 17278 | __builtin_crypto_vpermxor(vector unsigned long long __a, |
| 17279 | vector unsigned long long __b, |
| 17280 | vector unsigned long long __c) { |
| 17281 | return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( |
| 17282 | (vector unsigned char)__a, (vector unsigned char)__b, |
| 17283 | (vector unsigned char)__c); |
| 17284 | } |
| 17285 | |
| 17286 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 17287 | __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { |
| 17288 | return __builtin_altivec_crypto_vpmsumb(__a, __b); |
| 17289 | } |
| 17290 | |
| 17291 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 17292 | __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { |
| 17293 | return __builtin_altivec_crypto_vpmsumh(__a, __b); |
| 17294 | } |
| 17295 | |
| 17296 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 17297 | __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { |
| 17298 | return __builtin_altivec_crypto_vpmsumw(__a, __b); |
| 17299 | } |
| 17300 | |
| 17301 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 17302 | __builtin_crypto_vpmsumb(vector unsigned long long __a, |
| 17303 | vector unsigned long long __b) { |
| 17304 | return __builtin_altivec_crypto_vpmsumd(__a, __b); |
| 17305 | } |
| 17306 | |
| 17307 | static __inline__ vector signed char __ATTRS_o_ai |
| 17308 | vec_vgbbd(vector signed char __a) { |
| 17309 | return __builtin_altivec_vgbbd((vector unsigned char)__a); |
| 17310 | } |
| 17311 | |
| 17312 | #define vec_pmsum_be __builtin_crypto_vpmsumb |
| 17313 | #define vec_gb __builtin_altivec_vgbbd |
| 17314 | |
| 17315 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 17316 | vec_vgbbd(vector unsigned char __a) { |
| 17317 | return __builtin_altivec_vgbbd(__a); |
| 17318 | } |
| 17319 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17320 | static __inline__ vector signed long long __ATTRS_o_ai |
| 17321 | vec_gbb(vector signed long long __a) { |
| 17322 | return __builtin_altivec_vgbbd((vector unsigned char)__a); |
| 17323 | } |
| 17324 | |
| 17325 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 17326 | vec_gbb(vector unsigned long long __a) { |
| 17327 | return __builtin_altivec_vgbbd((vector unsigned char)__a); |
| 17328 | } |
| 17329 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17330 | static __inline__ vector long long __ATTRS_o_ai |
| 17331 | vec_vbpermq(vector signed char __a, vector signed char __b) { |
| 17332 | return __builtin_altivec_vbpermq((vector unsigned char)__a, |
| 17333 | (vector unsigned char)__b); |
| 17334 | } |
| 17335 | |
| 17336 | static __inline__ vector long long __ATTRS_o_ai |
| 17337 | vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { |
| 17338 | return __builtin_altivec_vbpermq(__a, __b); |
| 17339 | } |
| 17340 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17341 | #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 17342 | static __inline__ vector unsigned long long __attribute__((__always_inline__)) |
| 17343 | vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { |
| 17344 | return __builtin_altivec_vbpermq((vector unsigned char)__a, |
| 17345 | (vector unsigned char)__b); |
| 17346 | } |
| 17347 | #endif |
| 17348 | #endif |
| 17349 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17350 | |
| 17351 | /* vec_reve */ |
| 17352 | |
| 17353 | static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { |
| 17354 | return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, |
| 17355 | 5, 4, 3, 2, 1, 0); |
| 17356 | } |
| 17357 | |
| 17358 | static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { |
| 17359 | return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, |
| 17360 | 5, 4, 3, 2, 1, 0); |
| 17361 | } |
| 17362 | |
| 17363 | static inline __ATTRS_o_ai vector unsigned char |
| 17364 | vec_reve(vector unsigned char __a) { |
| 17365 | return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, |
| 17366 | 5, 4, 3, 2, 1, 0); |
| 17367 | } |
| 17368 | |
| 17369 | static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { |
| 17370 | return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); |
| 17371 | } |
| 17372 | |
| 17373 | static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { |
| 17374 | return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); |
| 17375 | } |
| 17376 | |
| 17377 | static inline __ATTRS_o_ai vector unsigned int |
| 17378 | vec_reve(vector unsigned int __a) { |
| 17379 | return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); |
| 17380 | } |
| 17381 | |
| 17382 | static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { |
| 17383 | return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); |
| 17384 | } |
| 17385 | |
| 17386 | static inline __ATTRS_o_ai vector signed short |
| 17387 | vec_reve(vector signed short __a) { |
| 17388 | return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); |
| 17389 | } |
| 17390 | |
| 17391 | static inline __ATTRS_o_ai vector unsigned short |
| 17392 | vec_reve(vector unsigned short __a) { |
| 17393 | return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); |
| 17394 | } |
| 17395 | |
| 17396 | static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { |
| 17397 | return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); |
| 17398 | } |
| 17399 | |
| 17400 | #ifdef __VSX__ |
| 17401 | static inline __ATTRS_o_ai vector bool long long |
| 17402 | vec_reve(vector bool long long __a) { |
| 17403 | return __builtin_shufflevector(__a, __a, 1, 0); |
| 17404 | } |
| 17405 | |
| 17406 | static inline __ATTRS_o_ai vector signed long long |
| 17407 | vec_reve(vector signed long long __a) { |
| 17408 | return __builtin_shufflevector(__a, __a, 1, 0); |
| 17409 | } |
| 17410 | |
| 17411 | static inline __ATTRS_o_ai vector unsigned long long |
| 17412 | vec_reve(vector unsigned long long __a) { |
| 17413 | return __builtin_shufflevector(__a, __a, 1, 0); |
| 17414 | } |
| 17415 | |
| 17416 | static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { |
| 17417 | return __builtin_shufflevector(__a, __a, 1, 0); |
| 17418 | } |
| 17419 | #endif |
| 17420 | |
| 17421 | /* vec_revb */ |
| 17422 | static __inline__ vector bool char __ATTRS_o_ai |
| 17423 | vec_revb(vector bool char __a) { |
| 17424 | return __a; |
| 17425 | } |
| 17426 | |
| 17427 | static __inline__ vector signed char __ATTRS_o_ai |
| 17428 | vec_revb(vector signed char __a) { |
| 17429 | return __a; |
| 17430 | } |
| 17431 | |
| 17432 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 17433 | vec_revb(vector unsigned char __a) { |
| 17434 | return __a; |
| 17435 | } |
| 17436 | |
| 17437 | static __inline__ vector bool short __ATTRS_o_ai |
| 17438 | vec_revb(vector bool short __a) { |
| 17439 | vector unsigned char __indices = |
| 17440 | { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; |
| 17441 | return vec_perm(__a, __a, __indices); |
| 17442 | } |
| 17443 | |
| 17444 | static __inline__ vector signed short __ATTRS_o_ai |
| 17445 | vec_revb(vector signed short __a) { |
| 17446 | vector unsigned char __indices = |
| 17447 | { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; |
| 17448 | return vec_perm(__a, __a, __indices); |
| 17449 | } |
| 17450 | |
| 17451 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 17452 | vec_revb(vector unsigned short __a) { |
| 17453 | vector unsigned char __indices = |
| 17454 | { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; |
| 17455 | return vec_perm(__a, __a, __indices); |
| 17456 | } |
| 17457 | |
| 17458 | static __inline__ vector bool int __ATTRS_o_ai |
| 17459 | vec_revb(vector bool int __a) { |
| 17460 | vector unsigned char __indices = |
| 17461 | { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; |
| 17462 | return vec_perm(__a, __a, __indices); |
| 17463 | } |
| 17464 | |
| 17465 | static __inline__ vector signed int __ATTRS_o_ai |
| 17466 | vec_revb(vector signed int __a) { |
| 17467 | vector unsigned char __indices = |
| 17468 | { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; |
| 17469 | return vec_perm(__a, __a, __indices); |
| 17470 | } |
| 17471 | |
| 17472 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 17473 | vec_revb(vector unsigned int __a) { |
| 17474 | vector unsigned char __indices = |
| 17475 | { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; |
| 17476 | return vec_perm(__a, __a, __indices); |
| 17477 | } |
| 17478 | |
| 17479 | static __inline__ vector float __ATTRS_o_ai |
| 17480 | vec_revb(vector float __a) { |
| 17481 | vector unsigned char __indices = |
| 17482 | { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; |
| 17483 | return vec_perm(__a, __a, __indices); |
| 17484 | } |
| 17485 | |
| 17486 | #ifdef __VSX__ |
| 17487 | static __inline__ vector bool long long __ATTRS_o_ai |
| 17488 | vec_revb(vector bool long long __a) { |
| 17489 | vector unsigned char __indices = |
| 17490 | { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; |
| 17491 | return vec_perm(__a, __a, __indices); |
| 17492 | } |
| 17493 | |
| 17494 | static __inline__ vector signed long long __ATTRS_o_ai |
| 17495 | vec_revb(vector signed long long __a) { |
| 17496 | vector unsigned char __indices = |
| 17497 | { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; |
| 17498 | return vec_perm(__a, __a, __indices); |
| 17499 | } |
| 17500 | |
| 17501 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 17502 | vec_revb(vector unsigned long long __a) { |
| 17503 | vector unsigned char __indices = |
| 17504 | { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; |
| 17505 | return vec_perm(__a, __a, __indices); |
| 17506 | } |
| 17507 | |
| 17508 | static __inline__ vector double __ATTRS_o_ai |
| 17509 | vec_revb(vector double __a) { |
| 17510 | vector unsigned char __indices = |
| 17511 | { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; |
| 17512 | return vec_perm(__a, __a, __indices); |
| 17513 | } |
| 17514 | #endif /* End __VSX__ */ |
| 17515 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17516 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 17517 | defined(__SIZEOF_INT128__) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17518 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 17519 | vec_revb(vector signed __int128 __a) { |
| 17520 | vector unsigned char __indices = |
| 17521 | { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; |
| 17522 | return (vector signed __int128)vec_perm((vector signed int)__a, |
| 17523 | (vector signed int)__a, |
| 17524 | __indices); |
| 17525 | } |
| 17526 | |
| 17527 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 17528 | vec_revb(vector unsigned __int128 __a) { |
| 17529 | vector unsigned char __indices = |
| 17530 | { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; |
| 17531 | return (vector unsigned __int128)vec_perm((vector signed int)__a, |
| 17532 | (vector signed int)__a, |
| 17533 | __indices); |
| 17534 | } |
| 17535 | #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ |
| 17536 | |
| 17537 | /* vec_xl */ |
| 17538 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17539 | #define vec_xld2 vec_xl |
| 17540 | #define vec_xlw4 vec_xl |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17541 | typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); |
| 17542 | typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); |
| 17543 | typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); |
| 17544 | typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); |
| 17545 | typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); |
| 17546 | typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); |
| 17547 | typedef vector float unaligned_vec_float __attribute__((aligned(1))); |
| 17548 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17549 | static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17550 | const signed char *__ptr) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17551 | return *(unaligned_vec_schar *)(__ptr + __offset); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17552 | } |
| 17553 | |
| 17554 | static inline __ATTRS_o_ai vector unsigned char |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17555 | vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17556 | return *(unaligned_vec_uchar*)(__ptr + __offset); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17557 | } |
| 17558 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17559 | static inline __ATTRS_o_ai vector signed short |
| 17560 | vec_xl(ptrdiff_t __offset, const signed short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17561 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17562 | return *(unaligned_vec_sshort *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17563 | } |
| 17564 | |
| 17565 | static inline __ATTRS_o_ai vector unsigned short |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17566 | vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17567 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17568 | return *(unaligned_vec_ushort *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17569 | } |
| 17570 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17571 | static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17572 | const signed int *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17573 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17574 | return *(unaligned_vec_sint *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17575 | } |
| 17576 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17577 | static inline __ATTRS_o_ai vector unsigned int |
| 17578 | vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17579 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17580 | return *(unaligned_vec_uint *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17581 | } |
| 17582 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17583 | static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17584 | const float *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17585 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17586 | return *(unaligned_vec_float *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17587 | } |
| 17588 | |
| 17589 | #ifdef __VSX__ |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17590 | typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); |
| 17591 | typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); |
| 17592 | typedef vector double unaligned_vec_double __attribute__((aligned(1))); |
| 17593 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17594 | static inline __ATTRS_o_ai vector signed long long |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17595 | vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17596 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17597 | return *(unaligned_vec_sll *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17598 | } |
| 17599 | |
| 17600 | static inline __ATTRS_o_ai vector unsigned long long |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17601 | vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17602 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17603 | return *(unaligned_vec_ull *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17604 | } |
| 17605 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17606 | static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17607 | const double *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17608 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17609 | return *(unaligned_vec_double *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17610 | } |
| 17611 | #endif |
| 17612 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17613 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 17614 | defined(__SIZEOF_INT128__) |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17615 | typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); |
| 17616 | typedef vector unsigned __int128 unaligned_vec_ui128 |
| 17617 | __attribute__((aligned(1))); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17618 | static inline __ATTRS_o_ai vector signed __int128 |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17619 | vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17620 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17621 | return *(unaligned_vec_si128 *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17622 | } |
| 17623 | |
| 17624 | static inline __ATTRS_o_ai vector unsigned __int128 |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17625 | vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17626 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17627 | return *(unaligned_vec_ui128 *)__addr; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17628 | } |
| 17629 | #endif |
| 17630 | |
| 17631 | /* vec_xl_be */ |
| 17632 | |
| 17633 | #ifdef __LITTLE_ENDIAN__ |
| 17634 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17635 | vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17636 | vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17637 | return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, |
| 17638 | 13, 12, 11, 10, 9, 8); |
| 17639 | } |
| 17640 | |
| 17641 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17642 | vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17643 | vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17644 | return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, |
| 17645 | 13, 12, 11, 10, 9, 8); |
| 17646 | } |
| 17647 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17648 | static __inline__ vector signed short __ATTRS_o_ai |
| 17649 | vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17650 | vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17651 | return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); |
| 17652 | } |
| 17653 | |
| 17654 | static __inline__ vector unsigned short __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17655 | vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17656 | vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17657 | return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); |
| 17658 | } |
| 17659 | |
| 17660 | static __inline__ vector signed int __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17661 | vec_xl_be(signed long long __offset, const signed int *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17662 | return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); |
| 17663 | } |
| 17664 | |
| 17665 | static __inline__ vector unsigned int __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17666 | vec_xl_be(signed long long __offset, const unsigned int *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17667 | return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); |
| 17668 | } |
| 17669 | |
| 17670 | static __inline__ vector float __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17671 | vec_xl_be(signed long long __offset, const float *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17672 | return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); |
| 17673 | } |
| 17674 | |
| 17675 | #ifdef __VSX__ |
| 17676 | static __inline__ vector signed long long __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17677 | vec_xl_be(signed long long __offset, const signed long long *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17678 | return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
| 17679 | } |
| 17680 | |
| 17681 | static __inline__ vector unsigned long long __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17682 | vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17683 | return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
| 17684 | } |
| 17685 | |
| 17686 | static __inline__ vector double __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17687 | vec_xl_be(signed long long __offset, const double *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17688 | return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); |
| 17689 | } |
| 17690 | #endif |
| 17691 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17692 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 17693 | defined(__SIZEOF_INT128__) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17694 | static __inline__ vector signed __int128 __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17695 | vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17696 | return vec_xl(__offset, __ptr); |
| 17697 | } |
| 17698 | |
| 17699 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17700 | vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17701 | return vec_xl(__offset, __ptr); |
| 17702 | } |
| 17703 | #endif |
| 17704 | #else |
| 17705 | #define vec_xl_be vec_xl |
| 17706 | #endif |
| 17707 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17708 | #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ |
| 17709 | defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17710 | |
| 17711 | /* vect_xl_sext */ |
| 17712 | |
| 17713 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17714 | vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17715 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17716 | } |
| 17717 | |
| 17718 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17719 | vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17720 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17721 | } |
| 17722 | |
| 17723 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17724 | vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17725 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17726 | } |
| 17727 | |
| 17728 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17729 | vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17730 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17731 | } |
| 17732 | |
| 17733 | /* vec_xl_zext */ |
| 17734 | |
| 17735 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17736 | vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17737 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17738 | } |
| 17739 | |
| 17740 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17741 | vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17742 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17743 | } |
| 17744 | |
| 17745 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17746 | vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17747 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17748 | } |
| 17749 | |
| 17750 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17751 | vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17752 | return (vector unsigned __int128)*(__pointer + __offset); |
| 17753 | } |
| 17754 | |
| 17755 | #endif |
| 17756 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17757 | /* vec_xlds */ |
| 17758 | #ifdef __VSX__ |
| 17759 | static __inline__ vector signed long long __ATTRS_o_ai |
| 17760 | vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { |
| 17761 | signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); |
| 17762 | return (vector signed long long) *__addr; |
| 17763 | } |
| 17764 | |
| 17765 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 17766 | vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { |
| 17767 | unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); |
| 17768 | return (unaligned_vec_ull) *__addr; |
| 17769 | } |
| 17770 | |
| 17771 | static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, |
| 17772 | const double *__ptr) { |
| 17773 | double *__addr = (double*)((signed char *)__ptr + __offset); |
| 17774 | return (unaligned_vec_double) *__addr; |
| 17775 | } |
| 17776 | |
| 17777 | /* vec_load_splats */ |
| 17778 | static __inline__ vector signed int __ATTRS_o_ai |
| 17779 | vec_load_splats(signed long long __offset, const signed int *__ptr) { |
| 17780 | signed int *__addr = (signed int*)((signed char *)__ptr + __offset); |
| 17781 | return (vector signed int)*__addr; |
| 17782 | } |
| 17783 | |
| 17784 | static __inline__ vector signed int __ATTRS_o_ai |
| 17785 | vec_load_splats(unsigned long long __offset, const signed int *__ptr) { |
| 17786 | signed int *__addr = (signed int*)((signed char *)__ptr + __offset); |
| 17787 | return (vector signed int)*__addr; |
| 17788 | } |
| 17789 | |
| 17790 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 17791 | vec_load_splats(signed long long __offset, const unsigned int *__ptr) { |
| 17792 | unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); |
| 17793 | return (vector unsigned int)*__addr; |
| 17794 | } |
| 17795 | |
| 17796 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 17797 | vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { |
| 17798 | unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); |
| 17799 | return (vector unsigned int)*__addr; |
| 17800 | } |
| 17801 | |
| 17802 | static __inline__ vector float __ATTRS_o_ai |
| 17803 | vec_load_splats(signed long long __offset, const float *__ptr) { |
| 17804 | float *__addr = (float*)((signed char *)__ptr + __offset); |
| 17805 | return (vector float)*__addr; |
| 17806 | } |
| 17807 | |
| 17808 | static __inline__ vector float __ATTRS_o_ai |
| 17809 | vec_load_splats(unsigned long long __offset, const float *__ptr) { |
| 17810 | float *__addr = (float*)((signed char *)__ptr + __offset); |
| 17811 | return (vector float)*__addr; |
| 17812 | } |
| 17813 | #endif |
| 17814 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17815 | /* vec_xst */ |
| 17816 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17817 | #define vec_xstd2 vec_xst |
| 17818 | #define vec_xstw4 vec_xst |
| 17819 | static inline __ATTRS_o_ai void |
| 17820 | vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17821 | *(unaligned_vec_schar *)(__ptr + __offset) = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17822 | } |
| 17823 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17824 | static inline __ATTRS_o_ai void |
| 17825 | vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { |
Logan Chien | dbcf412 | 2019-03-21 10:50:25 +0800 | [diff] [blame] | 17826 | *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17827 | } |
| 17828 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17829 | static inline __ATTRS_o_ai void |
| 17830 | vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17831 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17832 | *(unaligned_vec_sshort *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17833 | } |
| 17834 | |
| 17835 | static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17836 | ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17837 | unsigned short *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17838 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17839 | *(unaligned_vec_ushort *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17840 | } |
| 17841 | |
| 17842 | static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17843 | ptrdiff_t __offset, signed int *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17844 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17845 | *(unaligned_vec_sint *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17846 | } |
| 17847 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17848 | static inline __ATTRS_o_ai void |
| 17849 | vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17850 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17851 | *(unaligned_vec_uint *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17852 | } |
| 17853 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17854 | static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17855 | float *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17856 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17857 | *(unaligned_vec_float *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17858 | } |
| 17859 | |
| 17860 | #ifdef __VSX__ |
| 17861 | static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17862 | ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17863 | signed long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17864 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17865 | *(unaligned_vec_sll *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17866 | } |
| 17867 | |
| 17868 | static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17869 | ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17870 | unsigned long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17871 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17872 | *(unaligned_vec_ull *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17873 | } |
| 17874 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17875 | static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17876 | double *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17877 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17878 | *(unaligned_vec_double *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17879 | } |
| 17880 | #endif |
| 17881 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17882 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 17883 | defined(__SIZEOF_INT128__) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17884 | static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17885 | ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17886 | signed __int128 *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17887 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17888 | *(unaligned_vec_si128 *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17889 | } |
| 17890 | |
| 17891 | static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17892 | ptrdiff_t __offset, |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17893 | unsigned __int128 *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17894 | signed char *__addr = (signed char *)__ptr + __offset; |
| 17895 | *(unaligned_vec_ui128 *)__addr = __vec; |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17896 | } |
| 17897 | #endif |
| 17898 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17899 | /* vec_xst_trunc */ |
| 17900 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17901 | #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ |
| 17902 | defined(__SIZEOF_INT128__) |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17903 | static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17904 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17905 | signed char *__ptr) { |
| 17906 | *(__ptr + __offset) = (signed char)__vec[0]; |
| 17907 | } |
| 17908 | |
| 17909 | static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17910 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17911 | unsigned char *__ptr) { |
| 17912 | *(__ptr + __offset) = (unsigned char)__vec[0]; |
| 17913 | } |
| 17914 | |
| 17915 | static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17916 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17917 | signed short *__ptr) { |
| 17918 | *(__ptr + __offset) = (signed short)__vec[0]; |
| 17919 | } |
| 17920 | |
| 17921 | static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17922 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17923 | unsigned short *__ptr) { |
| 17924 | *(__ptr + __offset) = (unsigned short)__vec[0]; |
| 17925 | } |
| 17926 | |
| 17927 | static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17928 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17929 | signed int *__ptr) { |
| 17930 | *(__ptr + __offset) = (signed int)__vec[0]; |
| 17931 | } |
| 17932 | |
| 17933 | static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17934 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17935 | unsigned int *__ptr) { |
| 17936 | *(__ptr + __offset) = (unsigned int)__vec[0]; |
| 17937 | } |
| 17938 | |
| 17939 | static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17940 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17941 | signed long long *__ptr) { |
| 17942 | *(__ptr + __offset) = (signed long long)__vec[0]; |
| 17943 | } |
| 17944 | |
| 17945 | static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 17946 | ptrdiff_t __offset, |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 17947 | unsigned long long *__ptr) { |
| 17948 | *(__ptr + __offset) = (unsigned long long)__vec[0]; |
| 17949 | } |
| 17950 | #endif |
| 17951 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17952 | /* vec_xst_be */ |
| 17953 | |
| 17954 | #ifdef __LITTLE_ENDIAN__ |
| 17955 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, |
| 17956 | signed long long __offset, |
| 17957 | signed char *__ptr) { |
| 17958 | vector signed char __tmp = |
| 17959 | __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, |
| 17960 | 13, 12, 11, 10, 9, 8); |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17961 | typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; |
| 17962 | __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17963 | } |
| 17964 | |
| 17965 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, |
| 17966 | signed long long __offset, |
| 17967 | unsigned char *__ptr) { |
| 17968 | vector unsigned char __tmp = |
| 17969 | __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, |
| 17970 | 13, 12, 11, 10, 9, 8); |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17971 | typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; |
| 17972 | __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17973 | } |
| 17974 | |
| 17975 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, |
| 17976 | signed long long __offset, |
| 17977 | signed short *__ptr) { |
| 17978 | vector signed short __tmp = |
| 17979 | __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17980 | typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; |
| 17981 | __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17982 | } |
| 17983 | |
| 17984 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, |
| 17985 | signed long long __offset, |
| 17986 | unsigned short *__ptr) { |
| 17987 | vector unsigned short __tmp = |
| 17988 | __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 17989 | typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; |
| 17990 | __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 17991 | } |
| 17992 | |
| 17993 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, |
| 17994 | signed long long __offset, |
| 17995 | signed int *__ptr) { |
| 17996 | __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); |
| 17997 | } |
| 17998 | |
| 17999 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, |
| 18000 | signed long long __offset, |
| 18001 | unsigned int *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18002 | __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18003 | } |
| 18004 | |
| 18005 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, |
| 18006 | signed long long __offset, |
| 18007 | float *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18008 | __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18009 | } |
| 18010 | |
| 18011 | #ifdef __VSX__ |
| 18012 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, |
| 18013 | signed long long __offset, |
| 18014 | signed long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18015 | __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18016 | } |
| 18017 | |
| 18018 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, |
| 18019 | signed long long __offset, |
| 18020 | unsigned long long *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18021 | __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18022 | } |
| 18023 | |
| 18024 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, |
| 18025 | signed long long __offset, |
| 18026 | double *__ptr) { |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18027 | __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18028 | } |
| 18029 | #endif |
| 18030 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18031 | #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| 18032 | defined(__SIZEOF_INT128__) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18033 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, |
| 18034 | signed long long __offset, |
| 18035 | signed __int128 *__ptr) { |
| 18036 | vec_xst(__vec, __offset, __ptr); |
| 18037 | } |
| 18038 | |
| 18039 | static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, |
| 18040 | signed long long __offset, |
| 18041 | unsigned __int128 *__ptr) { |
| 18042 | vec_xst(__vec, __offset, __ptr); |
| 18043 | } |
| 18044 | #endif |
| 18045 | #else |
| 18046 | #define vec_xst_be vec_xst |
| 18047 | #endif |
| 18048 | |
| 18049 | #ifdef __POWER9_VECTOR__ |
Sasha Smundak | 746b022 | 2020-02-25 09:19:04 -0800 | [diff] [blame] | 18050 | #define vec_test_data_class(__a, __b) \ |
| 18051 | _Generic( \ |
| 18052 | (__a), vector float \ |
| 18053 | : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ |
| 18054 | vector double \ |
| 18055 | : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ |
| 18056 | (__b))) |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18057 | |
| 18058 | #endif /* #ifdef __POWER9_VECTOR__ */ |
| 18059 | |
| 18060 | static vector float __ATTRS_o_ai vec_neg(vector float __a) { |
| 18061 | return -__a; |
| 18062 | } |
| 18063 | |
| 18064 | #ifdef __VSX__ |
| 18065 | static vector double __ATTRS_o_ai vec_neg(vector double __a) { |
| 18066 | return -__a; |
| 18067 | } |
| 18068 | |
| 18069 | #endif |
| 18070 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18071 | #ifdef __VSX__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18072 | static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { |
| 18073 | return -__a; |
| 18074 | } |
| 18075 | #endif |
| 18076 | |
| 18077 | static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { |
| 18078 | return -__a; |
| 18079 | } |
| 18080 | |
| 18081 | static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { |
| 18082 | return -__a; |
| 18083 | } |
| 18084 | |
| 18085 | static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { |
| 18086 | return -__a; |
| 18087 | } |
| 18088 | |
| 18089 | static vector float __ATTRS_o_ai vec_nabs(vector float __a) { |
| 18090 | return - vec_abs(__a); |
| 18091 | } |
| 18092 | |
| 18093 | #ifdef __VSX__ |
| 18094 | static vector double __ATTRS_o_ai vec_nabs(vector double __a) { |
| 18095 | return - vec_abs(__a); |
| 18096 | } |
| 18097 | |
| 18098 | #endif |
| 18099 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18100 | #ifdef __POWER8_VECTOR__ |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 18101 | static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { |
| 18102 | return __builtin_altivec_vminsd(__a, -__a); |
| 18103 | } |
| 18104 | #endif |
| 18105 | |
| 18106 | static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { |
| 18107 | return __builtin_altivec_vminsw(__a, -__a); |
| 18108 | } |
| 18109 | |
| 18110 | static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { |
| 18111 | return __builtin_altivec_vminsh(__a, -__a); |
| 18112 | } |
| 18113 | |
| 18114 | static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { |
| 18115 | return __builtin_altivec_vminsb(__a, -__a); |
| 18116 | } |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18117 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18118 | static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, |
| 18119 | vector float __b) { |
| 18120 | return __builtin_ppc_recipdivf(__a, __b); |
| 18121 | } |
| 18122 | |
| 18123 | #ifdef __VSX__ |
| 18124 | static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, |
| 18125 | vector double __b) { |
| 18126 | return __builtin_ppc_recipdivd(__a, __b); |
| 18127 | } |
| 18128 | #endif |
| 18129 | |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18130 | #ifdef __POWER10_VECTOR__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18131 | |
| 18132 | /* vec_extractm */ |
| 18133 | |
| 18134 | static __inline__ unsigned int __ATTRS_o_ai |
| 18135 | vec_extractm(vector unsigned char __a) { |
| 18136 | return __builtin_altivec_vextractbm(__a); |
| 18137 | } |
| 18138 | |
| 18139 | static __inline__ unsigned int __ATTRS_o_ai |
| 18140 | vec_extractm(vector unsigned short __a) { |
| 18141 | return __builtin_altivec_vextracthm(__a); |
| 18142 | } |
| 18143 | |
| 18144 | static __inline__ unsigned int __ATTRS_o_ai |
| 18145 | vec_extractm(vector unsigned int __a) { |
| 18146 | return __builtin_altivec_vextractwm(__a); |
| 18147 | } |
| 18148 | |
| 18149 | static __inline__ unsigned int __ATTRS_o_ai |
| 18150 | vec_extractm(vector unsigned long long __a) { |
| 18151 | return __builtin_altivec_vextractdm(__a); |
| 18152 | } |
| 18153 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18154 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18155 | static __inline__ unsigned int __ATTRS_o_ai |
| 18156 | vec_extractm(vector unsigned __int128 __a) { |
| 18157 | return __builtin_altivec_vextractqm(__a); |
| 18158 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18159 | #endif |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18160 | |
| 18161 | /* vec_expandm */ |
| 18162 | |
| 18163 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18164 | vec_expandm(vector unsigned char __a) { |
| 18165 | return __builtin_altivec_vexpandbm(__a); |
| 18166 | } |
| 18167 | |
| 18168 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18169 | vec_expandm(vector unsigned short __a) { |
| 18170 | return __builtin_altivec_vexpandhm(__a); |
| 18171 | } |
| 18172 | |
| 18173 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18174 | vec_expandm(vector unsigned int __a) { |
| 18175 | return __builtin_altivec_vexpandwm(__a); |
| 18176 | } |
| 18177 | |
| 18178 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18179 | vec_expandm(vector unsigned long long __a) { |
| 18180 | return __builtin_altivec_vexpanddm(__a); |
| 18181 | } |
| 18182 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18183 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18184 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18185 | vec_expandm(vector unsigned __int128 __a) { |
| 18186 | return __builtin_altivec_vexpandqm(__a); |
| 18187 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18188 | #endif |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18189 | |
| 18190 | /* vec_cntm */ |
| 18191 | |
| 18192 | #define vec_cntm(__a, __mp) \ |
| 18193 | _Generic((__a), vector unsigned char \ |
| 18194 | : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \ |
| 18195 | vector unsigned short \ |
| 18196 | : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \ |
| 18197 | vector unsigned int \ |
| 18198 | : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \ |
| 18199 | vector unsigned long long \ |
| 18200 | : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp))) |
| 18201 | |
| 18202 | /* vec_gen[b|h|w|d|q]m */ |
| 18203 | |
| 18204 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18205 | vec_genbm(unsigned long long __bm) { |
| 18206 | return __builtin_altivec_mtvsrbm(__bm); |
| 18207 | } |
| 18208 | |
| 18209 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18210 | vec_genhm(unsigned long long __bm) { |
| 18211 | return __builtin_altivec_mtvsrhm(__bm); |
| 18212 | } |
| 18213 | |
| 18214 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18215 | vec_genwm(unsigned long long __bm) { |
| 18216 | return __builtin_altivec_mtvsrwm(__bm); |
| 18217 | } |
| 18218 | |
| 18219 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18220 | vec_gendm(unsigned long long __bm) { |
| 18221 | return __builtin_altivec_mtvsrdm(__bm); |
| 18222 | } |
| 18223 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18224 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18225 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18226 | vec_genqm(unsigned long long __bm) { |
| 18227 | return __builtin_altivec_mtvsrqm(__bm); |
| 18228 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18229 | #endif |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18230 | |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18231 | /* vec_pdep */ |
| 18232 | |
| 18233 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18234 | vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { |
| 18235 | return __builtin_altivec_vpdepd(__a, __b); |
| 18236 | } |
| 18237 | |
| 18238 | /* vec_pext */ |
| 18239 | |
| 18240 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18241 | vec_pext(vector unsigned long long __a, vector unsigned long long __b) { |
| 18242 | return __builtin_altivec_vpextd(__a, __b); |
| 18243 | } |
| 18244 | |
| 18245 | /* vec_cfuge */ |
| 18246 | |
| 18247 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18248 | vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { |
| 18249 | return __builtin_altivec_vcfuged(__a, __b); |
| 18250 | } |
| 18251 | |
| 18252 | /* vec_gnb */ |
| 18253 | |
| 18254 | #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) |
| 18255 | |
| 18256 | /* vec_ternarylogic */ |
| 18257 | #ifdef __VSX__ |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18258 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18259 | #define vec_ternarylogic(__a, __b, __c, __imm) \ |
| 18260 | _Generic((__a), vector unsigned char \ |
| 18261 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18262 | (vector unsigned long long)(__b), \ |
| 18263 | (vector unsigned long long)(__c), (__imm)), \ |
| 18264 | vector unsigned short \ |
| 18265 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18266 | (vector unsigned long long)(__b), \ |
| 18267 | (vector unsigned long long)(__c), (__imm)), \ |
| 18268 | vector unsigned int \ |
| 18269 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18270 | (vector unsigned long long)(__b), \ |
| 18271 | (vector unsigned long long)(__c), (__imm)), \ |
| 18272 | vector unsigned long long \ |
| 18273 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18274 | (vector unsigned long long)(__b), \ |
| 18275 | (vector unsigned long long)(__c), (__imm)), \ |
| 18276 | vector unsigned __int128 \ |
| 18277 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18278 | (vector unsigned long long)(__b), \ |
| 18279 | (vector unsigned long long)(__c), (__imm))) |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18280 | #else |
| 18281 | #define vec_ternarylogic(__a, __b, __c, __imm) \ |
| 18282 | _Generic((__a), vector unsigned char \ |
| 18283 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18284 | (vector unsigned long long)(__b), \ |
| 18285 | (vector unsigned long long)(__c), (__imm)), \ |
| 18286 | vector unsigned short \ |
| 18287 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18288 | (vector unsigned long long)(__b), \ |
| 18289 | (vector unsigned long long)(__c), (__imm)), \ |
| 18290 | vector unsigned int \ |
| 18291 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18292 | (vector unsigned long long)(__b), \ |
| 18293 | (vector unsigned long long)(__c), (__imm)), \ |
| 18294 | vector unsigned long long \ |
| 18295 | : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ |
| 18296 | (vector unsigned long long)(__b), \ |
| 18297 | (vector unsigned long long)(__c), (__imm))) |
| 18298 | #endif /* __SIZEOF_INT128__ */ |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18299 | #endif /* __VSX__ */ |
| 18300 | |
| 18301 | /* vec_genpcvm */ |
| 18302 | |
| 18303 | #ifdef __VSX__ |
| 18304 | #define vec_genpcvm(__a, __imm) \ |
| 18305 | _Generic((__a), vector unsigned char \ |
| 18306 | : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ |
| 18307 | vector unsigned short \ |
| 18308 | : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ |
| 18309 | vector unsigned int \ |
| 18310 | : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ |
| 18311 | vector unsigned long long \ |
| 18312 | : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) |
| 18313 | #endif /* __VSX__ */ |
| 18314 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18315 | /* vec_clr_first */ |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18316 | |
| 18317 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18318 | vec_clr_first(vector signed char __a, unsigned int __n) { |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18319 | #ifdef __LITTLE_ENDIAN__ |
| 18320 | return __builtin_altivec_vclrrb(__a, __n); |
| 18321 | #else |
| 18322 | return __builtin_altivec_vclrlb( __a, __n); |
| 18323 | #endif |
| 18324 | } |
| 18325 | |
| 18326 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18327 | vec_clr_first(vector unsigned char __a, unsigned int __n) { |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18328 | #ifdef __LITTLE_ENDIAN__ |
| 18329 | return __builtin_altivec_vclrrb((vector signed char)__a, __n); |
| 18330 | #else |
| 18331 | return __builtin_altivec_vclrlb((vector signed char)__a, __n); |
| 18332 | #endif |
| 18333 | } |
| 18334 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18335 | /* vec_clr_last */ |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18336 | |
| 18337 | static __inline__ vector signed char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18338 | vec_clr_last(vector signed char __a, unsigned int __n) { |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18339 | #ifdef __LITTLE_ENDIAN__ |
| 18340 | return __builtin_altivec_vclrlb(__a, __n); |
| 18341 | #else |
| 18342 | return __builtin_altivec_vclrrb( __a, __n); |
| 18343 | #endif |
| 18344 | } |
| 18345 | |
| 18346 | static __inline__ vector unsigned char __ATTRS_o_ai |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 18347 | vec_clr_last(vector unsigned char __a, unsigned int __n) { |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18348 | #ifdef __LITTLE_ENDIAN__ |
| 18349 | return __builtin_altivec_vclrlb((vector signed char)__a, __n); |
| 18350 | #else |
| 18351 | return __builtin_altivec_vclrrb((vector signed char)__a, __n); |
| 18352 | #endif |
| 18353 | } |
| 18354 | |
| 18355 | /* vec_cntlzm */ |
| 18356 | |
| 18357 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18358 | vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { |
| 18359 | return __builtin_altivec_vclzdm(__a, __b); |
| 18360 | } |
| 18361 | |
| 18362 | /* vec_cnttzm */ |
| 18363 | |
| 18364 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18365 | vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { |
| 18366 | return __builtin_altivec_vctzdm(__a, __b); |
| 18367 | } |
| 18368 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18369 | /* vec_mod */ |
| 18370 | |
| 18371 | static __inline__ vector signed int __ATTRS_o_ai |
| 18372 | vec_mod(vector signed int __a, vector signed int __b) { |
| 18373 | return __a % __b; |
| 18374 | } |
| 18375 | |
| 18376 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18377 | vec_mod(vector unsigned int __a, vector unsigned int __b) { |
| 18378 | return __a % __b; |
| 18379 | } |
| 18380 | |
| 18381 | static __inline__ vector signed long long __ATTRS_o_ai |
| 18382 | vec_mod(vector signed long long __a, vector signed long long __b) { |
| 18383 | return __a % __b; |
| 18384 | } |
| 18385 | |
| 18386 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18387 | vec_mod(vector unsigned long long __a, vector unsigned long long __b) { |
| 18388 | return __a % __b; |
| 18389 | } |
| 18390 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18391 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18392 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 18393 | vec_mod(vector signed __int128 __a, vector signed __int128 __b) { |
| 18394 | return __a % __b; |
| 18395 | } |
| 18396 | |
| 18397 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18398 | vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 18399 | return __a % __b; |
| 18400 | } |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18401 | #endif |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18402 | |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18403 | /* vec_sldbi */ |
| 18404 | |
| 18405 | #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) |
| 18406 | |
| 18407 | /* vec_srdbi */ |
| 18408 | |
| 18409 | #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) |
| 18410 | |
| 18411 | /* vec_insertl */ |
| 18412 | |
| 18413 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18414 | vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { |
| 18415 | #ifdef __LITTLE_ENDIAN__ |
| 18416 | return __builtin_altivec_vinsbrx(__b, __c, __a); |
| 18417 | #else |
| 18418 | return __builtin_altivec_vinsblx(__b, __c, __a); |
| 18419 | #endif |
| 18420 | } |
| 18421 | |
| 18422 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18423 | vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { |
| 18424 | #ifdef __LITTLE_ENDIAN__ |
| 18425 | return __builtin_altivec_vinshrx(__b, __c, __a); |
| 18426 | #else |
| 18427 | return __builtin_altivec_vinshlx(__b, __c, __a); |
| 18428 | #endif |
| 18429 | } |
| 18430 | |
| 18431 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18432 | vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { |
| 18433 | #ifdef __LITTLE_ENDIAN__ |
| 18434 | return __builtin_altivec_vinswrx(__b, __c, __a); |
| 18435 | #else |
| 18436 | return __builtin_altivec_vinswlx(__b, __c, __a); |
| 18437 | #endif |
| 18438 | } |
| 18439 | |
| 18440 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18441 | vec_insertl(unsigned long long __a, vector unsigned long long __b, |
| 18442 | unsigned int __c) { |
| 18443 | #ifdef __LITTLE_ENDIAN__ |
| 18444 | return __builtin_altivec_vinsdrx(__b, __c, __a); |
| 18445 | #else |
| 18446 | return __builtin_altivec_vinsdlx(__b, __c, __a); |
| 18447 | #endif |
| 18448 | } |
| 18449 | |
| 18450 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18451 | vec_insertl(vector unsigned char __a, vector unsigned char __b, |
| 18452 | unsigned int __c) { |
| 18453 | #ifdef __LITTLE_ENDIAN__ |
| 18454 | return __builtin_altivec_vinsbvrx(__b, __c, __a); |
| 18455 | #else |
| 18456 | return __builtin_altivec_vinsbvlx(__b, __c, __a); |
| 18457 | #endif |
| 18458 | } |
| 18459 | |
| 18460 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18461 | vec_insertl(vector unsigned short __a, vector unsigned short __b, |
| 18462 | unsigned int __c) { |
| 18463 | #ifdef __LITTLE_ENDIAN__ |
| 18464 | return __builtin_altivec_vinshvrx(__b, __c, __a); |
| 18465 | #else |
| 18466 | return __builtin_altivec_vinshvlx(__b, __c, __a); |
| 18467 | #endif |
| 18468 | } |
| 18469 | |
| 18470 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18471 | vec_insertl(vector unsigned int __a, vector unsigned int __b, |
| 18472 | unsigned int __c) { |
| 18473 | #ifdef __LITTLE_ENDIAN__ |
| 18474 | return __builtin_altivec_vinswvrx(__b, __c, __a); |
| 18475 | #else |
| 18476 | return __builtin_altivec_vinswvlx(__b, __c, __a); |
| 18477 | #endif |
| 18478 | } |
| 18479 | |
| 18480 | /* vec_inserth */ |
| 18481 | |
| 18482 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18483 | vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { |
| 18484 | #ifdef __LITTLE_ENDIAN__ |
| 18485 | return __builtin_altivec_vinsblx(__b, __c, __a); |
| 18486 | #else |
| 18487 | return __builtin_altivec_vinsbrx(__b, __c, __a); |
| 18488 | #endif |
| 18489 | } |
| 18490 | |
| 18491 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18492 | vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { |
| 18493 | #ifdef __LITTLE_ENDIAN__ |
| 18494 | return __builtin_altivec_vinshlx(__b, __c, __a); |
| 18495 | #else |
| 18496 | return __builtin_altivec_vinshrx(__b, __c, __a); |
| 18497 | #endif |
| 18498 | } |
| 18499 | |
| 18500 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18501 | vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { |
| 18502 | #ifdef __LITTLE_ENDIAN__ |
| 18503 | return __builtin_altivec_vinswlx(__b, __c, __a); |
| 18504 | #else |
| 18505 | return __builtin_altivec_vinswrx(__b, __c, __a); |
| 18506 | #endif |
| 18507 | } |
| 18508 | |
| 18509 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18510 | vec_inserth(unsigned long long __a, vector unsigned long long __b, |
| 18511 | unsigned int __c) { |
| 18512 | #ifdef __LITTLE_ENDIAN__ |
| 18513 | return __builtin_altivec_vinsdlx(__b, __c, __a); |
| 18514 | #else |
| 18515 | return __builtin_altivec_vinsdrx(__b, __c, __a); |
| 18516 | #endif |
| 18517 | } |
| 18518 | |
| 18519 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18520 | vec_inserth(vector unsigned char __a, vector unsigned char __b, |
| 18521 | unsigned int __c) { |
| 18522 | #ifdef __LITTLE_ENDIAN__ |
| 18523 | return __builtin_altivec_vinsbvlx(__b, __c, __a); |
| 18524 | #else |
| 18525 | return __builtin_altivec_vinsbvrx(__b, __c, __a); |
| 18526 | #endif |
| 18527 | } |
| 18528 | |
| 18529 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18530 | vec_inserth(vector unsigned short __a, vector unsigned short __b, |
| 18531 | unsigned int __c) { |
| 18532 | #ifdef __LITTLE_ENDIAN__ |
| 18533 | return __builtin_altivec_vinshvlx(__b, __c, __a); |
| 18534 | #else |
| 18535 | return __builtin_altivec_vinshvrx(__b, __c, __a); |
| 18536 | #endif |
| 18537 | } |
| 18538 | |
| 18539 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18540 | vec_inserth(vector unsigned int __a, vector unsigned int __b, |
| 18541 | unsigned int __c) { |
| 18542 | #ifdef __LITTLE_ENDIAN__ |
| 18543 | return __builtin_altivec_vinswvlx(__b, __c, __a); |
| 18544 | #else |
| 18545 | return __builtin_altivec_vinswvrx(__b, __c, __a); |
| 18546 | #endif |
| 18547 | } |
| 18548 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18549 | /* vec_extractl */ |
| 18550 | |
| 18551 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( |
| 18552 | vector unsigned char __a, vector unsigned char __b, unsigned int __c) { |
| 18553 | #ifdef __LITTLE_ENDIAN__ |
| 18554 | return __builtin_altivec_vextdubvrx(__a, __b, __c); |
| 18555 | #else |
| 18556 | vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); |
| 18557 | return vec_sld(__ret, __ret, 8); |
| 18558 | #endif |
| 18559 | } |
| 18560 | |
| 18561 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( |
| 18562 | vector unsigned short __a, vector unsigned short __b, unsigned int __c) { |
| 18563 | #ifdef __LITTLE_ENDIAN__ |
| 18564 | return __builtin_altivec_vextduhvrx(__a, __b, __c); |
| 18565 | #else |
| 18566 | vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); |
| 18567 | return vec_sld(__ret, __ret, 8); |
| 18568 | #endif |
| 18569 | } |
| 18570 | |
| 18571 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( |
| 18572 | vector unsigned int __a, vector unsigned int __b, unsigned int __c) { |
| 18573 | #ifdef __LITTLE_ENDIAN__ |
| 18574 | return __builtin_altivec_vextduwvrx(__a, __b, __c); |
| 18575 | #else |
| 18576 | vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); |
| 18577 | return vec_sld(__ret, __ret, 8); |
| 18578 | #endif |
| 18579 | } |
| 18580 | |
| 18581 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18582 | vec_extractl(vector unsigned long long __a, vector unsigned long long __b, |
| 18583 | unsigned int __c) { |
| 18584 | #ifdef __LITTLE_ENDIAN__ |
| 18585 | return __builtin_altivec_vextddvrx(__a, __b, __c); |
| 18586 | #else |
| 18587 | vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); |
| 18588 | return vec_sld(__ret, __ret, 8); |
| 18589 | #endif |
| 18590 | } |
| 18591 | |
| 18592 | /* vec_extracth */ |
| 18593 | |
| 18594 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( |
| 18595 | vector unsigned char __a, vector unsigned char __b, unsigned int __c) { |
| 18596 | #ifdef __LITTLE_ENDIAN__ |
| 18597 | return __builtin_altivec_vextdubvlx(__a, __b, __c); |
| 18598 | #else |
| 18599 | vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); |
| 18600 | return vec_sld(__ret, __ret, 8); |
| 18601 | #endif |
| 18602 | } |
| 18603 | |
| 18604 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( |
| 18605 | vector unsigned short __a, vector unsigned short __b, unsigned int __c) { |
| 18606 | #ifdef __LITTLE_ENDIAN__ |
| 18607 | return __builtin_altivec_vextduhvlx(__a, __b, __c); |
| 18608 | #else |
| 18609 | vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); |
| 18610 | return vec_sld(__ret, __ret, 8); |
| 18611 | #endif |
| 18612 | } |
| 18613 | |
| 18614 | static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( |
| 18615 | vector unsigned int __a, vector unsigned int __b, unsigned int __c) { |
| 18616 | #ifdef __LITTLE_ENDIAN__ |
| 18617 | return __builtin_altivec_vextduwvlx(__a, __b, __c); |
| 18618 | #else |
| 18619 | vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); |
| 18620 | return vec_sld(__ret, __ret, 8); |
| 18621 | #endif |
| 18622 | } |
| 18623 | |
| 18624 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18625 | vec_extracth(vector unsigned long long __a, vector unsigned long long __b, |
| 18626 | unsigned int __c) { |
| 18627 | #ifdef __LITTLE_ENDIAN__ |
| 18628 | return __builtin_altivec_vextddvlx(__a, __b, __c); |
| 18629 | #else |
| 18630 | vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); |
| 18631 | return vec_sld(__ret, __ret, 8); |
| 18632 | #endif |
| 18633 | } |
| 18634 | |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18635 | #ifdef __VSX__ |
| 18636 | |
| 18637 | /* vec_permx */ |
| 18638 | |
| 18639 | #define vec_permx(__a, __b, __c, __d) \ |
| 18640 | __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) |
| 18641 | |
| 18642 | /* vec_blendv */ |
| 18643 | |
| 18644 | static __inline__ vector signed char __ATTRS_o_ai |
| 18645 | vec_blendv(vector signed char __a, vector signed char __b, |
| 18646 | vector unsigned char __c) { |
| 18647 | return __builtin_vsx_xxblendvb(__a, __b, __c); |
| 18648 | } |
| 18649 | |
| 18650 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18651 | vec_blendv(vector unsigned char __a, vector unsigned char __b, |
| 18652 | vector unsigned char __c) { |
| 18653 | return __builtin_vsx_xxblendvb(__a, __b, __c); |
| 18654 | } |
| 18655 | |
| 18656 | static __inline__ vector signed short __ATTRS_o_ai |
| 18657 | vec_blendv(vector signed short __a, vector signed short __b, |
| 18658 | vector unsigned short __c) { |
| 18659 | return __builtin_vsx_xxblendvh(__a, __b, __c); |
| 18660 | } |
| 18661 | |
| 18662 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18663 | vec_blendv(vector unsigned short __a, vector unsigned short __b, |
| 18664 | vector unsigned short __c) { |
| 18665 | return __builtin_vsx_xxblendvh(__a, __b, __c); |
| 18666 | } |
| 18667 | |
| 18668 | static __inline__ vector signed int __ATTRS_o_ai |
| 18669 | vec_blendv(vector signed int __a, vector signed int __b, |
| 18670 | vector unsigned int __c) { |
| 18671 | return __builtin_vsx_xxblendvw(__a, __b, __c); |
| 18672 | } |
| 18673 | |
| 18674 | static __inline__ vector unsigned int __ATTRS_o_ai |
| 18675 | vec_blendv(vector unsigned int __a, vector unsigned int __b, |
| 18676 | vector unsigned int __c) { |
| 18677 | return __builtin_vsx_xxblendvw(__a, __b, __c); |
| 18678 | } |
| 18679 | |
| 18680 | static __inline__ vector signed long long __ATTRS_o_ai |
| 18681 | vec_blendv(vector signed long long __a, vector signed long long __b, |
| 18682 | vector unsigned long long __c) { |
| 18683 | return __builtin_vsx_xxblendvd(__a, __b, __c); |
| 18684 | } |
| 18685 | |
| 18686 | static __inline__ vector unsigned long long __ATTRS_o_ai |
| 18687 | vec_blendv(vector unsigned long long __a, vector unsigned long long __b, |
| 18688 | vector unsigned long long __c) { |
| 18689 | return __builtin_vsx_xxblendvd(__a, __b, __c); |
| 18690 | } |
| 18691 | |
| 18692 | static __inline__ vector float __ATTRS_o_ai |
| 18693 | vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { |
| 18694 | return __builtin_vsx_xxblendvw(__a, __b, __c); |
| 18695 | } |
| 18696 | |
| 18697 | static __inline__ vector double __ATTRS_o_ai |
| 18698 | vec_blendv(vector double __a, vector double __b, |
| 18699 | vector unsigned long long __c) { |
| 18700 | return __builtin_vsx_xxblendvd(__a, __b, __c); |
| 18701 | } |
| 18702 | |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18703 | /* vec_replace_elt */ |
| 18704 | |
| 18705 | #define vec_replace_elt __builtin_altivec_vec_replace_elt |
| 18706 | |
| 18707 | /* vec_replace_unaligned */ |
| 18708 | |
| 18709 | #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned |
| 18710 | |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18711 | /* vec_splati */ |
| 18712 | |
| 18713 | #define vec_splati(__a) \ |
| 18714 | _Generic((__a), signed int \ |
| 18715 | : ((vector signed int)__a), unsigned int \ |
| 18716 | : ((vector unsigned int)__a), float \ |
| 18717 | : ((vector float)__a)) |
| 18718 | |
| 18719 | /* vec_spatid */ |
| 18720 | |
| 18721 | static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { |
| 18722 | return ((vector double)((double)__a)); |
| 18723 | } |
| 18724 | |
| 18725 | /* vec_splati_ins */ |
| 18726 | |
| 18727 | static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( |
| 18728 | vector signed int __a, const unsigned int __b, const signed int __c) { |
| 18729 | #ifdef __LITTLE_ENDIAN__ |
| 18730 | __a[1 - __b] = __c; |
| 18731 | __a[3 - __b] = __c; |
| 18732 | #else |
| 18733 | __a[__b] = __c; |
| 18734 | __a[2 + __b] = __c; |
| 18735 | #endif |
| 18736 | return __a; |
| 18737 | } |
| 18738 | |
| 18739 | static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( |
| 18740 | vector unsigned int __a, const unsigned int __b, const unsigned int __c) { |
| 18741 | #ifdef __LITTLE_ENDIAN__ |
| 18742 | __a[1 - __b] = __c; |
| 18743 | __a[3 - __b] = __c; |
| 18744 | #else |
| 18745 | __a[__b] = __c; |
| 18746 | __a[2 + __b] = __c; |
| 18747 | #endif |
| 18748 | return __a; |
| 18749 | } |
| 18750 | |
| 18751 | static __inline__ vector float __ATTRS_o_ai |
| 18752 | vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { |
| 18753 | #ifdef __LITTLE_ENDIAN__ |
| 18754 | __a[1 - __b] = __c; |
| 18755 | __a[3 - __b] = __c; |
| 18756 | #else |
| 18757 | __a[__b] = __c; |
| 18758 | __a[2 + __b] = __c; |
| 18759 | #endif |
| 18760 | return __a; |
| 18761 | } |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18762 | |
| 18763 | /* vec_test_lsbb_all_ones */ |
| 18764 | |
| 18765 | static __inline__ int __ATTRS_o_ai |
| 18766 | vec_test_lsbb_all_ones(vector unsigned char __a) { |
| 18767 | return __builtin_vsx_xvtlsbb(__a, 1); |
| 18768 | } |
| 18769 | |
| 18770 | /* vec_test_lsbb_all_zeros */ |
| 18771 | |
| 18772 | static __inline__ int __ATTRS_o_ai |
| 18773 | vec_test_lsbb_all_zeros(vector unsigned char __a) { |
| 18774 | return __builtin_vsx_xvtlsbb(__a, 0); |
| 18775 | } |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18776 | #endif /* __VSX__ */ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18777 | |
| 18778 | /* vec_stril */ |
| 18779 | |
| 18780 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18781 | vec_stril(vector unsigned char __a) { |
| 18782 | #ifdef __LITTLE_ENDIAN__ |
| 18783 | return __builtin_altivec_vstribr((vector signed char)__a); |
| 18784 | #else |
| 18785 | return __builtin_altivec_vstribl((vector signed char)__a); |
| 18786 | #endif |
| 18787 | } |
| 18788 | |
| 18789 | static __inline__ vector signed char __ATTRS_o_ai |
| 18790 | vec_stril(vector signed char __a) { |
| 18791 | #ifdef __LITTLE_ENDIAN__ |
| 18792 | return __builtin_altivec_vstribr(__a); |
| 18793 | #else |
| 18794 | return __builtin_altivec_vstribl(__a); |
| 18795 | #endif |
| 18796 | } |
| 18797 | |
| 18798 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18799 | vec_stril(vector unsigned short __a) { |
| 18800 | #ifdef __LITTLE_ENDIAN__ |
| 18801 | return __builtin_altivec_vstrihr((vector signed short)__a); |
| 18802 | #else |
| 18803 | return __builtin_altivec_vstrihl((vector signed short)__a); |
| 18804 | #endif |
| 18805 | } |
| 18806 | |
| 18807 | static __inline__ vector signed short __ATTRS_o_ai |
| 18808 | vec_stril(vector signed short __a) { |
| 18809 | #ifdef __LITTLE_ENDIAN__ |
| 18810 | return __builtin_altivec_vstrihr(__a); |
| 18811 | #else |
| 18812 | return __builtin_altivec_vstrihl(__a); |
| 18813 | #endif |
| 18814 | } |
| 18815 | |
| 18816 | /* vec_stril_p */ |
| 18817 | |
| 18818 | static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { |
| 18819 | #ifdef __LITTLE_ENDIAN__ |
| 18820 | return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); |
| 18821 | #else |
| 18822 | return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); |
| 18823 | #endif |
| 18824 | } |
| 18825 | |
| 18826 | static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { |
| 18827 | #ifdef __LITTLE_ENDIAN__ |
| 18828 | return __builtin_altivec_vstribr_p(__CR6_EQ, __a); |
| 18829 | #else |
| 18830 | return __builtin_altivec_vstribl_p(__CR6_EQ, __a); |
| 18831 | #endif |
| 18832 | } |
| 18833 | |
| 18834 | static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { |
| 18835 | #ifdef __LITTLE_ENDIAN__ |
| 18836 | return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); |
| 18837 | #else |
| 18838 | return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); |
| 18839 | #endif |
| 18840 | } |
| 18841 | |
| 18842 | static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { |
| 18843 | #ifdef __LITTLE_ENDIAN__ |
| 18844 | return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); |
| 18845 | #else |
| 18846 | return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); |
| 18847 | #endif |
| 18848 | } |
| 18849 | |
| 18850 | /* vec_strir */ |
| 18851 | |
| 18852 | static __inline__ vector unsigned char __ATTRS_o_ai |
| 18853 | vec_strir(vector unsigned char __a) { |
| 18854 | #ifdef __LITTLE_ENDIAN__ |
| 18855 | return __builtin_altivec_vstribl((vector signed char)__a); |
| 18856 | #else |
| 18857 | return __builtin_altivec_vstribr((vector signed char)__a); |
| 18858 | #endif |
| 18859 | } |
| 18860 | |
| 18861 | static __inline__ vector signed char __ATTRS_o_ai |
| 18862 | vec_strir(vector signed char __a) { |
| 18863 | #ifdef __LITTLE_ENDIAN__ |
| 18864 | return __builtin_altivec_vstribl(__a); |
| 18865 | #else |
| 18866 | return __builtin_altivec_vstribr(__a); |
| 18867 | #endif |
| 18868 | } |
| 18869 | |
| 18870 | static __inline__ vector unsigned short __ATTRS_o_ai |
| 18871 | vec_strir(vector unsigned short __a) { |
| 18872 | #ifdef __LITTLE_ENDIAN__ |
| 18873 | return __builtin_altivec_vstrihl((vector signed short)__a); |
| 18874 | #else |
| 18875 | return __builtin_altivec_vstrihr((vector signed short)__a); |
| 18876 | #endif |
| 18877 | } |
| 18878 | |
| 18879 | static __inline__ vector signed short __ATTRS_o_ai |
| 18880 | vec_strir(vector signed short __a) { |
| 18881 | #ifdef __LITTLE_ENDIAN__ |
| 18882 | return __builtin_altivec_vstrihl(__a); |
| 18883 | #else |
| 18884 | return __builtin_altivec_vstrihr(__a); |
| 18885 | #endif |
| 18886 | } |
| 18887 | |
| 18888 | /* vec_strir_p */ |
| 18889 | |
| 18890 | static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { |
| 18891 | #ifdef __LITTLE_ENDIAN__ |
| 18892 | return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); |
| 18893 | #else |
| 18894 | return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); |
| 18895 | #endif |
| 18896 | } |
| 18897 | |
| 18898 | static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { |
| 18899 | #ifdef __LITTLE_ENDIAN__ |
| 18900 | return __builtin_altivec_vstribl_p(__CR6_EQ, __a); |
| 18901 | #else |
| 18902 | return __builtin_altivec_vstribr_p(__CR6_EQ, __a); |
| 18903 | #endif |
| 18904 | } |
| 18905 | |
| 18906 | static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { |
| 18907 | #ifdef __LITTLE_ENDIAN__ |
| 18908 | return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); |
| 18909 | #else |
| 18910 | return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); |
| 18911 | #endif |
| 18912 | } |
| 18913 | |
| 18914 | static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { |
| 18915 | #ifdef __LITTLE_ENDIAN__ |
| 18916 | return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); |
| 18917 | #else |
| 18918 | return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); |
| 18919 | #endif |
| 18920 | } |
| 18921 | |
| 18922 | /* vs[l | r | ra] */ |
| 18923 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18924 | #ifdef __SIZEOF_INT128__ |
Sasha Smundak | 4b1f33a | 2021-01-11 15:05:07 -0800 | [diff] [blame] | 18925 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18926 | vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 18927 | return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * |
| 18928 | __CHAR_BIT__)); |
| 18929 | } |
| 18930 | |
| 18931 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 18932 | vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { |
| 18933 | return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * |
| 18934 | __CHAR_BIT__)); |
| 18935 | } |
| 18936 | |
| 18937 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18938 | vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 18939 | return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * |
| 18940 | __CHAR_BIT__)); |
| 18941 | } |
| 18942 | |
| 18943 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 18944 | vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { |
| 18945 | return ( |
| 18946 | vector signed __int128)(((vector unsigned __int128)__a) >> |
| 18947 | (__b % |
| 18948 | (vector unsigned __int128)(sizeof( |
| 18949 | unsigned __int128) * |
| 18950 | __CHAR_BIT__))); |
| 18951 | } |
| 18952 | |
| 18953 | static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| 18954 | vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| 18955 | return ( |
| 18956 | vector unsigned __int128)(((vector signed __int128)__a) >> |
| 18957 | (__b % |
| 18958 | (vector unsigned __int128)(sizeof( |
| 18959 | unsigned __int128) * |
| 18960 | __CHAR_BIT__))); |
| 18961 | } |
| 18962 | |
| 18963 | static __inline__ vector signed __int128 __ATTRS_o_ai |
| 18964 | vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { |
| 18965 | return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * |
| 18966 | __CHAR_BIT__)); |
| 18967 | } |
| 18968 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 18969 | #endif /* __SIZEOF_INT128__ */ |
Sasha Smundak | 0fc590b | 2020-10-07 08:11:59 -0700 | [diff] [blame] | 18970 | #endif /* __POWER10_VECTOR__ */ |
| 18971 | |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 18972 | #undef __ATTRS_o_ai |
| 18973 | |
| 18974 | #endif /* __ALTIVEC_H */ |