From: Dale Johannesen Date: Wed, 20 Mar 2002 09:41:46 +0000 (+0100) Subject: PR optimization/5999, middle-end/5731 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed7d44bc74c5af2bd9e44ffe05b5b99c607fc614;p=gcc.git PR optimization/5999, middle-end/5731 PR optimization/5999, middle-end/5731 * expr.c (expand_expr) [RDIV_EXPR]: Only convert real divisions into multiplications by reciprocals. * gcc.c-torture/compile/20020319-1.c: New test. From-SVN: r51071 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9cf4c2aa34e..47c6ca9333a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-03-19 Dale Johannesen + + PR optimization/5999, middle-end/5731 + * expr.c (expand_expr) [RDIV_EXPR]: Only convert real divisions into + multiplications by reciprocals. + 2002-03-20 Neil Booth * Makefile.in: Update. diff --git a/gcc/expr.c b/gcc/expr.c index fd62a39b9c9..ef532feb561 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -7738,6 +7738,7 @@ expand_expr (exp, target, tmode, modifier) expensive divide. If not, combine will rebuild the original computation. */ if (flag_unsafe_math_optimizations && optimize && !optimize_size + && TREE_CODE (type) == REAL_TYPE && !real_onep (TREE_OPERAND (exp, 0))) return expand_expr (build (MULT_EXPR, type, TREE_OPERAND (exp, 0), build (RDIV_EXPR, type, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0be8cddeeed..84baf805712 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -4,6 +4,8 @@ * gcc.dg/struct-by-value-1.c: New test. + * gcc.c-torture/compile/20020319-1.c: New test. + 2002-03-18 Jakub Jelinek * g++.dg/opt/conj1.C: New test. diff --git a/gcc/testsuite/gcc.dg/20020319-1.c b/gcc/testsuite/gcc.dg/20020319-1.c new file mode 100644 index 00000000000..46a756d775a --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020319-1.c @@ -0,0 +1,10 @@ +/* PR optimization/5999 + This testcase ICEd because one a/b -> a * (1/b) optimization + did not handle complex divides. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math" } */ + +__complex__ double foo (__complex__ double x, __complex__ double y) +{ + return x / y; +}