Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/i386/immintrin.h @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
1 /* Copyright (C) 2008, 2009 Free Software Foundation, Inc. | 1 /* Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
2 | 2 |
3 This file is part of GCC. | 3 This file is part of GCC. |
4 | 4 |
5 GCC is free software; you can redistribute it and/or modify | 5 GCC is free software; you can redistribute it and/or modify |
6 it under the terms of the GNU General Public License as published by | 6 it under the terms of the GNU General Public License as published by |
54 | 54 |
55 #ifdef __AVX__ | 55 #ifdef __AVX__ |
56 #include <avxintrin.h> | 56 #include <avxintrin.h> |
57 #endif | 57 #endif |
58 | 58 |
59 #ifdef __RDRND__ | |
60 extern __inline int | |
61 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
62 _rdrand16_step (unsigned short *__P) | |
63 { | |
64 return __builtin_ia32_rdrand16_step (__P); | |
65 } | |
66 | |
67 extern __inline int | |
68 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
69 _rdrand32_step (unsigned int *__P) | |
70 { | |
71 return __builtin_ia32_rdrand32_step (__P); | |
72 } | |
73 #endif /* __RDRND__ */ | |
74 | |
75 #ifdef __x86_64__ | |
76 #ifdef __FSGSBASE__ | |
77 extern __inline unsigned int | |
78 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
79 _readfsbase_u32 (void) | |
80 { | |
81 return __builtin_ia32_rdfsbase32 (); | |
82 } | |
83 | |
84 extern __inline unsigned long long | |
85 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
86 _readfsbase_u64 (void) | |
87 { | |
88 return __builtin_ia32_rdfsbase64 (); | |
89 } | |
90 | |
91 extern __inline unsigned int | |
92 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
93 _readgsbase_u32 (void) | |
94 { | |
95 return __builtin_ia32_rdgsbase32 (); | |
96 } | |
97 | |
98 extern __inline unsigned long long | |
99 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
100 _readgsbase_u64 (void) | |
101 { | |
102 return __builtin_ia32_rdgsbase64 (); | |
103 } | |
104 | |
105 extern __inline void | |
106 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
107 _writefsbase_u32 (unsigned int __B) | |
108 { | |
109 __builtin_ia32_wrfsbase32 (__B); | |
110 } | |
111 | |
112 extern __inline void | |
113 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
114 _writefsbase_u64 (unsigned long long __B) | |
115 { | |
116 __builtin_ia32_wrfsbase64 (__B); | |
117 } | |
118 | |
119 extern __inline void | |
120 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
121 _writegsbase_u32 (unsigned int __B) | |
122 { | |
123 __builtin_ia32_wrgsbase32 (__B); | |
124 } | |
125 | |
126 extern __inline void | |
127 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
128 _writegsbase_u64 (unsigned long long __B) | |
129 { | |
130 __builtin_ia32_wrgsbase64 (__B); | |
131 } | |
132 #endif /* __FSGSBASE__ */ | |
133 | |
134 #ifdef __RDRND__ | |
135 extern __inline int | |
136 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
137 _rdrand64_step (unsigned long long *__P) | |
138 { | |
139 return __builtin_ia32_rdrand64_step (__P); | |
140 } | |
141 #endif /* __RDRND__ */ | |
142 #endif /* __x86_64__ */ | |
143 | |
144 #ifdef __F16C__ | |
145 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
146 _cvtsh_ss (unsigned short __S) | |
147 { | |
148 __v8hi __H = __extension__ (__v8hi){ __S, 0, 0, 0, 0, 0, 0, 0 }; | |
149 __v4sf __A = __builtin_ia32_vcvtph2ps (__H); | |
150 return __builtin_ia32_vec_ext_v4sf (__A, 0); | |
151 } | |
152 | |
153 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
154 _mm_cvtph_ps (__m128i __A) | |
155 { | |
156 return (__m128) __builtin_ia32_vcvtph2ps ((__v8hi) __A); | |
157 } | |
158 | |
159 extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
160 _mm256_cvtph_ps (__m128i __A) | |
161 { | |
162 return (__m256) __builtin_ia32_vcvtph2ps256 ((__v8hi) __A); | |
163 } | |
164 | |
165 #ifdef __OPTIMIZE__ | |
166 extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
167 _cvtss_sh (float __F, const int __I) | |
168 { | |
169 __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; | |
170 __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); | |
171 return (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); | |
172 } | |
173 | |
174 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
175 _mm_cvtps_ph (__m128 __A, const int __I) | |
176 { | |
177 return (__m128i) __builtin_ia32_vcvtps2ph ((__v4sf) __A, __I); | |
178 } | |
179 | |
180 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
181 _mm256_cvtps_ph (__m256 __A, const int __I) | |
182 { | |
183 return (__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf) __A, __I); | |
184 } | |
185 #else | |
186 #define _cvtss_sh(__F, __I) \ | |
187 (__extension__ \ | |
188 ({ \ | |
189 __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; \ | |
190 __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); \ | |
191 (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); \ | |
192 })) | |
193 | |
194 #define _mm_cvtps_ph(A, I) \ | |
195 ((__m128i) __builtin_ia32_vcvtps2ph ((__v4sf)(__m128) A, (int) (I))) | |
196 | |
197 #define _mm256_cvtps_ph(A, I) \ | |
198 ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I))) | |
199 #endif | |
200 | |
201 #endif /* __F16C__ */ | |
202 | |
59 #endif /* _IMMINTRIN_H_INCLUDED */ | 203 #endif /* _IMMINTRIN_H_INCLUDED */ |