diff options
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/optabs.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr32216.c | 14 | ||||
-rw-r--r-- | gcc/tree-vect-generic.c | 11 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 25 |
6 files changed, 59 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index addf5a2894b..5fa424d81d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,8 +1,18 @@ +2007-06-06 Uros Bizjak <ubizjak@gmail.com> + + PR tree-optimization/32216 + * tree-vectorizer.c (supportable_widening_operation): Determine + signedness of FIX_TRUNC_EXPR from output operand. + (supportable_narrowing_operation): Ditto. + * tree-vect-generic.c (expand_vector_operations_1): Determine + signedness of VEC_UNPACK_FLOAT_HI_EXPR and VEC_UNPACK_FLOAT_LO_EXPR + from input operand. + 2007-06-06 Thomas Neumann <tneumann@users.sourceforge.net> * config/i386/i386.c (enum pta_flags): Move out of struct scope... - (struct pta): ...from here. Change flags to unsigned to avoid excessive - casting (as it is used as a bit mask). + (struct pta): ...from here. Change flags to unsigned to avoid + excessive casting (as it is used as a bit mask). (override_options): Add casts according to the coding convenventions. (x86_64_elf_unique_section): Likewise. (examine_argument): Avoid using C++ keywords as variable names. diff --git a/gcc/optabs.c b/gcc/optabs.c index d659132c1e9..47114fcaa5c 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -357,6 +357,7 @@ optab_for_tree_code (enum tree_code code, tree type) return TYPE_UNSIGNED (type) ? vec_pack_usat_optab : vec_pack_ssat_optab; case VEC_PACK_FIX_TRUNC_EXPR: + /* The signedness is determined from output operand. */ return TYPE_UNSIGNED (type) ? vec_pack_ufix_trunc_optab : vec_pack_sfix_trunc_optab; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3990087283b..766369d5754 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-06-06 Uros Bizjak <ubizjak@gmail.com> + + PR tree-optimization/32216 + * gcc.dg/vect/pr32216.c: New test. + 2007-06-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR testsuite/18923 diff --git a/gcc/testsuite/gcc.dg/vect/pr32216.c b/gcc/testsuite/gcc.dg/vect/pr32216.c new file mode 100644 index 00000000000..cf2744125ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr32216.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_floatint_cvt } */ + +unsigned int wlookup2[203]; + +SetSoundVariables (int x) +{ + for (x = 1; x < 32; x++) + { + wlookup2[x] = (double) 16 / x; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index e955c44743c..8c0bbd556fa 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -412,17 +412,22 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) return; gcc_assert (code != CONVERT_EXPR); + + /* The signedness is determined from input argument. */ + if (code == VEC_UNPACK_FLOAT_HI_EXPR + || code == VEC_UNPACK_FLOAT_LO_EXPR) + type = TREE_TYPE (TREE_OPERAND (rhs, 0)); + op = optab_for_tree_code (code, type); /* For widening/narrowing vector operations, the relevant type is of the - arguments, not the widened result. */ + arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is + calculated in the same way above. */ if (code == WIDEN_SUM_EXPR || code == VEC_WIDEN_MULT_HI_EXPR || code == VEC_WIDEN_MULT_LO_EXPR || code == VEC_UNPACK_HI_EXPR || code == VEC_UNPACK_LO_EXPR - || code == VEC_UNPACK_FLOAT_HI_EXPR - || code == VEC_UNPACK_FLOAT_LO_EXPR || code == VEC_PACK_TRUNC_EXPR || code == VEC_PACK_SAT_EXPR || code == VEC_PACK_FIX_TRUNC_EXPR) diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index be2d6b3c7f7..8dba4d03cf9 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -1851,10 +1851,17 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype, gcc_unreachable (); } - *code1 = c1; - *code2 = c2; - optab1 = optab_for_tree_code (c1, vectype); - optab2 = optab_for_tree_code (c2, vectype); + if (code == FIX_TRUNC_EXPR) + { + /* The signedness is determined from output operand. */ + optab1 = optab_for_tree_code (c1, type); + optab2 = optab_for_tree_code (c2, type); + } + else + { + optab1 = optab_for_tree_code (c1, vectype); + optab2 = optab_for_tree_code (c2, vectype); + } if (!optab1 || !optab2) return false; @@ -1867,6 +1874,8 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype, || insn_data[icode2].operand[0].mode != TYPE_MODE (wide_vectype)) return false; + *code1 = c1; + *code2 = c2; return true; } @@ -1918,8 +1927,11 @@ supportable_narrowing_operation (enum tree_code code, gcc_unreachable (); } - *code1 = c1; - optab1 = optab_for_tree_code (c1, vectype); + if (code == FIX_TRUNC_EXPR) + /* The signedness is determined from output operand. */ + optab1 = optab_for_tree_code (c1, type); + else + optab1 = optab_for_tree_code (c1, vectype); if (!optab1) return false; @@ -1929,6 +1941,7 @@ supportable_narrowing_operation (enum tree_code code, || insn_data[icode1].operand[0].mode != TYPE_MODE (narrow_vectype)) return false; + *code1 = c1; return true; } |