IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
SubReg.h
Go to the documentation of this file.
1 // SubReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_SUBREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_SUBREG_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_sub_epi32(in11, in21);
59  __m128i out2 = _mm_sub_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,
72  const AvxType<ipReal32>::Type& in2)
73  {
74  return _mm256_sub_ps(in1, in2);
75  }
76 
77  static IPSDK_FORCEINLINE
78  void
79  act(const AvxType<ipReal32>::Type& in1,
80  const AvxType<ipReal32>::Type& in2,
82  {
83  out = _mm256_sub_ps(in1, in2);
84  }
85 };
86 
89 template <>
91 {
92  static IPSDK_FORCEINLINE
94  act(const AvxType<ipReal64>::Type& in1,
95  const AvxType<ipReal64>::Type& in2)
96  {
97  return _mm256_sub_pd(in1, in2);
98  }
99 
100  static IPSDK_FORCEINLINE
101  void
102  act(const AvxType<ipReal64>::Type& in1,
103  const AvxType<ipReal64>::Type& in2,
105  {
106  out = _mm256_sub_pd(in1, in2);
107  }
108 };
109 
112 
113 } // end of namespace detail
114 } // end of namespace simd
115 } // end of namespace ipsdk
116 
117 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_SUBREG_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: SubReg.h:39
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.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56