Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JIT: Misc if-conversion - #128449

#128449
Merged
jakobbotsch merged 9 commits into
dotnet:maindotnet/runtime:mainfrom
BoyBaykiller:if-conversion-float-foldBoyBaykiller/runtime:if-conversion-float-foldCopy head branch name to clipboard
Jul 13, 2026
Merged

JIT: Misc if-conversion#128449
jakobbotsch merged 9 commits into
dotnet:maindotnet/runtime:mainfrom
BoyBaykiller:if-conversion-float-foldBoyBaykiller/runtime:if-conversion-float-foldCopy head branch name to clipboard

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
@jakobbotsch
jakobbotsch merged commit 3df37a7 into dotnet:main Jul 13, 2026
137 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 14, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
* 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
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.