[PATCH] D121122: Set FLT_EVAL_METHOD to -1 when fast-math is enabled.

Bjorn Pettersson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 08:06:31 PDT 2022


bjope added a comment.

Looked around a bit.

- Seems like in GNU libc they use an internal `__GLIBC_FLT_EVAL_METHOD` that is set to 2 if `__FLT_EVAL_METHOD__` is -1   (https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/flt-eval-method.h;hb=f60e45ba10f0ca2794318de95720cdbdb6ff20d0).
- In LLVM:s libc I do not see anything like that, instead there is an `#error` if `__FLT_EVAL_METHOD__` is -1  (https://github.com/llvm/llvm-project/blob/main/libc/include/llvm-libc-types/float_t.h).
- Looking at newlib it seem to do nothing for `__FLT_EVAL_METHOD__` equal to -1, although it has some comments about "Assume float_t and double_t have been defined previously for this configuration (e.g. config.h)"  (https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=799ac494adc3f134a8f63a06397e833ec89c644a;hb=HEAD#l169)

So maybe I need to patch our newlib version somehow to make sure float_t is defined even for -1. But there could be problems with the LLVM libc implementation of math.h (which I think uses float_t.h).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121122



More information about the cfe-commits mailing list