Skip to content

JIT: Misc if-conversion#128449

Open
BoyBaykiller wants to merge 8 commits into
dotnet:mainfrom
BoyBaykiller:if-conversion-float-fold
Open

JIT: Misc if-conversion#128449
BoyBaykiller wants to merge 8 commits into
dotnet:mainfrom
BoyBaykiller:if-conversion-float-fold

Conversation

@BoyBaykiller

@BoyBaykiller BoyBaykiller commented May 21, 2026

Copy link
Copy Markdown
Contributor
  • Allow GT_SELECT for floats, but only temporally for optimizations, not into codegen (for now)
  • Call gtFoldExprConditional, this handles simple folding
  • Add missing GT_SELECT equality, needed because without gtFoldExprConditional asserts
  • Move the 32-bit bailout to after optimizations so that it can still profit from them. Only abort when there were no optimizations done

* call gtFoldExprConditional
* add missing GT_SELECT equality
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 21, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 21, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@tannergooding

Copy link
Copy Markdown
Member

Allow SELECTs for floats (only temporally for optimizations, not into codegen)

There's notably no reason to not allow it into codegen if the input is a floating-point comparison.

Such cases can emit cmpss followed by blendvps, which is smaller than ucomiss; test; jcc; etc

@BoyBaykiller

Copy link
Copy Markdown
Contributor Author

That'd be nice to handle. Currently doing that hits assert isGeneralRegister(dstReg) && isGeneralRegister(srcReg) in emitxarch.cpp:7955 so that probably needs some extra work (different PR)

@BoyBaykiller

BoyBaykiller commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@jakobbotsch PTAL. A few tiny changes packed in one PR.
Not quite sure how this is supposedly a slight tp improvement diffs.

Next we can look into supporting float-select into codegen. Or adding opts for it.

@BoyBaykiller BoyBaykiller changed the title JIT: Call gtFoldExprConditional in if-conversion and allow float SELECTs JIT: Misc if-conversion Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants