Skip to content

Register Optimization Design for mexce - #109

Closed
imakris wants to merge 0 commit into
masterfrom
claude/register-optimization-mexce-96pXD
Closed

Register Optimization Design for mexce#109
imakris wants to merge 0 commit into
masterfrom
claude/register-optimization-mexce-96pXD

Conversation

@imakris

@imakris imakris commented Dec 18, 2025

Copy link
Copy Markdown
Owner

…MM4/XMM5)

Phase 1 - x87 backend GPR address caching:

  • Add gpr_cache struct to track addresses in R10, R11, and RAX
  • Add analyze_variable_frequency() to identify hot variables
  • Add preload_address_caches() to load hot addresses into R10/R11 at start
  • Modify compile_elist to check R10/R11 cache before falling back to RAX
  • Update asmd_optimizer to use new cache infrastructure
  • Saves ~9 bytes per access for cached variables (3-byte load vs 12-byte mov+load)

Phase 2 - SSE2 backend XMM value caching:

  • Add xmm_value_cache struct to cache values in XMM4/XMM5
  • Modify compile_elist_sse2 to check XMM cache before loading from memory
  • Cache hot variables when stack depth <= 3 to avoid register conflicts
  • Invalidate XMM cache after libm function calls (XMM4/5 may be clobbered)
  • Saves memory load latency (1 cycle movsd reg-reg vs 4-7 cycle memory load)

Both optimizations maintain bit-identical results - all 44229 benchmark expressions pass with unchanged ULP precision statistics.

@imakris imakris closed this Dec 18, 2025
@imakris
imakris force-pushed the claude/register-optimization-mexce-96pXD branch from b731d84 to 6dc9f44 Compare December 18, 2025 23:22
@imakris
imakris deleted the claude/register-optimization-mexce-96pXD branch December 18, 2025 23:29
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