diff mbox series

[COMMITTED] patch for PR95464

Message ID f0e99301-5101-1d90-de69-d9cb8eff9e2d@redhat.com
State New
Headers show
Series [COMMITTED] patch for PR95464 | expand

Commit Message

Vladimir Makarov June 4, 2020, 4:13 p.m. UTC
The following patch fixes

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

The patch was successfully bootstrapped and tested on x86-64.  I did not 
test it on other major targets as they do not deal with STRICT_LOW_PART.

There is also no test case for this PR as it is hard to check the right 
code generation.

Comments

Jakub Jelinek June 4, 2020, 4:17 p.m. UTC | #1
On Thu, Jun 04, 2020 at 12:13:51PM -0400, Vladimir Makarov via Gcc-patches wrote:
> The following patch fixes
> 
>            https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95464
> 
> The patch was successfully bootstrapped and tested on x86-64.  I did not
> test it on other major targets as they do not deal with STRICT_LOW_PART.

Thanks.

> There is also no test case for this PR as it is hard to check the right code
> generation.

The testcase from the PR was a dg-do run testcase that FAILed without your
patch, can't we just use that testcase (in gcc.target/i386/, restricted to
lp64 and possibly linux only to make sure frame pointer can be safely
omitted)?

	Jakub
Vladimir Makarov June 4, 2020, 4:23 p.m. UTC | #2
On 2020-06-04 12:17 p.m., Jakub Jelinek wrote:
> On Thu, Jun 04, 2020 at 12:13:51PM -0400, Vladimir Makarov via Gcc-patches wrote:
>> The following patch fixes
>>
>>             https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95464
>>
>> The patch was successfully bootstrapped and tested on x86-64.  I did not
>> test it on other major targets as they do not deal with STRICT_LOW_PART.
> Thanks.
>
>> There is also no test case for this PR as it is hard to check the right code
>> generation.
> The testcase from the PR was a dg-do run testcase that FAILed without your
> patch, can't we just use that testcase (in gcc.target/i386/, restricted to
> lp64 and possibly linux only to make sure frame pointer can be safely
> omitted)?
>
> 	

OK, Jakub.  I'll try to create a test for the PR.
H.J. Lu June 4, 2020, 4:55 p.m. UTC | #3
On Thu, Jun 4, 2020 at 9:17 AM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Thu, Jun 04, 2020 at 12:13:51PM -0400, Vladimir Makarov via Gcc-patches wrote:
> > The following patch fixes
> >
> >            https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95464
> >
> > The patch was successfully bootstrapped and tested on x86-64.  I did not
> > test it on other major targets as they do not deal with STRICT_LOW_PART.
>
> Thanks.
>
> > There is also no test case for this PR as it is hard to check the right code
> > generation.
>
> The testcase from the PR was a dg-do run testcase that FAILed without your
> patch, can't we just use that testcase (in gcc.target/i386/, restricted to
> lp64 and possibly linux only to make sure frame pointer can be safely
> omitted)?

Why lp64?  Shouldn't it be !ia32?
Vladimir Makarov June 4, 2020, 5:27 p.m. UTC | #4
On 2020-06-04 12:55 p.m., H.J. Lu wrote:
> On Thu, Jun 4, 2020 at 9:17 AM Jakub Jelinek via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> The testcase from the PR was a dg-do run testcase that FAILed without your
>> patch, can't we just use that testcase (in gcc.target/i386/, restricted to
>> lp64 and possibly linux only to make sure frame pointer can be safely
>> omitted)?
> Why lp64?  Shouldn't it be !ia32?
>
Thank you, H.J.  I'll use ! ia32.
diff mbox series

Patch

Add processing STRICT_LOW_PART for matched reloads.

2020-06-04  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/95464
	* lra.c (lra_emit_move): Add processing STRICT_LOW_PART.
	* lra-constraints.c (match_reload): Use STRICT_LOW_PART in output
	reload if the original insn has it too.


diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bf6d4a2fd4b..421c453997b 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1071,6 +1071,8 @@  match_reload (signed char out, signed char *ins, signed char *outs,
   if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX)
     {
       start_sequence ();
+      if (out >= 0 && curr_static_id->operand[out].strict_low)
+	out_rtx = gen_rtx_STRICT_LOW_PART (VOIDmode, out_rtx);
       lra_emit_move (out_rtx, copy_rtx (new_out_reg));
       emit_insn (*after);
       *after = get_insns ();
diff --git a/gcc/lra.c b/gcc/lra.c
index 3435cff6a1d..caa09d86ca6 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -490,13 +490,16 @@  void
 lra_emit_move (rtx x, rtx y)
 {
   int old;
-
+  rtx_insn *insn;
+  
   if (GET_CODE (y) != PLUS)
     {
       if (rtx_equal_p (x, y))
 	return;
       old = max_reg_num ();
-      rtx_insn *insn = emit_move_insn (x, y);
+
+      insn = (GET_CODE (x) != STRICT_LOW_PART
+	      ? emit_move_insn (x, y) : emit_insn (gen_rtx_SET (x, y)));
       /* The move pattern may require scratch registers, so convert them
 	 into real registers now.  */
       if (insn != NULL_RTX)