IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ConditionalAddReg.h
1 // ConditionalAddReg.h:
3 // -----------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_COMMON_CONDITIONALADDREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_COMMON_CONDITIONALADDREG_H__
17 
19 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/ConditionalAddReg.h>
20 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/AddReg.h>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 
32 
33 template <
34  eInstructionSet::domain IS,
35  typename T>
37  IS,
38  T,
39  typename boost::enable_if<
40  typename boost::mpl::and_<
41  typename boost::mpl::not_equal_to<
42  boost::mpl::int_<IS>,
43  boost::mpl::int_<eInstructionSet::eIS_Avx512>
44  >::type,
45  typename boost::mpl::not_equal_to<
46  boost::mpl::int_<IS>,
47  boost::mpl::int_<eInstructionSet::eIS_Standard>
48  >::type
49  >::type
50  >::type
51 >
52 {
53 
54  static IPSDK_FORCEINLINE
55  typename RegType<IS, T>::Type
56  act(const typename RegMaskType<IS, T>::Type& mask,
57  const typename RegType<IS, T>::Type& in1,
58  const typename RegType<IS, T>::Type& in2)
59  {
60  typename RegType<IS, T>::Type out;
61  act(mask, in1, in2, out);
62  return out;
63  }
64 
65  static IPSDK_FORCEINLINE
66  typename RegType<IS, T>::Type
67  act(const typename RegMaskType<IS, T>::Type& mask,
68  const typename RegType<IS, T>::Type& in1,
69  const T& in2)
70  {
71  typename RegType<IS, T>::Type out;
72  act(mask, in1, in2, out);
73  return out;
74  }
75 
76  static IPSDK_FORCEINLINE
77  void
78  act(const typename RegMaskType<IS, T>::Type& mask,
79  const typename RegType<IS, T>::Type& in1,
80  const typename RegType<IS, T>::Type& in2,
81  typename RegType<IS, T>::Type& out)
82  {
83  typename RegType<IS, T>::Type regFromMask;
84  CastReg<IS, T, T>::act(mask, regFromMask);
85  typename RegType<IS, T>::Type maskAndIn2;
86  BitwiseAndReg<IS, T>::act(regFromMask, in2, maskAndIn2);
87  AddReg<IS, T>::act(in1, maskAndIn2, out);
88  }
89 
90  static IPSDK_FORCEINLINE
91  void
92  act(const typename RegMaskType<IS, T>::Type& mask,
93  const typename RegType<IS, T>::Type& in1,
94  const T& in2,
95  typename RegType<IS, T>::Type& out)
96  {
97  typename RegType<IS, T>::Type regFromMask;
98  CastReg<IS, T, T>::act(mask, regFromMask);
99 
100  typename RegType<IS, T>::Type maskAndIn2;
101  const typename RegType<IS, T>::Type regIn2 = AssignReg<IS, T>::act(in2);
102  BitwiseAndReg<IS, T>::act(regFromMask, regIn2, maskAndIn2);
103  AddReg<IS, T>::act(in1, maskAndIn2, out);
104  }
105 };
106 
109 
110 } // end of namespace detail
111 } // end of namespace simd
112 } // end of namespace ipsdk
113 
114 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_COMMON_CONDITIONALADDREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: CastReg.h:30
Definition: DataItemNodeHdrMacrosDetails.h:48
RegType class.
Definition: ConditionalAddReg.h:36
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
Definition: RegMaskType.h:29
Definition: RegType.h:29
Definition: BitwiseAndReg.h:30
Definition: AssignRegDecl.h:31