source: trunk/lib/symtab/library_conversion.h @ 1518

Last change on this file since 1518 was 1517, checked in by vla24, 8 years ago

SymbolTable?: clean up and fix idisa library calls

File size: 1.5 KB
Line 
1#ifndef LIBRARY_CONVERSION_H
2#define LIBRARY_CONVERSION_H
3
4#ifdef USE_IDISA
5#define USE_SSE2
6#include <idisa.hpp>
7#else
8#define TEMPLATED_SIMD_LIB
9#include "../lib_simd.h"
10#endif
11
12template <int fw>
13        class simdLibConvert
14{
15public:
16    static inline SIMD_type splat(SIMD_type v);
17    static inline SIMD_type mergel(SIMD_type r1, SIMD_type r2);
18    static inline SIMD_type mergeh(SIMD_type r1, SIMD_type r2);
19    static inline SIMD_type pack(SIMD_type r1, SIMD_type r2);
20    static inline int movemask(SIMD_type v);
21    static inline void print_simd_register(const char * var_name, SIMD_type v);
22};
23
24template <int fw>
25        inline SIMD_type simdLibConvert<fw>::splat(SIMD_type v)
26{
27#ifdef USE_IDISA
28    return mvmd<fw>::template splat<0>(v);
29#else
30  return simd<fw>::splat(v);
31#endif
32}
33
34template <int fw>
35        inline SIMD_type simdLibConvert<fw>::mergel(SIMD_type r1, SIMD_type r2)
36{
37#ifdef USE_IDISA
38  return esimd<fw>::mergel(r1, r2);
39#else
40  return simd<fw>::mergel(r1, r2);
41#endif
42}
43
44template <int fw>
45        inline SIMD_type simdLibConvert<fw>::mergeh(SIMD_type r1, SIMD_type r2)
46{
47#ifdef USE_IDISA
48  return esimd<fw>::mergeh(r1, r2);
49#else
50  return simd<fw>::mergeh(r1, r2);
51#endif
52}
53
54template <int fw>
55        inline SIMD_type simdLibConvert<fw>::pack(SIMD_type r1, SIMD_type r2)
56{
57#ifdef USE_IDISA
58  return hsimd<fw>::packl(r1, r2);
59#else
60  return simd<fw>::pack(r1, r2);
61#endif
62}
63
64template <>
65        inline int simdLibConvert<8>::movemask(SIMD_type v)
66{
67#ifdef USE_IDISA
68    return hsimd<8>::signmask(v);
69#else
70  return simd<8>::movemask(v);
71#endif
72}
73#endif // LIBRARY_CONVERSION_H
Note: See TracBrowser for help on using the repository browser.