py/emitinlinethumb: Shrink condition code lookups.#18997
Open
agatti wants to merge 1 commit intomicropython:masterfrom
Open
py/emitinlinethumb: Shrink condition code lookups.#18997agatti wants to merge 1 commit intomicropython:masterfrom
agatti wants to merge 1 commit intomicropython:masterfrom
Conversation
This commit optimises the lookup of opcodes' condition codes, in order to take up less code than before. The original data was held in a table containing the condition code value (an incrementing 0-based integer) and the two condition ASCII characters. Given that the condition code value also matches the entry's index in the table, that can be safely omitted. This saves 52 bytes when compiled for Thumb. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
Code size report: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18997 +/- ##
=======================================
Coverage 98.46% 98.46%
=======================================
Files 176 176
Lines 22784 22784
=======================================
Hits 22435 22435
Misses 349 349 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
This PR optimises the lookup of opcodes' condition codes, in order to take up less code than before.
The original data was held in a table containing the condition code value (an incrementing 0-based integer) and the two condition ASCII characters. Given that the condition code value also matches the entry's index in the table, that can be safely omitted.
This saves 52 bytes when compiled for Thumb for QEMU.
Testing
The inline assembler test suite was run successfully on
QEMU/MPS2_AN385. Octoprobe run 423 is queued to test the behaviour on real hardware, mostly to see how the expanded test behaves on a low memory board (ADAFRUIT_ITSYBITSY_M0_EXPRESS).Generative AI
I did not use generative AI tools when creating this PR.