This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR70310
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Mar 2016 14:46:20 +0100 (CET)
- Subject: [PATCH] Fix PR70310
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2016-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/70310
* tree-vect-generic.c (expand_vector_condition): Fold the built
condition.
* gcc.dg/torture/pr70310.c: New testcase.
Index: gcc/tree-vect-generic.c
===================================================================
*** gcc/tree-vect-generic.c (revision 234320)
--- gcc/tree-vect-generic.c (working copy)
*************** expand_vector_condition (gimple_stmt_ite
*** 897,903 ****
{
tree aa1 = tree_vec_extract (gsi, comp_inner_type, a1, width, index);
tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2, width, index);
! aa = build2 (TREE_CODE (a), cond_type, aa1, aa2);
}
else
aa = tree_vec_extract (gsi, cond_type, a, width, index);
--- 897,903 ----
{
tree aa1 = tree_vec_extract (gsi, comp_inner_type, a1, width, index);
tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2, width, index);
! aa = fold_build2 (TREE_CODE (a), cond_type, aa1, aa2);
}
else
aa = tree_vec_extract (gsi, cond_type, a, width, index);
Index: gcc/testsuite/gcc.dg/torture/pr70310.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr70310.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr70310.c (working copy)
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do run } */
+
+ typedef unsigned char v32u8 __attribute__ ((vector_size (32)));
+
+ unsigned __attribute__((noinline, noclone))
+ foo(unsigned u)
+ {
+ v32u8 v32u8_0 = (v32u8){} > (v32u8){-u};
+ return v32u8_0[31] + v32u8_0[0];
+ }
+
+ int
+ main ()
+ {
+ unsigned x = foo(0);
+ __builtin_printf ("%08x\n",x);
+ if (x != 0)
+ __builtin_abort();
+ return 0;
+ }