diff mbox

Fix ia64 barrier discovery (PR target/43897)

Message ID 20101129204525.GW29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 29, 2010, 8:45 p.m. UTC
On Mon, Nov 29, 2010 at 05:12:08PM +0100, Jakub Jelinek wrote:
> 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.

Or, alternatively, it can be done just for asm clobbers and no other
clobbers if you prefer so.  Also fixes all the gas dependency warnings
on gcc bootstrap and passed bootstrap/regtest on ia64-linux.

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

	PR target/43897
	* config/ia64/ia64.c (rtx_needs_barrier): Handle asm CLOBBER
	as a store into that register.

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


	Jakub
diff mbox

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
@@ -6321,6 +6321,17 @@ 
 	      break;
 
 	    case CLOBBER:
+	      if (REG_P (XEXP (pat, 0))
+		  && extract_asm_operands (x) != NULL_RTX
+		  && 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;
+}