Skip to content

JIT: (bug) Vector128/256<uint> division produces wrong lanes without AVX-512 (blendvpd used for 32-bit correction) #133752

Closed

Description

@EgorBo

Minimal repro

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

public static class Program
{
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    public static Vector128<uint> Test(Vector128<uint> l, Vector128<uint> r) => l / r;

    public static void Main()
    {
        Console.WriteLine(Test(Vector128.Create(uint.MaxValue, 9u, 1u, 1u), Vector128.Create(1u, 3u, 1u, 1u)));
    }
}

Expected

<4294967295, 3, 1, 1>

Actual

<2147483648, 3, 1, 1>

Notes

Repros on any AVX/AVX2 CPU without AVX-512; on an AVX-512 host set DOTNET_EnableAVX512=0. Correct when AVX-512 is available.
The cvttpd2dq overflow fixup blends with blendvpd (64-bit lanes) over packed 32-bit quotients, so one dword's sign bit controls its neighbour too.
Vector256<uint> is also wrong and additionally corrupts a correctly-computed neighbour lane: <uint.MaxValue,9,1,1,7,uint.MaxValue,3000000000,8> / <1,3,1,1,7,1,1,2> gives <2147483648,3,1,1,7,4294967295,2147483648,4> instead of <4294967295,3,1,1,1,4294967295,3000000000,4>.

Activity

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

    @EgorBo
    MemberAuthor

    Affected SDK versions:

    • 11.0.100-rc.2.26467.112
  5. added a commit that references this issue on Sep 22, 2026
    b08d5fd
  6. locked and limited conversation to collaborators on Oct 23, 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