Skip to content

JIT: Fix containment check for decomposed long halves in CreateScalar - #114654

Merged
BruceForstall merged 2 commits into
dotnet:mainfrom
saucecontrol:fix-114570
Apr 16, 2025
Merged

BruceForstall merged 2 commits into
dotnet:mainfrom
saucecontrol:fix-114570

Conversation

@saucecontrol

@saucecontrol saucecontrol commented Apr 14, 2025 •

Copy link
Copy Markdown
Member

Fixes #114570

The containment check for CreateScalar(GT_LONG) also checks the two halves of the long to see if they can be contained. This check did not include a restriction on load size, so we could emit a 4-byte load for a smaller type.

From the Fuzzlyn example, IR:

N018 ( 67, 40) [000020] -ACXG+-----                   t20 = *  IND       ubyte  <l:$381, c:$380>
               [000031] -----------                   t31 =    CNS_INT   int    0
                                                            /--*  t20    ubyte
                                                            +--*  t31    int
               [000032] -ACXG------                   t32 = *  LONG      long
                                                            /--*  t32    long
N022 ( 71, 45) [000024] -ACXG+-----                   t24 = *  HWINTRINSIC simd16 ulong CreateScalar <l:$403, c:$402>

codegen before:

IN0012: 000053 xor      edx, edx
IN0013: 000055 vmovd    xmm0, dword ptr [eax]
IN0014: 000059 vpinsrd  xmm0, xmm0, edx, 1

and after:

IN0012: 000053 movzx    eax, byte  ptr [eax]
IN0013: 000056 xor      edx, edx
IN0014: 000058 vmovd    xmm0, eax
IN0015: 00005C vpinsrd  xmm0, xmm0, edx, 1

No SPMI diffs

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 14, 2025
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 14, 2025
@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.

@BruceForstall

Copy link
Copy Markdown
Contributor

/ba-g unrelated failure

@BruceForstall
BruceForstall merged commit 248d6f4 into dotnet:main Apr 16, 2025
@saucecontrol
saucecontrol deleted the fix-114570 branch April 16, 2025 23:01
@github-actions github-actions Bot locked and limited conversation to collaborators May 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

JIT: Assertion failed 'isContainable || supportsRegOptional'

2 participants