1 // revisions: COMPAT INCOMPAT
2 // needs-llvm-components: x86
3 // compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3
4 // [COMPAT] compile-flags: -Ctarget-feature=+avx2,+avx
5 // [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx
7 // See also src/test/assembly/target-feature-multiple.rs
8 #![feature(no_core, lang_items)]
23 #[target_feature(enable = "avx")]
25 pub unsafe fn apple() -> u32 {
26 // CHECK-LABEL: @apple()
27 // CHECK-SAME: [[APPLEATTRS:#[0-9]+]] {
28 // CHECK: {{.*}}call{{.*}}@peach
32 // target features same as global
34 pub unsafe fn banana() -> u32 {
35 // CHECK-LABEL: @banana()
36 // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] {
37 // COMPAT: {{.*}}call{{.*}}@peach
38 // INCOMPAT: {{.*}}call{{.*}}@apple
39 apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT
42 // CHECK: attributes [[APPLEATTRS]]
43 // COMPAT-SAME: "target-features"="+avx2,+avx,+avx"
44 // INCOMPAT-SAME: "target-features"="-avx2,-avx,+avx"
45 // CHECK: attributes [[BANANAATTRS]]
46 // COMPAT-SAME: "target-features"="+avx2,+avx"
47 // INCOMPAT-SAME: "target-features"="-avx2,-avx"