This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.8] Reassoc fix (PR tree-optimization/60502)


On April 10, 2014 10:02:29 AM CEST, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>This backport didn't apply cleanly, because 4.8 doesn't have
>build_all_ones_cst function.
>
>So, either we can apply something like the patch below
>(bootstrapped/regtested with the other backports), or as another
>alternative I see backport the addition of build_minus_one_cst
>and build_all_ones_cst functions (probably without adding any new
>uses of those functions, just define in tree.c and declare in tree.h)
>and then apply the r208507 change as is.
>
>What do you prefer?

Backport the two functions.

Richard.

>2014-04-10  Jakub Jelinek  <jakub@redhat.com>
>
>	Backport from mainline
>	2014-03-12  Jakub Jelinek  <jakub@redhat.com>
>		    Marc Glisse  <marc.glisse@inria.fr>
>
>	PR tree-optimization/60502
>	* tree-ssa-reassoc.c (eliminate_not_pairs): Handle VECTOR_TYPE.
>
>	* gcc.c-torture/compile/pr60502.c: New test.
>
>--- gcc/tree-ssa-reassoc.c	(revision 208506)
>+++ gcc/tree-ssa-reassoc.c	(revision 208507)
>@@ -785,8 +785,15 @@ eliminate_not_pairs (enum tree_code opco
> 	  if (opcode == BIT_AND_EXPR)
> 	    oe->op = build_zero_cst (TREE_TYPE (oe->op));
> 	  else if (opcode == BIT_IOR_EXPR)
>-	    oe->op = build_low_bits_mask (TREE_TYPE (oe->op),
>-					  TYPE_PRECISION (TREE_TYPE (oe->op)));
>+	    {
>+	      tree type = TREE_TYPE (oe->op);
>+	      tree itype = type;
>+	      if (TREE_CODE (type) == VECTOR_TYPE)
>+		itype = TREE_TYPE (type);
>+	      oe->op = build_low_bits_mask (itype, TYPE_PRECISION (itype));
>+	      if (TREE_CODE (type) == VECTOR_TYPE)
>+		oe->op = build_vector_from_val (type, oe->op);
>+	    }
> 
> 	  reassociate_stats.ops_eliminated += ops->length () - 1;
> 	  ops->truncate (0);
>--- gcc/testsuite/gcc.c-torture/compile/pr60502.c	(revision 0)
>+++ gcc/testsuite/gcc.c-torture/compile/pr60502.c	(revision 208507)
>@@ -0,0 +1,18 @@
>+/* PR tree-optimization/60502 */
>+
>+typedef signed char v16i8 __attribute__ ((vector_size (16)));
>+typedef unsigned char v16u8 __attribute__ ((vector_size (16)));
>+
>+void
>+foo (v16i8 *x)
>+{
>+  v16i8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>-1, -1 };
>+  *x |= *x ^ m1;
>+}
>+
>+void
>+bar (v16u8 *x)
>+{
>+  v16u8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>-1, -1 };
>+  *x |= *x ^ m1;
>+}
>
>	Jakub



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]