[libc-commits] [PATCH] D153823: [libc][math] Fix floating-point test support on x86_64 Apple machines

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 26 18:26:15 PDT 2023


lntue added inline comments.


================
Comment at: libc/src/__support/FPUtil/x86_64/FEnvImpl.h:624-640
+#ifdef __APPLE__
+  x87_status.status_word |= (fpstate->status_word & 0x3F);
+#else
   x87_status.status_word |= (fpstate->x87_status.status_word & 0x3F);
+#endif // __APPLE__
   // Copy other non-sensitive parts of the status word.
+#ifndef __APPLE__
----------------
Do you mind combining the `#ifdef` to make it a bit easier to read:
```
#ifdef __APPLE__
  x87_status.status_word |= (fpstate->status_word & 0x3F);
  // We can set the x87 control word as is as there no sensitive bits.
  x87_status.control_word = fpstate->control_word;
#else
  x87_status.status_word |= (fpstate->x87_status.status_word & 0x3F);
  // Copy other non-sensitive parts of the status word.
  for (int i = 0; i < 5; i++) {
    x87_status._[i] = fpstate->x87_status._[i];
  // We can set the x87 control word as is as there no sensitive bits.
  x87_status.control_word = fpstate->x87_status.control_word;
#endif // __APPLE__
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153823/new/

https://reviews.llvm.org/D153823



More information about the libc-commits mailing list