This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |

Other format: | [Raw text] |

*From*: Richard Biener <richard dot guenther at gmail dot com>*To*: "Hurugalawadi, Naveen" <Naveen dot Hurugalawadi at caviumnetworks dot com>*Cc*: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>*Date*: Tue, 11 Aug 2015 15:10:06 +0200*Subject*: Re: [RFH] Move some flag_unsafe_math_optimizations using simplify and match*Authentication-results*: sourceware.org; auth=none*References*: <SN2PR0701MB1024EFC093CC2E3BCB62F0388E730 at SN2PR0701MB1024 dot namprd07 dot prod dot outlook dot com>

On Fri, Aug 7, 2015 at 10:43 AM, Hurugalawadi, Naveen <Naveen.Hurugalawadi@caviumnetworks.com> wrote: > Hi, > > Please find attached the patch "simplify-1.patch" that moves some > "flag_unsafe_math_optimizations" from fold-const.c to simplify and match. > > However, I am facing some issues with cbrt, exp2, pow10 and exp10 functions. > > Please review the patch and let me know whether its the right way to > implement them. > > Pointers on solving the unimplemented patterns issues will be very helpful. > > Regression tested on X86_64. > gcc.dg/torture/builtin-power-1.c FAIL's due to unimplemented exp10 and pow10 > optimizations. > AArch64 : Along with these cbrt and exp2 also has issues. Apart from what Marc said I'd like to see the patch splitted up somewhat. So can you split out the part that works well? I don't see what issues you are facing (apart from FIXME aarch64 ICEs) with the exp/log functions. It seems that with - /* Optimize expN(x)*expN(y) as expN(x+y). */ - if (fcode0 == fcode1 && BUILTIN_EXPONENT_P (fcode0)) - { - tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0); - tree arg = fold_build2_loc (loc, PLUS_EXPR, type, - CALL_EXPR_ARG (arg0, 0), - CALL_EXPR_ARG (arg1, 0)); - return build_call_expr_loc (loc, expfn, 1, arg); to +/* Simplify expN(x) * expN(y) -> expN(x+y). */ +(for exps (EXP EXP2) +/* FIXME : exp2 ICE's with AArch64. */ +(simplify + (mult:c (exps @0) (exps @1)) + (exps (plus @0 @1)))) you are missing EXP10 and POW10. I agree with Marc that on most function calls you want to add :s restrictions. Thus +/* Simplify cos(x) / sin(x) -> 1 / tan(x). */ +(simplify + (rdiv (COS @0) (SIN @0)) + (rdiv { build_one_cst (type); } (TAN @0))) becomes +/* Simplify cos(x) / sin(x) -> 1 / tan(x). */ +(simplify + (rdiv (COS:s @0) (SIN:s @0)) + (rdiv { build_one_cst (type); } (TAN @0))) so that if either or both cos() or sin() results are needed elsewhere the transform is not done. With the value-numbering plumbing I am currently doing it would still do the transform if tan (@0) is computed elsewhere. Thanks, Richard. > Thanks, > Naveen

**References**:**[RFH] Move some flag_unsafe_math_optimizations using simplify and match***From:*Hurugalawadi, Naveen

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |