Ping: GAS/ia64: spurious dv conflict

H. J. Lu hjl@lucon.org
Tue Oct 14 19:42:00 GMT 2003


On Tue, Oct 14, 2003 at 10:44:06AM -0700, H. J. Lu wrote:
> On Fri, Oct 10, 2003 at 09:16:53PM +0200, Andreas Schwab wrote:
> > http://sources.redhat.com/ml/binutils/2003-10/msg00005.html
> > 
> > Andreas.
> > 
> 
> Richard was right:
> 
> (p3)	cmp.eq p1, p0 = r1, r2
> 
> destroyed the mutex relation between p1 and p2. I am looking into
> it now.
> 

How about this patch?


H.J.
-------------- next part --------------
gas/

2003-10-14  Andreas Schwab  <schwab@suse.de>
	    H.J. Lu  <hongjiu.lu@intel.com>

	* config/tc-ia64.c (update_qp_mutex): New.
	(note_register_values): Call update_qp_mutex to update mutex
	relation on compare. Always add mutex relation for compare.

testsuite/

2003-10-14  Andreas Schwab  <schwab@suse.de>
	    H.J. Lu  <hongjiu.lu@intel.com>

	* gas/ia64/dv-mutex-err.s: Add more tests for compare.
	* gas/ia64/dv-mutex.s: Likewise.

	* gas/ia64/dv-mutex-err.l: Updated.
	* gas/ia64/dv-mutex.d: Likewise.

--- gas/config/tc-ia64.c.pred	2003-06-30 08:05:22.000000000 -0700
+++ gas/config/tc-ia64.c	2003-10-14 12:28:13.000000000 -0700
@@ -8726,6 +8726,33 @@ clear_qp_branch_flag (mask)
     }
 }
 
+/* P1 and P2 are mutually exclusive.  Remove any mutexes which contain
+   only one of the PRs.  */
+
+static void
+update_qp_mutex (valueT mask)
+{
+  int i;
+
+  i = 0;
+  while (i < qp_mutexeslen)
+    {
+      if ((qp_mutexes[i].prmask & mask) != 0
+	  && (qp_mutexes[i].prmask & mask) != mask)
+	{
+	  if (md.debug_dv)
+	    {
+	      fprintf (stderr, "  Clearing mutex relation");
+	      print_prmask (qp_mutexes[i].prmask);
+	      fprintf (stderr, "\n");
+	    }
+	  qp_mutexes[i] = qp_mutexes[--qp_mutexeslen];
+	}
+      else
+	++i;
+    }
+}
+
 /* Remove any mutexes which contain any of the PRs indicated in the mask.
 
    Any changes to a PR clears the mutex relations which include that PR.  */
@@ -8993,6 +9020,8 @@ note_register_values (idesc)
       valueT p1mask = (valueT) 1 << p1;
       valueT p2mask = (valueT) 1 << p2;
 
+      update_qp_mutex (p1mask | p2mask);
+
       /* If one of the PRs is PR0, we can't really do anything.  */
       if (p1 == 0 || p2 == 0)
 	{
@@ -9021,9 +9050,9 @@ note_register_values (idesc)
       else
 	{
 	  clear_qp_implies (p1mask | p2mask, p1mask | p2mask);
+	  add_qp_mutex (p1mask | p2mask);
 	  if (has_suffix_p (idesc->name, ".unc"))
 	    {
-	      add_qp_mutex (p1mask | p2mask);
 	      if (CURR_SLOT.qp_regno != 0)
 		{
 		  add_qp_imply (CURR_SLOT.opnd[0].X_add_number - REG_P,
@@ -9032,14 +9061,6 @@ note_register_values (idesc)
 				CURR_SLOT.qp_regno);
 		}
 	    }
-	  else if (CURR_SLOT.qp_regno == 0)
-	    {
-	      add_qp_mutex (p1mask | p2mask);
-	    }
-	  else
-	    {
-	      clear_qp_mutex (p1mask | p2mask);
-	    }
 	}
     }
   /* Look for mov imm insns into GRs.  */
