Patchwork Fix ia64 barrier discovery (PR target/43897)

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 29, 2010, 4:12 p.m.
Message ID <20101129161208.GV29412@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/73444/
State New
Headers show

Comments

Jakub Jelinek - Nov. 29, 2010, 4:12 p.m.
Hi!

We shouldn't ignore CLOBBERs in PARALLELs, as those mean the insn in
question can clobber the register in question.
Fixed thusly, bootstrapped/regtested on ia64-linux.  All the 12
Warning: Use of 'mov' violates WAW dependency 'PR%, % in 1 - 15' (impliedf), specific resource number is 1
warnings during bootstrap are gone with the patch, cc1plus except for
ia64.o has identical generated code.  The REG_RP check is because
when we don't ignore (clobber (reg:BI b0)) in the call insn pattern,
rws_access_regno will fail as it has been already set when handling the
clobber.

Ok for trunk?

2010-11-29  Jakub Jelinek  <jakub@redhat.com>

	PR target/43897
	* config/ia64/ia64.c (rtx_needs_barrier): Handle CLOBBER in
	a PARALLEL as a store into that register.  For CALLs don't call
	rws_access_regno for REG_RP if a CLOBBER from PARALLEL has
	already called it.

	* gcc.target/ia64/pr43897.c: New test.


	Jakub

Patch

--- gcc/config/ia64/ia64.c.jj	2010-11-24 18:10:51.000000000 +0100
+++ gcc/config/ia64/ia64.c	2010-11-29 12:37:09.000000000 +0100
@@ -6246,7 +6246,8 @@ 
       if (! flags.is_sibcall && ! rws_insn_test (REG_AR_CFM))
 	{
 	  new_flags.is_write = 1;
-	  need_barrier |= rws_access_regno (REG_RP, new_flags, pred);
+	  if (! rws_insn_test (REG_RP))
+	    need_barrier |= rws_access_regno (REG_RP, new_flags, pred);
 	  need_barrier |= rws_access_regno (AR_PFS_REGNUM, new_flags, pred);
 	  need_barrier |= rws_access_regno (REG_AR_CFM, new_flags, pred);
 	}
@@ -6321,6 +6322,16 @@ 
 	      break;
 
 	    case CLOBBER:
+	      if (REG_P (XEXP (pat, 0))
+		  && REGNO (XEXP (pat, 0)) != AR_UNAT_REGNUM)
+		{
+		  new_flags.is_write = 1;
+		  need_barrier |= rtx_needs_barrier (XEXP (pat, 0),
+						     new_flags, pred);
+		  new_flags = flags;
+		}
+	      break;
+
 	    case RETURN:
 	      break;
 
--- gcc/testsuite/gcc.target/ia64/pr43897.c.jj	2010-11-26 16:46:41.000000000 +0100
+++ gcc/testsuite/gcc.target/ia64/pr43897.c	2010-11-26 16:46:09.000000000 +0100
@@ -0,0 +1,12 @@ 
+/* PR target/43897 */
+/* { dg-do assemble } */
+/* { dg-options "-O2" } */
+
+int
+sub (int i)
+{
+  float tmp;
+  if (i)
+    __asm__ __volatile__ ("frcpa.s0 %0,p1=f0,f0":"=f" (tmp)::"p1");
+  return i + 10;
+}