From c4eb38b856f420325889f40afe3c8c3621e66c8a Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 3 Aug 2018 01:27:39 -0400 Subject: [PATCH] Improve CPU_ProbePower8() test --- ppc-simd.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ppc-simd.cpp b/ppc-simd.cpp index 51c5d3d4..c6859d09 100644 --- a/ppc-simd.cpp +++ b/ppc-simd.cpp @@ -161,11 +161,15 @@ bool CPU_ProbePower8() result = false; else { - byte b1[19] = {255, 255, 255, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, b2[17]; - const uint8x16_p v1 = (uint8x16_p)VectorLoad(0, b1+3); - VectorStore(v1, b2+1); + // POWER8 added 64-bit SIMD operations + const word64 m = W64LIT(0xffffffffffffffff); + word64 w1[2] = {m, m}, w2[2] = {3, 4}, w3[2]; + const uint64x2_p v1 = (uint64x2_p)VectorLoad(0, w1); + const uint64x2_p v2 = (uint64x2_p)VectorLoad(0, w2); + VectorStore(VectorAdd(v1, v2), w3); - result = (0 == std::memcmp(b1+3, b2+1, 16)); + // The 64-bit add will overflow. + result = (w3[0] == 2 && w3[1] == 3); } sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);