New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve diff disassembly #1022

Merged
merged 1 commit into from Jan 21, 2019

Conversation

Projects
None yet
3 participants
@wojtpl2
Copy link
Collaborator

wojtpl2 commented Jan 21, 2019

Currently when you generate diff two disassembly, the result file looks like:

BenchmarkDotNet.Samples.IntroDisassemblyCode

Diff for LoweringTESTtoBT method between:
.NET Core 2.0.9 (CoreCLR 4.6.26614.01, CoreFX 4.6.26614.01), 64bit RyuJIT
.NET Core 2.1.6 (CoreCLR 4.6.27019.06, CoreFX 4.6.27019.05), 64bit RyuJIT

        xor     edx,edx
        jmp     M00_L01
 M00_L00:
-       mov     ecx,eax
-       and     ecx,1Fh
-       mov     edx,1
-       shl     edx,cl
-       mov     ecx,dword ptr [rsp+4]
-       test    edx,ecx
+       bt      ecx,eax
        mov     edx,ecx
-       jne     M00_L01
+       jb      M00_L01
        inc     eax
 M00_L01:
        lea     ecx,[rdx+1]
-       mov     dword ptr [rsp+4],ecx
        cmp     edx,989680h
        jl      M00_L00
-       add     rsp,8
-; Total bytes of code 49
+       ret
+; Total bytes of code 27
 

After changes:

BenchmarkDotNet.Samples.IntroDisassemblyCode

Diff for LoweringTESTtoBT method between:
.NET Core 2.0.9 (CoreCLR 4.6.26614.01, CoreFX 4.6.26614.01), 64bit RyuJIT
.NET Core 2.1.6 (CoreCLR 4.6.27019.06, CoreFX 4.6.27019.05), 64bit RyuJIT

; BenchmarkDotNet.Samples.IntroDisassemblyCode.LoweringTESTtoBT()
        xor     eax,eax
        xor     edx,edx
        jmp     M00_L01
 M00_L00:
-       mov     ecx,eax
-       and     ecx,1Fh
-       mov     edx,1
-       shl     edx,cl
-       mov     ecx,dword ptr [rsp+4]
-       test    edx,ecx
+       bt      ecx,eax
        mov     edx,ecx
-       jne     M00_L01
+       jb      M00_L01
        inc     eax
 M00_L01:
        lea     ecx,[rdx+1]
-       mov     dword ptr [rsp+4],ecx
        cmp     edx,989680h
        jl      M00_L00
-       add     rsp,8
-; Total bytes of code 49
+       ret
+; Total bytes of code 27

@AndreyAkinshin AndreyAkinshin merged commit 6ccf453 into dotnet:master Jan 21, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla All CLA requirements met.

@AndreyAkinshin AndreyAkinshin added this to the v0.11.4 milestone Jan 21, 2019

@adamsitnik

This comment has been minimized.

Copy link
Member

adamsitnik commented Jan 21, 2019

@wojtpl2 thanks for doing this!

@wojtpl2 wojtpl2 deleted the wojtpl2:improve_diff_disassembly branch Jan 22, 2019

@wojtpl2

This comment has been minimized.

Copy link
Collaborator Author

wojtpl2 commented Jan 22, 2019

No problem. BTW I'm writing a post about this feature and during this I found this issue.

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