29#if defined(JPL_USE_SSE)
33#if defined (JPL_USE_SSE4_1)
36#elif defined(JPL_USE_NEON)
37#ifdef JPL_COMPILER_MSVC
39#include <arm64_neon.h>
62#if defined(JPL_USE_SSE)
64#elif defined(JPL_USE_NEON)
67 using Type = std::array<float, 4>;
109 template<u
int32 LaneIndex>
requires (
LaneIndex < 4)
197 inStream << data[0] <<
", " << data[1] <<
", " << data[2] <<
", " << data[3];
203 static_assert(std::is_trivial<simd>(),
"simd supposed to be a trivial type.");
209#if defined(JPL_USE_SSE)
211#elif defined(JPL_USE_NEON)
214 using Type = std::array<uint32,4>;
234 inline static constexpr uint32 cTrueValue = 0xffffffffu;
243 template<u
int32 LaneIndex>
requires (
LaneIndex < 4)
323 inStream << data[0] <<
", " << data[1] <<
", " << data[2] <<
", " << data[3];
329 static_assert(std::is_trivial<simd_mask>(),
"simd_mask supposed to be a trivial type.");
422 JPL_INLINE simd_mask
max(
const simd_mask& a,
const simd_mask& b)
noexcept;
425 JPL_INLINE simd_mask
min(
const simd_mask& a,
const simd_mask& b)
noexcept;
431 JPL_INLINE simd_mask
maxs(
const simd_mask& a,
const simd_mask& b)
noexcept;
434 JPL_INLINE simd_mask
mins(
const simd_mask& a,
const simd_mask& b)
noexcept;
443struct std::equal_to<
JPL::simd>
479#if defined(JPL_USE_SSE)
481#elif defined(JPL_USE_NEON)
493#if defined(JPL_USE_SSE)
495#elif defined(JPL_USE_NEON)
517#if defined(JPL_USE_SSE)
536 return {
x,
y,
z,
w };
543#if defined(JPL_USE_SSE)
545#elif defined(JPL_USE_NEON)
548 return simd(0, 0, 0, 0);
554 return simd(std::numeric_limits<float>::quiet_NaN());
559 return simd(std::numeric_limits<float>::infinity());
564#if defined(JPL_USE_SSE)
566#elif defined(JPL_USE_NEON)
575#if defined(JPL_USE_SSE)
577#elif defined(JPL_USE_NEON)
590#if defined(JPL_USE_SSE)
591#if defined(JPL_USE_AVX)
596 alignas(16)
float temp[4];
600#elif defined(JPL_USE_NEON)
601 alignas(16)
float temp[4];
605 return mNative[index];
609 template<u
int32 LaneIndex>
requires (
LaneIndex < 4)
612#if defined(JPL_USE_SSE)
614#elif defined(JPL_USE_NEON)
623#if defined(JPL_USE_SSE)
625#elif defined(JPL_USE_NEON)
639#if defined(JPL_USE_SSE)
641#elif defined(JPL_USE_NEON)
650#if defined(JPL_USE_SSE)
652#elif defined(JPL_USE_NEON)
666#if defined(JPL_USE_SSE)
668#elif defined(JPL_USE_NEON)
682#if defined(JPL_USE_SSE)
684#elif defined(JPL_USE_NEON)
687 for (
int i = 0;
i < 4; ++
i)
695#if defined(JPL_USE_SSE)
697#elif defined(JPL_USE_NEON)
700 for (
int i = 0;
i < 4; ++
i)
708#if defined(JPL_USE_SSE)
710#elif defined(JPL_USE_NEON)
713 for (
int i = 0;
i < 4; ++
i)
721#if defined(JPL_USE_SSE)
723#elif defined(JPL_USE_NEON)
726 for (
int i = 0;
i < 4; ++
i)
734#if defined(JPL_USE_SSE)
736#elif defined(JPL_USE_NEON)
750#if defined(JPL_USE_SSE)
752#elif defined(JPL_USE_NEON)
755 for (
int i = 0;
i < 4; ++
i)
763#if defined(JPL_USE_SSE)
765#elif defined(JPL_USE_NEON)
787#if defined(JPL_USE_SSE)
789#elif defined(JPL_USE_NEON)
803#if defined(JPL_USE_SSE)
805#elif defined(JPL_USE_NEON)
808 for (
int i = 0;
i < 4; ++
i)
816#if defined(JPL_USE_SSE)
818#elif defined(JPL_USE_NEON)
832#if defined(JPL_USE_SSE)
834#elif defined(JPL_USE_NEON)
848#if defined(JPL_USE_SSE)
850#elif defined(JPL_USE_NEON)
864#if defined(JPL_USE_SSE)
866#elif defined(JPL_USE_NEON)
880#if defined(JPL_USE_SSE)
882#elif defined(JPL_USE_NEON)
890 return (a.as_mask() | b.as_mask()).as_simd();
896#if defined(JPL_USE_SSE)
898#elif defined(JPL_USE_NEON)
906 return (a.as_mask() ^ b.as_mask()).as_simd();
912#if defined(JPL_USE_SSE)
914#elif defined(JPL_USE_NEON)
922 return (a.as_mask() & b.as_mask()).as_simd();
926 template<u
int32 LaneIndex>
requires(
LaneIndex < 4)
929#if defined(JPL_USE_SSE)
931#elif defined(JPL_USE_NEON)
940#if defined(JPL_USE_SSE)
946#elif defined (JPL_USE_NEON)
955#if defined(JPL_USE_SSE)
961#elif defined (JPL_USE_NEON)
972#if defined(JPL_USE_SSE)
978#elif defined (JPL_USE_NEON)
989#if defined(JPL_USE_SSE)
991#elif defined(JPL_USE_NEON)
1025#if defined(JPL_USE_SSE)
1027#elif defined(JPL_USE_NEON)
1030 return std::bit_cast<simd_mask>(*
this);
1036#if defined(JPL_USE_SSE4_1)
1038#elif defined(JPL_USE_SSE)
1043#elif defined(JPL_USE_NEON)
1066#if defined(JPL_USE_SSE)
1068#elif defined(JPL_USE_NEON)
1080#if defined(JPL_USE_SSE)
1082 static_cast<int>(
v3),
1083 static_cast<int>(
v2),
1084 static_cast<int>(
v1),
1085 static_cast<int>(
v0)
1087#elif defined(JPL_USE_NEON)
1108#if defined(JPL_USE_NEON)
1123#if defined(JPL_USE_SSE)
1125#elif defined(JPL_USE_NEON)
1134#if defined(JPL_USE_SSE)
1136#elif defined(JPL_USE_NEON)
1145#if defined(JPL_USE_SSE)
1147#elif defined(JPL_USE_NEON)
1157 template<u
int32 LaneIndex>
requires (
LaneIndex < 4)
1160#if defined(JPL_USE_SSE)
1162#elif defined(JPL_USE_NEON)
1186#if defined(JPL_USE_SSE)
1188#elif defined(JPL_USE_NEON)
1199 return m ?
static_cast<int>(std::countr_zero(
m)) : -1;
1206 return 31 -
static_cast<int>(std::countl_zero(
m));
1211#if defined(JPL_USE_SSE)
1213#elif defined(JPL_USE_NEON)
1216#if defined(JPL_COMPILER_MSVC)
1217 const uint32x4_t w = { .n128_u32 = { 1u, 2u, 4u, 8u } };
1232#if defined(JPL_USE_SSE4_1)
1234#elif defined(JPL_USE_SSE)
1241#elif defined(JPL_USE_NEON)
1255#if defined(JPL_USE_SSE4_1)
1257#elif defined(JPL_USE_SSE)
1264#elif defined(JPL_USE_NEON)
1277#if defined(JPL_USE_SSE)
1279#elif defined(JPL_USE_NEON)
1293#if defined(JPL_USE_SSE)
1295#elif defined(JPL_USE_NEON)
1308#if defined(JPL_USE_SSE)
1310#elif defined(JPL_USE_NEON)
1324#if defined(JPL_USE_SSE)
1327#elif defined(JPL_USE_NEON)
1340#if defined(JPL_USE_SSE)
1342#elif defined(JPL_USE_NEON)
1346 a.mNative[0] == b.mNative[0] ? cTrueValue : 0,
1347 a.mNative[1] == b.mNative[1] ? cTrueValue : 0,
1348 a.mNative[2] == b.mNative[2] ? cTrueValue : 0,
1349 a.mNative[3] == b.mNative[3] ? cTrueValue : 0
1356#if defined(JPL_USE_SSE)
1358#elif defined(JPL_USE_NEON)
1362 a.mNative[0] < b.mNative[0] ? cTrueValue : 0,
1363 a.mNative[1] < b.mNative[1] ? cTrueValue : 0,
1364 a.mNative[2] < b.mNative[2] ? cTrueValue : 0,
1365 a.mNative[3] < b.mNative[3] ? cTrueValue : 0
1372#if defined(JPL_USE_SSE)
1374#elif defined(JPL_USE_NEON)
1378 a.mNative[0] <= b.mNative[0] ? cTrueValue : 0,
1379 a.mNative[1] <= b.mNative[1] ? cTrueValue : 0,
1380 a.mNative[2] <= b.mNative[2] ? cTrueValue : 0,
1381 a.mNative[3] <= b.mNative[3] ? cTrueValue : 0
1388#if defined(JPL_USE_SSE)
1390#elif defined(JPL_USE_NEON)
1394 a.mNative[0] > b.mNative[0] ? cTrueValue : 0,
1395 a.mNative[1] > b.mNative[1] ? cTrueValue : 0,
1396 a.mNative[2] > b.mNative[2] ? cTrueValue : 0,
1397 a.mNative[3] > b.mNative[3] ? cTrueValue : 0
1404#if defined(JPL_USE_SSE)
1406#elif defined(JPL_USE_NEON)
1410 a.mNative[0] >= b.mNative[0] ? cTrueValue : 0,
1411 a.mNative[1] >= b.mNative[1] ? cTrueValue : 0,
1412 a.mNative[2] >= b.mNative[2] ? cTrueValue : 0,
1413 a.mNative[3] >= b.mNative[3] ? cTrueValue : 0
1420#if defined(JPL_USE_SSE)
1422#elif defined(JPL_USE_NEON)
1426 a.mNative[0] == b.mNative[0] ? cTrueValue : 0,
1427 a.mNative[1] == b.mNative[1] ? cTrueValue : 0,
1428 a.mNative[2] == b.mNative[2] ? cTrueValue : 0,
1429 a.mNative[3] == b.mNative[3] ? cTrueValue : 0
1436#if defined(JPL_USE_AVX512)
1438#elif defined(JPL_USE_SSE)
1440#elif defined(JPL_USE_NEON)
1449#if defined(JPL_USE_SSE)
1451#elif defined(JPL_USE_NEON)
1463#if defined(JPL_USE_SSE)
1465#elif defined(JPL_USE_NEON)
1477#if defined(JPL_USE_SSE)
1479#elif defined(JPL_USE_NEON)
1492#if defined(JPL_USE_SSE)
1495#elif defined(JPL_USE_NEON)
1500 mNative[0] >>
count,
1501 mNative[1] >>
count,
1502 mNative[2] >>
count,
1511#if defined(JPL_USE_SSE)
1514#elif defined(JPL_USE_NEON)
1519 mNative[0] <<
count,
1520 mNative[1] <<
count,
1521 mNative[2] <<
count,
1527 template<u
int Count>
requires(Count <= 31)
1530#if defined(JPL_USE_SSE)
1532#elif defined(JPL_USE_NEON)
1536 mNative[0] >> Count,
1537 mNative[1] >> Count,
1538 mNative[2] >> Count,
1544 template<u
int Count>
requires(Count <= 31)
1547#if defined(JPL_USE_SSE)
1549#elif defined(JPL_USE_NEON)
1553 mNative[0] << Count,
1554 mNative[1] << Count,
1555 mNative[2] << Count,
1561 template<u
int Count>
requires(Count <= 31)
1564#if defined(JPL_USE_SSE)
1566#elif defined(JPL_USE_NEON)
1570 static_cast<uint32>(
static_cast<int32>(mNative[0]) >> Count),
1571 static_cast<uint32>(
static_cast<int32>(mNative[1]) >> Count),
1572 static_cast<uint32>(
static_cast<int32>(mNative[2]) >> Count),
1573 static_cast<uint32>(
static_cast<int32>(mNative[3]) >> Count)
1580#if defined(JPL_USE_SSE)
1582#elif defined(JPL_USE_NEON)
1596#if defined(JPL_USE_SSE)
1598#elif defined(JPL_USE_NEON)
1612#if defined(JPL_USE_SSE)
1614#elif defined(JPL_USE_NEON)
1619 static_cast<float>(
mU32[0]),
1620 static_cast<float>(
mU32[1]),
1621 static_cast<float>(
mU32[2]),
1622 static_cast<float>(
mU32[3])
1629#if defined(JPL_USE_SSE)
1631#elif defined(JPL_USE_NEON)
1634 return std::bit_cast<simd>(*
this);
1640#if defined(JPL_USE_SSE)
1642#elif defined(JPL_USE_NEON)
1646 a.mNative[0] | b.mNative[0],
1647 a.mNative[1] | b.mNative[1],
1648 a.mNative[2] | b.mNative[2],
1649 a.mNative[3] | b.mNative[3]
1656#if defined(JPL_USE_SSE)
1658#elif defined(JPL_USE_NEON)
1662 a.mNative[0] ^ b.mNative[0],
1663 a.mNative[1] ^ b.mNative[1],
1664 a.mNative[2] ^ b.mNative[2],
1665 a.mNative[3] ^ b.mNative[3]
1672#if defined(JPL_USE_SSE)
1674#elif defined(JPL_USE_NEON)
1678 a.mNative[0] & b.mNative[0],
1679 a.mNative[1] & b.mNative[1],
1680 a.mNative[2] & b.mNative[2],
1681 a.mNative[3] & b.mNative[3]
1691#if defined(JPL_USE_SSE)
1693#elif defined(JPL_USE_NEON)
1696 return simd(std::sqrt(mNative[0]), std::sqrt(mNative[1]), std::sqrt(mNative[2]), std::sqrt(mNative[3]));
1702 template<
int NR>
requires(
NR > 0 &&
NR <= 2)
1707#if defined(JPL_USE_SSE)
1711 auto newton = [](
const Type&
x,
const Type&
y)
1715#if defined(JPL_USE_FMADD)
1728 if constexpr (
NR >= 1)
1732 if constexpr (
NR >= 2)
1738#elif defined (JPL_USE_NEON)
1741 auto newton = [](
const Type&
x,
const Type&
y)
1758 if constexpr (
NR >= 1)
1762 if constexpr (
NR >= 2)
1801#if defined(JPL_USE_SSE)
1803#elif defined(JPL_USE_NEON)
1806 return simd(std::max(a.mNative[0], b.mNative[0]),
1807 std::max(a.mNative[1], b.mNative[1]),
1808 std::max(a.mNative[2], b.mNative[2]),
1809 std::max(a.mNative[3], b.mNative[3]));
1815#if defined(JPL_USE_SSE)
1817#elif defined(JPL_USE_NEON)
1820 return simd(std::min(a.mNative[0], b.mNative[0]),
1821 std::min(a.mNative[1], b.mNative[1]),
1822 std::min(a.mNative[2], b.mNative[2]),
1823 std::min(a.mNative[3], b.mNative[3]));
1829#if defined(JPL_USE_SSE)
1831#elif defined(JPL_USE_NEON)
1845#if defined(JPL_USE_SSE)
1851#elif defined(JPL_USE_NEON)
1869#if defined (JPL_USE_SSE)
1870#if defined (JPL_USE_SSE4_1)
1880#elif defined (JPL_USE_NEON)
1901#if defined (JPL_USE_SSE)
1903#if defined (JPL_USE_SSE4_1)
1917#elif defined (JPL_USE_NEON)
1932#if defined(JPL_USE_SSE4_1)
1934#elif defined(JPL_USE_SSE)
1937 return (
vec + (
simd(0.5f) | sign.as_simd())).to_mask().to_simd();
1938#elif defined(JPL_USE_NEON)
1952#if defined(JPL_USE_SSE)
1954#elif defined(JPL_USE_NEON)
1964#if defined(JPL_USE_SSE)
1971#elif defined(JPL_USE_NEON)
1974 return { a.mNative[0], a.mNative[1], b.mNative[0], b.mNative[1] };
1980#if defined(JPL_USE_SSE)
1987#elif defined(JPL_USE_NEON)
1990 return { a.mNative[2], a.mNative[3], b.mNative[2], b.mNative[3] };
1996#if defined(JPL_USE_SSE)
1998#elif defined(JPL_USE_NEON)
2001 return { a.mNative[0], a.mNative[1], b.mNative[2], b.mNative[3] };
2007#if defined(JPL_USE_SSE)
2009#elif defined(JPL_USE_NEON)
2022#if defined(JPL_USE_SSE4_1)
2024#elif defined(JPL_USE_SSE)
2034#elif defined(JPL_USE_NEON)
2037 return simd_mask(std::max(a.mNative[0], b.mNative[0]),
2038 std::max(a.mNative[1], b.mNative[1]),
2039 std::max(a.mNative[2], b.mNative[2]),
2040 std::max(a.mNative[3], b.mNative[3]));
2046#if defined(JPL_USE_SSE4_1)
2048#elif defined(JPL_USE_SSE)
2057#elif defined(JPL_USE_NEON)
2060 return simd_mask(std::min(a.mNative[0], b.mNative[0]),
2061 std::min(a.mNative[1], b.mNative[1]),
2062 std::min(a.mNative[2], b.mNative[2]),
2063 std::min(a.mNative[3], b.mNative[3]));
2074#if defined(JPL_USE_SSE4_1)
2076#elif defined(JPL_USE_SSE)
2081#elif defined(JPL_USE_NEON)
2087 static_cast<uint32>(std::max(
static_cast<int32>(a.mNative[0]),
static_cast<int32>(b.mNative[0]))),
2088 static_cast<uint32>(std::max(
static_cast<int32>(a.mNative[1]),
static_cast<int32>(b.mNative[1]))),
2089 static_cast<uint32>(std::max(
static_cast<int32>(a.mNative[2]),
static_cast<int32>(b.mNative[2]))),
2090 static_cast<uint32>(std::max(
static_cast<int32>(a.mNative[3]),
static_cast<int32>(b.mNative[3]))));
2096#if defined(JPL_USE_SSE4_1)
2098#elif defined(JPL_USE_SSE)
2103#elif defined(JPL_USE_NEON)
2109 static_cast<uint32>(std::min(
static_cast<int32>(a.mNative[0]),
static_cast<int32>(b.mNative[0]))),
2110 static_cast<uint32>(std::min(
static_cast<int32>(a.mNative[1]),
static_cast<int32>(b.mNative[1]))),
2111 static_cast<uint32>(std::min(
static_cast<int32>(a.mNative[2]),
static_cast<int32>(b.mNative[2]))),
2112 static_cast<uint32>(std::min(
static_cast<int32>(a.mNative[3]),
static_cast<int32>(b.mNative[3]))));
#define JPL_ASSERT(inExpression,...)
Main assert macro, usage: JPL_ASSERT(condition, message) or JPL_ASSERT(condition)
Definition ErrorReporting.h:76
JPL_INLINE constexpr T FMA(T a, T b, T c) noexcept
Inlined fuse multiply-add. Compiler in some circumstances is more eager to optimize this than std::fm...
Definition Math.h:186
JPL_INLINE constexpr T InvSqrt(T x) noexcept
Definition Math.h:283
JPL_INLINE constexpr T Lerp(const T &v0, const T &v1, T t) noexcept
Linearly interpolate v0 towards v1.
Definition Math.h:172
JPL_INLINE constexpr T Sqrt(T x) noexcept
Definition Math.h:269
JPL_INLINE constexpr bool IsNearlyZero(T value, T errorTolerance=JPL_FLOAT_EPS_V< T >) noexcept
Definition Math.h:146
JPL_INLINE simd InvSqrtImpl(const simd &vec) noexcept
Definition SIMD.h:1703
JPL_INLINE simd InvSqrtFast(const simd &vec) noexcept
Definition SIMD.h:1783
JPL_INLINE constexpr T Sign2(T value) noexcept
Sign2 returns -1 for negative values, 1 otherwise.
Definition Math.h:131
Definition AcousticMaterial.h:36
JPL_INLINE simd clamp(const simd &value, const simd &minV, const simd &maxV) noexcept
Element-wise clamp.
Definition SIMD.h:1838
JPL_INLINE simd_mask clamps(const simd_mask &value, const simd_mask &minV, const simd_mask &maxV) noexcept
Element-wise clamp, signed.
Definition SIMD.h:2116
JPL_INLINE simd_mask operator!=(const simd &a, const simd &b) noexcept
Definition SIMD.h:341
JPL_INLINE simd_mask mins(const simd_mask &a, const simd_mask &b) noexcept
Element-wise min, signed.
Definition SIMD.h:2094
std::int32_t int32
Definition Core.h:316
JPL_INLINE simd_mask operator>=(const simd &a, const simd &b) noexcept
Definition SIMD.h:1402
JPL_INLINE simd operator|(const simd &a, const simd &b) noexcept
Component-wise logical OR.
Definition SIMD.h:878
JPL_INLINE simd_mask operator<=(const simd &a, const simd &b) noexcept
Definition SIMD.h:1370
JPL_INLINE simd_mask operator<(const simd &a, const simd &b) noexcept
Definition SIMD.h:1354
JPL_INLINE simd combine_hi(const simd &a, const simd &b) noexcept
Combine two high lanes of input a and b as { a2, a3, b2, b3 }.
Definition SIMD.h:1978
JPL_INLINE constexpr Vec2 operator/(T Scale, const JPL::Vec2 &V) noexcept
Definition MinimalVec2.h:64
unsigned int uint
Definition Core.h:308
JPL_INLINE simd_mask maxs(const simd_mask &a, const simd_mask &b) noexcept
Element-wise max, signed.
Definition SIMD.h:2072
JPL_INLINE simd reverse(const simd &vec) noexcept
Reverse the order of the lanes.
Definition SIMD.h:2005
std::uint32_t uint32
Definition Core.h:311
JPL_INLINE simd operator^(const simd &a, const simd &b) noexcept
Component-wise logical XOR.
Definition SIMD.h:894
JPL_INLINE simd combine_lohi(const simd &a, const simd &b) noexcept
Combine two low lanes of a and two high lanes from b as { a0, a1, b2, b3 }.
Definition SIMD.h:1994
JPL_INLINE constexpr bool operator==(const Vec2 &A, const Vec2 &B) noexcept
Definition MinimalVec2.h:59
JPL_INLINE simd operator&(const simd &a, const simd &b) noexcept
Component-wise logical AND.
Definition SIMD.h:910
JPL_INLINE simd_mask operator>(const simd &a, const simd &b) noexcept
Definition SIMD.h:1386
JPL_INLINE simd round(const simd &vec) noexcept
Element-wise round to nearest integer value.
Definition SIMD.h:1930
JPL_INLINE simd floor(const simd &vec) noexcept
Element-wise floor.
Definition SIMD.h:1861
JPL_INLINE simd max(const simd &a, const simd &b) noexcept
Element-wise max.
Definition SIMD.h:1799
JPL_INLINE simd ceil(const simd &vec) noexcept
Element-wise ceil.
Definition SIMD.h:1893
std::uint8_t uint8
Definition Core.h:309
JPL_INLINE simd fma(const simd &mul1, const simd &mul2, const simd &addV) noexcept
Element-wise fused multiply-add.
Definition SIMD.h:1843
JPL_INLINE constexpr Vec2 operator*(T Scale, const JPL::Vec2 &V) noexcept
Definition MinimalVec2.h:62
JPL_INLINE simd interleave_lohi(const simd &vec) noexcept
Interleave two low lanes with the two high lanes (e.g. { 0, 1, 2, 3 } -> { 0, 2, 1,...
Definition SIMD.h:1950
JPL_INLINE simd min(const simd &a, const simd &b) noexcept
Element-wise min.
Definition SIMD.h:1813
JPL_INLINE simd abs(const simd &vec) noexcept
Definition SIMD.h:1827
JPL_INLINE simd combine_lo(const simd &a, const simd &b) noexcept
Combine two low lanes of input a and b as { a0, a1, b0, b1 }.
Definition SIMD.h:1962
Definition ChannelMap.h:268
JPL_INLINE void store(uint32 *mem) const
Store values from simd to provided memory location.
Definition SIMD.h:1143
JPL_INLINE simd_mask & operator-=(const simd_mask &other) noexcept
Component-wise subtract two simd_mask vectors.
Definition SIMD.h:1322
JPL_INLINE bool all_of() const noexcept
Test if all of the components are true.
Definition SIMD.h:1169
JPL_INLINE simd_mask operator*(const simd_mask &other) const noexcept
Component-wise multiplies each of the 4 integer components with an integer (discards any overflow)
Definition SIMD.h:1230
Type mNative
Definition SIMD.h:327
JPL_INLINE bool any_of() const noexcept
Test if any of the components are true.
Definition SIMD.h:1174
JPL_INLINE simd_mask ashr() const noexcept
Definition SIMD.h:1562
JPL_INLINE simd_mask & operator*=(const simd_mask &other) noexcept
Component-wise multiplies each of the 4 integer components with an integer (discards any overflow)
Definition SIMD.h:1253
JPL_INLINE simd_mask operator-(const simd_mask &other) const noexcept
Component-wise subtract two simd_mask vectors.
Definition SIMD.h:1306
friend std::ostream & operator<<(std::ostream &inStream, const simd_mask &vec)
Definition SIMD.h:319
JPL_INLINE void operator^=(const simd_mask &other) noexcept
Component-wise logical XOR.
Definition SIMD.h:1461
JPL_INLINE int reduce_count() const noexcept
Count the number of components that are true.
Definition SIMD.h:1184
JPL_INLINE int reduce_max_index() const noexcept
Get index of the last component that is true.
Definition SIMD.h:1202
simd_mask() noexcept=default
JPL_INLINE simd_mask operator+(const simd_mask &other) const noexcept
Component-wise add an integer value to all integer components (discards any overflow)
Definition SIMD.h:1275
std::array< uint32, 4 > Type
Definition SIMD.h:214
JPL_INLINE simd as_simd() const noexcept
Reinterpret simd_mask as a simd (doesn't change the bits)
Definition SIMD.h:1627
JPL_INLINE uint32 get_lane() const noexcept
Get float component by index known at compile-time.
Definition SIMD.h:1158
JPL_INLINE simd_mask shr() const noexcept
Definition SIMD.h:1528
JPL_INLINE int reduce_min_index() const noexcept
Get index of the first component that is true.
Definition SIMD.h:1195
JPL_INLINE simd_mask & operator+=(const simd_mask &other) noexcept
Component-wise add two integer vectors (component wise)
Definition SIMD.h:1291
JPL_INLINE simd_mask operator>>(const uint32 count) const noexcept
Definition SIMD.h:1489
static JPL_INLINE simd_mask zero() noexcept
Definition SIMD.h:1121
JPL_INLINE simd_mask subs(const simd_mask &other) const noexcept
Definition SIMD.h:1594
JPL_INLINE int GetTrues() const noexcept
Store if [0] is true in bit 0, [1] in bit 1, [2] in bit 2 and [3] in bit 3.
Definition SIMD.h:1209
JPL_INLINE void operator&=(const simd_mask &other) noexcept
Component-wise logical AND.
Definition SIMD.h:1475
JPL_INLINE void load(const uint32 *mem)
Load values from memory into simd, 'mem' should point to memory with at least size() number of uint32...
Definition SIMD.h:1132
JPL_INLINE simd to_simd() const noexcept
Convert each component from an int to a float.
Definition SIMD.h:1610
JPL_INLINE void operator|=(const simd_mask &other) noexcept
Component-wise logical OR.
Definition SIMD.h:1447
JPL_INLINE bool none_of() const noexcept
Test if none of the components are true.
Definition SIMD.h:1179
JPL_INLINE simd_mask adds(const simd_mask &other) const noexcept
Definition SIMD.h:1578
JPL_INLINE simd_mask shl() const noexcept
Definition SIMD.h:1545
static JPL_INLINE simd_mask replicate(int value) noexcept
Definition SIMD.h:1106
JPL_INLINE simd_mask operator~() const noexcept
Component-wise logical NOT.
Definition SIMD.h:1434
Minimal 4-wide 32-bit float vector implementation for SIMD.
Definition SIMD.h:60
static JPL_INLINE simd c_0() noexcept
Frequently used constants.
Definition SIMD.h:456
friend JPL_INLINE simd operator*(float value, const simd &other) noexcept
Multiply vector with float.
Definition SIMD.h:648
JPL_INLINE float operator[](uint32 index) const noexcept
Get float component by index.
Definition SIMD.h:587
static JPL_INLINE simd c_1() noexcept
Definition SIMD.h:461
JPL_INLINE simd_mask to_mask() const noexcept
Convert each component from a float to an int.
Definition SIMD.h:987
JPL_INLINE simd operator/(float value) const noexcept
Divide vector by float.
Definition SIMD.h:664
JPL_INLINE simd & operator-=(const simd &other) noexcept
Subtract two float vectors (component wise)
Definition SIMD.h:801
JPL_INLINE simd_mask as_mask() const noexcept
Reinterpret simd as a simd_mask (doesn't change the bits)
Definition SIMD.h:1023
Type mNative
Definition SIMD.h:201
JPL_INLINE simd splat() const
Replicate component at LaneIndex to all components.
Definition SIMD.h:927
JPL_INLINE void operator|=(const simd &other) noexcept
Component-wise logical OR.
Definition SIMD.h:830
JPL_INLINE void load(const float *mem)
Load values from memory into simd, 'mem' should point to memory with at least size() number of floats...
Definition SIMD.h:562
static JPL_INLINE simd c_0p5() noexcept
Definition SIMD.h:466
static JPL_INLINE simd reciprocal(const simd &vec) noexcept
Reciprocal vector (1 / value) for each of the components.
Definition SIMD.h:1058
JPL_INLINE simd & operator+=(const simd &other) noexcept
Add two float vectors (component wise)
Definition SIMD.h:748
static JPL_INLINE simd zero() noexcept
Vector with all zeros.
Definition SIMD.h:541
std::array< float, 4 > Type
Definition SIMD.h:67
JPL_INLINE float reduce_min() const noexcept
Returns min component.
Definition SIMD.h:970
static JPL_INLINE simd c_pi() noexcept
Definition SIMD.h:471
JPL_INLINE simd & operator*=(float value) noexcept
Multiply vector with float.
Definition SIMD.h:680
JPL_INLINE void operator^=(const simd &other) noexcept
Component-wise logical XOR.
Definition SIMD.h:846
static JPL_INLINE simd inf() noexcept
Definition SIMD.h:557
JPL_INLINE float reduce_max() const noexcept
Returns max component.
Definition SIMD.h:953
static JPL_INLINE simd select(const simd_mask &mask, const simd &a, const simd &b) noexcept
Component-wise select, returns 'a' if mask is true, 'b' otherwise.
Definition SIMD.h:1034
JPL_INLINE void operator&=(const simd &other) noexcept
Component-wise logical AND.
Definition SIMD.h:862
JPL_INLINE float reduce() const noexcept
Returns sum of all components.
Definition SIMD.h:938
JPL_INLINE simd operator-() const noexcept
Negate.
Definition SIMD.h:761
JPL_INLINE simd operator+(const simd &other) const noexcept
Add two float vectors (component wise)
Definition SIMD.h:732
JPL_INLINE float get_lane() const noexcept
Get float component by index known at compile-time.
Definition SIMD.h:610
JPL_INLINE simd & operator/=(float value) noexcept
Divide vector by float.
Definition SIMD.h:706
JPL_INLINE void store(float *mem) const
Store values from simd to provided memory location.
Definition SIMD.h:573
static JPL_INLINE simd nan() noexcept
Vector with all NaN's.
Definition SIMD.h:552
static JPL_INLINE simd gather(const float *base, const simd_mask &offsets)
Gather 4 floats from memory at base + offsets[i] * Scale.
Definition SIMD.h:515
JPL_INLINE bool operator()(const JPL::simd &a, const JPL::simd &b) const
Definition SIMD.h:445