[libc-commits] [PATCH] D149767: [libc] Revert rounding mode changes for hermetic tests

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


jhuber6 created this revision.
jhuber6 added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149767

Files:
  libc/test/UnitTest/RoundingModeUtils.cpp


Index: libc/test/UnitTest/RoundingModeUtils.cpp
===================================================================
--- libc/test/UnitTest/RoundingModeUtils.cpp
+++ 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 @@
 }
 
 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149767.519136.patch
Type: text/x-patch
Size: 888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230503/8f825250/attachment.bin>


More information about the libc-commits mailing list