From 12e8d57108c50d8a63605c6eb0144c838c128337 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Wed, 16 Jun 2021 14:36:42 -0700 Subject: Remove pset, replace with ploadu. We can't make guarantees on alignment for existing calls to `pset`, so we should default to loading unaligned. But in that case, we should just use `ploadu` directly. For loading constants, this load should hopefully get optimized away. This is causing segfaults in Google Maps. --- Eigen/src/Geometry/arch/Geometry_SIMD.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Eigen/src/Geometry') diff --git a/Eigen/src/Geometry/arch/Geometry_SIMD.h b/Eigen/src/Geometry/arch/Geometry_SIMD.h index 89ac92062..9af6a9af7 100644 --- a/Eigen/src/Geometry/arch/Geometry_SIMD.h +++ b/Eigen/src/Geometry/arch/Geometry_SIMD.h @@ -28,8 +28,9 @@ struct quat_product evaluator ae(_a.coeffs()); evaluator be(_b.coeffs()); Quaternion res; - float arr[4] = {0.f, 0.f, 0.f, -0.f}; - const Packet4f mask = pset(arr); + const float neg_zero = numext::bit_cast(0x80000000u); + const float arr[4] = {0.f, 0.f, 0.f, neg_zero}; + const Packet4f mask = ploadu(arr); Packet4f a = ae.template packet(0); Packet4f b = be.template packet(0); Packet4f s1 = pmul(vec4f_swizzle1(a,1,2,0,2),vec4f_swizzle1(b,2,0,1,2)); @@ -55,8 +56,9 @@ struct quat_conj { evaluator qe(q.coeffs()); Quaternion res; - float arr[4] = {-0.f,-0.f,-0.f,0.f}; - const Packet4f mask = pset(arr); + const float neg_zero = numext::bit_cast(0x80000000u); + const float arr[4] = {neg_zero, neg_zero, neg_zero,0.f}; + const Packet4f mask = ploadu(arr); pstoret(&res.x(), pxor(mask, qe.template packet::Alignment,Packet4f>(0))); return res; } @@ -147,10 +149,10 @@ struct quat_conj evaluator qe(q.coeffs()); Quaternion res; const double neg_zero = numext::bit_cast(0x8000000000000000ull); - double arr1[2] = {neg_zero, neg_zero}; - double arr2[2] = {neg_zero, 0.0}; - const Packet2d mask0 = pset(arr1); - const Packet2d mask2 = pset(arr2); + const double arr1[2] = {neg_zero, neg_zero}; + const double arr2[2] = {neg_zero, 0.0}; + const Packet2d mask0 = ploadu(arr1); + const Packet2d mask2 = ploadu(arr2); pstoret(&res.x(), pxor(mask0, qe.template packet::Alignment,Packet2d>(0))); pstoret(&res.z(), pxor(mask2, qe.template packet::Alignment,Packet2d>(2))); return res; -- cgit v1.2.3