LATX, opt: Add configurable Jcc instruction patterns - #443
Open
y347812075 wants to merge 8 commits into
Open
Conversation
Separate pattern opcodes from the runtime option mask and extend the mask to 64 bits while preserving the legacy default bits. Add strict option parsing and common match, rejection, EFLAGS fallback, IR2, and host instruction statistics. Cover configuration priority, invalid input, pattern rollback, and fork behavior. Signed-off-by: yuerengan <y347812075@163.com>
Fuse adjacent ADD with JE, JNE, JS, or JNS and branch directly on the computed result when the remaining flags are dead. Keep live EFLAGS, memory fault, LOCK, TU, unlink, and AOT behavior on the existing paths. Add width, operand, rollback, and code generation coverage. Signed-off-by: yuerengan <y347812075@163.com>
Add adjacent SAR with JE, JNE, JS, or JNS and extend SHR with safe zero-result conditions. Reject zero effective shift counts so the original flags remain unchanged. Cover operand widths, count boundaries, live flags, faults, TU, unlink, AOT, rollback, and code generation. Signed-off-by: yuerengan <y347812075@163.com>
Fuse adjacent OR with JE, JNE, JS, or JNS and branch directly on the logical result while retaining the normal EFLAGS fallback when flags remain live. Add register, immediate, memory, fault, LOCK, TU, unlink, AOT, rollback, and code generation coverage for all operand widths. Signed-off-by: yuerengan <y347812075@163.com>
Extend the existing CMP, SUB, AND, and SHR result-branch patterns with the additional conditions that can be derived safely from their translated results. Reuse the existing translators and operand paths instead of adding parallel pattern implementations. Cover signed boundaries, overflow, flags, TU, unlink, AOT, and rollback behavior. Signed-off-by: yuerengan <y347812075@163.com>
Fuse OR with a later Jcc across safe intermediate instructions and retain the logical result in the existing pattern temporary. Restore OR-defined flags from the retained result on exception paths and keep unsafe crossings on the ordinary translation path. Cover signal recovery, faults, TU, unlink, AOT, rollback, and code generation. Signed-off-by: yuerengan <y347812075@163.com>
Fuse adjacent XOR with JE, JNE, JS, or JNS and branch directly on the logical result. Rebuild live XOR flags from the result without using XOR of the result with itself. Cover all operand widths, register clearing, memory, faults, LOCK, TU, unlink, AOT, rollback, and code generation. Signed-off-by: yuerengan <y347812075@163.com>
Fuse adjacent register DEC with JE or JNE and branch directly on the truncated decremented result. Keep DEC distinct from SUB so live flags preserve the incoming carry flag. Cover all operand widths, CF and overflow boundaries, memory fallback, TU, unlink, AOT, rollback, and code generation. Signed-off-by: yuerengan <y347812075@163.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.
Summary
Commit series
LATX, refactor: Decouple instruction pattern optionsLATX, opt: Add adjacent ADD and Jcc patternLATX, opt: Add SAR and extend SHR Jcc patternsLATX, opt: Add adjacent OR and Jcc patternLATX, opt: Expand safe Jcc pattern conditionsLATX, opt: Add OR XX Jcc patternLATX, opt: Add adjacent XOR and Jcc patternLATX, opt: Add adjacent DEC and Jcc patternValidation
git diff --checkcheckpatch.plon each commit: no errors; only the generic MAINTAINERS warning caused by adding integration test filesTracking
AgentsFlow: P-18 / T-298