Assembling Power instructions: dcbtst/dcbt.

Peter Bergner
Fri Sep 13 20:22:00 GMT 2013

On Fri, 2013-09-13 at 18:32 +0000, Paralkar Anmol-B07584 wrote:
> Hello,
>  Per Power ISA Version 2.07 (May 3, 2013) "4.3.2 Data Cache Instructions",
>  the assembly language syntax for the dcbtst instruction (pp. 771) is:
>  dcbtst RA,RB,TH [Category: Server]
>  dcbtst TH,RA,RB [Category: Embedded]
>  and it's layout in the object code is:
>   +------+------+------+------+------------+---+
>   |  31  |  TH  |  RA  |   RB |  246(0xF6) | / |
>   |0     |6     |11    |16    |21          |31 |
>   +------+------+------+------+------------+---+
>  (Analogously: dcbt pp. 770)
>  However, GAS (as of version decides on the syntax to use based on
>  processor/architecture dialect (not Power ISA Category), using the Server syntax in
>  the case of POWER4 and the Embedded syntax for generic PPC or VLE.

That was a bug fixed here:

>  Consequently (e.g.),
>  dcbtst 17, 14, 6
>  in the assembly file gets "misassembled" under -many for a user-space program on Linux:

When you only specify -many (and not one of -mpower4, -mpower5, etc.),
the assembler/disassembler will choose a default -m<CPU> value for
you.  That has changed over time, but is generally one of the newer
server cpus.  For example, for binutils trunk, the default is now
-mpower8 and for your 2.23.x binutils, it is -mpower7.
That should force the assembler and disassembler to assemble
the instruction using the server operand order you want, but the bug
above (which is in 2.23) basically resets it to an old cpu, so it
chooses to use the embedded/old cpu setting.

I think if you try a newer assembler/disassembler, you will see
that you get the operand ordering you're expecting.

> Also, is it at all possible that we add a PowerPC option to GAS:
> --isa-category=<val> where <val> in { server, embedded, ... /* more values
> as applicable */ } to be used in such cases where the Power ISA category
> serves to distinguish? The option could be OFF by default and be implemented
> in a way that keeps the code change as minimal as possible and preserves
> current user experience.

Do you mean something over and above the -m<CPU> option?


More information about the Binutils mailing list