-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #88981 - durin42:llvm-14-crc32, r=nagisa
rustc_codegen_llvm: make sse4.2 imply crc32 for LLVM 14 This fixes compiling things like the `snap` crate after https://reviews.llvm.org/D105462. I added a test that verifies the additional attribute gets specified, and confirmed that I can build cargo with both LLVM 13 and 14 with this change applied. r? `@nagisa` cc `@nikic`
- Loading branch information
Showing
4 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// only-x86_64 | ||
// assembly-output: emit-asm | ||
// compile-flags: --crate-type staticlib -Ctarget-feature=+sse4.2 | ||
|
||
// CHECK-LABEL: banana | ||
// CHECK: crc32 | ||
#[no_mangle] | ||
pub unsafe fn banana(v: u8) -> u32 { | ||
use std::arch::x86_64::*; | ||
let out = !0u32; | ||
_mm_crc32_u8(out, v) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// only-x86_64 | ||
// min-llvm-version: 14.0 | ||
// compile-flags: -Copt-level=3 | ||
|
||
#![crate_type = "lib"] | ||
|
||
#[cfg(target_arch = "x86_64")] | ||
#[target_feature(enable = "sse4.2")] | ||
#[no_mangle] | ||
pub unsafe fn crc32sse(v: u8) -> u32 { | ||
use std::arch::x86_64::*; | ||
let out = !0u32; | ||
_mm_crc32_u8(out, v) | ||
} | ||
|
||
// CHECK: attributes #0 {{.*"target-features"="\+sse4.2,\+crc32"}} |