diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-17 21:44:57 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-17 21:44:57 +0000 |
commit | 3623b3f6b547c99ad7751467d19c8de8d1cc4cb0 (patch) | |
tree | c8480e650f798616a3a4925e1f098f4f258e9711 /gcc/expr.c | |
parent | f76df888ab6421c0c4fe08206ec1b65b03ee1e5e (diff) | |
download | gcc-3623b3f6b547c99ad7751467d19c8de8d1cc4cb0.tar.gz |
* expr.c (epxand_expr): Convert divisions into multiplications by
reciprocals if -ffast-math.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 00219105159..041ee908044 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; |