[PATCH] D88238: [APFloat] convert SNaN to QNaN in convert() and raise Invalid signal
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 07:50:33 PDT 2020
sepavloff added a comment.
In D88238#2300685 <https://reviews.llvm.org/D88238#2300685>, @spatel wrote:
> In D88238#2300668 <https://reviews.llvm.org/D88238#2300668>, @spatel wrote:
>
>> D87822 <https://reviews.llvm.org/D87822> landed recently ( cc @sepavloff ), so this patch is now failing on the clang tests with:
>>
>> /Users/spatel/GitHub/llvm-project/clang/test/CodeGen/builtin-nan-legacy.c:6:3: error: initializer element is not a compile-time constant
>> __builtin_nan(""),
>> ^~~~~~~~~~~~~~~~~
>
> I'm not sure what the correct fix will be. The cast from double to float in those tests is raising the exception (opInvalidOp) as expected. That then causes the new APFloat::opStatus check in checkFloatingPointResult() to trigger and cause the error/stop compiling.
I would propose to put a check into `checkFloatingPointResult` like:
if (St & APFloat::opStatus::opInvalidOp) {
if (E is __builtin_nan() and probably other similar builtins)
return true;
...
It would allow initialization with NaN but catches other operations with it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88238/new/
https://reviews.llvm.org/D88238
More information about the llvm-commits
mailing list