[PATCH] D140294: clang: Replace implementation of __builtin_isnormal

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 25 21:00:38 PST 2022


sepavloff added a comment.

As mentioned in another review, using `fcmp` to represent `isnormal` in IR as well as any other classification function would result in incorrect code in strict mode. The source:

  inline __attribute__((always_inline)) _Bool func(float x) {
    return __builtin_isnormal(x);
  }
  
  _Bool check(float x) {
  #pragma STDC FENV_ACCESS ON
    return func(x);
  }

in this case would produce code that uses FP comparisons to implement `isnormal` (in the form of constrained intrinsics), this is incorrect. Using correct representation is impossible in this case, as the information about original check is already lost.


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

https://reviews.llvm.org/D140294



More information about the cfe-commits mailing list