[libc-commits] [libc] 137740e - [libc] Exclude few unused bits from x86 state for Windows
Hedin GarcĂa via libc-commits
libc-commits at lists.llvm.org
Wed Jul 21 06:11:50 PDT 2021
Author: Hedin Garca
Date: 2021-07-21T13:11:10Z
New Revision: 137740ecedf1ac61ad29e16badf1519d7c211c42
URL: https://github.com/llvm/llvm-project/commit/137740ecedf1ac61ad29e16badf1519d7c211c42
DIFF: https://github.com/llvm/llvm-project/commit/137740ecedf1ac61ad29e16badf1519d7c211c42.diff
LOG: [libc] Exclude few unused bits from x86 state for Windows
Windows fenv_t does not include the MXCSR register and
the unused bits at the end of the x87 status. So we
exclude them in our struct definitions to make it
easy to read/write the state. getEnv and setEnv
were also excluded to avoid using MXCSR, but a
forthcoming patch will handle these functions.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106386
Added:
Modified:
libc/utils/FPUtil/x86_64/FEnv.h
Removed:
################################################################################
diff --git a/libc/utils/FPUtil/x86_64/FEnv.h b/libc/utils/FPUtil/x86_64/FEnv.h
index 6718ef5f03a1a..8ae10afde084f 100644
--- a/libc/utils/FPUtil/x86_64/FEnv.h
+++ b/libc/utils/FPUtil/x86_64/FEnv.h
@@ -91,12 +91,16 @@ struct X87StateDescriptor {
uint16_t StatusWord;
uint16_t Unused2;
// TODO: Elaborate the remaining 20 bytes as required.
+#if !(defined(_WIN32))
uint32_t _[5];
+#endif
};
struct FPState {
X87StateDescriptor X87Status;
+#if !(defined(_WIN32))
uint32_t MXCSR;
+#endif
};
static_assert(
@@ -346,6 +350,7 @@ static inline int setRound(int mode) {
return 0;
}
+#if !(defined(_WIN32))
static inline int getEnv(fenv_t *envp) {
internal::FPState *state = reinterpret_cast<internal::FPState *>(envp);
internal::getX87StateDescriptor(state->X87Status);
@@ -360,6 +365,7 @@ static inline int setEnv(const fenv_t *envp) {
internal::writeMXCSR(state->MXCSR);
return 0;
}
+#endif
} // namespace fputil
} // namespace __llvm_libc
More information about the libc-commits
mailing list