[PATCH] D71467: [FPEnv] Generate constrained FP comparisons from clang
Ulrich Weigand via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 16 10:07:02 PST 2019
uweigand added a comment.
In D71467#1786192 <https://reviews.llvm.org/D71467#1786192>, @erichkeane wrote:
> __builtin_fpclassify/isfinite/isinf/isinf_sign/isnan/isnormal/signbit are all implemented the same as the OTHER ones, except there is a strange fixup step in SEMA that removes the float->double cast. It is IMO the wrong way to do it.
>
> I don't think it would modify the IR at all or the AST, but I'm also working on removing that hack (which is what I meant by the fp-classification type ones).
>
> I hope the work I've done already is sufficient to unblock this patch.
Yes, this patch is no longer blocked, thanks!
What I was trying to say is that there is a fundamental difference between the comparison builtins like isless, isgreater, etc. and the classification builtins like isinf, isnan, etc.
The former **should** result in comparison instructions being generated, the only difference between the builtin and a regular "<" operator is that the builtin emits a quiet compare while the operator emits a signaling compare in strict mode.
However, the latter (classification macros) should not actually emit **any** comparison instructions in strict mode, because the classification macros may never trap, but all comparison instructions do. So the basic idea of implementing e.g. isinf(x) as "fabs(x) == infinity" (like the comment in CGBuiltin.cpp currently says) is fundamentally wrong in strict mode.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71467/new/
https://reviews.llvm.org/D71467
More information about the cfe-commits
mailing list