Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/i386/smmintrin.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | f6334be47118 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
33 #else | 33 #else |
34 | 34 |
35 /* We need definitions from the SSSE3, SSE3, SSE2 and SSE header | 35 /* We need definitions from the SSSE3, SSE3, SSE2 and SSE header |
36 files. */ | 36 files. */ |
37 #include <tmmintrin.h> | 37 #include <tmmintrin.h> |
38 #include <mmintrin-common.h> | 38 |
39 /* Rounding mode macros. */ | |
40 #define _MM_FROUND_TO_NEAREST_INT 0x00 | |
41 #define _MM_FROUND_TO_NEG_INF 0x01 | |
42 #define _MM_FROUND_TO_POS_INF 0x02 | |
43 #define _MM_FROUND_TO_ZERO 0x03 | |
44 #define _MM_FROUND_CUR_DIRECTION 0x04 | |
45 | |
46 #define _MM_FROUND_RAISE_EXC 0x00 | |
47 #define _MM_FROUND_NO_EXC 0x08 | |
48 | |
49 #define _MM_FROUND_NINT \ | |
50 (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_RAISE_EXC) | |
51 #define _MM_FROUND_FLOOR \ | |
52 (_MM_FROUND_TO_NEG_INF | _MM_FROUND_RAISE_EXC) | |
53 #define _MM_FROUND_CEIL \ | |
54 (_MM_FROUND_TO_POS_INF | _MM_FROUND_RAISE_EXC) | |
55 #define _MM_FROUND_TRUNC \ | |
56 (_MM_FROUND_TO_ZERO | _MM_FROUND_RAISE_EXC) | |
57 #define _MM_FROUND_RINT \ | |
58 (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_RAISE_EXC) | |
59 #define _MM_FROUND_NEARBYINT \ | |
60 (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) | |
61 | |
62 /* Test Instruction */ | |
63 /* Packed integer 128-bit bitwise comparison. Return 1 if | |
64 (__V & __M) == 0. */ | |
65 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
66 _mm_testz_si128 (__m128i __M, __m128i __V) | |
67 { | |
68 return __builtin_ia32_ptestz128 ((__v2di)__M, (__v2di)__V); | |
69 } | |
70 | |
71 /* Packed integer 128-bit bitwise comparison. Return 1 if | |
72 (__V & ~__M) == 0. */ | |
73 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
74 _mm_testc_si128 (__m128i __M, __m128i __V) | |
75 { | |
76 return __builtin_ia32_ptestc128 ((__v2di)__M, (__v2di)__V); | |
77 } | |
78 | |
79 /* Packed integer 128-bit bitwise comparison. Return 1 if | |
80 (__V & __M) != 0 && (__V & ~__M) != 0. */ | |
81 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
82 _mm_testnzc_si128 (__m128i __M, __m128i __V) | |
83 { | |
84 return __builtin_ia32_ptestnzc128 ((__v2di)__M, (__v2di)__V); | |
85 } | |
86 | |
87 /* Macros for packed integer 128-bit comparison intrinsics. */ | |
88 #define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V)) | |
89 | |
90 #define _mm_test_all_ones(V) \ | |
91 _mm_testc_si128 ((V), _mm_cmpeq_epi32 ((V), (V))) | |
92 | |
93 #define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128 ((M), (V)) | |
94 | |
95 /* Packed/scalar double precision floating point rounding. */ | |
96 | |
97 #ifdef __OPTIMIZE__ | |
98 extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
99 _mm_round_pd (__m128d __V, const int __M) | |
100 { | |
101 return (__m128d) __builtin_ia32_roundpd ((__v2df)__V, __M); | |
102 } | |
103 | |
104 extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
105 _mm_round_sd(__m128d __D, __m128d __V, const int __M) | |
106 { | |
107 return (__m128d) __builtin_ia32_roundsd ((__v2df)__D, | |
108 (__v2df)__V, | |
109 __M); | |
110 } | |
111 #else | |
112 #define _mm_round_pd(V, M) \ | |
113 ((__m128d) __builtin_ia32_roundpd ((__v2df)(__m128d)(V), (int)(M))) | |
114 | |
115 #define _mm_round_sd(D, V, M) \ | |
116 ((__m128d) __builtin_ia32_roundsd ((__v2df)(__m128d)(D), \ | |
117 (__v2df)(__m128d)(V), (int)(M))) | |
118 #endif | |
119 | |
120 /* Packed/scalar single precision floating point rounding. */ | |
121 | |
122 #ifdef __OPTIMIZE__ | |
123 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
124 _mm_round_ps (__m128 __V, const int __M) | |
125 { | |
126 return (__m128) __builtin_ia32_roundps ((__v4sf)__V, __M); | |
127 } | |
128 | |
129 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
130 _mm_round_ss (__m128 __D, __m128 __V, const int __M) | |
131 { | |
132 return (__m128) __builtin_ia32_roundss ((__v4sf)__D, | |
133 (__v4sf)__V, | |
134 __M); | |
135 } | |
136 #else | |
137 #define _mm_round_ps(V, M) \ | |
138 ((__m128) __builtin_ia32_roundps ((__v4sf)(__m128)(V), (int)(M))) | |
139 | |
140 #define _mm_round_ss(D, V, M) \ | |
141 ((__m128) __builtin_ia32_roundss ((__v4sf)(__m128)(D), \ | |
142 (__v4sf)(__m128)(V), (int)(M))) | |
143 #endif | |
144 | |
145 /* Macros for ceil/floor intrinsics. */ | |
146 #define _mm_ceil_pd(V) _mm_round_pd ((V), _MM_FROUND_CEIL) | |
147 #define _mm_ceil_sd(D, V) _mm_round_sd ((D), (V), _MM_FROUND_CEIL) | |
148 | |
149 #define _mm_floor_pd(V) _mm_round_pd((V), _MM_FROUND_FLOOR) | |
150 #define _mm_floor_sd(D, V) _mm_round_sd ((D), (V), _MM_FROUND_FLOOR) | |
151 | |
152 #define _mm_ceil_ps(V) _mm_round_ps ((V), _MM_FROUND_CEIL) | |
153 #define _mm_ceil_ss(D, V) _mm_round_ss ((D), (V), _MM_FROUND_CEIL) | |
154 | |
155 #define _mm_floor_ps(V) _mm_round_ps ((V), _MM_FROUND_FLOOR) | |
156 #define _mm_floor_ss(D, V) _mm_round_ss ((D), (V), _MM_FROUND_FLOOR) | |
39 | 157 |
40 /* SSE4.1 */ | 158 /* SSE4.1 */ |
41 | 159 |
42 /* Integer blend instructions - select data from 2 sources using | 160 /* Integer blend instructions - select data from 2 sources using |
43 constant/variable mask. */ | 161 constant/variable mask. */ |
673 _mm_cmpgt_epi64 (__m128i __X, __m128i __Y) | 791 _mm_cmpgt_epi64 (__m128i __X, __m128i __Y) |
674 { | 792 { |
675 return (__m128i) __builtin_ia32_pcmpgtq ((__v2di)__X, (__v2di)__Y); | 793 return (__m128i) __builtin_ia32_pcmpgtq ((__v2di)__X, (__v2di)__Y); |
676 } | 794 } |
677 | 795 |
678 /* Calculate a number of bits set to 1. */ | 796 #ifdef __POPCNT__ |
679 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 797 #include <popcntintrin.h> |
680 _mm_popcnt_u32 (unsigned int __X) | |
681 { | |
682 return __builtin_popcount (__X); | |
683 } | |
684 | |
685 #ifdef __x86_64__ | |
686 extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
687 _mm_popcnt_u64 (unsigned long long __X) | |
688 { | |
689 return __builtin_popcountll (__X); | |
690 } | |
691 #endif | 798 #endif |
692 | 799 |
693 /* Accumulate CRC32 (polynomial 0x11EDC6F41) value. */ | 800 /* Accumulate CRC32 (polynomial 0x11EDC6F41) value. */ |
694 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 801 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
695 _mm_crc32_u8 (unsigned int __C, unsigned char __V) | 802 _mm_crc32_u8 (unsigned int __C, unsigned char __V) |