Skip to content

Mark the vectorized CRC update methods noinline #118544

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

Merged
merged 1 commit into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ private static bool CanBeVectorized(ReadOnlySpan<byte> source) =>
// Computation for Generic Polynomials Using PCLMULQDQ Instruction" in December, 2009.
// https://github.com/intel/isa-l/blob/33a2d9484595c2d6516c920ce39a694c144ddf69/crc/crc32_ieee_by4.asm
// https://github.com/SixLabors/ImageSharp/blob/f4f689ce67ecbcc35cebddba5aacb603e6d1068a/src/ImageSharp/Formats/Png/Zlib/Crc32.cs#L80
//
// Marking this as noinline so the JIT doesn't try and inline this and end up not inlining some of the calls it makes.
//
[MethodImpl(MethodImplOptions.NoInlining)]
private static uint UpdateVectorized(uint crc, ReadOnlySpan<byte> source)
{
Debug.Assert(CanBeVectorized(source), "source cannot be vectorized.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ private static Vector128<ulong> LoadFromSource(ref byte source, nuint elementOff
// "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction" in December, 2009 and the
// Intel reference implementation.
// https://github.com/intel/isa-l/blob/33a2d9484595c2d6516c920ce39a694c144ddf69/crc/crc64_ecma_norm_by8.asm
//
// Marking this as noinline so the JIT doesn't try and inline this and end up not inlining some of the calls it makes.
//
[MethodImpl(MethodImplOptions.NoInlining)]
private static ulong UpdateVectorized(ulong crc, ReadOnlySpan<byte> source)
{
Debug.Assert(CanBeVectorized(source), "source cannot be vectorized.");
Expand Down