Skip to content

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented May 5, 2021

Just a small optimization for #52286 (comment) comment.

void Test(ref float x) => x = 0;

Current codegen:

; Method Program:Test(byref) G_M20809_IG01:  vzeroupper  ;; bbWeight=1 PerfScore 1.00 G_M20809_IG02:  vxorps xmm0, xmm0  vmovss dword ptr [rcx], xmm0 ;; bbWeight=1 PerfScore 0.83 G_M20809_IG03:  ret  ;; bbWeight=1 PerfScore 1.00 ; Total bytes of code: 12

New codegen:

; Method Program:Test(byref) G_M20809_IG02:  mov dword ptr [rcx], 0 ;; bbWeight=1 PerfScore 1.00 G_M20809_IG03:  ret  ;; bbWeight=1 PerfScore 1.00 ; Total bytes of code: 7

SuperPMI results:

asm.aspnet.run.windows.x64.checked.2 -86 (-0.21% of base) asm.benchmarks.run.windows.x64.checked -684 (-1.02% of base) asm.libraries.crossgen.windows.x64.checked.3 -641 (-0.78% of base) asm.libraries.crossgen2.windows.x64.checked.2 -600 (-0.77% of base) asm.libraries.pmi.windows.x64.checked -967 (-0.99% of base) asm.tests_libraries.pmi.windows.x64.checked -25294 (-0.72% of base) asm.tests.pmi.windows.x64.checked.1 -71306 (-0.35% of base) 

/cc @dotnet/jit-contrib @SingleAccretion

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 5, 2021
@tannergooding
Copy link
Member

Changes LGTM.

@EgorBo EgorBo changed the title JIT: Optimize *x = 0.0 to *x = 0 JIT: Optimize *x = dblCns to *x = intCns May 10, 2021
@EgorBo
Copy link
Member Author

EgorBo commented May 17, 2021

@dotnet/jit-contrib @tannergooding anyone wants to approve? 🙂

@EgorBo EgorBo merged commit 79f9415 into dotnet:main May 18, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

7 participants