Skip to content

JIT: Switch GetElement and WithElement to native sized indices #118990

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakobbotsch
Copy link
Member

Fix #118974

@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 Aug 22, 2025
Copy link
Contributor

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

@@ -23270,6 +23273,7 @@ GenTree* Compiler::gtNewSimdGetElementNode(
var_types simdBaseType = JitType2PreciseVarType(simdBaseJitType);

assert(varTypeIsArithmetic(simdBaseType));
assert(op2->TypeIs(TYP_I_IMPL));
Copy link
Member

Choose a reason for hiding this comment

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

Just noting here, for explanation....

The reason that gtNewSimdGetElementNode took TYP_INT is because the underlying instruction takes TYP_BYTE.

The only time we actually consume it as TYP_I_IMPL is if it is non-constant and we must fallback to spilling the vector to memory and using the index dynamically.

@@ -1590,7 +1590,7 @@ GenTree* Compiler::addRangeCheckForHWIntrinsic(GenTree* immOp, int immLowerBound
// The value of (immUpperBound - immLowerBound + 1) is denoted as adjustedUpperBound.

const ssize_t adjustedUpperBound = (ssize_t)immUpperBound - immLowerBound + 1;
GenTree* adjustedUpperBoundNode = gtNewIconNode(adjustedUpperBound, TYP_INT);
GenTree* adjustedUpperBoundNode = gtNewIconNode(adjustedUpperBound, TYP_I_IMPL);
Copy link
Member

Choose a reason for hiding this comment

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

This ends up working because int32 - nativeint is defined, correct?

We have a lot of APIs that take TYP_UBYTE from the managed signature and which will only ever be [0, 255].

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing normalization in R2R'd codegen for Vector2.get_Item
2 participants