[PATCH] D109239: Add support for floating-option `-ffp-eval-method` and for new `pragma clang fp eval-method`

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 05:59:23 PDT 2022


zahiraam added a comment.

In D109239#3878422 <https://reviews.llvm.org/D109239#3878422>, @ArcsinX wrote:

> It seems for x86_32 case (e.g. with -m32 in command line) there is a difference between clang and GCC:
> clang: `__FLT_EVAL_METHOD__` == 0
> GCC: `__FLT_EVAL_METHOD__` == 2
>
> Example:
> https://godbolt.org/z/EbY8rPYGn
>
> I am not sure, is it a correct behavior from clang?

For 32-bit x86 targets, GCC defaults to -mfpmath=387 (no SSE). Passing -mfpmath=sse to GCC will use source precision. 
Clang’s 32-bit x86 targets defaults to using SSE instructions and evaluating at source precision. Clang doesn’t allow -mfpmath=387 
unless it’s passed along with -mno-sse which is redundant. Using -m32 (or -mfpmath=387) in combination with
-mno-sse will give you GCC’s default behavior. See https://godbolt.org/z/4d8fqzqEs


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

https://reviews.llvm.org/D109239



More information about the cfe-commits mailing list