[PATCH] D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 10:36:10 PDT 2021


spatel added a comment.

In D106362#3034000 <https://reviews.llvm.org/D106362#3034000>, @sepavloff wrote:

> In D106362#3033765 <https://reviews.llvm.org/D106362#3033765>, @spatel wrote:
>
>> In D106362#3033555 <https://reviews.llvm.org/D106362#3033555>, @sepavloff wrote:
>>
>>>>> Here is the sample program: https://godbolt.org/z/ssYs6ez91
>>>>> Hardware converts `SNaN + 0` into QNaN.
>>
>> This is cherry-picking the example to try to prove your point; gcc does not behave as you are suggesting in general. Here is a counter-example based on the first transform (fadd X, -0.0) affected by this patch:
>> https://godbolt.org/z/qj9Meavnd
>
> In this case no `add` instruction is generated, so it does not demonstrate hardware behavior. It is (incorrect) constant folding. ICC does not do such transformation. Could you please file a bug in GCC bug tracker?

Apologies to this patch review for being off-topic again, but the answer is no. 
I think you know that's not a standalone folding bug. It's intentional behavior in both compilers which you can easily show with a number of similar examples...
https://godbolt.org/z/fT1j8YPK6


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

https://reviews.llvm.org/D106362



More information about the llvm-commits mailing list