[PATCH] D62077: [InstSimplify] Teach fsub -0.0, (fneg X) ==> X about unary fneg

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 09:27:33 PDT 2019


spatel added a comment.

In D62077#1508771 <https://reviews.llvm.org/D62077#1508771>, @cameron.mcinally wrote:

> Actually, it looks like the sign can stick around regardless of NSZ. This test fails with the proposed change:
>
>   define <2 x float> @fsub_0_0_x_vec_undef2(<2 x float> %a) {
>   ; CHECK-LABEL: @fsub_0_0_x_vec_undef2(
>   ; CHECK-NEXT:    ret <2 x float> [[A:%.*]]
>   ;
>     %t1 = fsub <2 x float> zeroinitializer, %a
>     %ret = fsub nsz <2 x float> <float undef, float -0.0>, %t1
>     ret <2 x float> %ret
>   }
>
>
> LangRef says:
>
>   nsz
>   No Signed Zeros - Allow optimizations to treat the sign of a zero argument or result as insignificant.
>
>
> So I don't think we're guaranteed that -0.0 will be consistently converted to +0.0 when NSZ is in play.


Ah, I didn't notice that test; disregard my suggestion.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62077





More information about the llvm-commits mailing list