tonioni / WinUAE

WinUAE Amiga emulator
http://www.winuae.net/
549 stars 90 forks source link

Poor JIT performance on ADDX? #152

Open nonarkitten opened 5 years ago

nonarkitten commented 5 years ago

There seems to be a strong slow down with JIT when it encounters ADDX.

tonioni commented 5 years ago

I don't know (and I don't want to know, too much x86 assembly..) much about JIT but ADDX (and SUBX) appears to be fully supported without falling back to non-JIT emulation. Aranym developers probably can help more if needed, they have done JIT improvements in recent years (which I have merged).

What kind of test code you run and why do you think it is ADDX related? Which ADDX addressing mode?

nonarkitten commented 5 years ago

Without getting into too many specifics, it's a simple workload test. The following pattern:

addq.l #1,d5
addq.l #1,d4
add.l (a0),(a1)

Is ten times faster than

addx.l d1,d5
addq.l #1,d4
add.l (a0),(a1)

I'm guessing the extra work having to handle the X flag is the culprit here.

nonarkitten commented 5 years ago

Is there a way to show the emitted JIT code?

th-otto commented 5 years ago

Is there a way to show the emitted JIT code?

In aranym there is:https://github.com/aranym/aranym/blob/1328158098ddad1cafebbca27e7c493716dab688/src/uae_cpu/compiler/compemu_support.cpp#L4974-L4986

You have do compile aranym locally, with --enable-disasm and --enable-jit-debug, and then set that local variable disasm_block to true somewhere (this is not done anywhere in the code). But be aware that this will produce tons of debug output.