Gromacs
2024.4
|
#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"
Reference implementation, SIMD single precision.
Classes | |
class | gmx::SimdFloat |
Float SIMD variable. Available if GMX_SIMD_HAVE_FLOAT is 1. More... | |
class | gmx::SimdFInt32 |
Integer SIMD variable type to use for conversions to/from float. More... | |
class | gmx::SimdFBool |
Boolean type for float SIMD data. More... | |
class | gmx::SimdFIBool |
Boolean type for integer datatypes corresponding to float SIMD. More... | |
Functions | |
SIMD implementation load/store operations for single precision floating point | |
static SimdFloat gmx_simdcall | gmx::simdLoad (const float *m, SimdFloatTag={}) |
Load GMX_SIMD_FLOAT_WIDTH float numbers from aligned memory. More... | |
static void gmx_simdcall | gmx::store (float *m, SimdFloat a) |
Store the contents of SIMD float variable to aligned memory m. More... | |
static SimdFloat gmx_simdcall | gmx::simdLoadU (const float *m, SimdFloatTag={}) |
Load SIMD float from unaligned memory. More... | |
static void gmx_simdcall | gmx::storeU (float *m, SimdFloat a) |
Store SIMD float to unaligned memory. More... | |
static SimdFloat gmx_simdcall | gmx::setZeroF () |
Set all SIMD float variable elements to 0.0. More... | |
SIMD implementation load/store operations for integers (corresponding to float) | |
static SimdFInt32 gmx_simdcall | gmx::simdLoad (const std::int32_t *m, SimdFInt32Tag) |
Load aligned SIMD integer data, width corresponds to gmx::SimdFloat. More... | |
static void gmx_simdcall | gmx::store (std::int32_t *m, SimdFInt32 a) |
Store aligned SIMD integer data, width corresponds to gmx::SimdFloat. More... | |
static SimdFInt32 gmx_simdcall | gmx::simdLoadU (const std::int32_t *m, SimdFInt32Tag) |
Load unaligned integer SIMD data, width corresponds to gmx::SimdFloat. More... | |
static void gmx_simdcall | gmx::storeU (std::int32_t *m, SimdFInt32 a) |
Store unaligned SIMD integer data, width corresponds to gmx::SimdFloat. More... | |
static SimdFInt32 gmx_simdcall | gmx::setZeroFI () |
Set all SIMD (float) integer variable elements to 0. More... | |
template<int index> | |
static std::int32_t gmx_simdcall | gmx::extract (SimdFInt32 a) |
Extract element with index i from gmx::SimdFInt32. More... | |
SIMD implementation single precision floating-point bitwise logical operations | |
static SimdFloat gmx_simdcall | gmx::operator& (SimdFloat a, SimdFloat b) |
Bitwise and for two SIMD float variables. More... | |
static SimdFloat gmx_simdcall | gmx::andNot (SimdFloat a, SimdFloat b) |
Bitwise andnot for SIMD float. More... | |
static SimdFloat gmx_simdcall | gmx::operator| (SimdFloat a, SimdFloat b) |
Bitwise or for SIMD float. More... | |
static SimdFloat gmx_simdcall | gmx::operator^ (SimdFloat a, SimdFloat b) |
Bitwise xor for SIMD float. More... | |
SIMD implementation single precision floating-point arithmetics | |
static SimdFloat gmx_simdcall | gmx::operator+ (SimdFloat a, SimdFloat b) |
Add two float SIMD variables. More... | |
static SimdFloat gmx_simdcall | gmx::operator- (SimdFloat a, SimdFloat b) |
Subtract two float SIMD variables. More... | |
static SimdFloat gmx_simdcall | gmx::operator- (SimdFloat a) |
SIMD single precision negate. More... | |
static SimdFloat gmx_simdcall | gmx::operator* (SimdFloat a, SimdFloat b) |
Multiply two float SIMD variables. More... | |
static SimdFloat gmx_simdcall | gmx::fma (SimdFloat a, SimdFloat b, SimdFloat c) |
SIMD float Fused-multiply-add. Result is a*b+c. More... | |
static SimdFloat gmx_simdcall | gmx::fms (SimdFloat a, SimdFloat b, SimdFloat c) |
SIMD float Fused-multiply-subtract. Result is a*b-c. More... | |
static SimdFloat gmx_simdcall | gmx::fnma (SimdFloat a, SimdFloat b, SimdFloat c) |
SIMD float Fused-negated-multiply-add. Result is -a*b+c. More... | |
static SimdFloat gmx_simdcall | gmx::fnms (SimdFloat a, SimdFloat b, SimdFloat c) |
SIMD float Fused-negated-multiply-subtract. Result is -a*b-c. More... | |
static SimdFloat gmx_simdcall | gmx::rsqrt (SimdFloat x) |
SIMD float 1.0/sqrt(x) lookup. More... | |
static SimdFloat gmx_simdcall | gmx::rcp (SimdFloat x) |
SIMD float 1.0/x lookup. More... | |
static SimdFloat gmx_simdcall | gmx::maskAdd (SimdFloat a, SimdFloat b, SimdFBool m) |
Add two float SIMD variables, masked version. More... | |
static SimdFloat gmx_simdcall | gmx::maskzMul (SimdFloat a, SimdFloat b, SimdFBool m) |
Multiply two float SIMD variables, masked version. More... | |
static SimdFloat gmx_simdcall | gmx::maskzFma (SimdFloat a, SimdFloat b, SimdFloat c, SimdFBool m) |
SIMD float fused multiply-add, masked version. More... | |
static SimdFloat gmx_simdcall | gmx::maskzRsqrt (SimdFloat x, SimdFBool m) |
SIMD float 1.0/sqrt(x) lookup, masked version. More... | |
static SimdFloat gmx_simdcall | gmx::maskzRcp (SimdFloat x, SimdFBool m) |
SIMD float 1.0/x lookup, masked version. More... | |
static SimdFloat gmx_simdcall | gmx::abs (SimdFloat a) |
SIMD float Floating-point abs(). More... | |
static SimdFloat gmx_simdcall | gmx::max (SimdFloat a, SimdFloat b) |
Set each SIMD float element to the largest from two variables. More... | |
static SimdFloat gmx_simdcall | gmx::min (SimdFloat a, SimdFloat b) |
Set each SIMD float element to the smallest from two variables. More... | |
static SimdFloat gmx_simdcall | gmx::round (SimdFloat a) |
SIMD float round to nearest integer value (in floating-point format). More... | |
static SimdFloat gmx_simdcall | gmx::trunc (SimdFloat a) |
Truncate SIMD float, i.e. round towards zero - common hardware instruction. More... | |
template<MathOptimization opt = MathOptimization::Safe> | |
static SimdFloat gmx_simdcall | gmx::frexp (SimdFloat value, SimdFInt32 *exponent) |
Extract (integer) exponent and fraction from single precision SIMD. More... | |
template<MathOptimization opt = MathOptimization::Safe> | |
static SimdFloat gmx_simdcall | gmx::ldexp (SimdFloat value, SimdFInt32 exponent) |
Multiply a SIMD float value by the number 2 raised to an exp power. More... | |
static float gmx_simdcall | gmx::reduce (SimdFloat a) |
Return sum of all elements in SIMD float variable. More... | |
SIMD implementation single precision floating-point comparisons, boolean, selection. | |
static SimdFBool gmx_simdcall | gmx::operator== (SimdFloat a, SimdFloat b) |
SIMD a==b for single SIMD. More... | |
static SimdFBool gmx_simdcall | gmx::operator!= (SimdFloat a, SimdFloat b) |
SIMD a!=b for single SIMD. More... | |
static SimdFBool gmx_simdcall | gmx::operator< (SimdFloat a, SimdFloat b) |
SIMD a<b for single SIMD. More... | |
static SimdFBool gmx_simdcall | gmx::operator<= (SimdFloat a, SimdFloat b) |
SIMD a<=b for single SIMD. More... | |
static SimdFBool gmx_simdcall | gmx::testBits (SimdFloat a) |
Return true if any bits are set in the single precision SIMD. More... | |
static SimdFBool gmx_simdcall | gmx::operator&& (SimdFBool a, SimdFBool b) |
Logical and on single precision SIMD booleans. More... | |
static SimdFBool gmx_simdcall | gmx::operator|| (SimdFBool a, SimdFBool b) |
Logical or on single precision SIMD booleans. More... | |
static bool gmx_simdcall | gmx::anyTrue (SimdFBool a) |
Returns non-zero if any of the boolean in SIMD a is True, otherwise 0. More... | |
static SimdFloat gmx_simdcall | gmx::selectByMask (SimdFloat a, SimdFBool mask) |
Select from single precision SIMD variable where boolean is true. More... | |
static SimdFloat gmx_simdcall | gmx::selectByNotMask (SimdFloat a, SimdFBool mask) |
Select from single precision SIMD variable where boolean is false. More... | |
static SimdFloat gmx_simdcall | gmx::blend (SimdFloat a, SimdFloat b, SimdFBool sel) |
Vector-blend SIMD float selection. More... | |
SIMD implementation integer (corresponding to float) bitwise logical operations | |
static SimdFInt32 gmx_simdcall | gmx::operator& (SimdFInt32 a, SimdFInt32 b) |
Integer SIMD bitwise and. More... | |
static SimdFInt32 gmx_simdcall | gmx::andNot (SimdFInt32 a, SimdFInt32 b) |
Integer SIMD bitwise not/complement. More... | |
static SimdFInt32 gmx_simdcall | gmx::operator| (SimdFInt32 a, SimdFInt32 b) |
Integer SIMD bitwise or. More... | |
static SimdFInt32 gmx_simdcall | gmx::operator^ (SimdFInt32 a, SimdFInt32 b) |
Integer SIMD bitwise xor. More... | |
SIMD implementation integer (corresponding to float) arithmetics | |
static SimdFInt32 gmx_simdcall | gmx::operator+ (SimdFInt32 a, SimdFInt32 b) |
Add SIMD integers. More... | |
static SimdFInt32 gmx_simdcall | gmx::operator- (SimdFInt32 a, SimdFInt32 b) |
Subtract SIMD integers. More... | |
static SimdFInt32 gmx_simdcall | gmx::operator* (SimdFInt32 a, SimdFInt32 b) |
Multiply SIMD integers. More... | |
SIMD implementation integer (corresponding to float) comparisons, boolean, selection | |
static SimdFIBool gmx_simdcall | gmx::operator== (SimdFInt32 a, SimdFInt32 b) |
Equality comparison of two integers corresponding to float values. More... | |
static SimdFIBool gmx_simdcall | gmx::operator< (SimdFInt32 a, SimdFInt32 b) |
Less-than comparison of two SIMD integers corresponding to float values. More... | |
static SimdFIBool gmx_simdcall | gmx::testBits (SimdFInt32 a) |
Check if any bit is set in each element. More... | |
static SimdFIBool gmx_simdcall | gmx::operator&& (SimdFIBool a, SimdFIBool b) |
Logical AND on SimdFIBool. More... | |
static SimdFIBool gmx_simdcall | gmx::operator|| (SimdFIBool a, SimdFIBool b) |
Logical OR on SimdFIBool. More... | |
static bool gmx_simdcall | gmx::anyTrue (SimdFIBool a) |
Returns true if any of the boolean in x is True, otherwise 0. More... | |
static SimdFInt32 gmx_simdcall | gmx::selectByMask (SimdFInt32 a, SimdFIBool mask) |
Select from gmx::SimdFInt32 variable where boolean is true. More... | |
static SimdFInt32 gmx_simdcall | gmx::selectByNotMask (SimdFInt32 a, SimdFIBool mask) |
Select from gmx::SimdFInt32 variable where boolean is false. More... | |
static SimdFInt32 gmx_simdcall | gmx::blend (SimdFInt32 a, SimdFInt32 b, SimdFIBool sel) |
Vector-blend SIMD integer selection. More... | |
SIMD implementation conversion operations | |
static SimdFInt32 gmx_simdcall | gmx::cvtR2I (SimdFloat a) |
Round single precision floating point to integer. More... | |
static SimdFInt32 gmx_simdcall | gmx::cvttR2I (SimdFloat a) |
Truncate single precision floating point to integer. More... | |
static SimdFloat gmx_simdcall | gmx::cvtI2R (SimdFInt32 a) |
Convert integer to single precision floating point. More... | |
static SimdFIBool gmx_simdcall | gmx::cvtB2IB (SimdFBool a) |
Convert from single precision boolean to corresponding integer boolean. More... | |
static SimdFBool gmx_simdcall | gmx::cvtIB2B (SimdFIBool a) |
Convert from integer boolean to corresponding single precision boolean. More... | |