140 lines · c
1// Test how -cc1 -target-feature interacts with -print-enabled-extensions.2// The current behaviour does not look correct, since dependent features are3// removed from the printed list when one of their dependencies are disabled,4// but they are actually still enabled during compilation, and then actually5// disabled for parsing assembly.6 7// REQUIRES: aarch64-registered-target8 9// Behaviour with two positive features.10// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \11// RUN: -target-feature +neon -target-feature +sve \12// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=POS_ONLY13 14// Negative -target-feature disables the extension but keeps any dependencies of it (FEAT_FP16).15// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \16// RUN: -target-feature +neon -target-feature +sve -target-feature -sve \17// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=POS_NEG18 19// Disabling then re-enabling a feature is the same as never disabling it.20// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \21// RUN: -target-feature +neon -target-feature -sve -target-feature +sve \22// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=POS_ONLY23 24// Disabling then re-enabling a feature is the same as never disabling it.25// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \26// RUN: -target-feature +neon -target-feature +sve -target-feature -sve -target-feature +sve \27// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=POS_ONLY28 29// Only disabling it is the same as never having enabled it.30// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \31// RUN: -target-feature +neon \32// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=NEG_ONLY33 34// Only disabling it is the same as never having enabled it.35// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \36// RUN: -target-feature +neon -target-feature -sve \37// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=NEG_ONLY38 39// Disabling a dependency (after enabling the dependent) appears to disable the dependent feature.40// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \41// RUN: -target-feature +sve2 -target-feature -sve \42// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=DISABLE_DEP43 44// Disabling a dependency before enabling the dependent appears to have no effect.45// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \46// RUN: -target-feature -sve -target-feature +sve2 \47// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=DISABLE_DEP248 49// Disabling a dependency before enabling the dependent appears to have no effect.50// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -print-enabled-extensions \51// RUN: -target-feature +sve2 \52// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=DISABLE_DEP253 54// Driver --print-enabled-extensions indicates that negative -target-features disable dependent features.55// RUN: %clang --target=aarch64 -march=armv8-a+sve2 --print-enabled-extensions \56// RUN: -Xclang -target-feature -Xclang -sve \57// RUN: | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s --check-prefix=DISABLE_VIA_XCLANG58 59// However, sve2 is actually enabled in clang but disabled for MC.60// RUN: %clang --target=aarch64 -march=armv8-a+sve2 -c %s -o %t \61// RUN: -Xclang -target-feature -Xclang -sve \62// RUN: -Xclang -verify -Xclang -verify-ignore-unexpected=note63 64 65// POS_ONLY: Extensions enabled for the given AArch64 target66// POS_ONLY-EMPTY:67// POS_ONLY-NEXT: Architecture Feature(s) Description68// POS_ONLY-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions69// POS_ONLY-NEXT: FEAT_ETE Enable Embedded Trace Extension70// POS_ONLY-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions71// POS_ONLY-NEXT: FEAT_FP16 Enable half-precision floating-point data processing72// POS_ONLY-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions73// POS_ONLY-NEXT: FEAT_TRBE Enable Trace Buffer Extension74 75// POS_NEG: Extensions enabled for the given AArch64 target76// POS_NEG-EMPTY:77// POS_NEG-NEXT: Architecture Feature(s) Description78// POS_NEG-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions79// POS_NEG-NEXT: FEAT_ETE Enable Embedded Trace Extension80// POS_NEG-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions81// POS_NEG-NEXT: FEAT_FP16 Enable half-precision floating-point data processing82// POS_NEG-NEXT: FEAT_TRBE Enable Trace Buffer Extension83 84// NEG_POS: Extensions enabled for the given AArch64 target85// NEG_POS-EMPTY:86// NEG_POS-NEXT: Architecture Feature(s) Description87// NEG_POS-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions88// NEG_POS-NEXT: FEAT_ETE Enable Embedded Trace Extension89// NEG_POS-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions90// NEG_POS-NEXT: FEAT_FP16 Enable half-precision floating-point data processing91// NEG_POS-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions92// NEG_POS-NEXT: FEAT_TRBE Enable Trace Buffer Extension93 94// NEG_ONLY: Extensions enabled for the given AArch64 target95// NEG_ONLY-EMPTY:96// NEG_ONLY-NEXT: Architecture Feature(s) Description97// NEG_ONLY-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions98// NEG_ONLY-NEXT: FEAT_ETE Enable Embedded Trace Extension99// NEG_ONLY-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions100// NEG_ONLY-NEXT: FEAT_TRBE Enable Trace Buffer Extension101 102// DISABLE_DEP: Extensions enabled for the given AArch64 target103// DISABLE_DEP-EMPTY: 104// DISABLE_DEP-NEXT: Architecture Feature(s) Description105// DISABLE_DEP-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions106// DISABLE_DEP-NEXT: FEAT_ETE Enable Embedded Trace Extension107// DISABLE_DEP-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions108// DISABLE_DEP-NEXT: FEAT_FP16 Enable half-precision floating-point data processing109// DISABLE_DEP-NEXT: FEAT_TRBE Enable Trace Buffer Extension110 111// DISABLE_DEP2: Extensions enabled for the given AArch64 target112// DISABLE_DEP2-EMPTY: 113// DISABLE_DEP2-NEXT: Architecture Feature(s) Description114// DISABLE_DEP2-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions115// DISABLE_DEP2-NEXT: FEAT_ETE Enable Embedded Trace Extension116// DISABLE_DEP2-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions117// DISABLE_DEP2-NEXT: FEAT_FP16 Enable half-precision floating-point data processing118// DISABLE_DEP2-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions119// DISABLE_DEP2-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions120// DISABLE_DEP2-NEXT: FEAT_TRBE Enable Trace Buffer Extension121 122// DISABLE_VIA_XCLANG: Extensions enabled for the given AArch64 target123// DISABLE_VIA_XCLANG-EMPTY: 124// DISABLE_VIA_XCLANG-NEXT: Architecture Feature(s) Description125// DISABLE_VIA_XCLANG-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions126// DISABLE_VIA_XCLANG-NEXT: FEAT_ETE Enable Embedded Trace Extension127// DISABLE_VIA_XCLANG-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions128// DISABLE_VIA_XCLANG-NEXT: FEAT_FP16 Enable half-precision floating-point data processing129// DISABLE_VIA_XCLANG-NEXT: FEAT_TRBE Enable Trace Buffer Extension130 131#if __ARM_FEATURE_SVE2132#warning "SVE2 is enabled"133// expected-warning@-1 {{SVE2 is enabled}}134#endif135 136void fn_that_requires_sve2() {137 __asm__("ldnt1sh z0.s, p0/z, [z1.s]");138 // expected-error@-1 {{instruction requires: sve2}}139}140