Repository navigation
native-int: SIMD&FP loads/stores and literal loads stay inside regions - #61
Merged
Merged
Conversation
LDR/STR of B/H/S/D/Q registers (unsigned and unscaled offsets, pre/post- index, register offset), LDP/STP of S/D/Q registers, and LDR (literal) into general-purpose and SIMD&FP registers are emitted as native-int ops instead of ending the region (on cores without SVE/SME, where a SIMD&FP load writes just the low 128 bits). The data goes through the CPU state (the vector registers aren't mapped to host registers): a load is the host load into v31 (v30 for the second register of a pair) and a 128-bit store to the CPU state, which also zeroes the bits above the access as the guest load does. A pair takes one TLB check over both registers. The slow path calls the helper once per register, like TCG. Literal addresses are the guest pc plus the offset. In a native-int boot, these were the most common instructions that ended regions in the middle of a TB, after the PAC branches and B/BL that end TBs anyway (memcpy/objc paths use Q pairs). Tests: native_int_gen.py now also emits SIMD&FP loads/stores (all sizes, all addressing modes, pairs, page-crossing through the x27 window) and literal loads, and folds V0-V7/V16-V31 into the hash (the host harness leaves the callee-saved V8-V15 alone). native_int_check.S test 8: Q and D-pair loads across a page boundary, and a faulting Q load whose destination must stay unchanged with the registers before it exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A census of a native-int iOS boot found SIMD&FP loads/stores and literal loads to be the most common instructions ending native-int regions in the middle of a TB. (PAC branches and B/BL come up more often, but they end the TB anyway.) memcpy and objc paths use Q pairs. This PR covers them:
Testing:
native_int_gen.pynow also emits these forms (all sizes and addressing modes, pairs, page-crossing) and literal loads, and folds V0-V7 and V16-V31 into the hash.native_int_check.Stest 8: Q and D-pair loads across a page boundary, and a faulting Q load whose destination stays unchanged and whose preceding registers are exact.run-a13-tests.py: 41/41 on an M1 macOS build. A 300-seed soak had 0 mismatches against native-int off and against the host CPU.waiting_host(median 9.8 s) with no panic.🤖 Generated with Claude Code