IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseNotRegImpl.h
Go to the documentation of this file.
1 // BitwiseNotRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_SSE2_BITWISENOTREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_SSE2_BITWISENOTREGIMPL_H__
17 
20 
21 namespace ipsdk {
22 namespace simd {
23 namespace detail {
24 
27 
28 /*template <typename T>
29 struct BitwiseNotReg<eInstructionSet::eIS_Sse2, T,
30  typename boost::enable_if_c<boost::is_integral<T>::value>::type>
31 {
32  static
33  typename Sse2Type<T>::Type
34  act(const typename Sse2Type<T>::Type& in)
35  {
36  const Sse2Type<T>::Type allbits =
37  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0xFF);
38  return _mm_xor_si128(in, allbits);
39  }
40 
41 };
42 
43 template <>
44 struct BitwiseNotReg<eInstructionSet::eIS_Sse2, ipReal32>
45 {
46  static
47  Sse2Type<ipReal32>::Type
48  act(const Sse2Type<ipReal32>::Type& in)
49  {
50  const Sse2Type<ipUInt8>::Type allbits =
51  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0xFF);
52  return _mm_castsi128_ps(_mm_xor_si128(_mm_castps_si128(in), allbits));
53  }
54 };*/
55 
56 template <typename T>
57 IPSDK_FORCEINLINE
58 typename Sse2Type<T>::Type
59 BitwiseNotReg<eInstructionSet::eIS_Sse2, T,
60  typename boost::enable_if_c<boost::is_integral<T>::value>::type>::act(
61  const typename Sse2Type<T>::Type& in)
62 {
63  const typename Sse2Type<T>::Type allbits =
64  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0xFF);
65  return _mm_xor_si128(in, allbits);
66 }
67 
68 template <typename T>
69 IPSDK_FORCEINLINE
70 void
71 BitwiseNotReg<eInstructionSet::eIS_Sse2, T,
72  typename boost::enable_if_c<boost::is_integral<T>::value>::type>::act(
73  const typename Sse2Type<T>::Type& in,
74  typename Sse2Type<T>::Type& out)
75 {
76  typename Sse2Type<T>::Type allbits;
77  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(allbits, 0xFF);
78  out = _mm_xor_si128(in, allbits);
79 }
80 
81 IPSDK_FORCEINLINE
82 Sse2Type<ipReal32>::Type
83 BitwiseNotReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
84  const Sse2Type<ipReal32>::Type& in)
85 {
86  const Sse2Type<ipUInt8>::Type allbits =
87  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0xFF);
88  return _mm_castsi128_ps(_mm_xor_si128(_mm_castps_si128(in), allbits));
89 }
90 
91 IPSDK_FORCEINLINE
92 void
93 BitwiseNotReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
94  const Sse2Type<ipReal32>::Type& in,
95  Sse2Type<ipReal32>::Type& out)
96 {
97  Sse2Type<ipUInt8>::Type allbits;
98  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(allbits, 0xFF);
99  out = _mm_castsi128_ps(_mm_xor_si128(_mm_castps_si128(in), allbits));
100 }
101 
102 IPSDK_FORCEINLINE
103 Sse2Type<ipReal64>::Type
104 BitwiseNotReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
105  const Sse2Type<ipReal64>::Type& in)
106 {
107  const Sse2Type<ipUInt8>::Type allbits =
108  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0xFF);
109  return _mm_castsi128_pd(_mm_xor_si128(_mm_castpd_si128(in), allbits));
110 }
111 
112 IPSDK_FORCEINLINE
113 void
114 BitwiseNotReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
115  const Sse2Type<ipReal64>::Type& in,
116  Sse2Type<ipReal64>::Type& out)
117 {
118  Sse2Type<ipUInt8>::Type allbits;
119  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(allbits, 0xFF);
120  out = _mm_castsi128_pd(_mm_xor_si128(_mm_castpd_si128(in), allbits));
121 }
122 
125 
126 } // end of namespace detail
127 } // end of namespace simd
128 } // end of namespace ipsdk
129 
131 
132 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_SSE2_BITWISENOTREGIMPL_H__
declaration of specialized BitwiseAndReg structure for SSE2 instruction set
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36