Commit Graph

9 Commits

Author SHA1 Message Date
Herman S.
2d2105cfd8 [A64] Assert OPCODE_MEMSET invariants, remove dead general-case path 2026-03-29 15:14:04 +09:00
Wunkolo
664b77f38e [a64] Optimize OPCODE_MEMSET with zva
* Add unit tests
* Use `dc zva` to zero out entire cache-lines worth of data, when possible
 * Special instruction that zaps an entire cache-line into being zero-values, typically 64-bytes at a time
* Statically read and initialize the `DCZID_EL0` register value since reading registers with `mrs` can be kinda slow and isn't worth doing redundantly at JIT-time when it never changes.
* Update store-instructions to use inline post-increments to avoid an additional `add` instruction and keep encoded instruction immediates small

Pretty much every arm processor has a cache line size of 64 bytes, so a typical `dcbz128` to clear 128-bytes of data now results in:
```
dc zva, x0
add x0, x0, 64
dc zva, x0
```
rather than a sequence of 8 `stp xzr, xzr, ...` instructions
2026-03-29 15:13:45 +09:00
Wunkolo
6a47370219 [a64] Fix ATOMIC_EXCHANGE swp operand order
`swp` is weird and actually writes the first operand into the
memory address into the third operand,
_and puts the old value into the second operand_.
2026-03-26 16:04:36 +09:00
Wunkolo
dd3ffeb9cb [a64] Implement FEAT_LSE optimizations
Adds `platform_arm64` similar to `platform_arm64` to populate a 64-bit feature-flag value and creates a `a64_extension_mask` configuration-mask for the detection and utilization of certain arm ISA features. The first feature being `FEAT_LSE` which maps to `XBYAK_AARCH64_HWCAP_ATOMIC`.

Just like the x64 backend, implements `IsFeatureEnabled` to the emitter for checking if the host processor supports a certain subset of feature flag(s) at once.

Optimizes `OPCODE_ATOMIC_EXCHANGE`, `OPCODE_ATOMIC_COMPARE_EXCHANGE`,
and `OPCODE_RESERVED_STORE` with `FEAT_LSE` instructions.
2026-03-25 14:31:53 +09:00
Wunkolo
bf83c4e9f5 [a64] Implement OPCODE_CACHE_CONTROL store 2026-03-25 13:32:21 +09:00
Herman S.
a1e333223e [A64] Use 16-byte NEON stores in MEMSET fallback loop
Splat the fill byte into v0.16b and use str q0 (16 bytes/iter) for
the bulk, falling back to a byte loop for the 0-15 byte tail.
2026-03-24 16:17:13 +09:00
Herman S.
756ae7a558 [A64] Dedicate x19 as backend context pointer
Reserves x19 to permanently hold the A64BackendContext pointer
(x20 - sizeof(A64BackendContext)), set once in the HostToGuestThunk.
Since x19 is AAPCS64 callee-saved, it survives all host calls for free.

Eliminates repeated 2-instruction mov+sub sequences in stackpoint
push/pop, stack synchronization, FPCR management, and reserved
load/store paths.

Reduces allocatable GPRs from 8 to 7 (like on x64).
2026-03-24 14:23:31 +09:00
Reality
ecd7501029 [A64] Add MMIO-aware memory sequences 2026-03-23 10:39:50 +09:00
Herman S.
883c2030d0 [ARM64] Initial commit for arm64 backend
Based entirely off existing xbyak x86 implementation and available
tests. Still needs a lot of optimization and testing on non-Windows
platforms.

So far passes all tests and boots at least some games on Windows.
2026-03-22 15:57:37 +09:00