M-HT
Very Active Member
A small update on tests of my static recompiler.
I repeated the previous test - unaligned accesses + letting OS handle them, because I optimized some memory accesses - I folded the immediate offset into the memory access.
For example, instead of
I used
I got some more speed increase.
The second test was with runtime checking, whether the address is 32bit aligned (for now without stock function for reading/writing unaligned access or other optimizations).
The result was some speed increase over my old code.
The code I used for reading is this (for writing its similar):
Results (small / large file):
native: 0m1.740s / 0m37.540s
recompiled old: 0m9.520s / 2m30.380s
recompiled - unaligned + OS: 0m4.080s / 1m10.170s
recompiled - runtime checking: 0m8.520s / 2m15.790s
When I use stock functions for reading/writing and other optimizations (like using more registers), I'll get more speed increase than now. But that requires a lot more work, so I'll test that later.
The speed won't reach the speed of unaligned accesses + OS, but it will be an OS neutral code.
I repeated the previous test - unaligned accesses + letting OS handle them, because I optimized some memory accesses - I folded the immediate offset into the memory access.
For example, instead of
Code:
add madr, eax, #104
ldr eax, [madr]
Code:
ldr eax, [eax, #104]
The second test was with runtime checking, whether the address is 32bit aligned (for now without stock function for reading/writing unaligned access or other optimizations).
The result was some speed increase over my old code.
The code I used for reading is this (for writing its similar):
Code:
and tmp2, madr, #3
orr tmp2, tmp2, tmp2, lsr #1
bic tmp2, tmp2, #1
add pc, pc, tmp2, lsl #3
NOP
ldr eax, [madr]
b 1f
ldrb tmp1, [madr]
ldrb tmp2, [madr, #1]
orr tmp1, tmp1, tmp2, lsl #8
ldrb tmp2, [madr, #2]
orr tmp1, tmp1, tmp2, lsl #16
ldrb tmp2, [madr, #3]
orr eax, tmp1, tmp2, lsl #24
1:
Results (small / large file):
native: 0m1.740s / 0m37.540s
recompiled old: 0m9.520s / 2m30.380s
recompiled - unaligned + OS: 0m4.080s / 1m10.170s
recompiled - runtime checking: 0m8.520s / 2m15.790s
When I use stock functions for reading/writing and other optimizations (like using more registers), I'll get more speed increase than now. But that requires a lot more work, so I'll test that later.
The speed won't reach the speed of unaligned accesses + OS, but it will be an OS neutral code.