llvm.org GIT mirror llvm / 49e5e9f
[InstSimplify] fsub nnan x, x -> 0.0 is valid without ninf Both inf - inf and (-inf) - (-inf) are NaN, so it's already covered by nnan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239702 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 4 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
853853 return X;
854854 }
855855
856 // fsub nnan ninf x, x ==> 0.0
857 if (FMF.noNaNs() && FMF.noInfs() && Op0 == Op1)
856 // fsub nnan x, x ==> 0.0
857 if (FMF.noNaNs() && Op0 == Op1)
858858 return Constant::getNullValue(Op0->getType());
859859
860860 return nullptr;
6969 ret float %ret
7070 }
7171
72 ; fsub nnan ninf x, x ==> 0.0
72 ; fsub nnan x, x ==> 0.0
7373 ; CHECK-LABEL: @fsub_x_x(
7474 define float @fsub_x_x(float %a) {
7575 ; X - X ==> 0
76 %zero1 = fsub nnan ninf float %a, %a
76 %zero1 = fsub nnan float %a, %a
7777
7878 ; Dont fold
7979 ; CHECK: %no_zero1 = fsub
8080 %no_zero1 = fsub ninf float %a, %a
8181 ; CHECK: %no_zero2 = fsub
82 %no_zero2 = fsub nnan float %a, %a
82 %no_zero2 = fsub float %a, %a
8383 ; CHECK: %no_zero = fadd
8484 %no_zero = fadd float %no_zero1, %no_zero2
8585