Skip to content

JIT: (bug) [ARM64] assert varTypeIsSIMD(indexedElementOpType) for AdvSimd.MultiplyBySelectedScalar with Vector64.CreateScalarUnsafe #135526

Description

@EgorBo

On arm64, AdvSimd.MultiplyBySelectedScalar(a, Vector64.CreateScalarUnsafe(x), 0) hits an assertion in LSRA in the Checked JIT; the Release JIT produces the correct result.

Minimal Repro

using System;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;

public class Program
{
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    static Vector64<float> Test(Vector64<float> a, float x) => AdvSimd.MultiplyBySelectedScalar(a, Vector64.CreateScalarUnsafe(x), 0);

    public static int Main()
    {
        Vector64<float> r = Test(Vector64.Create(1f, 2f), 3f);
        Console.WriteLine(r);
        return 100;
    }
}

Expected

<3, 6>

Actual

Assertion failed 'varTypeIsSIMD(indexedElementOpType)' in 'Program:Test(System.Runtime.Intrinsics.Vector64`1[float],float):System.Runtime.Intrinsics.Vector64`1[float]' during 'Linear scan register alloc'
    File: src/coreclr/jit/lsraarm64.cpp:1688

Regression?

Unknown, because the assert is Checked-only. Release (.NET 10.0.12 and main) prints the expected <3, 6>.

Notes

  • LowerHWIntrinsic (lowerarmarch.cpp) removes NI_Vector_CreateScalarUnsafe for any HW intrinsic user except scalar FMA, so the indexed operand of a HW_Category_SIMDByIndexedElement intrinsic becomes TYP_FLOAT.
  • LSRA BuildHWIntrinsicImmediate (and HWIntrinsicImmOpHelper in codegen) derive the lane bounds from that operand's SIMD type.

Activity

  1. added this to the 12.0.0 milestone on Oct 9, 2026
  2. added
    area-CodeGen-coreclr
    on Oct 9, 2026
  3. dotnet-policy-service commented on Oct 9, 2026

    @dotnet-policy-service
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions