23namespace vctr::expressions
28template <
size_t extent,
class SrcAType,
class SrcBType,
class SrcCType>
29requires are::same<ValueType<SrcAType>, ValueType<SrcBType>, ValueType<SrcCType>>
38 using SrcAStorageInfoType = std::invoke_result_t<
decltype (&std::remove_cvref_t<SrcAType>::getStorageInfo), SrcAType>;
39 using SrcBStorageInfoType = std::invoke_result_t<
decltype (&std::remove_cvref_t<SrcBType>::getStorageInfo), SrcBType>;
40 using SrcCStorageInfoType = std::invoke_result_t<
decltype (&std::remove_cvref_t<SrcCType>::getStorageInfo), SrcCType>;
49 template <
class SrcA,
class SrcB,
class SrcC>
51 : srcA (std::forward<SrcA> (a)),
52 srcB (std::forward<SrcB> (b)),
53 srcC (std::forward<SrcC> (c)),
54 storageInfo (srcA.getStorageInfo(), srcB.getStorageInfo(), srcC.getStorageInfo())
57 constexpr const auto& getStorageInfo()
const {
return storageInfo; }
59 constexpr size_t size()
const {
return srcA.size(); }
61 constexpr bool isNotAliased (
const void*)
const
66 VCTR_FORCEDINLINE
constexpr auto operator[] (
size_t i)
const
68 return srcA[i] * srcB[i] + srcC[i];
72 void prepareNeonEvaluation()
const
73 requires ::vctr::has::prepareNeonEvaluation<SrcAType> && ::vctr::has::prepareNeonEvaluation<SrcBType> && ::vctr::has::prepareNeonEvaluation<SrcCType>
75 srcA.prepareNeonEvaluation();
76 srcB.prepareNeonEvaluation();
77 srcC.prepareNeonEvaluation();
80 VCTR_FORCEDINLINE VCTR_TARGET (
"avx")
void prepareAVXEvaluation()
const
81 requires ::vctr::has::prepareAVXEvaluation<SrcAType> && ::vctr::has::prepareAVXEvaluation<SrcBType> && ::vctr::has::prepareAVXEvaluation<SrcCType>
83 srcA.prepareAVXEvaluation();
84 srcB.prepareAVXEvaluation();
85 srcC.prepareAVXEvaluation();
88 VCTR_FORCEDINLINE VCTR_TARGET (
"sse4.1")
void prepareSSEEvaluation()
const
89 requires ::vctr::has::prepareSSEEvaluation<SrcAType> && ::vctr::has::prepareSSEEvaluation<SrcBType> && ::vctr::has::prepareSSEEvaluation<SrcCType>
91 srcA.prepareSSEEvaluation();
92 srcB.prepareSSEEvaluation();
93 srcC.prepareSSEEvaluation();
100 return Expression::AVX::fma (srcA.getAVX (i), srcB.getAVX (i), srcC.getAVX (i));
108 return Expression::Neon::fma (srcA.getNeon (i), srcB.getNeon (i), srcC.getNeon (i));
124template <
class SrcAType,
class SrcBType,
class SrcCType>
131 constexpr auto extent = getCommonExtent<SrcAType, SrcBType, SrcCType>();
Multiply-Accumulates three vector like types.
Definition: MultiplyAccumulate.h:31
Constrains a type to have a member function getAVX (size_t) const.
Definition: ContainerAndExpressionConcepts.h:92
Constrains a type to have a member function getNeon (size_t) const.
Definition: ContainerAndExpressionConcepts.h:84
Constrains a type to either be an expression template or any derived instance of VctrBase.
Definition: ContainerAndExpressionConcepts.h:230
constexpr auto multiplyAccumulate(SrcAType &&a, SrcBType &&b, SrcCType &&c)
Computes the multiply-accumulate operation (a * b) + c.
Definition: MultiplyAccumulate.h:128
The main namespace of the VCTR project.
Definition: Array.h:24
constexpr void assertCommonSize(const A &a, const B &b)
Ensures that both sources have the same size.
Definition: Traits.h:256
typename detail::ValueType< std::remove_cvref_t< T > >::Type ValueType
If T is an expression template, it equals its return type, if it's a type that defines value_type as ...
Definition: Traits.h:201
Definition: AVXRegister.h:28
Definition: SIMDHelpers.h:222
Supplies some handy typedefs and traits needed when implementing expression templates.
Definition: ExpressionTemplate.h:41
static constexpr auto allElementTypesSame
Indicates if all source element types and the return types are same.
Definition: ExpressionTemplate.h:80
The base class to every expression template.
Definition: ExpressionTemplate.h:37
Definition: NeonRegister.h:28