OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Apr 2011 09:39:57 +0000 (09:39 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Apr 2011 09:39:57 +0000 (09:39 +0000)
* tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use
operand_equal_p to compare DR_BASE_ADDRESSes.
(vect_check_interleaving): Likewise.

gcc/testsuite/
* gcc.dg/vect/vect-119.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172817 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-119.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index ec65ff1..028e230 100644 (file)
@@ -1,5 +1,11 @@
 2011-04-21  Richard Sandiford  <richard.sandiford@linaro.org>
 
+       * tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use
+       operand_equal_p to compare DR_BASE_ADDRESSes.
+       (vect_check_interleaving): Likewise.
+
+2011-04-21  Richard Sandiford  <richard.sandiford@linaro.org>
+
        PR target/46329
        * config/arm/arm.c (arm_legitimate_constant_p_1): Return false
        for all Neon struct constants.
index 7cda82e..5917c5b 100644 (file)
@@ -1,5 +1,9 @@
 2011-04-21  Richard Sandiford  <richard.sandiford@linaro.org>
 
+       * gcc.dg/vect/vect-119.c: New test.
+
+2011-04-21  Richard Sandiford  <richard.sandiford@linaro.org>
+
        * gcc.dg/vect/vect.exp: Run the main tests twice, one with -flto
        and once without.
 
diff --git a/gcc/testsuite/gcc.dg/vect/vect-119.c b/gcc/testsuite/gcc.dg/vect/vect-119.c
new file mode 100644 (file)
index 0000000..fa40f15
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+
+#define OUTER 32
+#define INNER 40
+
+static unsigned int
+bar (const unsigned int x[INNER][2], unsigned int sum)
+{
+  int i;
+
+  for (i = 0; i < INNER; i++)
+    sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
+  return sum;
+}
+
+unsigned int foo (const unsigned int x[OUTER][INNER][2])
+{
+  int i;
+  unsigned int sum;
+
+  sum = 0.0f;
+  for (i = 0; i < OUTER; i++)
+    sum = bar (x[i], sum);
+  return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "Detected interleaving of size 2" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
index d7d174f..9ce4626 100644 (file)
@@ -314,11 +314,7 @@ vect_drs_dependent_in_basic_block (struct data_reference *dra,
 
   /* Check that the data-refs have same bases and offsets.  If not, we can't
      determine if they are dependent.  */
-  if ((DR_BASE_ADDRESS (dra) != DR_BASE_ADDRESS (drb)
-       && (TREE_CODE (DR_BASE_ADDRESS (dra)) != ADDR_EXPR
-           || TREE_CODE (DR_BASE_ADDRESS (drb)) != ADDR_EXPR
-           || TREE_OPERAND (DR_BASE_ADDRESS (dra), 0)
-           != TREE_OPERAND (DR_BASE_ADDRESS (drb),0)))
+  if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0)
       || !dr_equal_offsets_p (dra, drb))
     return true;
 
@@ -364,11 +360,7 @@ vect_check_interleaving (struct data_reference *dra,
 
   /* Check that the data-refs have same first location (except init) and they
      are both either store or load (not load and store).  */
-  if ((DR_BASE_ADDRESS (dra) != DR_BASE_ADDRESS (drb)
-       && (TREE_CODE (DR_BASE_ADDRESS (dra)) != ADDR_EXPR
-          || TREE_CODE (DR_BASE_ADDRESS (drb)) != ADDR_EXPR
-          || TREE_OPERAND (DR_BASE_ADDRESS (dra), 0)
-          != TREE_OPERAND (DR_BASE_ADDRESS (drb),0)))
+  if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0)
       || !dr_equal_offsets_p (dra, drb)
       || !tree_int_cst_compare (DR_INIT (dra), DR_INIT (drb))
       || DR_IS_READ (dra) != DR_IS_READ (drb))