This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] POWER7 nops


This patch adds support for POWER7's group ending nop, which is different
than the group ending nop used on POWER6.  This passed build and make check.
Ok for mainline?

Peter

gas/
	* config/tc-ppc.c (ppc_handle_align): Handle power7's group ending nop.

gas/testsuite/
	* gas/ppc/power7.d ("ori", ".p2align"): Add tests for group ending nop.
	* gas/ppc/power7.s: Likewise.
	* gas/ppc/power6.d: Likewise.
	* gas/ppc/power6.s: Likewise.

Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.152
diff -u -p -r1.152 tc-ppc.c
--- gas/config/tc-ppc.c	14 Mar 2009 09:34:27 -0000	1.152
+++ gas/config/tc-ppc.c	31 Mar 2009 15:40:16 -0000
@@ -5687,13 +5687,14 @@ ppc_handle_align (struct frag *fragP)
       fragP->fr_var = 4;
       md_number_to_chars (dest, 0x60000000, 4);
 
-      if ((ppc_cpu & PPC_OPCODE_POWER6) != 0)
+      if ((ppc_cpu & PPC_OPCODE_POWER6) != 0
+	  || (ppc_cpu & PPC_OPCODE_POWER7) != 0)
 	{
-	  /* For power6, we want the last nop to be a group terminating
-	     one, "ori 1,1,0".  Do this by inserting an rs_fill frag
-	     immediately after this one, with its address set to the last
-	     nop location.  This will automatically reduce the number of
-	     nops in the current frag by one.  */
+	  /* For power6 and power7, we want the last nop to be a group
+	     terminating one.  Do this by inserting an rs_fill frag immediately
+	     after this one, with its address set to the last nop location.
+	     This will automatically reduce the number of nops in the current
+	     frag by one.  */
 	  if (count > 4)
 	    {
 	      struct frag *group_nop = xmalloc (SIZEOF_STRUCT_FRAG + 4);
@@ -5707,7 +5708,12 @@ ppc_handle_align (struct frag *fragP)
 	      dest = group_nop->fr_literal;
 	    }
 
-	  md_number_to_chars (dest, 0x60210000, 4);
+	  if ((ppc_cpu & PPC_OPCODE_POWER7) != 0)
+	    /* power7 group terminating nop: "ori 2,2,0".  */
+	    md_number_to_chars (dest, 0x60420000, 4);
+	  else
+	    /* power6 group terminating nop: "ori 1,1,0".  */
+	    md_number_to_chars (dest, 0x60210000, 4);
 	}
     }
 }
Index: gas/testsuite/gas/ppc/power6.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/power6.d,v
retrieving revision 1.4
diff -u -p -r1.4 power6.d
--- gas/testsuite/gas/ppc/power6.d	26 Feb 2009 22:07:33 -0000	1.4
+++ gas/testsuite/gas/ppc/power6.d	31 Mar 2009 15:40:17 -0000
@@ -69,3 +69,5 @@ Disassembly of section \.text:
   ec:	7d 6a 02 74 	cbcdtd  r10,r11
   f0:	7d 6a 02 34 	cdtbcd  r10,r11
   f4:	7d 4b 60 94 	addg6s  r10,r11,r12
+  f8:	60 21 00 00 	ori     r1,r1,0
+  fc:	60 21 00 00 	ori     r1,r1,0
Index: gas/testsuite/gas/ppc/power6.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/power6.s,v
retrieving revision 1.4
diff -u -p -r1.4 power6.s
--- gas/testsuite/gas/ppc/power6.s	26 Feb 2009 22:07:33 -0000	1.4
+++ gas/testsuite/gas/ppc/power6.s	31 Mar 2009 15:40:17 -0000
@@ -64,3 +64,5 @@ start:
 	cbcdtd  10,11
 	cdtbcd  10,11
 	addg6s  10,11,12
+	ori	1,1,0
+	.p2align 4,,15
Index: gas/testsuite/gas/ppc/power7.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/power7.d,v
retrieving revision 1.2
diff -u -p -r1.2 power7.d
--- gas/testsuite/gas/ppc/power7.d	26 Feb 2009 22:07:33 -0000	1.2
+++ gas/testsuite/gas/ppc/power7.d	31 Mar 2009 15:40:17 -0000
@@ -111,3 +111,7 @@ Disassembly of section \.text:
  194:	ed c0 78 34 	frsqrtes f14,f15
  198:	ed c0 78 35 	frsqrtes\. f14,f15
  19c:	7c 43 27 1e 	isel    r2,r3,r4,28
+ 1a0:	60 42 00 00 	ori     r2,r2,0
+ 1a4:	60 00 00 00 	nop
+ 1a8:	60 00 00 00 	nop
+ 1ac:	60 42 00 00 	ori     r2,r2,0
Index: gas/testsuite/gas/ppc/power7.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/power7.s,v
retrieving revision 1.2
diff -u -p -r1.2 power7.s
--- gas/testsuite/gas/ppc/power7.s	26 Feb 2009 22:07:33 -0000	1.2
+++ gas/testsuite/gas/ppc/power7.s	31 Mar 2009 15:40:17 -0000
@@ -104,3 +104,5 @@ power7:
 	frsqrtes  14,15
 	frsqrtes. 14,15
 	isel	  2,3,4,28
+	ori	  2,2,0
+	.p2align 4,,15



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]