Skip to content

ARM64 JIT: incorrect code when Load4xVector128 result registers wrap from V31 to V0 #134604

Description

@HMBSbige

Description

On ARM64, an identity table lookup using AdvSimd.Arm64.Load4xVector128 returns an incorrect result with the .NET 10.0.12 JIT. When a four-register load uses V29, V30, V31, V0, the JIT emits an extra instruction that overwrites V0 with the table pointer.

Reproduction Steps

Minimal reproduction: https://github.com/HMBSbige/dotnet-jit-arm64-register-wraparound

Run in the repository directory on ARM64:

dotnet run -c Release

Expected behavior

0xF7F8FC06: the test performs eight identity lookups, each followed by an increment, starting from 0xF7F8FBFE.

Actual behavior

8. Failing CI run on macos-latest.

Regression?

No response

Known Workarounds

No response

Configuration

  • ARM64 · .NET 10.0.12 · SDK 10.0.401
  • Release: fails; Debug: passes

Other information

GenTreeJitIntrinsic::GetRegNumByIdx adds idx without wrapping at V31. For V29 + 3, it returns P0 instead of V0.

return (regNumber)(GetRegNum() + idx);

The JIT emits:

4C40209D          ld1     {v29.16b, v30.16b, v31.16b, v0.16b}, [x4]
9E670000          fmov    d0, p0

LLDB decodes 0x9E670000 as fmov d0, x0, which overwrites the loaded table data. Replacing only this instruction with NOP in a native replay restores the expected result.

Activity

  1. added
    untriaged
    on Sep 24, 2026
  2. added
    area-CodeGen-coreclr
    on Sep 24, 2026
  3. dotnet-policy-service commented on Sep 24, 2026

    @dotnet-policy-service
    Contributor

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

  4. JulieLeeMSFT commented on Sep 25, 2026

    @JulieLeeMSFT
    Member
  5. removed
    untriaged
    on Sep 25, 2026
  6. added this to the 12.0.0 milestone on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions