Skip to content

Simplify arithmetic operations on registry and memory#125559

Open
pedrobsaila wants to merge 5 commits intodotnet:mainfrom
pedrobsaila:125300
Open

Simplify arithmetic operations on registry and memory#125559
pedrobsaila wants to merge 5 commits intodotnet:mainfrom
pedrobsaila:125300

Conversation

@pedrobsaila
Copy link
Contributor

@pedrobsaila pedrobsaila commented Mar 14, 2026

Fixes #125300

Lacks tests, working on it

Before :

Program:AddReg(int):int (FullOpts):
       lea      eax, [rdi+2*rdi]
       ret      

Program:AddMem(byref):int (FullOpts):
       mov      eax, dword ptr [rdi]
       lea      ecx, [rax+rax]
       add      eax, ecx
       ret      

Program:SubReg(int):int (FullOpts):
       xor      eax, eax
       sub      eax, edi
       ret      

Program:SubMem(byref):int (FullOpts):
       mov      eax, dword ptr [rdi]
       mov      ecx, eax
       sub      ecx, eax
       sub      ecx, eax
       mov      eax, ecx
       ret  

After:

Program:AddReg(int):int (FullOpts):
       lea      eax, [rdi+2*rdi]
       ret      

Program:AddMem(byref):int (FullOpts):
       mov      eax, dword ptr [rdi]
       lea      eax, [rax+2*rax]
       ret      

Program:SubReg(int):int (FullOpts):
       mov      eax, ecx
       neg      eax
       ret      

Program:SubMem(byref):int (FullOpts):
       mov      eax, dword ptr [rdi]
       neg      eax
       ret 

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 14, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 14, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Simplify arithmetic operations on memory, as is already done for register

1 participant