IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsGreaterEqualRegImpl.h
Go to the documentation of this file.
1 // IsGreaterEqualRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX_ISGREATEREQUALREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX_ISGREATEREQUALREGIMPL_H__
17 
20 
21 namespace ipsdk {
22 namespace simd {
23 namespace detail {
24 
27 
28 template <typename T>
29 IPSDK_FORCEINLINE
30 typename RegMaskType<eInstructionSet::eIS_Avx, T>::Type
31 IsGreaterEqualReg<eInstructionSet::eIS_Avx, T,
32  typename boost::enable_if<
33  typename boost::mpl::and_<
34  typename boost::is_integral<T>::type,
35  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::type
36  >::type
37  >::type
38 >::act(
39  const typename AvxType<T>::Type& in1,
40  const typename AvxType<T>::Type& in2)
41 {
42  typename RegMaskType<eInstructionSet::eIS_Avx, T>::Type out;
43  act(in1, in2, out);
44  return out;
45 }
46 
47 template <typename T>
48 IPSDK_FORCEINLINE
49 void
50 IsGreaterEqualReg<eInstructionSet::eIS_Avx, T,
51  typename boost::enable_if<
52  typename boost::mpl::and_<
53  typename boost::is_integral<T>::type,
54  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::type
55  >::type
56  >::type
57 >::act(
58  const typename AvxType<T>::Type& in1,
59  const typename AvxType<T>::Type& in2,
60  typename RegMaskType<eInstructionSet::eIS_Avx, T>::Type& out)
61 {
62  __m128i in11, in12;
63  __m128i in21, in22;
64  COPY_IMM_TO_XMM(in1, in11, in12);
65  COPY_IMM_TO_XMM(in2, in21, in22);
66  __m128i out1 = IsGreaterEqualReg<eInstructionSet::eIS_Sse2, T>::act(in11, in21);
67  __m128i out2 = IsGreaterEqualReg<eInstructionSet::eIS_Sse2, T>::act(in12, in22);
68  COPY_XMM_TO_IMM(out1, out2, out);
69 }
70 
71 IPSDK_FORCEINLINE
72 RegMaskType<eInstructionSet::eIS_Avx, ipReal32>::Type
73 IsGreaterEqualReg<eInstructionSet::eIS_Avx, ipReal32>::act(
74  const AvxType<ipReal32>::Type& in1,
75  const AvxType<ipReal32>::Type& in2)
76 {
77  return _mm256_cmp_ps(in1, in2, _CMP_GE_OQ);
78 }
79 
80 IPSDK_FORCEINLINE
81 void
82 IsGreaterEqualReg<eInstructionSet::eIS_Avx, ipReal32>::act(
83  const AvxType<ipReal32>::Type& in1,
84  const AvxType<ipReal32>::Type& in2,
85  RegMaskType<eInstructionSet::eIS_Avx, ipReal32>::Type& out)
86 {
87  out = _mm256_cmp_ps(in1, in2, _CMP_GE_OQ);
88 }
89 
90 IPSDK_FORCEINLINE
91 RegMaskType<eInstructionSet::eIS_Avx, ipReal64>::Type
92 IsGreaterEqualReg<eInstructionSet::eIS_Avx, ipReal64>::act(
93  const AvxType<ipReal64>::Type& in1,
94  const AvxType<ipReal64>::Type& in2)
95 {
96  return _mm256_cmp_pd(in1, in2, _CMP_GE_OQ);
97 }
98 
99 IPSDK_FORCEINLINE
100 void
101 IsGreaterEqualReg<eInstructionSet::eIS_Avx, ipReal64>::act(
102  const AvxType<ipReal64>::Type& in1,
103  const AvxType<ipReal64>::Type& in2,
104  RegMaskType<eInstructionSet::eIS_Avx, ipReal64>::Type& out)
105 {
106  out = _mm256_cmp_pd(in1, in2, _CMP_GE_OQ);
107 }
108 
111 
112 } // end of namespace detail
113 } // end of namespace simd
114 } // end of namespace ipsdk
115 
116 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX_ISGREATEREQUALREGIMPL_H__
Functions to convert from 128 (resp. 256) bits registers to 256 (resp. 128) bits registers.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Advanced Vector Extensions.
Definition: InstructionSetTypes.h:44