Skip to content

JIT: Invalid smnegl transformation #92537

@jakobbotsch

Description

@jakobbotsch
// Generated by Fuzzlyn v1.6 on 2023-09-23 15:15:18
// Run on Arm64 Windows
// Seed: 17929576410580344290
// Reduced from 324.8 KiB to 0.4 KiB in 00:04:43
// Debug: Outputs -2472766155
// Release: Outputs 1822201141

public class C0
{
    public uint F4;
    public C0(uint f4)
    {
        F4 = f4;
    }
}

public class Program
{
    public static C0 s_8 = new C0(2472766155U);
    public static ushort[] s_39 = new ushort[]{1};
    public static void Main()
    {
        uint vr2 = s_8.F4;
        long vr0 = -(s_39[0] * (long)vr2);
        System.Console.WriteLine(vr0);
    }
}

The codegen is

G_M27646_IG03:  ;; offset=0x001C
            movz    x0, #0x1D78      // data for Program:s_8
            movk    x0, #0x7A00 LSL #16
            movk    x0, #657 LSL #32
            ldr     x1, [x0]
            ldr     w1, [x1, #0x08]
            ldr     x0, [x0, #0x08]
            ldr     w2, [x0, #0x08]
            cmp     w2, #0
            bls     G_M27646_IG06
            ldrh    w0, [x0, #0x10]
            smnegl  x0, w0, w1
            movz    x1, #0x5B90      // code for System.Console:WriteLine(long)
            movk    x1, #0x8153 LSL #16
            movk    x1, #0x7FFE LSL #32
            ldr     x1, [x1]
            blr     x1

This looks like a regression introduced by #91886, cc @c272 @kunalspathak

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