-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT produces unoptimized codegen for indirect byte comparisons against a register #33504
Comments
I guess it works as expected for |
Is this possibly because while
|
I don't think partial stalls are a concern here. If you call movzx eax, dl
cmp byte ptr [rcx], al The bigger concern IMO is that two registers need to be used to hold the temporary values. That could create an unnecessary stack spill. |
The point of this is that |
This is one of those cases where the jit codegen directly reflects IL semantics (integral IL stack entries are always 32 or 64 bits). The values to be compared are widened to stack size and then compared. What the jit is missing is an optimization that can resize and reshape computations to the optimal version for the target ISA (to be fair, the jit does some of this today, but it's hit and miss). In this case, for x64, the optimization is narrowing. Tracking cases of these with #32504. |
Since the JIT optimization work here is tracked by a separate issue, I'm closing this one. |
Repro code:
Actual codegen:
Expected behavior:
I would expect those first three instructions to be combined into a single
cmp byte ptr [rcx], dl
instruction.category:cq
theme:codegen
skill-level:intermediate
cost:medium
The text was updated successfully, but these errors were encountered: