Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Fix ShiftRightLogical constant folding #105571

Merged
merged 7 commits into from
Jul 29, 2024

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Jul 26, 2024

Fixes #105558

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 26, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@jakobbotsch
Copy link
Member

jakobbotsch commented Jul 26, 2024

Do other shifts/rotates need similar fixes? I see a lot of similar issues but with other intrinsics on the latest CI run (https://dev.azure.com/dnceng-public/public/_build/results?buildId=756781&view=ms.vss-build-web.run-extensions-tab)

e.g.

// Generated by Fuzzlyn v2.1 on 2024-07-26 14:07:14
// Run on X64 Linux
// Seed: 1354279171424132776-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 44.6 KiB to 0.4 KiB in 00:00:43
// Debug: Outputs <4096, 0, 0, 0>
// Release: Outputs <0, 0, 0, 0>
using System;
using System.Runtime.CompilerServices;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static void Main()
    {
        var vr1 = Vector128.CreateScalar(1);
        Vector128<int> vr2 = Avx512F.VL.RotateRight(vr1, 84);
        System.Console.WriteLine(vr2);
    }
}

@EgorBo
Copy link
Member Author

EgorBo commented Jul 29, 2024

Do other shifts/rotates need similar fixes? I see a lot of similar issues but with other intrinsics on the latest CI run (https://dev.azure.com/dnceng-public/public/_build/results?buildId=756781&view=ms.vss-build-web.run-extensions-tab)

This one is fixed by this PR so I suggest we do case-by-case, or feel free to post issues with multiple snippets

PS: actually it was not, pushed a fix

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'm not too familiar with this code, so might want to wait for Tanner as well

@EgorBo EgorBo merged commit f251b17 into dotnet:main Jul 29, 2024
114 checks passed
@EgorBo EgorBo deleted the fix-ShiftRightLogical-const-fold branch July 29, 2024 15:43
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: Another potential bad codegen with shift by Vector128
3 participants