Skip to content

JIT: Bad codegen with SVE hardware intrinsics #118377

@jakobbotsch

Description

@jakobbotsch
// Generated by Fuzzlyn v3.3 on 2025-08-05 00:20:11
// Run on Arm64 Linux
// Seed: 7831934182807398228-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256,armsve,armsve2
// Reduced from 61.3 KiB to 1.3 KiB in 00:00:54
// Debug: Outputs <14533768479604701151, 1>
// Release: Outputs <14533768479604701151, 0>
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;

public struct S4
{
    public ulong F0;
    public S4(ulong f0) : this()
    {
        F0 = f0;
    }
}

public class Program
{
    public static IRuntime s_rt;
    public static ulong s_4;
    public static void Main()
    {
        s_rt = new Runtime();
        S4 vr13 = new S4(1);
        M3(vr13);
    }

    public static Vector<ulong> M4()
    {
        var vr3 = Sve.CreateWhileLessThanMask64Bit(0, 0);
        var vr5 = Vector.Create<ulong>(s_4);
        var vr1 = Sve.CreateBreakPropagateMask(vr3, vr5);
        var vr7 = Vector.Create<ulong>(0);
        return Sve.Add(vr1, vr7);
    }

    public static void M3(S4 argThis)
    {
        var vr4 = argThis.F0;
        var vr0 = Vector.Create<ulong>(vr4);
        var vr8 = Vector128.CreateScalar(14533768479604701152UL).AsVector();
        var vr10 = argThis.F0;
        var vr9 = Vector.Create<ulong>(vr10);
        var vr6 = Sve.AbsoluteDifference(vr8, vr9);
        var vr11 = M4();
        Vector<ulong> var2 = Sve.ConditionalSelect(vr0, vr6, vr11);
        s_rt.WriteLine(var2);
    }
}

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

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

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions