aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-01-16 16:00:17 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-01-16 16:00:17 +0000
commita1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf (patch)
tree7b576b7515a8cd71afd71de1f0d38d04d85e48a0 /gcc
parentde4af523c5a6790873770f4d1248bedc4dd6e56a (diff)
downloadgcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.zip
gcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.tar.gz
gcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.tar.bz2
re PR tree-optimization/34769 (gcc.dg/vect/no-vfa-pr29145.c)
2008-01-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/34769 * tree-data-ref.c (initialize_matrix_A): Revert fix for PR34458. * tree.c (int_cst_value): Instead make this function more permissive in what it accepts as valid input. Document this function always sign-extends the value. From-SVN: r131573
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-data-ref.c15
-rw-r--r--gcc/tree.c19
3 files changed, 23 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 909008b..2d4f0c7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/34769
+ * tree-data-ref.c (initialize_matrix_A): Revert fix for PR34458.
+ * tree.c (int_cst_value): Instead make this function more
+ permissive in what it accepts as valid input. Document this
+ function always sign-extends the value.
+
2008-01-16 Jakub Jelinek <jakub@redhat.com>
Richard Guenther <rguenther@suse.de>
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 1fe7c0a..2f17ed1 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1823,21 +1823,12 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
static HOST_WIDE_INT
initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
{
- tree type;
-
gcc_assert (chrec);
- type = TREE_TYPE (chrec);
if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
- return tree_low_cst (chrec, TYPE_UNSIGNED (type)
- && !(TREE_CODE (type) == INTEGER_TYPE
- && TYPE_IS_SIZETYPE (type)));
-
- type = TREE_TYPE (CHREC_RIGHT (chrec));
- A[index][0] = mult * tree_low_cst (CHREC_RIGHT (chrec),
- TYPE_UNSIGNED (type)
- && !(TREE_CODE (type) == INTEGER_TYPE
- && TYPE_IS_SIZETYPE (type)));
+ return int_cst_value (chrec);
+
+ A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 02570b7..21121b2 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8036,21 +8036,26 @@ find_compatible_field (tree record, tree orig_field)
return orig_field;
}
-/* Return value of a constant X. */
+/* Return value of a constant X and sign-extend it. */
HOST_WIDE_INT
int_cst_value (const_tree x)
{
unsigned bits = TYPE_PRECISION (TREE_TYPE (x));
unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x);
- bool negative = ((val >> (bits - 1)) & 1) != 0;
- gcc_assert (bits <= HOST_BITS_PER_WIDE_INT);
+ /* Make sure the sign-extended value will fit in a HOST_WIDE_INT. */
+ gcc_assert (TREE_INT_CST_HIGH (x) == 0
+ || TREE_INT_CST_HIGH (x) == -1);
- if (negative)
- val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1;
- else
- val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1);
+ if (bits < HOST_BITS_PER_WIDE_INT)
+ {
+ bool negative = ((val >> (bits - 1)) & 1) != 0;
+ if (negative)
+ val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1;
+ else
+ val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1);
+ }
return val;
}