@@ -198,17 +198,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* PR71078: x / abs(x) -> copysign (1.0, x) */
(simplify
(rdiv:C (convert? @0) (convert? (abs @0)))
+ /* We can't always transform to copysign for long double.
+ See PR58797. */
(if (SCALAR_FLOAT_TYPE_P (type)
+ && ! types_match (type, long_double_type_node)
&& ! HONOR_NANS (type)
&& ! HONOR_INFINITIES (type))
(switch
(if (types_match (type, float_type_node))
(BUILT_IN_COPYSIGNF { build_one_cst (type); } (convert @0)))
(if (types_match (type, double_type_node))
- (BUILT_IN_COPYSIGN { build_one_cst (type); } (convert @0)))
- (if (types_match (type, long_double_type_node))
- (BUILT_IN_COPYSIGNL { build_one_cst (type); } (convert @0))))))
-
+ (BUILT_IN_COPYSIGN { build_one_cst (type); } (convert @0))))))
+
/* In IEEE floating point, x/1 is not equivalent to x for snans. */
(simplify
(rdiv @0 real_onep)
@@ -17,13 +17,5 @@ double f2(double x)
return t2;
}
-long double f3 (long double x)
-{
- long double t1 = fabsl (x);
- long double t2 = x / t1;
- return t2;
-}
-
/* { dg-final { scan-tree-dump "__builtin_copysignf" "forwprop1" } } */
/* { dg-final { scan-tree-dump "__builtin_copysign" "forwprop1" } } */
-/* { dg-final { scan-tree-dump "__builtin_copysignl" "forwprop1" } } */
@@ -17,13 +17,5 @@ double f2(double x)
return t2;
}
-long double f3 (long double x)
-{
- long double t1 = fabsl (x);
- long double t2 = t1 / x;
- return t2;
-}
-
/* { dg-final { scan-tree-dump "__builtin_copysignf" "forwprop1" } } */
/* { dg-final { scan-tree-dump "__builtin_copysign" "forwprop1" } } */
-/* { dg-final { scan-tree-dump "__builtin_copysignl" "forwprop1" } } */