2021-03-13 07:29:39 -06:00
|
|
|
//@ revisions: COMPAT INCOMPAT
|
|
|
|
//@ needs-llvm-components: x86
|
|
|
|
//@ compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3
|
2024-08-04 14:32:17 -05:00
|
|
|
//@ [COMPAT] compile-flags: -Ctarget-feature=+avx2
|
2021-03-13 07:29:39 -06:00
|
|
|
//@ [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx
|
|
|
|
|
2023-01-05 02:45:44 -06:00
|
|
|
// See also tests/assembly/target-feature-multiple.rs
|
2021-03-13 07:29:39 -06:00
|
|
|
#![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 {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK-LABEL: @apple()
|
|
|
|
// CHECK-SAME: [[APPLEATTRS:#[0-9]+]] {
|
|
|
|
// CHECK: {{.*}}call{{.*}}@peach
|
2021-03-13 07:29:39 -06:00
|
|
|
peach()
|
|
|
|
}
|
|
|
|
|
2022-03-02 18:00:00 -06:00
|
|
|
// target features same as global
|
2021-03-13 07:29:39 -06:00
|
|
|
#[no_mangle]
|
|
|
|
pub unsafe fn banana() -> u32 {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK-LABEL: @banana()
|
|
|
|
// CHECK-SAME: [[BANANAATTRS:#[0-9]+]] {
|
|
|
|
// COMPAT: {{.*}}call{{.*}}@peach
|
|
|
|
// INCOMPAT: {{.*}}call{{.*}}@apple
|
2021-03-13 07:29:39 -06:00
|
|
|
apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: attributes [[APPLEATTRS]]
|
2024-08-04 14:32:17 -05:00
|
|
|
// COMPAT-SAME: "target-features"="+avx,+avx2,{{.*}}"
|
2024-07-26 10:27:21 -05:00
|
|
|
// INCOMPAT-SAME: "target-features"="-avx2,-avx,+avx,{{.*}}"
|
2021-03-13 07:29:39 -06:00
|
|
|
// CHECK: attributes [[BANANAATTRS]]
|
2024-08-04 14:32:17 -05:00
|
|
|
// COMPAT-SAME: "target-features"="+avx,+avx2,{{.*}}"
|
2022-03-02 18:00:00 -06:00
|
|
|
// INCOMPAT-SAME: "target-features"="-avx2,-avx"
|