VCTR
Loading...
Searching...
No Matches
Forward.h
1/*
2 ==============================================================================
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5 Copyright 2026- by sonible GmbH.
6
7 This file is part of VCTR - Versatile Container Templates Reconceptualized.
8
9 VCTR is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License version 3
11 only, as published by the Free Software Foundation.
12
13 VCTR is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License version 3 for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 version 3 along with VCTR. If not, see <https://www.gnu.org/licenses/>.
20 ==============================================================================
21*/
22
23namespace vctr::expressions
24{
25
26template <size_t extent, class SrcType>
28{
29public:
30 using value_type = ValueType<SrcType>;
31
32 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (Forward, src)
33
34 VCTR_FORCEDINLINE constexpr value_type operator[] (size_t i) const
35 {
36 return src[i];
37 }
38
39 //==============================================================================
40 VCTR_FORCEDINLINE const value_type* evalNextVectorOpInExpressionChain (value_type* dst) const
42 {
43 if (auto* srcData = src.evalNextVectorOpInExpressionChain (dst); srcData != dst)
44 std::copy_n (srcData, size(), dst);
45
46 return dst;
47 }
48
49 //==============================================================================
50 VCTR_FORWARD_PREPARE_SIMD_EVALUATION_UNARY_EXPRESSION_MEMBER_FUNCTIONS
51
52 VCTR_FORCEDINLINE VCTR_TARGET ("sse4.1") SSERegister<value_type> getSSE (size_t i) const
53 requires (archX64 && has::getSSE<SrcType>)
54 {
55 return src.getSSE (i);
56 }
57
58 VCTR_FORCEDINLINE VCTR_TARGET ("fma") AVXRegister<value_type> getAVX (size_t i) const
60 {
61 return src.getAVX (i);
62 }
63
64 VCTR_FORCEDINLINE VCTR_TARGET ("avx2") AVXRegister<value_type> getAVX (size_t i) const
66 {
67 return src.getAVX (i);
68 }
69
70 VCTR_FORCEDINLINE NeonRegister<value_type> getNeon (size_t i) const
71 requires (archARM && has::getNeon<SrcType>)
72 {
73 return src.getNeon (i);
74 }
75};
76
77} // namespace vctr::expressions
78
79namespace vctr
80{
81
90
91}
Definition: Forward.h:28
Constrains a type to have a member function evalNextVectorOpInExpressionChain (value_type*) const.
Definition: ContainerAndExpressionConcepts.h:112
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 have a member function getSSE (size_t) const.
Definition: ContainerAndExpressionConcepts.h:100
Constrains a type to represent a real valued floating point number.
Definition: NumericTypeConcepts.h:83
constexpr ExpressionChainBuilder< expressions::Forward > forward
An expression that forwards the source unaltered.
Definition: Forward.h:89
The main namespace of the VCTR project.
Definition: Array.h:24
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
An expression chain builder is an object which supplies various operator<< overloads which build chai...
Definition: ExpressionChainBuilder.h:170
The base class to every expression template.
Definition: ExpressionTemplate.h:37
Definition: NeonRegister.h:28
Definition: SSERegister.h:28