Skip to content

JIT: (bug) an embedded broadcast of a runtime value hits a JIT assert when it is widened for masking #133552

Closed

Description

@EgorBo

Repro

using System;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

class Program
{
    // The broadcast source is a runtime load, not a constant.
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    static unsafe Vector128<double> Test(Vector128<float> v, float* p,
                                         Vector128<double> a, Vector128<double> b, Vector128<double> f)
    {
        Vector128<float> anded = Sse.And(v, Vector128.Create(*p));
        return Vector128.ConditionalSelect(Vector128.Equals(a, b), anded.AsDouble(), f);
    }

    static unsafe void Main()
    {
        if (!Avx512F.VL.IsSupported)
            throw new PlatformNotSupportedException("AVX-512VL is required.");

        float x = 1.0f;
        var eq = Vector128.Create(1.0);

        Console.WriteLine(Test(Vector128.Create(1.0f), &x, eq, eq, Vector128.Create(9.0))
                          .AsUInt32().GetElement(0).ToString("X8"));
    }
}

Expected

3F800000

Actual

Assert failure(PID 46276 [0x0000b4c4], Thread: 112720 [0x1b850]): Assertion failed 'constNode->OperIs(GT_CNS_INT)' in 'Program:Test(System.Runtime.Intrinsics.Vector128`1[float],ptr,System.Runtime.Intrinsics.Vector128`1[double],System.Runtime.Intrinsics.Vector128`1[double],System.Runtime.Intrinsics.Vector128`1[double]):System.Runtime.Intrinsics.Vector128`1[double]' during 'Lowering nodeinfo' (IL size 35; hash 0xbc6a6a4e; FullOpts)

    File: C:\prj\runtime-main3\src\coreclr\jit\lowerxarch.cpp:10519

The same assert fires with Sse.Xor in place of Sse.And, and with the int/long forms. The
Vector256 and Vector512 shapes of the same pattern instead fail an adjacent assert
(tgtMaskSize == 2, lowerxarch.cpp:10509).

Platform

Windows x64 with AVX-512VL, local Checked build of dotnet/runtime main (ef97eb5).

Activity

  1. added this to the 12.0.0 milestone on Sep 10, 2026
  2. added
    area-CodeGen-coreclr
    on Sep 10, 2026
  3. dotnet-policy-service commented on Sep 10, 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 15, 2026
    ae47da8
  5. EgorBo commented on Sep 18, 2026

    @EgorBo
    MemberAuthor

    Affected SDK versions:

    • 11.0.100-rc.2.26467.112
  6. added a commit that references this issue on Sep 18, 2026
    8881272
  7. EgorBo commented on Sep 18, 2026

    @EgorBo
    MemberAuthor

    @tannergooding would you consider backporting the fix from #133708 to release/11.0?

    It currently only exists in main (12.0). The repro still fails on the shipped 11.0 RC2 SDK (11.0.100-rc.2.26467.112), while 8.0.425, 9.0.318 and 10.0.401 all behave correctly, so this is a regression introduced during the 11.0 cycle rather than a long-standing bug — 11.0 would ship with it.

    Note: this comment was produced by an AI agent; the repro was re-run against all four released SDKs to confirm the results above.

  8. locked and limited conversation to collaborators on Oct 19, 2026
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