Mercurial > hg > CbC > CbC_gcc
diff gcc/config/rs6000/mmintrin.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line diff
--- a/gcc/config/rs6000/mmintrin.h Thu Oct 25 07:37:49 2018 +0900 +++ b/gcc/config/rs6000/mmintrin.h Thu Feb 13 11:34:05 2020 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2018 Free Software Foundation, Inc. +/* Copyright (C) 2002-2020 Free Software Foundation, Inc. This file is part of GCC. @@ -112,7 +112,6 @@ return _mm_cvtsi64_si32 (__i); } -#ifdef __powerpc64__ /* Convert I to a __m64 object. */ /* Intel intrinsic. */ @@ -173,9 +172,14 @@ __vector signed short vm1; __vector signed char vresult; - vm1 = (__vector signed short)__builtin_pack_vector_int128 (__m2, __m1); - vresult = vec_vpkshss (vm1, vm1); - return (__m64) __builtin_unpack_vector_int128 ((__vector __int128)vresult, 0); + vm1 = (__vector signed short) (__vector unsigned long long) +#ifdef __LITTLE_ENDIAN__ + { __m1, __m2 }; +#else + { __m2, __m1 }; +#endif + vresult = vec_packs (vm1, vm1); + return (__m64) ((__vector long long) vresult)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -193,9 +197,14 @@ __vector signed int vm1; __vector signed short vresult; - vm1 = (__vector signed int)__builtin_pack_vector_int128 (__m2, __m1); - vresult = vec_vpkswss (vm1, vm1); - return ((__m64) __builtin_unpack_vector_int128 ((__vector __int128)vresult, 0)); + vm1 = (__vector signed int) (__vector unsigned long long) +#ifdef __LITTLE_ENDIAN__ + { __m1, __m2 }; +#else + { __m2, __m1 }; +#endif + vresult = vec_packs (vm1, vm1); + return (__m64) ((__vector long long) vresult)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -210,12 +219,19 @@ extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_packs_pu16 (__m64 __m1, __m64 __m2) { - __vector signed short vm1; - __vector unsigned char vresult; - - vm1 = (__vector signed short)__builtin_pack_vector_int128 (__m2, __m1); - vresult = vec_vpkshus (vm1, vm1); - return ((__m64) __builtin_unpack_vector_int128 ((__vector __int128)vresult, 0)); + __vector unsigned char r; + __vector signed short vm1 = (__vector signed short) (__vector long long) +#ifdef __LITTLE_ENDIAN__ + { __m1, __m2 }; +#else + { __m2, __m1 }; +#endif + const __vector signed short __zero = { 0 }; + __vector __bool short __select = vec_cmplt (vm1, __zero); + r = vec_packs ((__vector unsigned short) vm1, (__vector unsigned short) vm1); + __vector __bool char packsel = vec_pack (__select, __select); + r = vec_sel (r, (const __vector unsigned char) __zero, packsel); + return (__m64) ((__vector long long) r)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -236,7 +252,7 @@ a = (__vector unsigned char)vec_splats (__m1); b = (__vector unsigned char)vec_splats (__m2); c = vec_mergel (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[1]; #else __m64_union m1, m2, res; @@ -317,7 +333,7 @@ a = (__vector unsigned char)vec_splats (__m1); b = (__vector unsigned char)vec_splats (__m2); c = vec_mergel (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 1)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -398,7 +414,7 @@ a = (__vector signed char)vec_splats (__m1); b = (__vector signed char)vec_splats (__m2); c = vec_add (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -434,7 +450,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = vec_add (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -466,7 +482,7 @@ a = (__vector signed int)vec_splats (__m1); b = (__vector signed int)vec_splats (__m2); c = vec_add (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -496,7 +512,7 @@ a = (__vector signed char)vec_splats (__m1); b = (__vector signed char)vec_splats (__m2); c = vec_sub (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -532,7 +548,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = vec_sub (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -564,7 +580,7 @@ a = (__vector signed int)vec_splats (__m1); b = (__vector signed int)vec_splats (__m2); c = vec_sub (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -581,7 +597,7 @@ extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _m_psubd (__m64 __m1, __m64 __m2) { - return _mm_add_pi32 (__m1, __m2); + return _mm_sub_pi32 (__m1, __m2); } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -711,7 +727,7 @@ extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cmpeq_pi8 (__m64 __m1, __m64 __m2) { -#ifdef _ARCH_PWR6 +#if defined(_ARCH_PWR6) && defined(__powerpc64__) __m64 res; __asm__( "cmpb %0,%1,%2;\n" @@ -754,7 +770,7 @@ a = (__vector signed char)vec_splats (__m1); b = (__vector signed char)vec_splats (__m2); c = (__vector signed char)vec_cmpgt (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -791,7 +807,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = (__vector signed short)vec_cmpeq (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -822,7 +838,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = (__vector signed short)vec_cmpgt (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -855,7 +871,7 @@ a = (__vector signed int)vec_splats (__m1); b = (__vector signed int)vec_splats (__m2); c = (__vector signed int)vec_cmpeq (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -884,7 +900,7 @@ a = (__vector signed int)vec_splats (__m1); b = (__vector signed int)vec_splats (__m2); c = (__vector signed int)vec_cmpgt (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; #else __m64_union m1, m2, res; @@ -915,7 +931,7 @@ a = (__vector signed char)vec_splats (__m1); b = (__vector signed char)vec_splats (__m2); c = vec_adds (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -933,7 +949,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = vec_adds (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -951,7 +967,7 @@ a = (__vector unsigned char)vec_splats (__m1); b = (__vector unsigned char)vec_splats (__m2); c = vec_adds (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -970,7 +986,7 @@ a = (__vector unsigned short)vec_splats (__m1); b = (__vector unsigned short)vec_splats (__m2); c = vec_adds (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -989,7 +1005,7 @@ a = (__vector signed char)vec_splats (__m1); b = (__vector signed char)vec_splats (__m2); c = vec_subs (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1008,7 +1024,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = vec_subs (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1027,7 +1043,7 @@ a = (__vector unsigned char)vec_splats (__m1); b = (__vector unsigned char)vec_splats (__m2); c = vec_subs (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1046,7 +1062,7 @@ a = (__vector unsigned short)vec_splats (__m1); b = (__vector unsigned short)vec_splats (__m2); c = vec_subs (a, b); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1068,7 +1084,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = vec_vmsumshm (a, b, zero); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1085,8 +1101,13 @@ __vector signed short c; __vector signed int w0, w1; __vector unsigned char xform1 = { +#ifdef __LITTLE_ENDIAN__ 0x02, 0x03, 0x12, 0x13, 0x06, 0x07, 0x16, 0x17, 0x0A, 0x0B, 0x1A, 0x1B, 0x0E, 0x0F, 0x1E, 0x1F +#else + 0x00, 0x01, 0x10, 0x11, 0x04, 0x05, 0x14, 0x15, + 0x00, 0x01, 0x10, 0x11, 0x04, 0x05, 0x14, 0x15 +#endif }; a = (__vector signed short)vec_splats (__m1); @@ -1096,7 +1117,7 @@ w1 = vec_vmulosh (a, b); c = (__vector signed short)vec_perm (w0, w1, xform1); - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1115,7 +1136,7 @@ a = (__vector signed short)vec_splats (__m1); b = (__vector signed short)vec_splats (__m2); c = a * b; - return (__builtin_unpack_vector_int128 ((__vector __int128)c, 0)); + return (__m64) ((__vector long long) c)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -1136,7 +1157,7 @@ m = (__vector signed short)vec_splats (__m); c = (__vector unsigned short)vec_splats ((unsigned short)__count); r = vec_sl (m, (__vector unsigned short)c); - return (__builtin_unpack_vector_int128 ((__vector __int128)r, 0)); + return (__m64) ((__vector long long) r)[0]; } else return (0); @@ -1205,7 +1226,7 @@ m = (__vector signed short)vec_splats (__m); c = (__vector unsigned short)vec_splats ((unsigned short)__count); r = vec_sra (m, (__vector unsigned short)c); - return (__builtin_unpack_vector_int128 ((__vector __int128)r, 0)); + return (__m64) ((__vector long long) r)[0]; } else return (0); @@ -1274,7 +1295,7 @@ m = (__vector unsigned short)vec_splats (__m); c = (__vector unsigned short)vec_splats ((unsigned short)__count); r = vec_sr (m, (__vector unsigned short)c); - return (__builtin_unpack_vector_int128 ((__vector __int128)r, 0)); + return (__m64) ((__vector long long) r)[0]; } else return (0); @@ -1417,7 +1438,7 @@ __vector signed short w; w = (__vector signed short)vec_splats (__w); - return (__builtin_unpack_vector_int128 ((__vector __int128)w, 0)); + return (__m64) ((__vector long long) w)[0]; #else __m64_union res; @@ -1437,7 +1458,7 @@ __vector signed char b; b = (__vector signed char)vec_splats (__b); - return (__builtin_unpack_vector_int128 ((__vector __int128)b, 0)); + return (__m64) ((__vector long long) b)[0]; #else __m64_union res; @@ -1452,5 +1473,4 @@ return (res.as_m64); #endif } -#endif /* __powerpc64__ */ #endif /* _MMINTRIN_H_INCLUDED */