[libc-commits] [libc] 9e6946c - [libc] Revert rounding mode changes for hermetic tests

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed May 3 09:51:50 PDT 2023


Author: Joseph Huber
Date: 2023-05-03T11:51:42-05:00
New Revision: 9e6946c2522a3ddc9157b48a9a8b4050c19450f5

URL: https://github.com/llvm/llvm-project/commit/9e6946c2522a3ddc9157b48a9a8b4050c19450f5
DIFF: https://github.com/llvm/llvm-project/commit/9e6946c2522a3ddc9157b48a9a8b4050c19450f5.diff

LOG: [libc] Revert rounding mode changes for hermetic tests

We got rid of the rounding mode here so that the hermetic tests wouldn't
depend on the system fenv.h. But this seemed to cause some bots to
break. Getting rid of this change for now, it should be fine for the CPU
builds.

Differential Revision: https://reviews.llvm.org/D149767

Added: 
    

Modified: 
    libc/test/UnitTest/RoundingModeUtils.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp
index e2fde1d03de8..8cc6834d89ed 100644
--- a/libc/test/UnitTest/RoundingModeUtils.cpp
+++ b/libc/test/UnitTest/RoundingModeUtils.cpp
@@ -8,7 +8,7 @@
 
 #include "RoundingModeUtils.h"
 
-#include "src/__support/FPUtil/FEnvImpl.h"
+#include <fenv.h>
 
 namespace __llvm_libc {
 namespace fputil {
@@ -34,15 +34,15 @@ int get_fe_rounding(RoundingMode mode) {
 }
 
 ForceRoundingMode::ForceRoundingMode(RoundingMode mode) {
-  old_rounding_mode = fputil::get_round();
+  old_rounding_mode = fegetround();
   rounding_mode = get_fe_rounding(mode);
   if (old_rounding_mode != rounding_mode)
-    fputil::set_round(rounding_mode);
+    fesetround(rounding_mode);
 }
 
 ForceRoundingMode::~ForceRoundingMode() {
   if (old_rounding_mode != rounding_mode)
-    fputil::set_round(old_rounding_mode);
+    fesetround(old_rounding_mode);
 }
 
 } // namespace testing


        


More information about the libc-commits mailing list