KEMBAR78
[JIT] ARM64 - Optimize `x < 0` and `x >= 0` by TIHan · Pull Request #83176 · dotnet/runtime · GitHub
Skip to content

Conversation

@TIHan
Copy link
Contributor

@TIHan TIHan commented Mar 9, 2023

Description

#43440

As for handling GT_GE, I do not think it is worth doing the optimization in the non-conditional case. It would require neg and a lsr which I believe would be slower than just the cmp and cset. According to A78, the pair of cmp and cset instructions are accelerated through instruction fusion - so it's probably only worth replacing them if we can do it in just one instruction.

Acceptance Criteria

@ghost ghost assigned TIHan Mar 9, 2023
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 9, 2023
@ghost
Copy link

ghost commented Mar 9, 2023

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

Issue Details

Addresses the first case of #43440

As for handling GT_GE, I do not think it is worth it. It would require neg and a lsr which I believe would be slower than just the cmp and cset. According to A78, the pair of cmp and cset instructions are accelerated through instruction fusion - so it's probably only worth replacing them if we can do it in just one.

Author: TIHan
Assignees: TIHan
Labels:

area-CodeGen-coreclr

Milestone: -

@TIHan TIHan changed the title [JIT] ARM64 - Optimize 'x < 0' [JIT] ARM64 - Optimize x < 0 and x >= 0 Mar 10, 2023
TIHan and others added 2 commits March 14, 2023 05:15
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one fix

@TIHan
Copy link
Contributor Author

TIHan commented Mar 16, 2023

I'm going to do another round for this optimization, filed #83562 to track it.

Therefore, I will go ahead and merge this one.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants