public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR71478] Fix ICE in tree-ssa-reassoc.c
@ 2016-06-10  2:19 kugan
  2016-06-10 11:34 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: kugan @ 2016-06-10  2:19 UTC (permalink / raw)
  To: gcc-patches, Richard Biener

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Hi,

In PR71478, for vector negation of ssa produced by call stmt, we add 
vector (-1) and ssa to the ops list. However, in the place where we 
remove the (-1) from ops list, we failed to do this for vector integer. 
As a result, rewrite_expr_tree wrongly assumes that it is working with 
gimple_assign.

Attached patch fixes the place where we remove the vector (-1).

Regression tested on x86-64-linux-gnu with no new regressions. 
Regression testing on aarc64-linux-gnu is ongoing. Is this OK for trunk?

Thanks,
Kugan

gcc/testsuite/ChangeLog:

2016-06-10  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* gcc.dg/pr71478.c: New test.

gcc/ChangeLog:

2016-06-10  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for
	vector integer type.

[-- Attachment #2: pr71478.txt --]
[-- Type: text/plain, Size: 1219 bytes --]

diff --git a/gcc/testsuite/gcc.dg/pr71478.c b/gcc/testsuite/gcc.dg/pr71478.c
index e69de29..7b9cce6 100644
--- a/gcc/testsuite/gcc.dg/pr71478.c
+++ b/gcc/testsuite/gcc.dg/pr71478.c
@@ -0,0 +1,21 @@
+/* PR target/71478 */
+/* { dg-require-effective-target vect_int } */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef unsigned int __attribute__ ((vector_size (8))) uv2si;
+typedef int __attribute__ ((vector_size (8))) v2si;
+
+uv2si bar (v2si);
+
+uv2si
+foo (void)
+{
+  v2si x = (v2si) (0x00007fff80008000UL);
+  v2si y = (v2si) (0x8f997fff00000000UL);
+  uv2si z = x >= y;
+  uv2si k = bar (x);
+  uv2si j = k * __builtin_shuffle (z, z, (uv2si) {1, 3});
+  return k * j;
+}
+
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 36b34d3..e32d503 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -5303,8 +5303,7 @@ reassociate_bb (basic_block bb)
 		  && rhs_code == MULT_EXPR)
 		{
 		  last = ops.last ();
-		  if (((TREE_CODE (last->op) == INTEGER_CST
-			&& integer_minus_onep (last->op))
+		  if ((integer_minus_onep (last->op)
 		       || real_minus_onep (last->op))
 		      && !HONOR_SNANS (TREE_TYPE (lhs))
 		      && (!HONOR_SIGNED_ZEROS (TREE_TYPE (lhs))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR71478] Fix ICE in tree-ssa-reassoc.c
  2016-06-10  2:19 [PR71478] Fix ICE in tree-ssa-reassoc.c kugan
@ 2016-06-10 11:34 ` Richard Biener
  2016-06-13 18:58   ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2016-06-10 11:34 UTC (permalink / raw)
  To: kugan; +Cc: gcc-patches

On Fri, Jun 10, 2016 at 4:19 AM, kugan
<kugan.vivekanandarajah@linaro.org> wrote:
> Hi,
>
> In PR71478, for vector negation of ssa produced by call stmt, we add vector
> (-1) and ssa to the ops list. However, in the place where we remove the (-1)
> from ops list, we failed to do this for vector integer. As a result,
> rewrite_expr_tree wrongly assumes that it is working with gimple_assign.
>
> Attached patch fixes the place where we remove the vector (-1).
>
> Regression tested on x86-64-linux-gnu with no new regressions. Regression
> testing on aarc64-linux-gnu is ongoing. Is this OK for trunk?

Ok.

Richard.

> Thanks,
> Kugan
>
> gcc/testsuite/ChangeLog:
>
> 2016-06-10  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         * gcc.dg/pr71478.c: New test.
>
> gcc/ChangeLog:
>
> 2016-06-10  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         * tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for
>         vector integer type.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR71478] Fix ICE in tree-ssa-reassoc.c
  2016-06-10 11:34 ` Richard Biener
@ 2016-06-13 18:58   ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2016-06-13 18:58 UTC (permalink / raw)
  To: Richard Biener; +Cc: kugan, gcc-patches

On Fri, Jun 10, 2016 at 01:34:07PM +0200, Richard Biener wrote:
> On Fri, Jun 10, 2016 at 4:19 AM, kugan
> <kugan.vivekanandarajah@linaro.org> wrote:
> > Hi,
> >
> > In PR71478, for vector negation of ssa produced by call stmt, we add vector
> > (-1) and ssa to the ops list. However, in the place where we remove the (-1)
> > from ops list, we failed to do this for vector integer. As a result,
> > rewrite_expr_tree wrongly assumes that it is working with gimple_assign.
> >
> > Attached patch fixes the place where we remove the vector (-1).
> >
> > Regression tested on x86-64-linux-gnu with no new regressions. Regression
> > testing on aarc64-linux-gnu is ongoing. Is this OK for trunk?
> 
> Ok.

The testcase fails for me on i686-linux.

Requiring vect_int outside of */vect/ is bogus, it assumes the default
vectorization flags are used, which is not the case here.
But furthermore, it makes zero sense to require it, vector_size attribute
must be supported always, just without HW support lowered to scalar insns.
-Wno-psabi -w are the standard options used to turn off psabi warnings
on i?86 and powerpc.

Tested on i686-linux and x86_64-linux, committed to trunk as obvious.

2016-06-13  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/71478
	* gcc.dg/pr71478.c: Remove dg-require-effective-target vect_int.
	Add -Wno-psabi -w to dg-options.

--- gcc/testsuite/gcc.dg/pr71478.c	(revision 237383)
+++ gcc/testsuite/gcc.dg/pr71478.c	(working copy)
@@ -1,7 +1,6 @@
 /* PR middle-end/71478 */
-/* { dg-require-effective-target vect_int } */
 /* { dg-do compile } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -Wno-psabi -w" } */
 
 typedef unsigned int __attribute__ ((vector_size (8))) uv2si;
 typedef int __attribute__ ((vector_size (8))) v2si;
@@ -18,4 +17,3 @@ foo (void)
   uv2si j = k * __builtin_shuffle (z, z, (uv2si) {1, 3});
   return k * j;
 }
-


	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-13 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10  2:19 [PR71478] Fix ICE in tree-ssa-reassoc.c kugan
2016-06-10 11:34 ` Richard Biener
2016-06-13 18:58   ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).