Skip to content

LATX, opt: Add instruction-pattern optimizations - #527

Draft
xiezyang wants to merge 1 commit into
lat-opensource:masterfrom
xiezyang:restore-instpattern-optimizations
Draft

xiezyang wants to merge 1 commit into
lat-opensource:masterfrom
xiezyang:restore-instpattern-optimizations

Conversation

@xiezyang

Copy link
Copy Markdown
Contributor

Summary

This draft records the instruction-pattern optimizations that were removed from
the final AVX optimization series and are not present in current master:

  • BSR/NOT/ADD and clamp-u8 folding
  • u16 difference/CMOV folding
  • AVX three-lane sum folding

The restored matchers remain gated by CONFIG_LATX_INSTS_PATTERN and
option_instptn, run after flag analysis, and dispatch through
try_translate_instptn().

This is currently an archival draft, not a merge-ready optimization claim.

Validation

  • LoongArch x86_64 build passed.
  • test-avx-vector-sums passed.
  • test-integer-diff-cmov passed.
  • test-integer-patterns passed.
  • The three fixtures ran in JIT, cold-AOT and hot-AOT modes. Hot-AOT requires
    the SEG_AOT_LOADED marker, so a JIT fallback does not pass the test.
  • GDB confirmed all four matchers and their translation functions executed.
  • lat-pr-fast: 49/49 passed.
  • No i386 runtime test, native x86 result or performance benchmark is claimed.

Checklist

  • I have read CONTRIBUTING.md.
  • Every commit contains a DCO sign-off (git commit -s).
  • Relevant build and test results are included, with remaining limitations
    documented.

Restore the instruction-pattern optimizations removed from the AVX optimization series: BSR/NOT/ADD and clamp-u8 folding, u16 difference/CMOV folding, and the AVX three-lane sum sequence. Keep matching behind CONFIG_LATX_INSTS_PATTERN and option_instptn, run the scanners after flag analysis, and dispatch the folds through try_translate_instptn().

Add self-checking integration fixtures for full-register integer behavior, AVX alias and observation guards, and JIT/cold-AOT/hot-AOT execution. The hot-AOT runner verifies that the generated cache was loaded instead of silently falling back to JIT.

Validation: LoongArch x86_64 build passed; test-avx-vector-sums, test-integer-diff-cmov and test-integer-patterns passed; GDB confirmed all four matchers and their translation paths ran; lat-pr-fast passed 49/49. No i386 runtime test, native x86 result or performance benchmark is claimed.
Signed-off-by: Zhaoyang Xie <xie_zyang@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant