-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
xarch: Use ZF and CF flags whenever possible to eliminate test instruction #53053
Comments
@dotnet/jit-contrib |
Those are the total number of methods/occurences? |
Yes. |
Same as #6794 ? |
The first step here is likely updating https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/instrsxarch.h to properly track which instructions modify/read which flags. Today, we have a
We could likely update this to a few helper methods and then a set of flags that track which EFLAGS bits are read/modified. In practice, this would be |
I prototyped correctly tracking the read/written flags: tannergooding@80214bd Notably, the CMOVcc, SETcc, and Jcc should track just the flag(s) they read, since we have one entry per |
Thanks @tannergooding. I will try to prototype on top of your changes. |
Done by #53214 |
From
"Appendix F Instruction Effects on RFLAGS"
of AMD manual and"Appendix A EFLAGS CROSS-REFERENCE"
and"Appendix B EFLAGS CONDITION CODES"
of Intel manual, there are many ALU instructions that writesZF
andCF
flags. If there is atest
instruction that follows such ALU instruction and it operates on same register like ALU, then we could eliminate suchtest
instruction.I did quick analysis and found handful of places in .NET libraries where we have such pattern and could eliminate it.
For the analysis, I just looked for following pattern:
Related discussion : #52297 (comment)
Analysis result: je_jne.txt
The text was updated successfully, but these errors were encountered: