mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 12:44:40 +00:00
72800d3b89
Except for `simd-intrinsic/`, which has a lot of files containing multiple types like `u8x64` which really are better when hand-formatted. There is a surprising amount of two-space indenting in this directory. Non-trivial changes: - `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the test. - `rustfmt::skip` used in a few places where hand-formatting read more nicely: `enum/enum-match.rs` - Line number adjustments needed for the expected output of `debug-column.rs` and `coroutine-debug.rs`.
47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
//@ revisions: COMPAT INCOMPAT
|
|
//@ needs-llvm-components: x86
|
|
//@ compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3
|
|
//@ [COMPAT] compile-flags: -Ctarget-feature=+avx2,+avx
|
|
//@ [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx
|
|
|
|
// See also tests/assembly/target-feature-multiple.rs
|
|
#![feature(no_core, lang_items)]
|
|
#![crate_type = "lib"]
|
|
#![no_core]
|
|
|
|
#[lang = "sized"]
|
|
trait Sized {}
|
|
#[lang = "copy"]
|
|
trait Copy {}
|
|
|
|
extern "C" {
|
|
fn peach() -> u32;
|
|
}
|
|
|
|
#[inline]
|
|
#[target_feature(enable = "avx")]
|
|
#[no_mangle]
|
|
pub unsafe fn apple() -> u32 {
|
|
// CHECK-LABEL: @apple()
|
|
// CHECK-SAME: [[APPLEATTRS:#[0-9]+]] {
|
|
// CHECK: {{.*}}call{{.*}}@peach
|
|
peach()
|
|
}
|
|
|
|
// target features same as global
|
|
#[no_mangle]
|
|
pub unsafe fn banana() -> u32 {
|
|
// CHECK-LABEL: @banana()
|
|
// CHECK-SAME: [[BANANAATTRS:#[0-9]+]] {
|
|
// COMPAT: {{.*}}call{{.*}}@peach
|
|
// INCOMPAT: {{.*}}call{{.*}}@apple
|
|
apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT
|
|
}
|
|
|
|
// CHECK: attributes [[APPLEATTRS]]
|
|
// COMPAT-SAME: "target-features"="+avx2,+avx,+avx"
|
|
// INCOMPAT-SAME: "target-features"="-avx2,-avx,+avx"
|
|
// CHECK: attributes [[BANANAATTRS]]
|
|
// COMPAT-SAME: "target-features"="+avx2,+avx"
|
|
// INCOMPAT-SAME: "target-features"="-avx2,-avx"
|