public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* mtsprg on BOOKE
@ 2004-10-29 16:17 Jeff Baker
  2004-10-29 16:19 ` Jeff Baker
  2004-10-29 22:16 ` James E Wilson
  0 siblings, 2 replies; 10+ messages in thread
From: Jeff Baker @ 2004-10-29 16:17 UTC (permalink / raw)
  To: binutils

Why does the following assembly produce errors on BOOKE?

mtsprg 7, %r3
mfsprg %r3, 7

Doesn't BOOKE have SPRG0-0 -> SPRG0-7?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-10-29 16:17 mtsprg on BOOKE Jeff Baker
@ 2004-10-29 16:19 ` Jeff Baker
  2004-10-29 16:25   ` Dave Korn
  2004-10-29 22:16 ` James E Wilson
  1 sibling, 1 reply; 10+ messages in thread
From: Jeff Baker @ 2004-10-29 16:19 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

Whoops, I mean SPRG0->SPRG7 obviously.

Jeff Baker wrote:
> Why does the following assembly produce errors on BOOKE?
> 
> mtsprg 7, %r3
> mfsprg %r3, 7
> 
> Doesn't BOOKE have SPRG0-0 -> SPRG0-7?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: mtsprg on BOOKE
  2004-10-29 16:19 ` Jeff Baker
@ 2004-10-29 16:25   ` Dave Korn
  2004-10-29 16:32     ` Jeff Baker
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2004-10-29 16:25 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

> -----Original Message-----
> From: binutils-owner On Behalf Of Jeff Baker
> Sent: 29 October 2004 17:19

> 
> Whoops, I mean SPRG0->SPRG7 obviously.
> 
> Jeff Baker wrote:
> > Why does the following assembly produce errors on BOOKE?
> > 
> > mtsprg 7, %r3
> > mfsprg %r3, 7
> > 
> > Doesn't BOOKE have SPRG0-0 -> SPRG0-7?

  Just a WAG, but you didn't forget the -mregnames flag by any possible
chance, did you?

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....
 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-10-29 16:25   ` Dave Korn
@ 2004-10-29 16:32     ` Jeff Baker
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Baker @ 2004-10-29 16:32 UTC (permalink / raw)
  To: Dave Korn; +Cc: binutils

-mregnames has no effect.

Dave Korn wrote:
>>-----Original Message-----
>>From: binutils-owner On Behalf Of Jeff Baker
>>Sent: 29 October 2004 17:19
> 
> 
>>Whoops, I mean SPRG0->SPRG7 obviously.
>>
>>Jeff Baker wrote:
>>
>>>Why does the following assembly produce errors on BOOKE?
>>>
>>>mtsprg 7, %r3
>>>mfsprg %r3, 7
>>>
>>>Doesn't BOOKE have SPRG0-0 -> SPRG0-7?
> 
> 
>   Just a WAG, but you didn't forget the -mregnames flag by any possible
> chance, did you?
> 
>     cheers, 
>       DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-10-29 16:17 mtsprg on BOOKE Jeff Baker
  2004-10-29 16:19 ` Jeff Baker
@ 2004-10-29 22:16 ` James E Wilson
  2004-11-01 15:26   ` Jeff Baker
  1 sibling, 1 reply; 10+ messages in thread
From: James E Wilson @ 2004-10-29 22:16 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

On Fri, 2004-10-29 at 09:17, Jeff Baker wrote:
> Why does the following assembly produce errors on BOOKE?
> mtsprg 7, %r3

Looking at the sources, opcode/ppc-opc.c, I see that the mtsprg macro
only takes 2-bit sprg register numbers, which is apparently correct for
the basic ppc architecture, but not for e500.  This should probably be
conditional on the architecture choice.  I haven't looked at any
architecture or processor manuals to double check.

Meanwhile, "mtsprg7 %r3" will work.  Likewise for mfsprg.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-10-29 22:16 ` James E Wilson
@ 2004-11-01 15:26   ` Jeff Baker
  2004-11-01 20:25     ` Kumar Gala
  2004-11-01 22:30     ` James E Wilson
  0 siblings, 2 replies; 10+ messages in thread
From: Jeff Baker @ 2004-11-01 15:26 UTC (permalink / raw)
  To: James E Wilson; +Cc: binutils

I've never worked in the opcodes area before and I'm not sure how to 
implement this change.  Can anyone give me a hand?

James E Wilson wrote:
> On Fri, 2004-10-29 at 09:17, Jeff Baker wrote:
> 
>>Why does the following assembly produce errors on BOOKE?
>>mtsprg 7, %r3
> 
> 
> Looking at the sources, opcode/ppc-opc.c, I see that the mtsprg macro
> only takes 2-bit sprg register numbers, which is apparently correct for
> the basic ppc architecture, but not for e500.  This should probably be
> conditional on the architecture choice.  I haven't looked at any
> architecture or processor manuals to double check.
> 
> Meanwhile, "mtsprg7 %r3" will work.  Likewise for mfsprg.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-11-01 15:26   ` Jeff Baker
@ 2004-11-01 20:25     ` Kumar Gala
  2004-11-01 22:30     ` James E Wilson
  1 sibling, 0 replies; 10+ messages in thread
