IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
AddReg.h
Go to the documentation of this file.
1 // AddReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_ADDREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_ADDREG_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
35 template <>
37 {
38  static IPSDK_FORCEINLINE
40  act(const AvxType<ipInt32>::Type& in1,
41  const AvxType<ipInt32>::Type& in2)
42  {
44  act(in1, in2, out);
45  return out;
46  }
47 
48  static IPSDK_FORCEINLINE
49  void
50  act(const AvxType<ipInt32>::Type& in1,
51  const AvxType<ipInt32>::Type& in2,
53  {
54  __m128i in11, in12;
55  __m128i in21, in22;
56  COPY_IMM_TO_XMM(in1, in11, in12);
57  COPY_IMM_TO_XMM(in2, in21, in22);
58  __m128i out1 = _mm_add_epi32(in11, in21);
59  __m128i out2 = _mm_add_epi32(in12, in22);
60  COPY_XMM_TO_IMM(out1, out2, out);
61  }
62 };
63 
66 template <>
68 {
69  static IPSDK_FORCEINLINE
71  act(const AvxType<ipReal32>::Type& in1, const AvxType<ipReal32>::Type& in2)
72  {
73  return _mm256_add_ps(in1, in2);
74  }
75 
76  static IPSDK_FORCEINLINE
77  void
78  act(const AvxType<ipReal32>::Type& in1,
79  const AvxType<ipReal32>::Type& in2,
81  {
82  out = _mm256_add_ps(in1, in2);
83  }
84 };
85 
88 template <>
90 {
91  static IPSDK_FORCEINLINE
93  act(const AvxType<ipReal64>::Type& in1, const AvxType<ipReal64>::Type& in2)
94  {
95  return _mm256_add_pd(in1, in2);
96  }
97 
98  static IPSDK_FORCEINLINE
99  void
100  act(const AvxType<ipReal64>::Type& in1,
101  const AvxType<ipReal64>::Type& in2,
103  {
104  out = _mm256_add_pd(in1, in2);
105  }
106 };
107 
110 
111 } // end of namespace detail
112 } // end of namespace simd
113 } // end of namespace ipsdk
114 
115 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_ADDREG_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
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
int32_t ipInt32
Base types definition.
Definition: BaseTypes.h:52
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.
template structure which is specialized to implement the arithmetic addition on 2 scalars or 2 regist...
Definition: AddReg.h:37
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56