Implement aarch64 CRC32 LLVM intrinsics#1651
Open
bryancostanich wants to merge 2 commits intorust-lang:mainfrom
Open
Implement aarch64 CRC32 LLVM intrinsics#1651bryancostanich wants to merge 2 commits intorust-lang:mainfrom
bryancostanich wants to merge 2 commits intorust-lang:mainfrom
Conversation
Covers all 8 LLVM intrinsics (llvm.aarch64.crc32{,c}{b,h,w,x}).
Reference values generated with the LLVM backend on aarch64-apple-darwin.
Currently fails: cg_clif emits a 'not yet supported' trap.
This comment has been minimized.
This comment has been minimized.
Lower the eight CRC32 LLVM intrinsics to crc32{,c}{b,h,w,x} inline
assembly via the existing codegen_inline_asm_inner helper, mirroring
the existing x86 sse42.crc32 lowering.
Unblocks crc32fast on aarch64-{apple-darwin,unknown-linux-*}, which is
pulled in transitively by png -> image and Bevy's PNG screenshot path.
1a985e7 to
7bc02ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for the eight
llvm.aarch64.crc32{,c}{b,h,w,x}intrinsics by lowering them tocrc32{,c}{b,h,w,x}inline assembly via the existingcodegen_inline_asm_innerhelper. Mirrors PR #1490 (the x86 sse42.crc32 family).This unblocks
crc32faston aarch64 under the cranelift backend, which is pulled in transitively by common crates includingpng→imageand Bevy's PNG screenshot path. Multiple users have reported this in #171 over the past year (llvm.aarch64.crc32bblocking Tauri builds,llvm.aarch64.crc32xblocking utoipa-swagger-ui, etc.).What's covered
Tests
`example/neon.rs` extended with `test_crc32()` covering all eight intrinsics. Reference values were generated by running the same call sequence under the LLVM backend on `aarch64-apple-darwin` and pasted into the assertions.
Verified locally on `aarch64-apple-darwin`:
Refs #171