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

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 09:04:03 PDT 2019


cameron.mcinally added a comment.

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.


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