[libc-commits] [libc] 198292f - [libc][math] Fix floating point exception testing macros in FPMatcher.h for

Tue Ly via libc-commits libc-commits at lists.llvm.org
Fri Feb 24 10:43:53 PST 2023


Author: Tue Ly
Date: 2023-02-24T13:43:33-05:00
New Revision: 198292f26c17bbc4b9595aca0e9886a6a9806594

URL: https://github.com/llvm/llvm-project/commit/198292f26c17bbc4b9595aca0e9886a6a9806594
DIFF: https://github.com/llvm/llvm-project/commit/198292f26c17bbc4b9595aca0e9886a6a9806594.diff

LOG: [libc][math] Fix floating point exception testing macros in FPMatcher.h for
aarch64.

Added: 
    

Modified: 
    libc/test/UnitTest/FPMatcher.h

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h
index 4d2d128ffcf9d..f804b652f2759 100644
--- a/libc/test/UnitTest/FPMatcher.h
+++ b/libc/test/UnitTest/FPMatcher.h
@@ -124,14 +124,16 @@ FPMatcher<T, C> 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<T, C> 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<T, C> 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);                        \
     }                                                                          \


        


More information about the libc-commits mailing list