Skip to content

Commit f26ead9

Browse files
committed
Test: Fixed Mixed Precision
Consistently: Real -> ParticleReal
1 parent 98e25d7 commit f26ead9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Tests/SIMD/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,26 +427,26 @@ int main (int argc, char* argv[])
427427

428428
// ================================================================
429429
// Test 14: any_of, where, select — portable single-source
430-
// Uses SIMDReal<>, which is a SIMD vector when AMREX_USE_SIMD=ON
430+
// Uses SIMDParticleReal<>, which is a SIMD vector when AMREX_USE_SIMD=ON
431431
// and a plain scalar when OFF. The same code path exercises
432432
// both the real SIMD and the scalar fallback implementations.
433433
// ================================================================
434434
{
435-
using Real_t = simd::SIMDReal<>;
435+
using PReal_t = simd::SIMDParticleReal<>;
436436

437437
// safe reciprocal: 1/b where b != 0, else 0
438-
Real_t b(ParticleReal(2));
439-
auto mask = b != Real_t(ParticleReal(0));
440-
auto safe_b = simd::stdx::select(mask, b, Real_t(ParticleReal(1)));
438+
auto b = PReal_t(2);
439+
auto mask = b != PReal_t(0);
440+
auto safe_b = simd::stdx::select(mask, b, PReal_t(1));
441441
auto recip = simd::stdx::select(mask,
442-
Real_t(ParticleReal(1)) / safe_b,
443-
Real_t(ParticleReal(0)));
442+
PReal_t(1) / safe_b,
443+
PReal_t(0));
444444

445445
// any_of: at least one lane should be nonzero
446446
AMREX_ALWAYS_ASSERT(simd::stdx::any_of(mask));
447447

448448
// where: masked assignment
449-
Real_t acc(ParticleReal(0));
449+
auto acc = PReal_t(0);
450450
simd::stdx::where(mask, acc) = recip;
451451

452452
// verify: b=2 everywhere → recip=0.5, acc=0.5
@@ -455,7 +455,7 @@ int main (int argc, char* argv[])
455455
if (std::abs(got - expected) > ParticleReal(1.e-10)) { ++err; }
456456
};
457457
#ifdef AMREX_USE_SIMD
458-
for (int lane = 0; lane < static_cast<int>(Real_t::size()); ++lane) {
458+
for (int lane = 0; lane < static_cast<int>(PReal_t::size()); ++lane) {
459459
check(recip[lane], ParticleReal(0.5));
460460
check(acc[lane], ParticleReal(0.5));
461461
}

0 commit comments

Comments
 (0)