aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-02-02 15:14:18 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-02-02 15:14:18 -0500
commit58633be8f39bef7d2ee7f85f62e72b24c5885e4c (patch)
tree6e31914c2598d6e778b5250c0683cb3e32aa97d0 /gcc
parent75ddf8b0d235e6ee35ab1759f519e1bbc052e142 (diff)
downloadgcc-58633be8f39bef7d2ee7f85f62e72b24c5885e4c.zip
gcc-58633be8f39bef7d2ee7f85f62e72b24c5885e4c.tar.gz
gcc-58633be8f39bef7d2ee7f85f62e72b24c5885e4c.tar.bz2
(const_binop, COMPLEX_TYPE, case RDIV_EXPR): If complex integer, use
TRUNC_DIV_EXPR for inner division. From-SVN: r6468
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 6f6027d..600bbfa 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;