Skip to content

JIT: (bug) complementing an AVX comparison drops the complement #133518

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 Vector256<float> Test(Vector256<float> a, Vector256<float> b) =>
        ~Avx.Compare(a, b, FloatComparisonMode.OrderedNotEqualNonSignaling);

    static void Main() {
        if (!Avx.IsSupported)
            throw new PlatformNotSupportedException("AVX is required.");
        Vector256<float> value = Vector256.Create(1.0f);
        Console.WriteLine(Test(value, value).AsUInt32().GetElement(0).ToString("X8"));
    }
}

Expected

FFFFFFFF

Equal non-NaN lanes fail ordered-not-equal, so the comparison yields zero bits and the complement is all-bits-set.

Actual

00000000

Platform

Windows x64 with AVX, .NET 11.0.0-rc.1.26425.128.

Activity

  1. added this to the 12.0.0 milestone on Sep 9, 2026
  2. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Sep 9, 2026
  3. dotnet-policy-service commented on Sep 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.

  4. MihuBot commented on Sep 9, 2026

    @MihuBot

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

  5. self-assigned this
    on Sep 9, 2026
  6. changed the title [-]JIT: complementing an AVX comparison drops the complement[/-] [+]JIT: (bug) complementing an AVX comparison drops the complement[/+] on Sep 10, 2026
  7. added a commit that references this issue on Sep 10, 2026
    24d55c0
  8. EgorBo commented on Sep 18, 2026

    @EgorBo
    MemberAuthor

    Affected SDK versions:

    • 10.0.401
    • 11.0.100-rc.2.26467.112
  9. 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-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