Skip to content

JIT: wrong result with Avx512F.BlendVariable #114921

Closed
@BruceForstall

Description

@BruceForstall
// Generated by Fuzzlyn v2.5 on 2025-04-22 17:32:36
// Run on X64 Windows
// Seed: 7915602115310323123-vectort,vector128,vector256,vector512,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86avx512vbmi,x86avx512vbmivl,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 123.1 KiB to 0.5 KiB in 00:00:46
// Debug: Outputs <0, 0, 0, 0, 0, 0, 0, 0>
// Release: Outputs <0, 0, 0, 0, -1, -1, -1, -1>
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static Vector512<long> s_4 = Vector512.Create<long>(-1);
    public static Vector128<long> s_8;
    public static void Main()
    {
        var vr1 = Vector512.Create<long>(0);
        s_4 = Avx512F.BlendVariable(s_4, Avx512F.InsertVector128(vr1, s_8, 0), s_4);
        System.Console.WriteLine(s_4);
    }
}

another case:

// Generated by Fuzzlyn v2.5 on 2025-04-22 17:37:13
// Run on X64 Windows
// Seed: 14731447107126414231-vectort,vector128,vector256,vector512,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86avx512vbmi,x86avx512vbmivl,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 217.7 KiB to 1.0 KiB in 00:02:50
// Debug: Outputs <9223372036854775807, 0, 0, 0, 0, 0, 0, 0>
// Release: Outputs <4294967295, 0, 0, 0, 0, 0, 0, 0>
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public struct S2
{
    public Vector128<long> F0;
    public S2(Vector128<long> f0) : this()
    {
        F0 = f0;
    }
}

public class Program
{
    public static IRuntime s_rt;
    public static void Main()
    {
        s_rt = new Runtime();
        long vr6 = default(long);
        S2 vr7 = new S2(Vector128.CreateScalar(9223372036854775807L));
        Vector512<long> vr14 = default(Vector512<long>);
        var vr9 = Vector512.Create<long>(vr6);
        var vr10 = vr7.F0;
        var vr11 = Avx512F.InsertVector128(vr9, vr10, 0);
        var vr12 = Vector512.CreateScalar(-9223372036854775808L);
        var vr13 = Avx512F.BlendVariable(vr14, vr11, vr12);
        s_rt.WriteLine(vr13);
    }
}

public interface IRuntime
{
    void WriteLine<T>(T value);
}

public class Runtime : IRuntime
{
    public void WriteLine<T>(T value) => System.Console.WriteLine(value);
}

cc @dotnet/jit-contrib @dotnet/intel

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIavx512Related to the AVX-512 architecture

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions