@@ -47,8 +47,6 @@ namespace compass {
4747
4848};
4949
50-
51-
5250#endif
5351namespace compass {
5452
@@ -252,6 +250,106 @@ namespace compass {
252250
253251#endif
254252#ifdef COMPASS_CT_ARCH_X86
253+ #ifndef COMPASS_CT_PREPROCESSOR_IMPL_H_
254+ #define COMPASS_CT_PREPROCESSOR_IMPL_H_
255+
256+
257+
258+ #ifndef WIN32
259+
260+ #if defined(__SSE2__) || defined(__SSE2_MATH__)
261+ #define COMPASS_CT_HAS_SSE2 1
262+ #endif
263+
264+ #if defined(__SSE3__) && defined(__SSSE3__)
265+ #define COMPASS_CT_HAS_SSE3 1
266+ #endif
267+
268+ #if defined(__SSE4_2__) && defined(__SSE4_1__)
269+ #define COMPASS_CT_HAS_SSE4 1
270+ #endif
271+
272+ #else
273+
274+ #if _M_IX86_FP >= 2
275+ #define COMPASS_CT_HAS_SSE2 1
276+ #define COMPASS_CT_HAS_SSE3 1
277+ #define COMPASS_CT_HAS_SSE4 1
278+ #endif
279+ #endif
280+ #ifndef COMPASS_TAGS_H_
281+ #define COMPASS_TAGS_H_
282+
283+
284+ namespace compass {
285+
286+
287+ namespace feature {
288+
289+
290+
291+
292+ struct sse {};
293+ struct sse2 {};
294+ struct sse3 {};
295+ struct sse4 {};
296+
297+
298+ struct avx {};
299+ struct avx2 {};
300+
301+
302+ };
303+
304+
305+ };
306+ #endif
307+ namespace compass {
308+
309+ namespace compiletime {
310+
311+ template <typename feature_t >
312+ struct has {
313+ static const bool enabled = false ;
314+ };
315+
316+ template <>
317+ struct has <feature::sse2>{
318+ static const bool enabled=
319+ #ifdef COMPASS_CT_HAS_SSE2
320+ true ;
321+ #else
322+ false ;
323+ #endif
324+
325+ };
326+
327+ template <>
328+ struct has <feature::sse3>{
329+ static const bool enabled=
330+ #ifdef COMPASS_CT_HAS_SSE3
331+ true ;
332+ #else
333+ false ;
334+ #endif
335+
336+ };
337+
338+ template <>
339+ struct has <feature::sse4>{
340+ static const bool enabled=
341+ #ifdef COMPASS_CT_HAS_SSE4
342+ true ;
343+ #else
344+ false ;
345+ #endif
346+
347+ };
348+
349+ };
350+ };
351+
352+ #endif
255353#ifndef COMPASS_RT_X86_IMPL_H_
256354#define COMPASS_RT_X86_IMPL_H_
257355#ifndef COMPASS_RT_X86_CPUID_H
@@ -515,33 +613,6 @@ namespace compass {
515613#endif
516614#endif
517615
518- #endif
519- #ifndef COMPASS_TAGS_H_
520- #define COMPASS_TAGS_H_
521-
522-
523- namespace compass {
524-
525-
526- namespace feature {
527-
528-
529-
530-
531- struct sse {};
532- struct sse2 {};
533- struct sse3 {};
534- struct sse4 {};
535-
536-
537- struct avx {};
538- struct avx2 {};
539-
540-
541- };
542-
543-
544- };
545616#endif
546617#ifndef COMPASS_BIT_VIEW_H
547618#define COMPASS_BIT_VIEW_H
0 commit comments