public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARC] Fix ARC backend ICE on pr29921-2
@ 2015-11-11 15:24 Claudiu Zissulescu
  2015-11-11 18:15 ` Joern Wolfgang Rennecke
  0 siblings, 1 reply; 3+ messages in thread
From: Claudiu Zissulescu @ 2015-11-11 15:24 UTC (permalink / raw)
  To: gcc-patches, gnu; +Cc: Francois Bedard

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

Please find attached a patch that fixes the ARC backend ICE on pr29921-2 test from gcc.dg (dg.exp). 

The patch will allow generating conditional move also outside expand scope. The error was triggered during if-conversion.

Ok to apply?
Claudiu

ChangeLog:
2015-11-11  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (gen_compare_reg): Swap operands also when we
	do not expand to rtl.


[-- Attachment #2: 00-fixpr29921-2.patch --]
[-- Type: application/octet-stream, Size: 1467 bytes --]

From 9f380b8b1369f92d1e45f4c509f23988c19f05c3 Mon Sep 17 00:00:00 2001
From: Claudiu Zissulescu <claziss@synopsys.com>
Date: Wed, 11 Nov 2015 16:09:30 +0100
Subject: [PATCH] ARC: fix pr29921-2 issue

---
 gcc/config/arc/arc.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 85d53e4..8bb0969 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1690,6 +1690,7 @@ gen_compare_reg (rtx comparison, machine_mode omode)
     {
       rtx op0 = gen_rtx_REG (cmode, 0);
       rtx op1 = gen_rtx_REG (cmode, GET_MODE_SIZE (cmode) / UNITS_PER_WORD);
+      bool swap = false;
 
       switch (code)
 	{
@@ -1698,15 +1699,19 @@ gen_compare_reg (rtx comparison, machine_mode omode)
 	  break;
 	case LT: case UNGE: case LE: case UNGT:
 	  code = swap_condition (code);
-	  tmp = x;
-	  x = y;
-	  y = tmp;
+	  swap = true;
 	  break;
 	default:
 	  gcc_unreachable ();
 	}
       if (currently_expanding_to_rtl)
 	{
+	  if (swap)
+	    {
+	      tmp = x;
+	      x = y;
+	      y = tmp;
+	    }
 	  emit_move_insn (op0, x);
 	  emit_move_insn (op1, y);
 	}
@@ -1714,6 +1719,11 @@ gen_compare_reg (rtx comparison, machine_mode omode)
 	{
 	  gcc_assert (rtx_equal_p (op0, x));
 	  gcc_assert (rtx_equal_p (op1, y));
+	  if (swap)
+	    {
+	      op0 = y;
+	      op1 = x;
+	    }
 	}
       emit_insn (gen_cmp_float (cc_reg, gen_rtx_COMPARE (mode, op0, op1)));
     }
-- 
1.9.1


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

* Re: [PATCH][ARC] Fix ARC backend ICE on pr29921-2
  2015-11-11 15:24 [PATCH][ARC] Fix ARC backend ICE on pr29921-2 Claudiu Zissulescu
@ 2015-11-11 18:15 ` Joern Wolfgang Rennecke
  2015-11-12  9:29   ` Claudiu Zissulescu
  0 siblings, 1 reply; 3+ messages in thread
From: Joern Wolfgang Rennecke @ 2015-11-11 18:15 UTC (permalink / raw)
  To: Claudiu Zissulescu, gcc-patches; +Cc: Francois Bedard



On 11/11/15 15:22, Claudiu Zissulescu wrote:
> Please find attached a patch that fixes the ARC backend ICE on pr29921-2 test from gcc.dg (dg.exp).
>
> The patch will allow generating conditional move also outside expand scope. The error was triggered during if-conversion.
>
> Ok to apply?

OK.

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

* RE: [PATCH][ARC] Fix ARC backend ICE on pr29921-2
  2015-11-11 18:15 ` Joern Wolfgang Rennecke
@ 2015-11-12  9:29   ` Claudiu Zissulescu
  0 siblings, 0 replies; 3+ messages in thread
From: Claudiu Zissulescu @ 2015-11-12  9:29 UTC (permalink / raw)
  To: Joern Wolfgang Rennecke, gcc-patches; +Cc: Francois Bedard

Patch applied.

Thanks Joern,
Claudiu

> -----Original Message-----
> From: Joern Wolfgang Rennecke [mailto:gnu@amylaar.uk]
> Sent: Wednesday, November 11, 2015 7:15 PM
> To: Claudiu Zissulescu; gcc-patches@gcc.gnu.org
> Cc: Francois Bedard
> Subject: Re: [PATCH][ARC] Fix ARC backend ICE on pr29921-2
> 
> 
> 
> On 11/11/15 15:22, Claudiu Zissulescu wrote:
> > Please find attached a patch that fixes the ARC backend ICE on pr29921-2
> test from gcc.dg (dg.exp).
> >
> > The patch will allow generating conditional move also outside expand
> scope. The error was triggered during if-conversion.
> >
> > Ok to apply?
> 
> OK.

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

end of thread, other threads:[~2015-11-12  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 15:24 [PATCH][ARC] Fix ARC backend ICE on pr29921-2 Claudiu Zissulescu
2015-11-11 18:15 ` Joern Wolfgang Rennecke
2015-11-12  9:29   ` Claudiu Zissulescu

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).