[Libre-soc-bugs] [Bug 979] Implement C-based Power ISA decoder compiler
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Wed Sep 6 20:22:25 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=979
--- Comment #31 from Dmitry Selyutin <ghostmansd at gmail.com> ---
I implemented a hash lookup by PO as well. With this lookup, here's what we
have:
$ echo -n > /tmp/test.s; for i in $(seq 4194304); do echo "addi 2,1,-1" >>
/tmp/test.s; done
$ powerpc64le-linux-gnu-as -mlibresoc /tmp/test.s -o /tmp/test.o &&
powerpc64le-linux-gnu-objcopy -O binary /tmp/test.o /tmp/bin.o
$ time powerpc64le-linux-gnu-objdump -dr -mpowerpc -D -b binary -mpowerpc -EL
/tmp/bin.o > /dev/null
real 0m3.033s
user 0m1.922s
sys 0m1.082s
$ cat test.c
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "svp64.h"
int
main(int argc, char *argv[]) {
FILE *fp;
struct svp64_ctx ctx;
fp = fopen(argv[1], "rb");
for (size_t index = 0; index < 4194304UL; ++index) {
uint32_t insn;
enum svp64_state state;
fread(&insn, sizeof(uint32_t), 1, fp);
state = svp64_disassemble(&ctx, insn);
if (state != SVP64_SUCCESS)
abort();
printf("%s ", ctx.record->name);
for (size_t id = 0; ctx.record->operands[id]; ++id)
printf("%ld ", ctx.operands[id]);
printf("\n");
}
return 0;
}
$ ./test /tmp/bin.o > /dev/null
real 0m0.854s
user 0m0.828s
sys 0m0.023s
I for sure realize that binutils does more work than we do, but still, I think
this is a good start.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list