PATCH: powerpc regnames

Tristan Gingold gingold@adacore.com
Thu Nov 8 14:58:00 GMT 2007


Here is the patch to fix this issue.
Tristan.

On Oct 19, 2007, at 1:40 PM, Alan Modra wrote:
> On Fri, Oct 19, 2007 at 01:16:33PM +0200, Tristan Gingold wrote:
>> Note that your patch doesn't handle all cases:
>> %cr7*4+gt is not accepted.
>
> Indeed.  Would you like to fix it?


gas:
2007-11-08  Tristan Gingold  <gingold@adacore.com>

	* config/tc-ppc.c (md_assemble): If -mregnames, when parsing
	PPC_OPERAND_CR always parse as expression to allow register name
	followed by an expression.

gas/testsuite:
2007-11-08  Tristan Gingold  <gingold@adacore.com>

	* gas/ppc/regnames.d: New.  Test -mregnames switch.
	* gas/ppc/regnames.s: Likewise.

	* gas/ppc/ppc.exp: Run regnames.


*** gas/config/tc-ppc.c 7 Nov 2007 14:10:48 -0000       1.130
--- gas/config/tc-ppc.c 8 Nov 2007 14:51:14 -0000
***************
*** 2454,2460 ****
         else
   #endif                /* TE_PE */
         {
!         if (! register_name (&ex))
             {
               char save_lex = lex_type['%'];

--- 2454,2465 ----
         else
   #endif                /* TE_PE */
         {
!         /* For CR operand, always parse as an expression if  
reg_names_p.
!            This is useful for instruction like:
!              cror 4*%cr7+gt,%cr7*4+gt,4*%cr6+gt
!         */
!         if ((reg_names_p && (operand->flags & PPC_OPERAND_CR) != 0)
!             || ! register_name (&ex))
             {
               char save_lex = lex_type['%'];

*** /dev/null   2004-06-30 22:03:36.000000000 +0200
--- gas/testsuite/gas/ppc/regnames.s    2007-11-08 15:25:10.000000000  
+0100
***************
*** 0 ****
--- 1,3 ----
+       .text
+         cror 4*%cr7+gt,%cr7*4+gt,4*%cr6+gt
+       lbz r4,4(r5)
*** /dev/null   2004-06-30 22:03:36.000000000 +0200
--- gas/testsuite/gas/ppc/regnames.d    2007-11-08 15:40:02.000000000  
+0100
***************
*** 0 ****
--- 1,8 ----
+ #as: -mregnames
+ #objdump: -s -j .text
+ #name: PowerPC symbolic regnames
+
+ .*
+
+ Contents of section \.text:
+  0000 4fbdcb82 88850004 .*
*** gas/testsuite/gas/ppc/ppc.exp       24 Aug 2007 00:56:29  
-0000      1.15
--- gas/testsuite/gas/ppc/ppc.exp       8 Nov 2007 14:58:25 -0000
***************
*** 30,35 ****
--- 30,36 ----
   if { [istarget powerpc*-*-*] } then {
       run_dump_test "simpshft"
       run_dump_test "machine"
+     run_dump_test "regnames"

       if { [istarget powerpc-*-*aix*] } then {
         run_dump_test "altivec_xcoff"



More information about the Binutils mailing list