From: Kumar Gala @ 2004-11-01 20:25 UTC (permalink / raw)
  To: jbaker; +Cc: binutils, James E Wilson

Jeff,

Looking at opcode/ppc-opc.c I think what you want to look at modifying 
the following:

\f
/* The operands table.

    The fields are bits, shift, insert, extract, flags.

    We used to put parens around the various additions, like the one
    for BA just below.  However, that caused trouble with feeble
    compilers with a limit on depth of a parenthesized expression, like
    (reportedly) the compiler in Microsoft Developer Studio 5.  So we
    omit the parens, since the macros are never used in a context where
    the addition will be ambiguous.  */

.... [snip] ....

   /* The SPRG register number in an XFX form m[ft]sprg instruction.  */
#define SPRG SPRBAT + 1
#define SPRG_MASK (0x3 << 16)
   { 2, 16, NULL, NULL, 0 },

-- 

You will want to grow the size of the field from 2 bits to 3.  I can 
remember if you will need to adjust the shift amount or not.  I would 
also recommend adding some testcases to gas/testsuite/ppc/booke.{s,d}

- kumar

On Nov 1, 2004, at 9:26 AM, Jeff Baker wrote:

> I've never worked in the opcodes area before and I'm not sure how to
> implement this change.  Can anyone give me a hand?
>
> James E Wilson wrote:
>  > On Fri, 2004-10-29 at 09:17, Jeff Baker wrote:
>  >
> >>Why does the following assembly produce errors on BOOKE?
>  >>mtsprg 7, %r3
>  >
> >
> > Looking at the sources, opcode/ppc-opc.c, I see that the mtsprg macro
>  > only takes 2-bit sprg register numbers, which is apparently correct 
> for
>  > the basic ppc architecture, but not for e500.  This should probably 
> be
>  > conditional on the architecture choice.  I haven't looked at any
>  > architecture or processor manuals to double check.
>  >
> > Meanwhile, "mtsprg7 %r3" will work.  Likewise for mfsprg.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-11-01 15:26   ` Jeff Baker
  2004-11-01 20:25     ` Kumar Gala
@ 2004-11-01 22:30     ` James E Wilson
  2004-11-02 15:34       ` Jeff Baker
  1 sibling, 1 reply; 10+ messages in thread
From: James E Wilson @ 2004-11-01 22:30 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

On Mon, 2004-11-01 at 07:26, Jeff Baker wrote:
> I've never worked in the opcodes area before and I'm not sure how to 
> implement this change.  Can anyone give me a hand?

Find the mtsprg entry in the opcodes/ppc-opc.c file.

Most ports do a sequential search, and take the first matching entry. 
So you can add a second mtsprg entry immediately before the existing
one, where this additional entry is only enabled for booke (and
ppc405?).  You will need to adjust the masks and operand bits as
appropriate.  You can't change the definition of existing macros, but
you can add new ones that are correct for the booke case, and use them
in this new entry.

