[libc-commits] [PATCH] D121839: [libc] Change FEnv to use MXCSR as source of truth

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Mar 21 20:52:21 PDT 2022


lntue added inline comments.


================
Comment at: libc/src/__support/FPUtil/x86_64/FEnvImpl.h:377
+  // Set exception flags in the status word
+  status_word |= (mxcsr & 0x03) << 4;
+  status_word |= (mxcsr & 0x04) << 1;
----------------
You should either name these bit masks or add comments to tell which flag is set in each line.


================
Comment at: libc/src/__support/FPUtil/x86_64/FEnvImpl.h:484
+  */
+  mxcsr |= static_cast<uint16_t>((state->status_word & 0x30000000) >> 28);
+  mxcsr |= static_cast<uint16_t>((state->status_word & 0x08000000) >> 25);
----------------
You should name these bit masks to make it easier to keep track and debug which flag is set in which line.  Also look like they can be re-used for control word also.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121839



More information about the libc-commits mailing list