diff mbox series

patch to fix PR84112

Message ID d6ee44d5-fad9-f360-cd05-f7ef5697f578@redhat.com
State New
Headers show
Series patch to fix PR84112 | expand

Commit Message

Vladimir Makarov Jan. 30, 2018, 8:31 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84112

   The patch was successfully bootstrapped and tested on x86-64 and ppc64.

   Committed as rev. 257204.

Comments

Rainer Orth Jan. 30, 2018, 8:37 p.m. UTC | #1
Hi Vladimir,

>   The following patch fixes
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84112
>
>   The patch was successfully bootstrapped and tested on x86-64 and ppc64.
>
>   Committed as rev. 257204.
[...]
> Index: testsuite/ChangeLog
> ===================================================================
> --- testsuite/ChangeLog	(revision 257203)
> +++ testsuite/ChangeLog	(working copy)
> @@ -1,3 +1,8 @@
> +2018-01-30  Vladimir Makarov  <vmakarov@redhat.com>
> +
> +	PR target/84112
> +	* pr84112.c: New.

this should be gcc.target/powerpc/pr84112.c instead.

> Index: testsuite/gcc.target/powerpc/pr84112.c

	Rainer
Vladimir Makarov Jan. 30, 2018, 8:43 p.m. UTC | #2
On 01/30/2018 03:37 PM, Rainer Orth wrote:
> Hi Vladimir,
>
>>    The following patch fixes
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84112
>>
>>    The patch was successfully bootstrapped and tested on x86-64 and ppc64.
>>
>>    Committed as rev. 257204.
> [...]
>> Index: testsuite/ChangeLog
>> ===================================================================
>> --- testsuite/ChangeLog	(revision 257203)
>> +++ testsuite/ChangeLog	(working copy)
>> @@ -1,3 +1,8 @@
>> +2018-01-30  Vladimir Makarov  <vmakarov@redhat.com>
>> +
>> +	PR target/84112
>> +	* pr84112.c: New.
> this should be gcc.target/powerpc/pr84112.c instead.
>
Thank you for fixing my changelog entry.
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 257203)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2018-01-30  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/84112
+	* lra-constraints.c (curr_insn_transform): Process AND in the
+	address.
+
 2018-01-30  Jakub Jelinek  <jakub@redhat.com>
 
 	PR rtl-optimization/83986
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 257203)
+++ lra-constraints.c	(working copy)
@@ -4216,7 +4216,17 @@  curr_insn_transform (bool check_only_p)
 				GET_MODE_SIZE (GET_MODE (op)));
 	  else if (get_reload_reg (OP_IN, Pmode, *loc, rclass, FALSE,
 				   "offsetable address", &new_reg))
-	    lra_emit_move (new_reg, *loc);
+	    {
+	      rtx addr = *loc;
+	      enum rtx_code code = GET_CODE (addr);
+	      
+	      if (code == AND && CONST_INT_P (XEXP (addr, 1)))
+		/* (and ... (const_int -X)) is used to align to X bytes.  */
+		addr = XEXP (*loc, 0);
+	      lra_emit_move (new_reg, addr);
+	      if (addr != *loc)
+		emit_move_insn (new_reg, gen_rtx_AND (GET_MODE (new_reg), new_reg, XEXP (*loc, 1)));
+	    }
 	  before = get_insns ();
 	  end_sequence ();
 	  *loc = new_reg;
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 257203)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2018-01-30  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/84112
+	* pr84112.c: New.
+
 2018-01-30  Jakub Jelinek  <jakub@redhat.com>
 
 	PR rtl-optimization/83986
Index: testsuite/gcc.target/powerpc/pr84112.c
===================================================================
--- testsuite/gcc.target/powerpc/pr84112.c	(nonexistent)
+++ testsuite/gcc.target/powerpc/pr84112.c	(working copy)
@@ -0,0 +1,33 @@ 
+/* { dg-do compile { target powerpc*-*-* } }*/
+/* { dg-options "-mcpu=power8 -O3 -fstack-protector-strong -fpic" } */
+
+char *b;
+int c, d, e, f;
+
+void
+foo (char *h, int k, int l, int m, int j, int q)
+{
+  char *i = b;
+  int n = d;
+  int s = e;
+  while (c)
+    {
+      for (; j <= 0; j += 12)
+	{
+	  i[j] = n & k - h[j] >> 31 | q & ~(k - h[j] >> 31);
+	  i[j + 1] = n & l - h[j + 1] >> 31 | q & ~(l - h[j + 1] >> 31);
+	  i[j + 2] = n & m - h[j + 2] >> 31 | s & ~(m - h[j + 2] >> 31);
+	  i[j + 3] = n & k - h[j + 3] >> 31 | q & ~(k - h[j + 3] >> 31);
+	  i[j + 4] = n & l - h[j + 4] >> 31 | q & ~(l - h[j + 4] >> 31);
+	  i[j + 5] = n & m - h[j + 5] >> 31 | s & ~(m - h[j + 5] >> 31);
+	  i[j + 6] = n & k - h[j + 6] >> 31 | q & ~(k - h[j + 6] >> 31);
+	  i[j + 7] = n & l - h[j + 7] >> 31 | q & ~(l - h[j + 7] >> 31);
+	  i[j + 8] = n & m - h[j + 8] >> 31 | s & ~(m - h[j + 8] >> 31);
+	  i[j + 9] = n & k - h[j + 9] >> 31 | q & ~(k - h[j + 9] >> 31);
+	  i[j + 10] = n & l - h[j + 10] >> 31 | q & ~(l - h[j + 10] >> 31);
+	  i[j + 11] = n & m - h[j + 11] >> 31 | s & ~(m - h[j + 11] >> 31);
+	}
+      while (j < f)
+	;
+    }
+}