You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// These tests check for consistency across implementations, instead of giving examples of expected outcome.
8
+
7
9
staticconstintptr_t ITERATIONS = 1000000;
8
10
9
11
template<typename T>
@@ -119,8 +121,64 @@ void binaryEquivalent (
119
121
printText(U"*");
120
122
}
121
123
122
-
#defineUNARY_POINT_EQUIVALENCE(S, V, EXPR) unaryEquivalent<S, S, V, V>([](const S &a) -> S { return EXPR; }, [](const V &a) -> V { return EXPR; }, U"unary function equivalence test between " U###S U" and " U###V U" for " U###EXPR)
123
-
#defineBINARY_POINT_EQUIVALENCE(S, V, EXPR) binaryEquivalent<S, S, V, V>([](const S &a, const S &b) -> S { return EXPR; }, [](const V &a, const V &b) -> V { return EXPR; }, U"binary function equivalence test between " U###S U" and " U###V U" for " U###EXPR)
124
+
// TODO: Is it time to use varargs instead of copying this?
#defineUNARY_POINT_EQUIVALENCE_EXPR(S, V, EXPR) unaryEquivalent<S, S, V, V>([](const S &a) -> S { return EXPR; }, [](const V &a) -> V { return EXPR; }, U"unary function equivalence test between " U###S U" and " U###V U" for " U###EXPR)
178
+
#defineBINARY_POINT_EQUIVALENCE_EXPR(S, V, EXPR) binaryEquivalent<S, S, V, V>([](const S &a, const S &b) -> S { return EXPR; }, [](const V &a, const V &b) -> V { return EXPR; }, U"binary function equivalence test between " U###S U" and " U###V U" for " U###EXPR)
179
+
#defineUNARY_POINT_EQUIVALENCE_FUNC(S, V, FUNC) unaryEquivalent<S, S, V, V>([](const S &a) -> S { returnFUNC(a); }, [](const V &a) -> V { returnFUNC(a); }, U"unary function equivalence test between " U###S U" and " U###V U" for " U###FUNC)
180
+
#defineBINARY_POINT_EQUIVALENCE_FUNC(S, V, FUNC) binaryEquivalent<S, S, V, V>([](const S &a, const S &b) -> S { returnFUNC(a, b); }, [](const V &a, const V &b) -> V { returnFUNC(a, b); }, U"binary function equivalence test between " U###S U" and " U###V U" for " U###FUNC)
181
+
#defineTRINARY_POINT_EQUIVALENCE_FUNC(S, V, FUNC) trinaryEquivalent<S, S, V, V>([](const S &a, const S &b, const S &c) -> S { returnFUNC(a, b, c); }, [](const V &a, const V &b, const V &c) -> V { returnFUNC(a, b, c); }, U"binary function equivalence test between " U###S U" and " U###V U" for " U###FUNC)
124
182
125
183
START_TEST(BruteSimd)
126
184
printText(U"\nThe bruteforce SIMD test is compiled using:\n");
@@ -141,75 +199,154 @@ START_TEST(BruteSimd)
141
199
#endif
142
200
143
201
// Addition.
144
-
BINARY_POINT_EQUIVALENCE(uint8_t , U8x16 , a + b);
145
-
BINARY_POINT_EQUIVALENCE(uint8_t , U8x32 , a + b);
146
-
BINARY_POINT_EQUIVALENCE(uint16_t, U16x8 , a + b);
147
-
BINARY_POINT_EQUIVALENCE(uint16_t, U16x16, a + b);
148
-
BINARY_POINT_EQUIVALENCE(uint32_t, U32x4 , a + b);
149
-
BINARY_POINT_EQUIVALENCE(uint32_t, U32x8 , a + b);
150
-
BINARY_POINT_EQUIVALENCE(int32_t , I32x4 , a + b);
151
-
BINARY_POINT_EQUIVALENCE(int32_t , I32x8 , a + b);
152
-
BINARY_POINT_EQUIVALENCE(float , F32x4 , a + b);
153
-
BINARY_POINT_EQUIVALENCE(float , F32x8 , a + b);
202
+
BINARY_POINT_EQUIVALENCE_EXPR(uint8_t , U8x16 , a + b);
203
+
BINARY_POINT_EQUIVALENCE_EXPR(uint8_t , U8x32 , a + b);
204
+
BINARY_POINT_EQUIVALENCE_EXPR(uint16_t, U16x8 , a + b);
205
+
BINARY_POINT_EQUIVALENCE_EXPR(uint16_t, U16x16, a + b);
206
+
BINARY_POINT_EQUIVALENCE_EXPR(uint32_t, U32x4 , a + b);
207
+
BINARY_POINT_EQUIVALENCE_EXPR(uint32_t, U32x8 , a + b);
208
+
BINARY_POINT_EQUIVALENCE_EXPR(int32_t , I32x4 , a + b);
209
+
BINARY_POINT_EQUIVALENCE_EXPR(int32_t , I32x8 , a + b);
210
+
BINARY_POINT_EQUIVALENCE_EXPR(float , F32x4 , a + b);
211
+
BINARY_POINT_EQUIVALENCE_EXPR(float , F32x8 , a + b);
154
212
155
213
// Subtraction
156
-
BINARY_POINT_EQUIVALENCE(uint8_t , U8x16 , a - b);
157
-
BINARY_POINT_EQUIVALENCE(uint8_t , U8x32 , a - b);
158
-
BINARY_POINT_EQUIVALENCE(uint16_t, U16x8 , a - b);
159
-
BINARY_POINT_EQUIVALENCE(uint16_t, U16x16, a - b);
160
-
BINARY_POINT_EQUIVALENCE(uint32_t, U32x4 , a - b);
161
-
BINARY_POINT_EQUIVALENCE(uint32_t, U32x8 , a - b);
162
-
BINARY_POINT_EQUIVALENCE(int32_t , I32x4 , a - b);
163
-
BINARY_POINT_EQUIVALENCE(int32_t , I32x8 , a - b);
164
-
BINARY_POINT_EQUIVALENCE(float , F32x4 , a - b);
165
-
BINARY_POINT_EQUIVALENCE(float , F32x8 , a - b);
166
-
167
-
// Negation
168
-
UNARY_POINT_EQUIVALENCE(int32_t , I32x4 , -a);
169
-
UNARY_POINT_EQUIVALENCE(int32_t , I32x8 , -a);
170
-
UNARY_POINT_EQUIVALENCE(float , F32x4 , -a);
171
-
UNARY_POINT_EQUIVALENCE(float , F32x8 , -a);
214
+
BINARY_POINT_EQUIVALENCE_EXPR(uint8_t , U8x16 , a - b);
215
+
BINARY_POINT_EQUIVALENCE_EXPR(uint8_t , U8x32 , a - b);
216
+
BINARY_POINT_EQUIVALENCE_EXPR(uint16_t, U16x8 , a - b);
217
+
BINARY_POINT_EQUIVALENCE_EXPR(uint16_t, U16x16, a - b);
218
+
BINARY_POINT_EQUIVALENCE_EXPR(uint32_t, U32x4 , a - b);
219
+
BINARY_POINT_EQUIVALENCE_EXPR(uint32_t, U32x8 , a - b);
220
+
BINARY_POINT_EQUIVALENCE_EXPR(int32_t , I32x4 , a - b);
221
+
BINARY_POINT_EQUIVALENCE_EXPR(int32_t , I32x8 , a - b);
222
+
BINARY_POINT_EQUIVALENCE_EXPR(float , F32x4 , a - b);
223
+
BINARY_POINT_EQUIVALENCE_EXPR(float , F32x8 , a - b);
0 commit comments