PR optimization/5999, middle-end/5731
authorDale Johannesen <dalej@apple.com>
Wed, 20 Mar 2002 09:41:46 +0000 (10:41 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 20 Mar 2002 09:41:46 +0000 (10:41 +0100)
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

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20020319-1.c [new file with mode: 0644]

index 9cf4c2aa34ecdd7311b6e761b296f5f213cd2ca8..47c6ca9333a6467fb06ada8468367ca0995c4d0b 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-19 Dale Johannesen  <dalej@apple.com>
+
+       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  <neil@daikokuya.demon.co.uk>
 
        * Makefile.in: Update.
index fd62a39b9c9ca938a792977b49fea97d6b365857..ef532feb561be05fd73509fbf06e590b590785b3 100644 (file)
@@ -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,
index 0be8cddeeed4519fe912105096b3b4feb7cbbf83..84baf8057120923e564a74e3e6fca0b763382a9e 100644 (file)
@@ -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  <jakub@redhat.com>
 
        * 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 (file)
index 0000000..46a756d
--- /dev/null
@@ -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;
+}