Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,6 @@ static int TwoArrays(int[] a, int[] b)
return a[0] + b[0] + a[3] + b[1];
}

[MethodImpl(MethodImplOptions.NoInlining)]
static float SimdLoadBetweenBCs(float[] a)
{
// The contiguous Vector128.Create from a[1..4] is lowered to a single
// SIMD load whose bounds check throws ArgumentOutOfRangeException, not
// IndexOutOfRangeException. It must act as a barrier: if a[0]'s check
// were strengthened to a[7] across it, a too-short array would observe
// IndexOutOfRangeException instead of the ArgumentOutOfRangeException
// the SIMD load is required to throw first.
float x = a[0];
Vector128<float> v = Vector128.Create(a[1], a[2], a[3], a[4]);
return x + v.ToScalar() + a[7];
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int UnsignedShiftBySignBit(int i)
{
Expand Down Expand Up @@ -350,20 +336,6 @@ public static int TestEntryPoint()
if (UnsignedShiftBySignBit(-1) != 1 || UnsignedShiftBySignBit(0) != 0)
return 0;

// A SIMD load with a non-IOOB bounds check (ArgumentOutOfRangeException)
// between two array checks must act as a barrier: a[0]'s check must not
// be strengthened across it, otherwise a short array would observe
// IndexOutOfRangeException instead of ArgumentOutOfRangeException.
// The contiguous Vector128.Create -> single SIMD load recognition and the
// bounds-check coalescing being validated here are RyuJIT-specific, so
// only assert the exact exception type on CoreCLR.
if (!TestLibrary.Utilities.IsMonoRuntime && Vector128.IsHardwareAccelerated)
{
if (SimdLoadBetweenBCs(new float[8]) != 0f)
return 0;
Assert.Throws<ArgumentOutOfRangeException>(() => SimdLoadBetweenBCs(new float[1]));
}

return 100;
}
}
Loading