Skip to content

JIT: (bug) comparing a reinterpreted vector comparison result for equality returns the wrong answer #133555

Closed

Description

@EgorBo

Repro

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

class Program
{
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    static bool Test(Vector128<byte> l, Vector128<byte> r, Vector128<long> other) =>
        Vector128.GreaterThan(l, r).AsInt64() == other;

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

        // 9 > 8 in every lane, so the comparison result is AllBitsSet.
        Console.WriteLine(Test(Vector128.Create((byte)9), Vector128.Create((byte)8),
                               Vector128<long>.AllBitsSet));
    }
}

Expected

True

Actual

False

Two bit-for-bit identical vectors compare as unequal.

Platform

Windows x64 with AVX-512BW+VL, local Checked build of dotnet/runtime main (ef97eb5).
Requires EVEX codegen; DOTNET_EnableAVX512=0 produces the correct True.
Also reproduces on release .NET 11.0.100-rc.1.26420.103, and at MinOpts.

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. MihuBot commented on Sep 10, 2026

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  5. added a commit that references this issue on Sep 15, 2026
    ae47da8
  6. EgorBo commented on Sep 18, 2026

    @EgorBo
    MemberAuthor

    Affected SDK versions:

    • 9.0.318
    • 10.0.401
    • 11.0.100-rc.2.26467.112
  7. added a commit that references this issue on Sep 18, 2026
    8881272
  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