re PR tree-optimization/37021 (Fortran Complex reduction / multiplication not vectorized)
authorRichard Biener <rguenther@suse.de>
Wed, 27 Mar 2013 10:38:29 +0000 (10:38 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 27 Mar 2013 10:38:29 +0000 (10:38 +0000)
2013-03-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/37021
* tree-vect-data-refs.c (vect_check_strided_load): Allow
REALPART/IMAGPART_EXPRs around the supported refs.
* tree-ssa-structalias.c (find_func_aliases): Assume that
floating-point values are not used to transfer pointers.

* gfortran.dg/vect/fast-math-pr37021.f90: New testcase.

From-SVN: r197158

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/fast-math-pr37021.f90 [new file with mode: 0644]
gcc/tree-ssa-structalias.c
gcc/tree-vect-data-refs.c

index f00cb045ab2f72d1abc8f1b3a02acbb9f1b21db7..b90cc6738ca53ae08ff94eeaca87eb1bc7529b5f 100644 (file)
@@ -1,3 +1,11 @@
+2013-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/37021
+       * tree-vect-data-refs.c (vect_check_strided_load): Allow
+       REALPART/IMAGPART_EXPRs around the supported refs.
+       * tree-ssa-structalias.c (find_func_aliases): Assume that
+       floating-point values are not used to transfer pointers.
+
 2013-03-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>
 
        * gcc/target.def (TARGET_HAS_IFUNC_P): New target hook.
index 5b26dad3f2a27397eaa5d857b772600fc52efcb9..17d588908bd90893abb74d499ef314122c0c9d39 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/37021
+       * gfortran.dg/vect/fast-math-pr37021.f90: New testcase.
+
 2013-03-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>
 
        * g++.dg/ipa/ivinline-1.C: Add target nonpic.
diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-pr37021.f90 b/gcc/testsuite/gfortran.dg/vect/fast-math-pr37021.f90
new file mode 100644 (file)
index 0000000..d2eebd4
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do compile }
+
+subroutine to_product_of(self,a,b,a1,a2)
+  complex(kind=8) :: self (:)
+  complex(kind=8), intent(in) :: a(:,:)
+  complex(kind=8), intent(in) :: b(:)
+  integer a1,a2
+  self = ZERO
+  do i = 1,a1
+    do j = 1,a2
+      self(i) = self(i) + a(i,j)*b(j)
+    end do
+  end do
+end subroutine
+
+! { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } }
+! { dg-final { cleanup-tree-dump "vect" } }
index 236b86a9bdd472f6c30ed9403d18d4669cf1f921..c588e876b2bb2cca836c96927bef13bc8a835dfa 100644 (file)
@@ -4631,7 +4631,11 @@ find_func_aliases (gimple origt)
 
          get_constraint_for (lhsop, &lhsc);
 
-         if (code == POINTER_PLUS_EXPR)
+         if (FLOAT_TYPE_P (TREE_TYPE (lhsop)))
+           /* If the operation produces a floating point result then
+              assume the value is not produced to transfer a pointer.  */
+           ;
+         else if (code == POINTER_PLUS_EXPR)
            get_constraint_for_ptr_offset (gimple_assign_rhs1 (t),
                                           gimple_assign_rhs2 (t), &rhsc);
          else if (code == BIT_AND_EXPR
index 579f6032280b102671157c6b7e28be191ffe998d..188581f6246bc4c9765846b0ddc1e386239245be 100644 (file)
@@ -2798,6 +2798,10 @@ vect_check_strided_load (gimple stmt, loop_vec_info loop_vinfo)
 
   base = DR_REF (dr);
 
+  if (TREE_CODE (base) == REALPART_EXPR
+      || TREE_CODE (base) == IMAGPART_EXPR)
+    base = TREE_OPERAND (base, 0);
+
   if (TREE_CODE (base) == ARRAY_REF)
     {
       off = TREE_OPERAND (base, 1);