Skip to content

ARM64: bad codegen for Vector.Dot #132800

Closed

Description

@dhartglassMSFT

The following code returns a different value under jit optimizations on arm64:

    public static int Main()
    {
        int result = Vector128.IndexOf(
            AdvSimd.SubtractRoundedHighNarrowingUpper(Vector64<uint>.AllBitsSet,
                                                      Vector128<ulong>.AllBitsSet,
                                                      Vector128<ulong>.AllBitsSet),
            Vector.Dot(Vector<uint>.One, Vector<uint>.One));

        return result == -1 ? 100 : 101;
    }

jit generates CMEQ for Vector IndexOf which expects the dot product in every lane.
Lowering for this Vector.Dot uses AddAcross (ADDV) which writes to only lane 0.
Either we shouldn't have dropped the toScalar+Create during Morph, or lower must explicitly broadcast as well.

Activity

  1. added this to the 12.0.0 milestone on Aug 26, 2026
  2. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Aug 26, 2026
  3. dotnet-policy-service commented on Aug 26, 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. added a commit that references this issue on Sep 16, 2026
    313ad9c
  5. added a commit that references this issue on Sep 18, 2026
    44afade
  6. locked and limited conversation to collaborators on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions