From 198292f26c17bbc4b9595aca0e9886a6a9806594 Mon Sep 17 00:00:00 2001 From: Tue Ly Date: Fri, 24 Feb 2023 13:35:52 -0500 Subject: [PATCH] [libc][math] Fix floating point exception testing macros in FPMatcher.h for aarch64. --- libc/test/UnitTest/FPMatcher.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h index 4d2d128..f804b65 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -124,14 +124,16 @@ FPMatcher getMatcher(T expectedValue) { #define EXPECT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT), expected); \ + EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + expected); \ } \ } while (0) #define ASSERT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - ASSERT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT), expected); \ + ASSERT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + expected); \ } \ } while (0) @@ -140,7 +142,8 @@ FPMatcher getMatcher(T expectedValue) { __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_EQ(expected_val, actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT), \ + EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + expected_except, \ expected_except); \ __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ } \ @@ -151,7 +154,8 @@ FPMatcher getMatcher(T expectedValue) { __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_IS_NAN(actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT), \ + EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + expected_except, \ expected_except); \ __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ } \ -- 2.7.4