@@ -42,11 +42,17 @@ namespace vir
42
42
43
43
constexpr int simd_permute_uninit = simd_permute_zero - 1 ;
44
44
45
+ #if defined __clang__ and __clang__ <= 13
46
+ #define VIR_CONSTEVAL constexpr
47
+ #else
48
+ #define VIR_CONSTEVAL consteval
49
+ #endif
50
+
45
51
namespace simd_permutations
46
52
{
47
53
struct DuplicateEven
48
54
{
49
- consteval unsigned
55
+ VIR_CONSTEVAL unsigned
50
56
operator ()(unsigned i) const
51
57
{ return i & ~1u ; }
52
58
};
@@ -55,7 +61,7 @@ namespace vir
55
61
56
62
struct DuplicateOdd
57
63
{
58
- consteval unsigned
64
+ VIR_CONSTEVAL unsigned
59
65
operator ()(unsigned i) const
60
66
{ return i | 1u ; }
61
67
};
@@ -65,7 +71,7 @@ namespace vir
65
71
template <unsigned N>
66
72
struct SwapNeighbors
67
73
{
68
- consteval unsigned
74
+ VIR_CONSTEVAL unsigned
69
75
operator ()(unsigned i, auto size) const
70
76
{
71
77
static_assert (size % (2 * N) == 0 ,
@@ -85,7 +91,7 @@ namespace vir
85
91
template <int Position>
86
92
struct Broadcast
87
93
{
88
- consteval int
94
+ VIR_CONSTEVAL int
89
95
operator ()(int ) const
90
96
{ return Position; }
91
97
};
@@ -99,7 +105,7 @@ namespace vir
99
105
100
106
struct Reverse
101
107
{
102
- consteval int
108
+ VIR_CONSTEVAL int
103
109
operator ()(int i) const
104
110
{ return -1 - i; }
105
111
};
@@ -112,7 +118,7 @@ namespace vir
112
118
static constexpr int Offset = O;
113
119
static constexpr bool is_even_rotation = Offset % 2 == 0 ;
114
120
115
- consteval int
121
+ VIR_CONSTEVAL int
116
122
operator ()(int i, auto size) const
117
123
{ return (i + Offset) % size.value ; }
118
124
};
@@ -123,7 +129,7 @@ namespace vir
123
129
template <int Offset>
124
130
struct Shift
125
131
{
126
- consteval int
132
+ VIR_CONSTEVAL int
127
133
operator ()(int i, int size) const
128
134
{
129
135
const int j = i + Offset;
@@ -138,6 +144,8 @@ namespace vir
138
144
inline constexpr Shift<Offset> shift {};
139
145
}
140
146
147
+ #undef VIR_CONSTEVAL
148
+
141
149
template <std::size_t N = 0 , vir::any_simd_or_mask V,
142
150
detail::index_permutation_function<V::size()> F>
143
151
VIR_ALWAYS_INLINE constexpr stdx::resize_simd_t <N == 0 ? V::size() : N, V>
0 commit comments