IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseAndNotReg.h
Go to the documentation of this file.
1 // BitwiseAndNotReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISEANDNOTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISEANDNOTREG_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
30 template <typename T>
32  typename boost::enable_if_c<boost::is_integral<T>::value>::type>
33 {
34  static IPSDK_FORCEINLINE
35  typename AvxType<T>::Type
36  act(const typename AvxType<T>::Type& in1, const typename AvxType<T>::Type& in2)
37  {
39  act(in1, in2, out);
40  return out;
41  }
42 
43  static IPSDK_FORCEINLINE
44  void
45  act(const typename AvxType<T>::Type& in1,
46  const typename AvxType<T>::Type& in2,
47  typename AvxType<T>::Type& out)
48  {
49  __m128i in11, in12;
50  __m128i in21, in22;
51  COPY_IMM_TO_XMM(in1, in11, in12);
52  COPY_IMM_TO_XMM(in2, in21, in22);
53  __m128i out1 = _mm_andnot_si128(in21, in11);
54  __m128i out2 = _mm_andnot_si128(in22, in12);
55  COPY_XMM_TO_IMM(out1, out2, out);
56  }
57 };
58 
59 template <>
61 {
62  static IPSDK_FORCEINLINE
64  act(const AvxType<ipReal32>::Type& in1,
65  const AvxType<ipReal32>::Type& in2)
66  {
67  return _mm256_andnot_ps(in2, in1);
68  }
69 
70  static IPSDK_FORCEINLINE
71  void
72  act(const AvxType<ipReal32>::Type& in1,
73  const AvxType<ipReal32>::Type& in2,
75  {
76  out = _mm256_andnot_ps(in2, in1);
77  }
78 };
79 
80 template <>
82 {
83  static IPSDK_FORCEINLINE
85  act(const AvxType<ipReal64>::Type& in1,
86  const AvxType<ipReal64>::Type& in2)
87  {
88  return _mm256_andnot_pd(in2, in1);
89  }
90 
91  static IPSDK_FORCEINLINE
92  void
93  act(const AvxType<ipReal64>::Type& in1,
94  const AvxType<ipReal64>::Type& in2,
96  {
97  out = _mm256_andnot_pd(in2, in1);
98  }
99 };
100 
103 
104 } // end of namespace detail
105 } // end of namespace simd
106 } // end of namespace ipsdk
107 
108 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISEANDNOTREG_H__
Defines the IPSDK_FORCEINLINE.
Functions to convert from 128 (resp. 256) bits registers to 256 (resp. 128) bits registers.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: BitwiseAndNotReg.h:30
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Predefined types for Avx instruction set management.
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Advanced Vector Extensions.
Definition: InstructionSetTypes.h:44
Definition of import/export macro for library.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56