mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Use bit_cast to create -0.0 for floating point types to avoid compiler optimization changing sign with --ffast-math enabled.
This commit is contained in:
@@ -143,7 +143,7 @@ struct compute_inverse_size4<Architecture::Target, float, MatrixType, ResultType
|
||||
iC = psub(iC, pmul(vec4f_swizzle2(A, A, 1, 0, 3, 2), vec4f_swizzle2(DC, DC, 2, 1, 2, 1)));
|
||||
iC = psub(pmul(B, vec4f_duplane(dC, 0)), iC);
|
||||
|
||||
const float sign_mask[4] = {0.0f, -0.0f, -0.0f, 0.0f};
|
||||
const float sign_mask[4] = {0.0f, numext::bit_cast<float>(0x80000000u), numext::bit_cast<float>(0x80000000u), 0.0f};
|
||||
const Packet4f p4f_sign_PNNP = pset<Packet4f>(sign_mask);
|
||||
rd = pxor(rd, p4f_sign_PNNP);
|
||||
iA = pmul(iA, rd);
|
||||
@@ -326,8 +326,8 @@ struct compute_inverse_size4<Architecture::Target, double, MatrixType, ResultTyp
|
||||
iC1 = psub(pmul(B1, dC), iC1);
|
||||
iC2 = psub(pmul(B2, dC), iC2);
|
||||
|
||||
const double sign_mask1[2] = {0.0, -0.0};
|
||||
const double sign_mask2[2] = {-0.0, 0.0};
|
||||
const double sign_mask1[2] = {0.0, numext::bit_cast<double>(0x8000000000000000ull)};
|
||||
const double sign_mask2[2] = {numext::bit_cast<double>(0x8000000000000000ull), 0.0};
|
||||
const Packet2d sign_PN = pset<Packet2d>(sign_mask1);
|
||||
const Packet2d sign_NP = pset<Packet2d>(sign_mask2);
|
||||
d1 = pxor(rd, sign_PN);
|
||||
|
||||
Reference in New Issue
Block a user