Some targets use operand specifiers that are interpreted by the
assembler.  In this case, you can modify e.g. config/tc-ppc.c to
interpret the operand specifier differently depending on the
architecture.  The PPC port does not appear to use this scheme though. 
So it looks like we have to modify the opcodes/ppc-opc.c file directly.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-11-01 22:30     ` James E Wilson
@ 2004-11-02 15:34       ` Jeff Baker
  2004-11-02 22:51         ` James E Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Baker @ 2004-11-02 15:34 UTC (permalink / raw)
  To: James E Wilson; +Cc: binutils

Thanks, I figured out how to get this working... sortof.  I can change 
the generic SPRG/SPRG_MASK definitions as a quick test so I know I'm 
making the correct modification, but I don't know how to define the 
mfsprg and mtsprg ops in such a way as it won't complain about duplicate 
insns.

James E Wilson wrote:
> On Mon, 2004-11-01 at 07:26, Jeff Baker wrote:
> 
>>I've never worked in the opcodes area before and I'm not sure how to 
>>implement this change.  Can anyone give me a hand?
> 
> 
> Find the mtsprg entry in the opcodes/ppc-opc.c file.
> 
> Most ports do a sequential search, and take the first matching entry. 
> So you can add a second mtsprg entry immediately before the existing
> one, where this additional entry is only enabled for booke (and
> ppc405?).  You will need to adjust the masks and operand bits as
> appropriate.  You can't change the definition of existing macros, but
> you can add new ones that are correct for the booke case, and use them
> in this new entry.
> 
> Some targets use operand specifiers that are interpreted by the
> assembler.  In this case, you can modify e.g. config/tc-ppc.c to
> interpret the operand specifier differently depending on the
> architecture.  The PPC port does not appear to use this scheme though. 
> So it looks like we have to modify the opcodes/ppc-opc.c file directly.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: mtsprg on BOOKE
  2004-11-02 15:34       ` Jeff Baker
@ 2004-11-02 22:51         ` James E Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: James E Wilson @ 2004-11-02 22:51 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

On Tue, 2004-11-02 at 07:34, Jeff Baker wrote:
> Thanks, I figured out how to get this working... sortof.  I can change 
> the generic SPRG/SPRG_MASK definitions as a quick test so I know I'm 
> making the correct modification, but I don't know how to define the 
> mfsprg and mtsprg ops in such a way as it won't complain about duplicate 
> insns.

I am not intimately familiar with the ppc port, so I don't know offhand
what criteria is uses to say that two entries are duplicate
instructions.  I suggest looking at or debugging the result to find out.

I was assuming you could have two entries with the same instruction
name, as there are examples of that, e.g. mtdbsr, but maybe that works
only if they are enabled for different processors.  In that case, we
would need booke and ppc-booke for the mtsprg entries, but there is
probably no current way to specify ppc minus booke.  In that case, we
may need one entry, but then there is the question of how to
conditionalize it, as I don't think you can specify variable size
fields, but we do need to give a warning if someone tries to access
sprg7 with a basic ppc target.  I think you can fix that problem with
accessor functions.  See for instance insert_spr/extract_spr.  So you
can define insert_sprg/extract_sprg functions, you can specify the
maximum bit-field size for the argument, and then inside the insert_sprg
function you can give an error if a register is used that is out of
range for the current architecture.  See for instance the insert_bo and
valid_bo functions which do something like this.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-11-02 22:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-29 16:17 mtsprg on BOOKE Jeff Baker
2004-10-29 16:19 ` Jeff Baker
2004-10-29 16:25   ` Dave Korn
2004-10-29 16:32     ` Jeff Baker
2004-10-29 22:16 ` James E Wilson
2004-11-01 15:26   ` Jeff Baker
2004-11-01 20:25     ` Kumar Gala
2004-11-01 22:30     ` James E Wilson
2004-11-02 15:34       ` Jeff Baker
2004-11-02 22:51         ` James E Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).