Gromacs
2026.0-dev-20241204-d69d709
|
#include "config.h"
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <algorithm>
#include <array>
#include "gromacs/math/utilities.h"
#include "gromacs/simd/impl_reference/impl_reference_definitions.h"
#include "gromacs/simd/impl_reference/impl_reference_simd_float.h"
#include "gromacs/utility/fatalerror.h"
Reference implementation, SIMD double precision.
Classes | |
class | gmx::SimdDouble |
Double SIMD variable. Available if GMX_SIMD_HAVE_DOUBLE is 1. More... | |
class | gmx::SimdDInt32 |
Integer SIMD variable type to use for conversions to/from double. More... | |
class | gmx::SimdDBool |
Boolean type for double SIMD data. More... | |
class | gmx::SimdDIBool |
Boolean type for integer datatypes corresponding to double SIMD. More... | |
Functions | |
SIMD implementation load/store operations for double precision floating point | |
static SimdDouble gmx_simdcall | gmx::simdLoad (const double *m, SimdDoubleTag={}) |
Load GMX_SIMD_DOUBLE_WIDTH numbers from aligned memory. More... | |
static void gmx_simdcall | gmx::store (double *m, SimdDouble a) |
Store the contents of SIMD double variable to aligned memory m. More... | |
static SimdDouble gmx_simdcall | gmx::simdLoadU (const double *m, SimdDoubleTag={}) |
Load SIMD double from unaligned memory. More... | |
static void gmx_simdcall | gmx::storeU (double *m, SimdDouble a) |
Store SIMD double to unaligned memory. More... | |
static SimdDouble gmx_simdcall | gmx::setZeroD () |
Set all SIMD double variable elements to 0.0. More... | |
SIMD implementation load/store operations for integers (corresponding to double) | |
static SimdDInt32 gmx_simdcall | gmx::simdLoad (const std::int32_t *m, SimdDInt32Tag) |
Load aligned SIMD integer data, width corresponds to gmx::SimdDouble. More... | |
static void gmx_simdcall | gmx::store (std::int32_t *m, SimdDInt32 a) |
Store aligned SIMD integer data, width corresponds to gmx::SimdDouble. More... | |
static SimdDInt32 gmx_simdcall | gmx::simdLoadU (const std::int32_t *m, SimdDInt32Tag) |
Load unaligned integer SIMD data, width corresponds to gmx::SimdDouble. More... | |
static void gmx_simdcall | gmx::storeU (std::int32_t *m, SimdDInt32 a) |
Store unaligned SIMD integer data, width corresponds to gmx::SimdDouble. More... | |
static SimdDInt32 gmx_simdcall | gmx::setZeroDI () |
Set all SIMD (double) integer variable elements to 0. More... | |
template<int index> | |
static std::int32_t gmx_simdcall | gmx::extract (SimdDInt32 a) |
Extract element with index i from gmx::SimdDInt32. More... | |
SIMD implementation double precision floating-point bitwise logical operations | |
static SimdDouble gmx_simdcall | gmx::operator& (SimdDouble a, SimdDouble b) |
Bitwise and for two SIMD double variables. More... | |
static SimdDouble gmx_simdcall | gmx::andNot (SimdDouble a, SimdDouble b) |
Bitwise andnot for SIMD double. More... | |
static SimdDouble gmx_simdcall | gmx::operator| (SimdDouble a, SimdDouble b) |
Bitwise or for SIMD double. More... | |
static SimdDouble gmx_simdcall | gmx::operator^ (SimdDouble a, SimdDouble b) |
Bitwise xor for SIMD double. More... | |
SIMD implementation double precision floating-point arithmetics | |
static SimdDouble gmx_simdcall | gmx::operator+ (SimdDouble a, SimdDouble b) |
Add two double SIMD variables. More... | |
static SimdDouble gmx_simdcall | gmx::operator- (SimdDouble a, SimdDouble b) |
Subtract two double SIMD variables. More... | |
static SimdDouble gmx_simdcall | gmx::operator- (SimdDouble a) |
SIMD double precision negate. More... | |
static SimdDouble gmx_simdcall | gmx::operator* (SimdDouble a, SimdDouble b) |
Multiply two double SIMD variables. More... | |
static SimdDouble gmx_simdcall | gmx::fma (SimdDouble a, SimdDouble b, SimdDouble c) |
SIMD double Fused-multiply-add. Result is a*b+c. More... | |
static SimdDouble gmx_simdcall | gmx::fms (SimdDouble a, SimdDouble b, SimdDouble c) |
SIMD double Fused-multiply-subtract. Result is a*b-c. More... | |
static SimdDouble gmx_simdcall | gmx::fnma (SimdDouble a, SimdDouble b, SimdDouble c) |
SIMD double Fused-negated-multiply-add. Result is -a*b+c. More... | |
static SimdDouble gmx_simdcall | gmx::fnms (SimdDouble a, SimdDouble b, SimdDouble c) |
SIMD double Fused-negated-multiply-subtract. Result is -a*b-c. More... | |
static SimdDouble gmx_simdcall | gmx::rsqrt (SimdDouble x) |
double SIMD 1.0/sqrt(x) lookup. More... | |
static SimdDouble gmx_simdcall | gmx::rcp (SimdDouble x) |
SIMD double 1.0/x lookup. More... | |
static SimdDouble gmx_simdcall | gmx::maskAdd (SimdDouble a, SimdDouble b, SimdDBool m) |
Add two double SIMD variables, masked version. More... | |
static SimdDouble gmx_simdcall | gmx::maskzMul (SimdDouble a, SimdDouble b, SimdDBool m) |
Multiply two double SIMD variables, masked version. More... | |
static SimdDouble gmx_simdcall | gmx::maskzFma (SimdDouble a, SimdDouble b, SimdDouble c, SimdDBool m) |
SIMD double fused multiply-add, masked version. More... | |
static SimdDouble gmx_simdcall | gmx::maskzRsqrt (SimdDouble x, SimdDBool m) |
SIMD double 1.0/sqrt(x) lookup, masked version. More... | |
static SimdDouble gmx_simdcall | gmx::maskzRcp (SimdDouble x, SimdDBool m) |
SIMD double 1.0/x lookup, masked version. More... | |
static SimdDouble gmx_simdcall | gmx::abs (SimdDouble a) |
SIMD double floating-point fabs(). More... | |
static SimdDouble gmx_simdcall | gmx::max (SimdDouble a, SimdDouble b) |
Set each SIMD double element to the largest from two variables. More... | |
static SimdDouble gmx_simdcall | gmx::min (SimdDouble a, SimdDouble b) |
Set each SIMD double element to the smallest from two variables. More... | |
static SimdDouble gmx_simdcall | gmx::round (SimdDouble a) |
SIMD double round to nearest integer value (in floating-point format). More... | |
static SimdDouble gmx_simdcall | gmx::trunc (SimdDouble a) |
Truncate SIMD double, i.e. round towards zero - common hardware instruction. More... | |
template<MathOptimization opt = MathOptimization::Safe> | |
static SimdDouble gmx_simdcall | gmx::frexp (SimdDouble value, SimdDInt32 *exponent) |
Extract (integer) exponent and fraction from double precision SIMD. More... | |
template<MathOptimization opt = MathOptimization::Safe> | |
static SimdDouble gmx_simdcall | gmx::ldexp (SimdDouble value, SimdDInt32 exponent) |
Multiply a SIMD double value by the number 2 raised to an exp power. More... | |
static double gmx_simdcall | gmx::reduce (SimdDouble a) |
Return sum of all elements in SIMD double variable. More... | |
SIMD implementation double precision floating-point comparison, boolean, selection. | |
static SimdDBool gmx_simdcall | gmx::operator== (SimdDouble a, SimdDouble b) |
SIMD a==b for double SIMD. More... | |
static SimdDBool gmx_simdcall | gmx::operator!= (SimdDouble a, SimdDouble b) |
SIMD a!=b for double SIMD. More... | |
static SimdDBool gmx_simdcall | gmx::operator< (SimdDouble a, SimdDouble b) |
SIMD a<b for double SIMD. More... | |
static SimdDBool gmx_simdcall | gmx::operator<= (SimdDouble a, SimdDouble b) |
SIMD a<=b for double SIMD. More... | |
static SimdDBool gmx_simdcall | gmx::testBits (SimdDouble a) |
Return true if any bits are set in the single precision SIMD. More... | |
static SimdDBool gmx_simdcall | gmx::operator&& (SimdDBool a, SimdDBool b) |
Logical and on double precision SIMD booleans. More... | |
static SimdDBool gmx_simdcall | gmx::operator|| (SimdDBool a, SimdDBool b) |
Logical or on double precision SIMD booleans. More... | |
static bool gmx_simdcall | gmx::anyTrue (SimdDBool a) |
Returns non-zero if any of the boolean in SIMD a is True, otherwise 0. More... | |
static SimdDouble gmx_simdcall | gmx::selectByMask (SimdDouble a, SimdDBool mask) |
Select from double precision SIMD variable where boolean is true. More... | |
static SimdDouble gmx_simdcall | gmx::selectByNotMask (SimdDouble a, SimdDBool mask) |
Select from double precision SIMD variable where boolean is false. More... | |
static SimdDouble gmx_simdcall | gmx::blend (SimdDouble a, SimdDouble b, SimdDBool sel) |
Vector-blend SIMD double selection. More... | |
SIMD implementation integer (corresponding to double) bitwise logical operations | |
static SimdDInt32 gmx_simdcall | gmx::operator& (SimdDInt32 a, SimdDInt32 b) |
Integer SIMD bitwise and. More... | |
static SimdDInt32 gmx_simdcall | gmx::andNot (SimdDInt32 a, SimdDInt32 b) |
Integer SIMD bitwise not/complement. More... | |
static SimdDInt32 gmx_simdcall | gmx::operator| (SimdDInt32 a, SimdDInt32 b) |
Integer SIMD bitwise or. More... | |
static SimdDInt32 gmx_simdcall | gmx::operator^ (SimdDInt32 a, SimdDInt32 b) |
Integer SIMD bitwise xor. More... | |
SIMD implementation integer (corresponding to double) arithmetics | |
static SimdDInt32 gmx_simdcall | gmx::operator+ (SimdDInt32 a, SimdDInt32 b) |
Add SIMD integers. More... | |
static SimdDInt32 gmx_simdcall | gmx::operator- (SimdDInt32 a, SimdDInt32 b) |
Subtract SIMD integers. More... | |
static SimdDInt32 gmx_simdcall | gmx::operator* (SimdDInt32 a, SimdDInt32 b) |
Multiply SIMD integers. More... | |
SIMD implementation integer (corresponding to double) comparisons, boolean selection | |
static SimdDIBool gmx_simdcall | gmx::operator== (SimdDInt32 a, SimdDInt32 b) |
Equality comparison of two integers corresponding to double values. More... | |
static SimdDIBool gmx_simdcall | gmx::operator< (SimdDInt32 a, SimdDInt32 b) |
Less-than comparison of two SIMD integers corresponding to double values. More... | |
static SimdDIBool gmx_simdcall | gmx::testBits (SimdDInt32 a) |
Check if any bit is set in each element. More... | |
static SimdDIBool gmx_simdcall | gmx::operator&& (SimdDIBool a, SimdDIBool b) |
Logical AND on SimdDIBool. More... | |
static SimdDIBool gmx_simdcall | gmx::operator|| (SimdDIBool a, SimdDIBool b) |
Logical OR on SimdDIBool. More... | |
static bool gmx_simdcall | gmx::anyTrue (SimdDIBool a) |
Returns true if any of the boolean in x is True, otherwise 0. More... | |
static SimdDInt32 gmx_simdcall | gmx::selectByMask (SimdDInt32 a, SimdDIBool mask) |
Select from gmx::SimdDInt32 variable where boolean is true. More... | |
static SimdDInt32 gmx_simdcall | gmx::selectByNotMask (SimdDInt32 a, SimdDIBool mask) |
Select from gmx::SimdDInt32 variable where boolean is false. More... | |
static SimdDInt32 gmx_simdcall | gmx::blend (SimdDInt32 a, SimdDInt32 b, SimdDIBool sel) |
Vector-blend SIMD integer selection. More... | |
SIMD implementation conversion operations | |
static SimdDInt32 gmx_simdcall | gmx::cvtR2I (SimdDouble a) |
Round double precision floating point to integer. More... | |
static SimdDInt32 gmx_simdcall | gmx::cvttR2I (SimdDouble a) |
Truncate double precision floating point to integer. More... | |
static SimdDouble gmx_simdcall | gmx::cvtI2R (SimdDInt32 a) |
Convert integer to double precision floating point. More... | |
static SimdDIBool gmx_simdcall | gmx::cvtB2IB (SimdDBool a) |
Convert from double precision boolean to corresponding integer boolean. More... | |
static SimdDBool gmx_simdcall | gmx::cvtIB2B (SimdDIBool a) |
Convert from integer boolean to corresponding double precision boolean. More... | |
static SimdDouble gmx_simdcall | gmx::cvtF2D (SimdFloat gmx_unused f) |
Convert SIMD float to double. More... | |
static SimdFloat gmx_simdcall | gmx::cvtD2F (SimdDouble gmx_unused d) |
Convert SIMD double to float. More... | |
static void gmx_simdcall | gmx::cvtF2DD (SimdFloat gmx_unused f, SimdDouble gmx_unused *d0, SimdDouble gmx_unused *d1) |
Convert SIMD float to double. More... | |
static SimdFloat gmx_simdcall | gmx::cvtDD2F (SimdDouble gmx_unused d0, SimdDouble gmx_unused d1) |
Convert SIMD double to float. More... | |