Skip to content

JIT: Call gtFoldExprConditional in if-conversion and allow float SELECTs#128449

Draft
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:if-conversion-float-fold
Draft

JIT: Call gtFoldExprConditional in if-conversion and allow float SELECTs#128449
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:if-conversion-float-fold

Conversation

@BoyBaykiller
Copy link
Copy Markdown
Contributor

@BoyBaykiller BoyBaykiller commented May 21, 2026

  • Allow SELECTs for floats (only temporally for optimizations, not into codegen)
  • Call gtFoldExprConditional (this handles simple folding for int + float)
  • Add missing GT_SELECT equality (without this gtFoldExprConditional asserts)
  • Move the 32-bit bailout to after SELECT optimizations so that it can still profit from them. Only when there were no optimizations done abort

* 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)

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