--- gas/testsuite/gas/ia64/dv-mutex-err.l.pred	2000-04-23 09:41:25.000000000 -0700
+++ gas/testsuite/gas/ia64/dv-mutex-err.l	2003-10-14 12:13:08.000000000 -0700
@@ -2,3 +2,12 @@
 .*:9: Warning: Use of 'ld8' .* RAW dependency 'GR%, % in 1 - 127' \(impliedf\), specific resource number is 26
 .*:9: Warning: Only the first path encountering the conflict is reported
 .*:8: Warning: This is the location of the conflicting usage
+.*:14: Warning: Use of 'mov' may violate WAW dependency 'GR%, % in 1 - 127' \(impliedf\), specific resource number is 4
+.*:14: Warning: Only the first path encountering the conflict is reported
+.*:13: Warning: This is the location of the conflicting usage
+.*:20: Warning: Use of 'mov' may violate WAW dependency 'GR%, % in 1 - 127' \(impliedf\), specific resource number is 4
+.*:19: Warning: This is the location of the conflicting usage
+.*:26: Warning: Use of 'mov' may violate WAW dependency 'GR%, % in 1 - 127' \(impliedf\), specific resource number is 4
+.*:25: Warning: This is the location of the conflicting usage
+.*:32: Warning: Use of 'mov' may violate WAW dependency 'GR%, % in 1 - 127' \(impliedf\), specific resource number is 4
+.*:31: Warning: This is the location of the conflicting usage
--- gas/testsuite/gas/ia64/dv-mutex-err.s.pred	2000-04-23 09:41:25.000000000 -0700
+++ gas/testsuite/gas/ia64/dv-mutex-err.s	2003-10-14 12:05:37.000000000 -0700
@@ -7,3 +7,27 @@ start:	
 	cmp.eq	p6, p0 = r29, r0
 	add	r26 = r26, r29
 	ld8	r29 = [r26]
+
+	.pred.rel.mutex p1, p2
+	cmp.eq p0, p1 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
+
+	.pred.rel.mutex p1, p2
+(p3)	cmp.eq p0, p1 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
+
+	.pred.rel.mutex p1, p2
+	cmp.eq p2, p3 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
+
+	.pred.rel.mutex p1, p2
+(p3)	cmp.eq p2, p3 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
--- gas/testsuite/gas/ia64/dv-mutex.d.pred	2003-09-25 21:07:48.000000000 -0700
+++ gas/testsuite/gas/ia64/dv-mutex.d	2003-10-14 12:33:32.000000000 -0700
@@ -25,3 +25,15 @@ Disassembly of section \.text:
   50:	1d 00 00 00 01 00 	\[MFB\]       nop\.m 0x0
   56:	00 00 00 02 00 00 	            nop\.f 0x0
   5c:	00 00 20 00       	            rfi;;
+  60:	0a 08 04 04 02 78 	\[MMI\]       cmp\.eq p1,p2=r1,r2;;
+  66:	40 10 00 00 42 81 	      \(p01\) mov r4=2
+  6c:	40 00 00 84       	      \(p02\) mov r4=4
+  70:	1d 00 00 00 01 00 	\[MFB\]       nop\.m 0x0
+  76:	00 00 00 02 00 00 	            nop\.f 0x0
+  7c:	00 00 20 00       	            rfi;;
+  80:	6a 08 04 04 02 78 	\[MMI\] \(p03\) cmp\.eq p1,p2=r1,r2;;
+  86:	40 10 00 00 42 81 	      \(p01\) mov r4=2
+  8c:	40 00 00 84       	      \(p02\) mov r4=4
+  90:	1d 00 00 00 01 00 	\[MFB\]       nop\.m 0x0
+  96:	00 00 00 02 00 00 	            nop\.f 0x0
+  9c:	00 00 20 00       	            rfi;;
--- gas/testsuite/gas/ia64/dv-mutex.s.pred	2000-09-02 09:58:33.000000000 -0700
+++ gas/testsuite/gas/ia64/dv-mutex.s	2003-10-14 11:49:56.000000000 -0700
@@ -21,4 +21,16 @@ start:	
 (p1)	mov r4 = 2
 (p2)	mov r4 = 4
 	rfi
+
+// non-predicated compares don't remove mutex
+	cmp.eq p1, p2 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
+
+// predicated compares don't remove mutex
+(p3)	cmp.eq p1, p2 = r1, r2;;
+(p1)	mov r4 = 2
+(p2)	mov r4 = 4
+	rfi
 L:	


More information about the Binutils mailing list