[Libre-soc-dev] Compressed instructions

Alexandre Oliva oliva at gnu.org
Sat Nov 21 14:21:57 GMT 2020

On Nov 21, 2020, Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:

> On 11/21/20, Alexandre Oliva <oliva at gnu.org> wrote:
>> On Nov 20, 2020, Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:

>>> even though it is very early i'd like to look at how we can get
>>> statistical feedback in order to iterate on the encoding allocation.
>> I'll give that some thought and get back to you on this.

> thanks Alexandre.  i raised this bugreport for its discussion.
> https://bugs.libre-soc.org/show_bug.cgi?id=532

I think I'll need you (?) to create a bugzilla account for me; it looks
like randos like me can't create accounts on our own ;-)

> a complex 3 line sed script is a first approximation.

Here's a hack that adds 'histogram' as a ppc disassembler option.  It
makes separate buckets according to binutils' own notion of ppc opcodes.
I'm not sure that's the most useful way to go about it, but it ought to
do as a first cut.

I suppose counting significant bits of immediate and offset operands
could be useful, but I haven't implemented that yet.

I imagine that it might make sense to count branches in a single bucket.

Any other thoughts on what else would be useful to have?

$ ./objdump -M histogram -d ppc-gcc | sed '1,/^Opcode histogram/d' | sort -n | tail
    3386 cmpdi (2c200000)
    4306 nop (60000000)
    4404 beq (41820000)
    5219 b (48000000)
    5715 bl (48000001)
    8957 li (38000000)
    9205 addi (38000000)
   10167 std (f8000000)
   10718 mr (7c000378)
   18828 ld (e8000000)

-------------- next part --------------

Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

More information about the Libre-soc-dev mailing list