summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-02-02 20:14:18 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-02-02 20:14:18 +0000
commit56d9b5a89151a68ba9c252e76ec3a9e85abd9fef (patch)
tree6e31914c2598d6e778b5250c0683cb3e32aa97d0 /gcc
parent5dc6f9ee5adee88483679858034cbf3d63a0d5ef (diff)
downloadgcc-56d9b5a89151a68ba9c252e76ec3a9e85abd9fef.tar.gz
(const_binop, COMPLEX_TYPE, case RDIV_EXPR): If complex integer, use
TRUNC_DIV_EXPR for inner division. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6f6027d67a0..600bbfa728e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1433,18 +1433,26 @@ const_binop (code, arg1, arg2, notrunc)
const_binop (MULT_EXPR, r2, r2, notrunc),
const_binop (MULT_EXPR, i2, i2, notrunc),
notrunc);
- t = build_complex (const_binop (RDIV_EXPR,
- const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r1, r2, notrunc),
- const_binop (MULT_EXPR, i1, i2, notrunc),
- notrunc),
- magsquared, notrunc),
- const_binop (RDIV_EXPR,
- const_binop (MINUS_EXPR,
- const_binop (MULT_EXPR, i1, r2, notrunc),
- const_binop (MULT_EXPR, r1, i2, notrunc),
- notrunc),
- magsquared, notrunc));
+
+ t = build_complex
+ (const_binop (INTEGRAL_TYPE_P (TREE_TYPE (r1))
+ ? TRUNC_DIV_EXPR : RDIV_EXPR,
+ const_binop (PLUS_EXPR,
+ const_binop (MULT_EXPR, r1, r2,
+ notrunc),
+ const_binop (MULT_EXPR, i1, i2,
+ notrunc),
+ notrunc),
+ magsquared, notrunc),
+ const_binop (INTEGRAL_TYPE_P (TREE_TYPE (r1))
+ ? TRUNC_DIV_EXPR : RDIV_EXPR,
+ const_binop (MINUS_EXPR,
+ const_binop (MULT_EXPR, i1, r2,
+ notrunc),
+ const_binop (MULT_EXPR, r1, i2,
+ notrunc),
+ notrunc),
+ magsquared, notrunc));
}
break;