> >> +(for cmp (gt ge lt le)
> >> +     outp (convert convert negate negate)
> >> +     outn (negate negate convert convert)
> >> + /* Transform (X > 0.0 ? 1.0 : -1.0) into copysign(1, X). */
> >> + /* Transform (X >= 0.0 ? 1.0 : -1.0) into copysign(1, X). */
> >> + /* Transform (X < 0.0 ? 1.0 : -1.0) into copysign(1,-X). */
> >> + /* Transform (X <= 0.0 ? 1.0 : -1.0) into copysign(1,-X). */
> >> +(simplify
> >> +  (cond (cmp @0 real_zerop) real_onep real_minus_onep)
> >> +  (if (!HONOR_NANS (type) && !HONOR_SIGNED_ZEROS (type)
> >> +       && types_match (type, TREE_TYPE (@0)))
> >> +   (switch
> >> +    (if (types_match (type, float_type_node))
> >> +     (BUILT_IN_COPYSIGNF { build_one_cst (type); } (outp @0)))
> >> +    (if (types_match (type, double_type_node))
> >> +     (BUILT_IN_COPYSIGN { build_one_cst (type); } (outp @0)))
> >> +    (if (types_match (type, long_double_type_node))
> >> +     (BUILT_IN_COPYSIGNL { build_one_cst (type); } (outp @0))))))
> >>

Hi,

Out of curiosity is there any reason why this transformation can't be more 
general?

e.g. Transform (X > 0.0 ? CST : -CST) into copysign(CST, X).

we would at the very least avoid a csel or a branch then.

Regards,
Tamar

Reply via email to