Skip to content

Commit 3483b32

Browse files
committed
[SingleSource] Relax fmax signed-zero checks on some platforms.
On some platforms, fmax doesn't treat -0.0 < +0.0. For now limit precise signed-zero checks to ARM64 macOS. Fixes llvm/llvm-project#166912.
1 parent e810d81 commit 3483b32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

SingleSource/UnitTests/Vectorizer/fmax-reduction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ static bool isEqual(float A, float B) {
1111
if (std::isnan(A) || std::isnan(B))
1212
return std::isnan(A) && std::isnan(B);
1313

14+
#if defined(__aarch64__) && defined(__APPLE__)
15+
// On ARM64 macOS, check signbit for zeros since fmax treats -0.0 < +0.0.
16+
// On other platforms, treat -0.0 and +0.0 via the == check below
1417
if (A == 0.0f)
1518
return B == 0.0f && std::signbit(A) == std::signbit(B);
19+
#endif
1620

1721
return A == B;
1822
}

0 commit comments

Comments
 (0)