2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2014,2015,2016,2017,2018, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
41 #include "gromacs/math/utilities.h"
42 #include "gromacs/simd/simd.h"
43 #include "gromacs/utility/basedefinitions.h"
45 #include "testutils/testasserts.h"
61 /*! \addtogroup module_simd */
64 #if GMX_SIMD_HAVE_REAL
66 /*! \brief Test fixture for floating-point tests (identical to the generic \ref SimdTest) */
67 typedef SimdTest SimdFloatingpointTest
;
69 TEST_F(SimdFloatingpointTest
, setZero
)
71 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(0.0), setZero());
74 TEST_F(SimdFloatingpointTest
, set
)
77 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(c1
), SimdReal(c1
));
78 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(c0
), SimdReal(*p
));
81 TEST_F(SimdFloatingpointTest
, add
)
83 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
+ c3
, c1
+ c4
, c2
+ c5
),
84 rSimd_c0c1c2
+ rSimd_c3c4c5
);
87 TEST_F(SimdFloatingpointTest
, maskAdd
)
89 SimdBool m
= setSimdRealFrom3R(c6
, 0, c7
) != setZero();
90 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
+ c3
, c1
+ 0.0, c2
+ c5
),
91 maskAdd(rSimd_c0c1c2
, rSimd_c3c4c5
, m
));
94 TEST_F(SimdFloatingpointTest
, sub
)
96 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
- c3
, c1
- c4
, c2
- c5
),
97 rSimd_c0c1c2
- rSimd_c3c4c5
);
100 TEST_F(SimdFloatingpointTest
, mul
)
102 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
* c3
, c1
* c4
, c2
* c5
),
103 rSimd_c0c1c2
* rSimd_c3c4c5
);
106 TEST_F(SimdFloatingpointTest
, maskzMul
)
108 SimdBool m
= setSimdRealFrom3R(c1
, 0, c1
) != setZero();
109 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
* c3
, 0.0, c2
* c5
),
110 maskzMul(rSimd_c0c1c2
, rSimd_c3c4c5
, m
));
113 TEST_F(SimdFloatingpointTest
, fma
)
115 // The last bit of FMA operations depends on hardware, so we don't require exact match
116 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
* c3
+ c6
, c1
* c4
+ c7
, c2
* c5
+ c8
),
117 fma(rSimd_c0c1c2
, rSimd_c3c4c5
, rSimd_c6c7c8
));
121 TEST_F(SimdFloatingpointTest
, maskzFma
)
123 SimdBool m
= setSimdRealFrom3R(c2
, 0, c3
) != setZero();
124 // The last bit of FMA operations depends on hardware, so we don't require exact match
125 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
* c3
+ c6
, 0.0, c2
* c5
+ c8
),
126 maskzFma(rSimd_c0c1c2
, rSimd_c3c4c5
, rSimd_c6c7c8
, m
));
129 TEST_F(SimdFloatingpointTest
, fms
)
131 // The last bit of FMA operations depends on hardware, so we don't require exact match
132 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c0
* c3
- c6
, c1
* c4
- c7
, c2
* c5
- c8
),
133 fms(rSimd_c0c1c2
, rSimd_c3c4c5
, rSimd_c6c7c8
));
136 TEST_F(SimdFloatingpointTest
, fnma
)
138 // The last bit of FMA operations depends on hardware, so we don't require exact match
139 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(c6
- c0
* c3
, c7
- c1
* c4
, c8
- c2
* c5
),
140 fnma(rSimd_c0c1c2
, rSimd_c3c4c5
, rSimd_c6c7c8
));
143 TEST_F(SimdFloatingpointTest
, fnms
)
145 // The last bit of FMA operations depends on hardware, so we don't require exact match
146 GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom3R(-c0
* c3
- c6
, -c1
* c4
- c7
, -c2
* c5
- c8
),
147 fnms(rSimd_c0c1c2
, rSimd_c3c4c5
, rSimd_c6c7c8
));
150 TEST_F(SimdFloatingpointTest
, abs
)
152 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, abs(rSimd_c0c1c2
)); // fabs(x)=x
153 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, abs(rSimd_m0m1m2
)); // fabs(-x)=x
156 TEST_F(SimdFloatingpointTest
, neg
)
158 GMX_EXPECT_SIMD_REAL_EQ(rSimd_m0m1m2
, -(rSimd_c0c1c2
)); // fneg(x)=-x
159 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, -(rSimd_m0m1m2
)); // fneg(-x)=x
162 #if GMX_SIMD_HAVE_LOGICAL
163 TEST_F(SimdFloatingpointTest
, and)
165 GMX_EXPECT_SIMD_REAL_EQ(rSimd_logicalResultAnd
,
166 (rSimd_logicalA
& rSimd_logicalB
));
169 TEST_F(SimdFloatingpointTest
, or)
171 GMX_EXPECT_SIMD_REAL_EQ(rSimd_logicalResultOr
,
172 (rSimd_logicalA
| rSimd_logicalB
));
175 TEST_F(SimdFloatingpointTest
, xor)
177 /* Test xor by taking xor with a number and its negative. This should result
178 * in only the sign bit being set. We then use this bit change the sign of
181 SimdReal signbit
= SimdReal(c1
) ^ SimdReal(-c1
);
182 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(-c2
, c3
, -c4
), (signbit
^ setSimdRealFrom3R(c2
, -c3
, c4
)));
185 TEST_F(SimdFloatingpointTest
, andNot
)
187 /* Use xor (which we already tested, so fix that first if both tests fail)
188 * to extract the sign bit, and then use andnot to take absolute values.
190 SimdReal signbit
= SimdReal(c1
) ^ SimdReal(-c1
);
191 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c2
, c3
, c4
), andNot(signbit
, setSimdRealFrom3R(-c2
, c3
, -c4
)));
196 TEST_F(SimdFloatingpointTest
, max
)
198 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R( c3
, c1
, c4
), max(rSimd_c0c1c2
, rSimd_c3c0c4
));
199 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R( c3
, c1
, c4
), max(rSimd_c3c0c4
, rSimd_c0c1c2
));
200 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(-c0
, -c0
, -c2
), max(rSimd_m0m1m2
, rSimd_m3m0m4
));
201 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(-c0
, -c0
, -c2
), max(rSimd_m3m0m4
, rSimd_m0m1m2
));
204 TEST_F(SimdFloatingpointTest
, min
)
206 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R( c0
, c0
, c2
), min(rSimd_c0c1c2
, rSimd_c3c0c4
));
207 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R( c0
, c0
, c2
), min(rSimd_c3c0c4
, rSimd_c0c1c2
));
208 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(-c3
, -c1
, -c4
), min(rSimd_m0m1m2
, rSimd_m3m0m4
));
209 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(-c3
, -c1
, -c4
), min(rSimd_m3m0m4
, rSimd_m0m1m2
));
212 TEST_F(SimdFloatingpointTest
, round
)
214 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(2), round(rSimd_2p25
));
215 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(4), round(rSimd_3p75
));
216 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(-2), round(rSimd_m2p25
));
217 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(-4), round(rSimd_m3p75
));
220 TEST_F(SimdFloatingpointTest
, roundMode
)
222 /* Rounding mode needs to be consistent between round and cvtR2I */
223 SimdReal x0
= setSimdRealFrom3R(0.5, 11.5, 99.5);
224 SimdReal x1
= setSimdRealFrom3R(-0.5, -11.5, -99.5);
226 GMX_EXPECT_SIMD_REAL_EQ(round(x0
), cvtI2R(cvtR2I(x0
)));
227 GMX_EXPECT_SIMD_REAL_EQ(round(x1
), cvtI2R(cvtR2I(x1
)));
230 TEST_F(SimdFloatingpointTest
, trunc
)
232 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(2), trunc(rSimd_2p25
));
233 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(3), trunc(rSimd_3p75
));
234 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(-2), trunc(rSimd_m2p25
));
235 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(-3), trunc(rSimd_m3p75
));
238 // We explicitly test the exponent/mantissa routines with double precision data,
239 // since these usually rely on direct manipulation and shift of the SIMD registers,
240 // where it is easy to make mistakes with single vs double precision.
242 TEST_F(SimdFloatingpointTest
, frexp
)
247 fraction
= frexp(rSimd_Exp
, &exponent
);
249 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(0.609548660288905419513128,
250 0.5833690139241746175358116,
251 -0.584452007502232362412542),
253 GMX_EXPECT_SIMD_INT_EQ(setSimdIntFrom3I(61, -40, 55), exponent
);
256 #if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
257 fraction
= frexp(rSimd_ExpDouble
, &exponent
);
259 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(0.6206306194761728178832527,
260 0.5236473618795619566768096,
261 -0.9280331023751380303821179),
263 GMX_EXPECT_SIMD_INT_EQ(setSimdIntFrom3I(588, -461, 673), exponent
);
267 TEST_F(SimdFloatingpointTest
, ldexp
)
269 SimdReal one
= setSimdRealFrom1R(1.0);
271 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(pow(2.0, 60.0), pow(2.0, -41.0), pow(2.0, 54.0)),
272 ldexp
<MathOptimization::Unsafe
>(one
, setSimdIntFrom3I(60, -41, 54)));
273 #if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
274 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(pow(2.0, 587.0), pow(2.0, -462.0), pow(2.0, 672.0)),
275 ldexp
<MathOptimization::Unsafe
>(one
, setSimdIntFrom3I(587, -462, 672)));
277 // The default safe version must be able to handle very negative arguments too
278 GMX_EXPECT_SIMD_REAL_EQ(setZero(), ldexp(one
, setSimdIntFrom3I(-2000, -1000000, -1000000000)));
282 * We do extensive 1/sqrt(x) and 1/x accuracy testing in the math module, so
283 * we just make sure the lookup instructions appear to work here
286 TEST_F(SimdFloatingpointTest
, rsqrt
)
288 SimdReal x
= setSimdRealFrom3R(4.0, M_PI
, 1234567890.0);
289 SimdReal ref
= setSimdRealFrom3R(0.5, 1.0/std::sqrt(M_PI
), 1.0/std::sqrt(1234567890.0));
290 int shiftbits
= std::numeric_limits
<real
>::digits
-GMX_SIMD_RSQRT_BITS
;
297 /* Set the allowed ulp error as 2 to the power of the number of bits in
298 * the mantissa that do not have to be correct after the table lookup.
300 setUlpTol(1LL << shiftbits
);
301 GMX_EXPECT_SIMD_REAL_NEAR(ref
, rsqrt(x
));
304 TEST_F(SimdFloatingpointTest
, maskzRsqrt
)
306 SimdReal x
= setSimdRealFrom3R(M_PI
, -4.0, 0.0);
307 // simdCmpLe is tested separately further down
308 SimdBool m
= setZero() < x
;
309 SimdReal ref
= setSimdRealFrom3R(1.0/std::sqrt(M_PI
), 0.0, 0.0);
310 int shiftbits
= std::numeric_limits
<real
>::digits
-GMX_SIMD_RSQRT_BITS
;
317 /* Set the allowed ulp error as 2 to the power of the number of bits in
318 * the mantissa that do not have to be correct after the table lookup.
320 setUlpTol(1LL << shiftbits
);
321 GMX_EXPECT_SIMD_REAL_NEAR(ref
, maskzRsqrt(x
, m
));
324 TEST_F(SimdFloatingpointTest
, rcp
)
326 SimdReal x
= setSimdRealFrom3R(4.0, M_PI
, 1234567890.0);
327 SimdReal ref
= setSimdRealFrom3R(0.25, 1.0/M_PI
, 1.0/1234567890.0);
328 int shiftbits
= std::numeric_limits
<real
>::digits
-GMX_SIMD_RCP_BITS
;
335 /* Set the allowed ulp error as 2 to the power of the number of bits in
336 * the mantissa that do not have to be correct after the table lookup.
338 setUlpTol(1LL << shiftbits
);
339 GMX_EXPECT_SIMD_REAL_NEAR(ref
, rcp(x
));
342 TEST_F(SimdFloatingpointTest
, maskzRcp
)
344 SimdReal x
= setSimdRealFrom3R(M_PI
, 0.0, -1234567890.0);
345 SimdBool m
= (x
!= setZero());
346 SimdReal ref
= setSimdRealFrom3R(1.0/M_PI
, 0.0, -1.0/1234567890.0);
347 int shiftbits
= std::numeric_limits
<real
>::digits
-GMX_SIMD_RCP_BITS
;
354 /* Set the allowed ulp error as 2 to the power of the number of bits in
355 * the mantissa that do not have to be correct after the table lookup.
357 setUlpTol(1LL << shiftbits
);
358 GMX_EXPECT_SIMD_REAL_NEAR(ref
, maskzRcp(x
, m
));
361 TEST_F(SimdFloatingpointTest
, cmpEqAndSelectByMask
)
363 SimdBool eq
= rSimd_c4c6c8
== rSimd_c6c7c8
;
364 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(0, 0, c2
), selectByMask(rSimd_c0c1c2
, eq
));
367 TEST_F(SimdFloatingpointTest
, selectByNotMask
)
369 SimdBool eq
= rSimd_c4c6c8
== rSimd_c6c7c8
;
370 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c0
, c1
, 0), selectByNotMask(rSimd_c0c1c2
, eq
));
373 TEST_F(SimdFloatingpointTest
, cmpNe
)
375 SimdBool eq
= rSimd_c4c6c8
!= rSimd_c6c7c8
;
376 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c0
, c1
, 0), selectByMask(rSimd_c0c1c2
, eq
));
379 TEST_F(SimdFloatingpointTest
, cmpLe
)
381 SimdBool le
= rSimd_c4c6c8
<= rSimd_c6c7c8
;
382 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, selectByMask(rSimd_c0c1c2
, le
));
385 TEST_F(SimdFloatingpointTest
, cmpLt
)
387 SimdBool lt
= rSimd_c4c6c8
< rSimd_c6c7c8
;
388 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c0
, c1
, 0), selectByMask(rSimd_c0c1c2
, lt
));
391 #if GMX_SIMD_HAVE_INT32_LOGICAL || GMX_SIMD_HAVE_LOGICAL
392 TEST_F(SimdFloatingpointTest
, testBits
)
394 SimdBool eq
= testBits(setSimdRealFrom3R(c1
, 0, c1
));
395 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c0
, 0, c2
), selectByMask(rSimd_c0c1c2
, eq
));
397 // Test if we detect only the sign bit being set
398 eq
= testBits(setSimdRealFrom1R(GMX_REAL_NEGZERO
));
399 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, selectByMask(rSimd_c0c1c2
, eq
));
403 TEST_F(SimdFloatingpointTest
, andB
)
405 SimdBool eq
= rSimd_c4c6c8
== rSimd_c6c7c8
;
406 SimdBool le
= rSimd_c4c6c8
<= rSimd_c6c7c8
;
407 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(0, 0, c2
), selectByMask(rSimd_c0c1c2
, (eq
&& le
)));
410 TEST_F(SimdFloatingpointTest
, orB
)
412 SimdBool eq
= rSimd_c4c6c8
== rSimd_c6c7c8
;
413 SimdBool lt
= rSimd_c4c6c8
< rSimd_c6c7c8
;
414 GMX_EXPECT_SIMD_REAL_EQ(rSimd_c0c1c2
, selectByMask(rSimd_c0c1c2
, (eq
|| lt
)));
417 TEST_F(SimdFloatingpointTest
, anyTrueB
)
419 alignas(GMX_SIMD_ALIGNMENT
) std::array
<real
, GMX_SIMD_REAL_WIDTH
> mem
{};
421 // Test the false case
422 EXPECT_FALSE(anyTrue(setZero() < load
<SimdReal
>(mem
.data())));
424 // Test each bit (these should all be true)
425 for (int i
= 0; i
< GMX_SIMD_REAL_WIDTH
; i
++)
429 EXPECT_TRUE(anyTrue(setZero() < load
<SimdReal
>(mem
.data()))) << "Not detecting true in element " << i
;
433 TEST_F(SimdFloatingpointTest
, blend
)
435 SimdBool lt
= rSimd_c4c6c8
< rSimd_c6c7c8
;
436 GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(c3
, c4
, c2
), blend(rSimd_c0c1c2
, rSimd_c3c4c5
, lt
));
439 TEST_F(SimdFloatingpointTest
, reduce
)
441 // The horizontal sum of the SIMD variable depends on the width, so
442 // simply store it an extra time and calculate what the sum should be
443 std::vector
<real
> v
= simdReal2Vector(rSimd_c3c4c5
);
446 for (int i
= 0; i
< GMX_SIMD_REAL_WIDTH
; i
++)
451 EXPECT_REAL_EQ_TOL(sum
, reduce(rSimd_c3c4c5
), defaultRealTolerance() );
454 #endif // GMX_SIMD_HAVE_REAL
456 #if GMX_SIMD_HAVE_FLOAT && GMX_SIMD_HAVE_DOUBLE
457 TEST_F(SimdFloatingpointTest
, cvtFloat2Double
)
459 alignas(GMX_SIMD_ALIGNMENT
) float f
[GMX_SIMD_FLOAT_WIDTH
];
460 alignas(GMX_SIMD_ALIGNMENT
) double d
[GMX_SIMD_FLOAT_WIDTH
]; // Yes, double array length should be same as float
465 FloatingPointTolerance
tolerance(defaultRealTolerance());
467 for (i
= 0; i
< GMX_SIMD_FLOAT_WIDTH
; i
++)
469 // Scale by 1+100*eps to use low bits too.
470 // Due to the conversions we want to avoid being too sensitive to fluctuations in last bit
471 f
[i
] = i
* (1.0 + 100*GMX_FLOAT_EPS
);
474 vf
= load
<SimdFloat
>(f
);
475 #if (GMX_SIMD_FLOAT_WIDTH == 2*GMX_SIMD_DOUBLE_WIDTH)
477 cvtF2DD(vf
, &vd0
, &vd1
);
478 store(d
+ GMX_SIMD_DOUBLE_WIDTH
, vd1
); // Store upper part halfway through array
479 #elif (GMX_SIMD_FLOAT_WIDTH == GMX_SIMD_DOUBLE_WIDTH)
482 # error Width of float SIMD must either be identical to double, or twice the width.
484 store(d
, vd0
); // store lower (or whole) part from start of vector
486 for (i
= 0; i
< GMX_SIMD_FLOAT_WIDTH
; i
++)
488 EXPECT_REAL_EQ_TOL(f
[i
], d
[i
], tolerance
);
492 TEST_F(SimdFloatingpointTest
, cvtDouble2Float
)
494 alignas(GMX_SIMD_ALIGNMENT
) float f
[GMX_SIMD_FLOAT_WIDTH
];
495 alignas(GMX_SIMD_ALIGNMENT
) double d
[GMX_SIMD_FLOAT_WIDTH
]; // Yes, double array length should be same as float
499 FloatingPointTolerance
tolerance(defaultRealTolerance());
501 // This fills elements for pd1 too when double width is 2*single width
502 for (i
= 0; i
< GMX_SIMD_FLOAT_WIDTH
; i
++)
504 // Scale by 1+eps to use low bits too.
505 // Due to the conversions we want to avoid being too sensitive to fluctuations in last bit
506 d
[i
] = i
* (1.0 + 100*GMX_FLOAT_EPS
);
509 vd0
= load
<SimdDouble
>(d
);
510 #if (GMX_SIMD_FLOAT_WIDTH == 2*GMX_SIMD_DOUBLE_WIDTH)
511 SimdDouble vd1
= load
<SimdDouble
>(d
+ GMX_SIMD_DOUBLE_WIDTH
); // load upper half of data
512 vf
= cvtDD2F(vd0
, vd1
);
513 #elif (GMX_SIMD_FLOAT_WIDTH == GMX_SIMD_DOUBLE_WIDTH)
516 # error Width of float SIMD must either be identical to double, or twice the width.
520 // This will check elements in pd1 too when double width is 2*single width
521 for (i
= 0; i
< GMX_SIMD_FLOAT_WIDTH
; i
++)
523 EXPECT_FLOAT_EQ_TOL(d
[i
], f
[i
], tolerance
);
526 #endif // GMX_SIMD_HAVE_FLOAT && GMX_SIMD_HAVE_DOUBLE