Repository: dotnet/runtime (C#)

Issue:
[Fuzzlyn] Incorrect T1 behavior around division
```csharp
// Generated by Fuzzlyn v3.1 on 2025-05-29 20:01:16
// Run on X64 Windows
// Seed: 14412340127944514498-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 53.8 KiB to 0.7 KiB in 00:02:59
// Debug: Prints 1 line(s)
// Release: Prints 0 line(s)
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class C0
{
    public ushort F0;
}

public struct S0
{
    public Vector256<int> F0;
}

public class C1
{
    public C0 F0;
    public C1(C0 f0)
    {
        F0 = f0;
    }
}

public class Program
{
    public static void Main()
    {
        var vr1 = new C1(new C0());
        M3(vr1);
    }

    public static void M3(C1 argThis)
    {
        if (0 >= (Bmi2.X64.ZeroHighBits(0, 0) / ((0UL & argThis.F0.F0) | 1)))
        {
            S0[] var1 = new S0[]
            {
                new S0()
            };
            System.Console.WriteLine(var1[0].F0);
        }
    }
}
```


Discussion:
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in [area-owners.md](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you want to be subscribed.
<!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Doesn't look to be Bmi2 specific, reproduces on:
```cs
public static void Main()
{
    ushort y = 0;
    Test(0, ref y);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static void Test(ulong x, ref ushort y)
{
    if (0 >= x / ((0UL & y) | 1))
        Console.WriteLine("always taken");
}
```



Patch:
diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp
index 3edac296301db0..3b1cd0aca7bd9c 100644
--- a/src/coreclr/jit/gentree.cpp
+++ b/src/coreclr/jit/gentree.cpp
@@ -19914,7 +19914,13 @@ bool GenTree::IsArrayAddr(GenTreeArrAddr** pArrAddr)
 bool GenTree::SupportsSettingZeroFlag()
 {
 #if defined(TARGET_XARCH)
-    if (OperIs(GT_AND, GT_OR, GT_XOR, GT_ADD, GT_SUB, GT_NEG, GT_LSH, GT_RSH, GT_RSZ, GT_ROL, GT_ROR))
+    if (OperIs(GT_LSH, GT_RSH, GT_RSZ, GT_ROL, GT_ROR))
+    {
+        // Shift/Rotate instructions do not update the flags in case of count being zero.
+        return gtGetOp2()->IsNeverZero();
+    }
+
+    if (OperIs(GT_AND, GT_OR, GT_XOR, GT_ADD, GT_SUB, GT_NEG))
     {
         return true;
     }


Test patch:
diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.cs b/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.cs
new file mode 100644
index 00000000000000..86094be387b5f2
--- /dev/null
+++ b/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+// Generated by Fuzzlyn v3.1 on 2025-05-29 20:01:16
+// Run on X64 Windows
+// Seed: 14412340127944514498-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 53.8 KiB to 0.7 KiB in 00:02:59
+// Debug: Prints 1 line(s)
+// Release: Prints 0 line(s)
+
+using System;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+public class Runtime_116125
+{
+    [Fact]
+    public static void TestEntryPoint()
+    {
+        ushort y = 0;
+        Problem(0, ref y);
+    }
+
+    [MethodImpl(MethodImplOptions.NoInlining)]
+    static void Problem(ulong x, ref ushort y)
+    {
+        if (x / ((0UL & y) | 1) <= 0)
+        {
+            
+        }
+        else
+        {
+            throw new InvalidOperationException();
+        }
+    }
+}
diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.csproj
new file mode 100644
index 00000000000000..de6d5e08882e86
--- /dev/null
+++ b/src/tests/JIT/Regression/JitBlue/Runtime_116125/Runtime_116125.csproj
@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildProjectName).cs" />
+  </ItemGroup>
+</Project>