diff options
| author | Augie Fackler <augie@google.com> | 2021-09-15 10:18:10 -0400 |
|---|---|---|
| committer | Augie Fackler <augie@google.com> | 2021-09-20 11:31:55 -0400 |
| commit | 4185b76dc3d3b22292033125487c07ce52276b11 (patch) | |
| tree | ef72cc6fb54001c5fe3c125b155b65c303aed043 /src/test/codegen | |
| parent | db1fb85cff63ad5fffe435e17128f99f9e1d970c (diff) | |
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.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/sse42-implies-crc32.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/codegen/sse42-implies-crc32.rs b/src/test/codegen/sse42-implies-crc32.rs new file mode 100644 index 00000000000..47b1a899340 --- /dev/null +++ b/src/test/codegen/sse42-implies-crc32.rs @@ -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"}} |
