From: Jan Hubicka Date: Tue, 17 Jul 2001 21:44:57 +0000 (+0200) Subject: expr.c (epxand_expr): Convert divisions into multiplications by reciprocals if -ffast... X-Git-Tag: prereleases/libstdc++-3.0.95~3227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7e9703c27ee1b02df751646742fb5020a2d2b8c;p=thirdparty%2Fgcc.git expr.c (epxand_expr): Convert divisions into multiplications by reciprocals if -ffast-math. * expr.c (epxand_expr): Convert divisions into multiplications by reciprocals if -ffast-math. From-SVN: r44090 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d5e47996a09..fda69fb8dbed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 17 23:43:31 CEST 2001 Jan Hubicka + + * expr.c (epxand_expr): Convert divisions into multiplications by + reciprocals if -ffast-math. + 2001-07-17 Neil Booth * dbxout.c (dbxout_really_begin_function): Rename to diff --git a/gcc/expr.c b/gcc/expr.c index 002191051594..041ee9080441 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -7830,6 +7830,16 @@ expand_expr (exp, target, tmode, modifier) return expand_divmod (0, code, mode, op0, op1, target, unsignedp); case RDIV_EXPR: + /* Emit a/b as a*(1/b). Later we may manage CSE the reciprocal saving + expensive divide. If not, combine will rebuild the original + computation. */ + if (flag_unsafe_math_optimizations && optimize && !optimize_size + && !real_onep (TREE_OPERAND (exp, 0))) + return expand_expr (build (MULT_EXPR, type, TREE_OPERAND (exp, 0), + build (RDIV_EXPR, type, + build_real (type, dconst1), + TREE_OPERAND (exp, 1))), + target, tmode, unsignedp); this_optab = flodiv_optab; goto binop;