You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following code correctly throws exception in TieredCompilation, does not throw with TieredCompilation=0.
gtNewSimdIsInfinityNode probably needs to respect side effects before folding.
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
public class TestClass
{
public static int Main(string[] args)
{
Vector64<int> a = Vector64<int>.Zero;
byte idx = 2;
Vector64.IsInfinity(AdvSimd.Arm64.MultiplyDoublingScalarBySelectedScalarSaturateHigh(a, a, idx));
return 1;
}
}
@dhartglassMSFT looks like these are just generally missing a gtWrapWithSideEffects on some paths. It's a relatively simple fix and I can handle it if needed.
@dhartglassMSFT looks like these are just generally missing a gtWrapWithSideEffects on some paths. It's a relatively simple fix and I can handle it if needed.
yeah feel free, I'm updating Antigen (fuzzer) currently and filing issues, this was one
It is not tiering-dependent. The report contrasts tiered against TieredCompilation=0; the table above is identical under fullopts and under DOTNET_JITMinOpts=1. That points at intrinsic expansion during importation
rather than a later phase.
Consuming the result does not save the operand. The original example
discards it.
The IsZero control is the useful part: it is value-dependent, so it cannot be
folded, and its operand survives. That isolates the behaviour to the
constant-fold path for predicates that are trivially decidable on integer
element types.
By that reasoning these Vector128 predicates are all fold candidates on
integer vectors — I have only confirmed IsInfinity drops the operand, the rest
are candidates by construction:
Full self-contained repro (prints the table above)
// Definitive: is the operand evaluated at all?//// An exception proves a side effect was skipped, but a counter proves it more// directly and cannot be confused with exception-handling behaviour.//// Vector128.IsInfinity on an INTEGER vector is trivially false, so the JIT// folds it. dotnet/runtime#132902 says gtNewSimdIsInfinityNode needs to respect// side effects before folding. This checks whether the operand runs.usingSystem;usingSystem.Runtime.CompilerServices;usingSystem.Runtime.Intrinsics;publicstaticclassProgram{privatestaticintCounter;[MethodImpl(MethodImplOptions.NoInlining)]privatestaticintBump(){Counter++;return3;}[MethodImpl(MethodImplOptions.NoInlining)]privatestaticvoidV64_Discard()=>Vector64.IsInfinity(Vector64.Create(Bump()));[MethodImpl(MethodImplOptions.NoInlining)]privatestaticvoidV128_Discard()=>Vector128.IsInfinity(Vector128.Create(Bump()));[MethodImpl(MethodImplOptions.NoInlining)]privatestaticvoidV128_Consume(){varr=Vector128.IsInfinity(Vector128.Create(Bump()));if(!r.Equals(default)){Console.WriteLine("unexpected: IsInfinity true for an int vector");}}// Control: a predicate that is NOT constant for integers cannot be folded,// so its operand must survive.[MethodImpl(MethodImplOptions.NoInlining)]privatestaticvoidV128_Control_IsZero(){varr=Vector128.IsZero(Vector128.Create(Bump()));if(!r.Equals(default)){Console.WriteLine("(IsZero true, fine)");}}privatestaticvoidCheck(stringname,Actiona){Counter=0;a();Console.WriteLine($"{name}: operand evaluated {Counter} time(s)"+(Counter==0?" <-- SIDE EFFECT DROPPED":""));}publicstaticintMain(){Check("V64 IsInfinity discard ",V64_Discard);Check("V128 IsInfinity discard ",V128_Discard);Check("V128 IsInfinity consume ",V128_Consume);Check("V128 IsZero consume ",V128_Control_IsZero);return100;}}
Activity
dotnet-policy-service commentedon Aug 28, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
dhartglassMSFT commentedon Aug 28, 2026
These may have the same issue
gtNewSimdIsFiniteNode
gtNewSimdIsInfinityNode
gtNewSimdIsIntegerNode
gtNewSimdIsNaNNode
gtNewSimdIsNegativeNode
gtNewSimdIsNegativeInfinityNode
gtNewSimdIsPositiveNode
gtNewSimdIsPositiveInfinityNode
gtNewSimdIsSubnormalNode
tannergooding commentedon Aug 28, 2026
@dhartglassMSFT looks like these are just generally missing a
gtWrapWithSideEffectson some paths. It's a relatively simple fix and I can handle it if needed.dhartglassMSFT commentedon Aug 28, 2026
yeah feel free, I'm updating Antigen (fuzzer) currently and filing issues, this was one
AndyAyersMS commentedon Aug 29, 2026
I hit this independently while building a fuzzer generator for the class, and it
looks broader than the original report in three ways.
It is not arm64-specific and needs no exotic intrinsic. Portable repro, x64,
70 lines with no test framework:
Vector64.IsInfinity, discardedVector128.IsInfinity, discardedVector128.IsInfinity, consumedVector128.IsZero, consumed (control)It is not tiering-dependent. The report contrasts tiered against
TieredCompilation=0; the table above is identical underfulloptsand underDOTNET_JITMinOpts=1. That points at intrinsic expansion during importationrather than a later phase.
Consuming the result does not save the operand. The original example
discards it.
The
IsZerocontrol is the useful part: it is value-dependent, so it cannot befolded, and its operand survives. That isolates the behaviour to the
constant-fold path for predicates that are trivially decidable on integer
element types.
By that reasoning these
Vector128predicates are all fold candidates oninteger vectors — I have only confirmed
IsInfinitydrops the operand, the restare candidates by construction:
IsInfinity,IsNaN,IsFinite,IsNegativeInfinity,IsPositiveInfinity,IsSubnormal,IsIntegerTested on
d2ea726dd3d.Full self-contained repro (prints the table above)
Preserve side effects in SIMD classification helpers (#132921)
[release/11.0] Preserve side effects in SIMD classification helpers (#…