[PATCH] D77815: [flang] Fix setting mxcsr on MSVC
Jean Perier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 01:34:04 PDT 2020
jeanPerier added a comment.
> Looks like `originalFenv_` is still used for restoring the original state. Shall I change the type of `originalFenv_` to be `unsigned int` on x86_64? (Or maybe a union?)
> From what I understand `originalFenv_` is used for changing and restoring the `__mxcsr` value (or its equivalents on aarch64).
In host.cpp, `originalFenv_` is more than just the `__mxcsr`, it also backs-up the whole fp environment (original rounding mode, exceptions that were raised,...) before calling the run-time to fold. Interrupts are also disabled between the related `feholdexcept` / `fesetenv` (we do not want the compiler to crash if the Fortran code being folded is wrong and triggers a division by zero or such), so it should be kept.
`currentFenv_` however was only about manipulating the `__mxcsr` (or `__fpcr `/...), so you can remove it where you do not need it anymore.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77815/new/
https://reviews.llvm.org/D77815
More information about the llvm-commits
mailing list