diff options
author | Ulrich Weigand <Ulrich.Weigand@de.ibm.com> | 2009-12-07 22:20:06 +0000 |
---|---|---|
committer | Ulrich Weigand <Ulrich.Weigand@de.ibm.com> | 2009-12-07 22:20:06 +0000 |
commit | 33ae49a17543651abc5938fe4e7cf80db28d7154 (patch) | |
tree | 8987f4ac57b43ecfe768a88109d59971dabad7de | |
parent | 73a4390cc2823957f2ed2efa3fea9355e2f2384a (diff) |
2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Backport from mainline:
gcc/
2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com>
* c-typeck.c (build_binary_op): Allow % on integal vectors.
* doc/extend.texi (Vector Extension): Document that % is allowed too.
gcc/cp/
2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com>
* typeck.c (build_binary_op): Allow % on integal vectors.
gcc/testsuite/
2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com>
* gcc.dg/vector-4.c: New testcase.
* gcc.dg/simd-1b.c: % is now allowed for integer vectors.
* g++.dg/ext/vector16.C: New testcase.
2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Backport from mainline:
gcc/
2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C/31499
* c-typeck.c (process_init_element): Treat VECTOR_TYPE like ARRAY_TYPE
and RECORD_TYPE/UNION_TYPE. When outputing the actual element and the
value is a VECTOR_CST, the element type is the element type of the
vector.
gcc/testsuite/
2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C/31499
* gcc.dg/vector-init-1.c: New testcase.
* gcc.dg/vector-init-2.c: New testcase.
2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Update to gcc-4_4-branch revision 155038.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/cell-4_4-branch@155055 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.cell | 46 | ||||
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/DATESTAMP | 2 | ||||
-rw-r--r-- | gcc/c-typeck.c | 23 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 2 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/vector16.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/simd-1b.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vector-4.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vector-init-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vector-init-2.c | 25 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 2 |
13 files changed, 135 insertions, 12 deletions
diff --git a/ChangeLog.cell b/ChangeLog.cell index e40209e233c..4c4a904fb76 100644 --- a/ChangeLog.cell +++ b/ChangeLog.cell @@ -1,3 +1,49 @@ +2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + +gcc/ + 2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * c-typeck.c (build_binary_op): Allow % on integal vectors. + * doc/extend.texi (Vector Extension): Document that % is allowed too. + +gcc/cp/ + 2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (build_binary_op): Allow % on integal vectors. + +gcc/testsuite/ + 2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * gcc.dg/vector-4.c: New testcase. + * gcc.dg/simd-1b.c: % is now allowed for integer vectors. + * g++.dg/ext/vector16.C: New testcase. + +2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + +gcc/ + 2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR C/31499 + * c-typeck.c (process_init_element): Treat VECTOR_TYPE like ARRAY_TYPE + and RECORD_TYPE/UNION_TYPE. When outputing the actual element and the + value is a VECTOR_CST, the element type is the element type of the + vector. + +gcc/testsuite/ + 2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR C/31499 + * gcc.dg/vector-init-1.c: New testcase. + * gcc.dg/vector-init-2.c: New testcase. + +2008-12-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Update to gcc-4_4-branch revision 155038. + 2008-12-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> Backport from mainline: diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2295faf537..c0f6cb6c838 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-12-07 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (*iorqi_ext_2): Fix insn mnemonic typo. + +2009-12-06 Richard Henderson <rth@redhat.com> + + * tree-ssa-dom.c (degenerate_phi_result): Check for NULL phi + argument earlier. + 2009-12-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> Backport from mainline: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7c257af6124..6f422360397 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20091204 +20091207 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index e9dad623ab9..c8004737979 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -6891,7 +6891,8 @@ process_init_element (struct c_expr value, bool implicit) || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields == 0) process_init_element (pop_init_level (1), true); - else if (TREE_CODE (constructor_type) == ARRAY_TYPE + else if ((TREE_CODE (constructor_type) == ARRAY_TYPE + || TREE_CODE (constructor_type) == VECTOR_TYPE) && (constructor_max_index == 0 || tree_int_cst_lt (constructor_max_index, constructor_index))) @@ -6952,7 +6953,7 @@ process_init_element (struct c_expr value, bool implicit) && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE - || fieldcode == UNION_TYPE)) + || fieldcode == UNION_TYPE || fieldcode == VECTOR_TYPE)) { push_init_level (1); continue; @@ -7042,7 +7043,7 @@ process_init_element (struct c_expr value, bool implicit) && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE - || fieldcode == UNION_TYPE)) + || fieldcode == UNION_TYPE || fieldcode == VECTOR_TYPE)) { push_init_level (1); continue; @@ -7082,7 +7083,7 @@ process_init_element (struct c_expr value, bool implicit) && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != elttype && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE - || eltcode == UNION_TYPE)) + || eltcode == UNION_TYPE || eltcode == VECTOR_TYPE)) { push_init_level (1); continue; @@ -7130,8 +7131,12 @@ process_init_element (struct c_expr value, bool implicit) /* Now output the actual element. */ if (value.value) - output_init_element (value.value, strict_string, - elttype, constructor_index, 1, implicit); + { + if (TREE_CODE (value.value) == VECTOR_CST) + elttype = TYPE_MAIN_VARIANT (constructor_type); + output_init_element (value.value, strict_string, + elttype, constructor_index, 1, implicit); + } constructor_index = size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); @@ -8390,7 +8395,11 @@ build_binary_op (location_t location, enum tree_code code, case FLOOR_MOD_EXPR: warn_for_div_by_zero (location, op1); - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) + if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE + && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE + && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) + common = 1; + else if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) { /* Although it would be tempting to shorten always here, that loses on some targets, since the modulo instruction is undefined if the diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index c50356e1cd8..b1868ac45d7 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -9880,7 +9880,7 @@ (const_int 8)))) (clobber (reg:CC FLAGS_REG))] "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))" - "ior{b}\t{%h2, %h0|%h0, %h2}" + "or{b}\t{%h2, %h0|%h0, %h2}" [(set_attr "type" "alu") (set_attr "length_immediate" "0") (set_attr "mode" "QI")]) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index c3403df1016..b89365b2018 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3481,7 +3481,11 @@ cp_build_binary_op (location_t location, case FLOOR_MOD_EXPR: warn_for_div_by_zero (location, op1); - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) + if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE + && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE + && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) + common = 1; + else if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) { /* Although it would be tempting to shorten always here, that loses on some targets, since the modulo instruction is undefined if the diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 25a15ed4db6..5503328bd54 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -5726,7 +5726,7 @@ produce code that uses 4 @code{SIs}. The types defined in this manner can be used with a subset of normal C operations. Currently, GCC will allow using the following operators -on these types: @code{+, -, *, /, unary minus, ^, |, &, ~}@. +on these types: @code{+, -, *, /, unary minus, ^, |, &, ~, %}@. The operations behave like C++ @code{valarrays}. Addition is defined as the addition of the corresponding elements of the operands. For diff --git a/gcc/testsuite/g++.dg/ext/vector16.C b/gcc/testsuite/g++.dg/ext/vector16.C new file mode 100644 index 00000000000..7964a881f4a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector16.C @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(4*sizeof(int)) )) + +vector int a, b, c; + + +/* Test that remainder works for vectors. */ +void f(void) +{ + a = b % c; +} diff --git a/gcc/testsuite/gcc.dg/simd-1b.c b/gcc/testsuite/gcc.dg/simd-1b.c index 56d94b91c68..1e2b597b565 100644 --- a/gcc/testsuite/gcc.dg/simd-1b.c +++ b/gcc/testsuite/gcc.dg/simd-1b.c @@ -14,7 +14,7 @@ void hanneke () { /* Operators on compatible SIMD types. */ - a %= b; /* { dg-error "invalid operands to binary %" } */ + a %= b; c &= d; a |= b; c ^= d; diff --git a/gcc/testsuite/gcc.dg/vector-4.c b/gcc/testsuite/gcc.dg/vector-4.c new file mode 100644 index 00000000000..7964a881f4a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(4*sizeof(int)) )) + +vector int a, b, c; + + +/* Test that remainder works for vectors. */ +void f(void) +{ + a = b % c; +} diff --git a/gcc/testsuite/gcc.dg/vector-init-1.c b/gcc/testsuite/gcc.dg/vector-init-1.c new file mode 100644 index 00000000000..5baf9568840 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-init-1.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ + +/* PR C/31499, test that the C front-end treats vectors like an array. */ + +#define vector __attribute__((__vector_size__(4*sizeof(int)) )) +vector signed int v1[]={0,1,2,3,4,5,6,7}; diff --git a/gcc/testsuite/gcc.dg/vector-init-2.c b/gcc/testsuite/gcc.dg/vector-init-2.c new file mode 100644 index 00000000000..6527f495d81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-init-2.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ + +/* PR C/31499, test that the C front-end treats vectors like an array + and that it works at runtime. */ + +#define vector __attribute__((__vector_size__(4*sizeof(int)) )) +vector signed int v1[]={0,1,2,3,4,5,6,7}; + + +int main(void) +{ + int i; + for (i = 0; i < sizeof(v1)/sizeof(v1[0]); i++) + { + vector int t = v1[i]; + int *d = (int*)&t; + int j; + for (j = 0; j < 4; j++) + { + if (d[j] != i * 4 + j) + __builtin_abort (); + } + } + return 0; +}
\ No newline at end of file diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 6d6d02bc305..3f9e1e8e292 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2491,6 +2491,8 @@ degenerate_phi_result (gimple phi) if (arg == lhs) continue; + else if (!arg) + break; else if (!val) val = arg; else if (!operand_equal_p (arg, val, 0)) |