Correct powerpc spe opcode lookup

Peter Bergner bergner@vnet.ibm.com
Tue May 8 19:49:00 GMT 2018


On 5/8/18 8:01 AM, Alan Modra wrote:
> 	* ppc-dis.c (PPC_OPCD_SEGS): Define using PPC_OP.
> 	(VLE_OPCD_SEGS, SPE2_OPCD_SEGS): Similarly, using macros used to
> 	partition opcode space for index lookup.

I like it, thanks.


A somewhat related question: We have two methods of implementing extended
mnemonics.  One is adding them to the appropriate *_opcodes[] table (eg, "mr",
"vmr", etc.) and the other is placing them in the powerpc_macros[] table
(eg, slwi, clrrdi, etc.).

Both methods seem to have their benefits.  However, my big issue with the
powerpc_macros[] table is that any extended mnemonic implemented using it
cannot be disassembled to the extended mnemonic, meaning you always get the
base instruction instead.  For example, "slwi r3,r4,3" is always disassembled
as "rlwinm r3,r4,3,0,28" even though slwi is much more readable.  We also get
bad error messages in the case the base instruction isn't supported:

bergner@pike:~/binutils/BUGS$ cat slwi.s 
	.text
	slwi	3,4,3
bergner@pike:~/binutils/BUGS$ as -a32 -mvle slwi.s 
slwi.s: Assembler messages:
slwi.s:2: Error: unrecognized opcode: `rlwinm'

This is due to powerpc_macros[] doesn't have the deprecated field like the
*_opcodes[] tables do, so some unsupported extended mnemonics still get
added to the hash table, so we translate it to the unsupported base insn
and then we die.

Should we just remove powerpc_macros[] and move its entries into the
appropriate *_opcodes[] tables?  Or do you have another option that
allows us to disassemble those extended mnemonics in powerpc_macros[]?

Peter



More information about the Binutils mailing list