| 1 |
// Test how -cc1 -target-feature interacts with -print-enabled-extensions. |
| 2 |
// The current behaviour does not look correct, since dependent features are |
| 3 |
// removed from the printed list when one of their dependencies are disabled, |
| 4 |
// but they are actually still enabled during compilation, and then actually |
| 5 |
// disabled for parsing assembly. |
| 6 |
|
| 7 |
// REQUIRES: aarch64-registered-target |
| 8 |
|
| 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_ONLY |
| 13 |
|
| 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_NEG |
| 18 |
|
| 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_ONLY |
| 23 |
|
| 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_ONLY |
| 28 |
|
| 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_ONLY |
| 33 |
|
| 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_ONLY |
| 38 |
|
| 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_DEP |
| 43 |
|
| 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_DEP2 |
| 48 |
|
| 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_DEP2 |
| 53 |
|
| 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_XCLANG |
| 58 |
|
| 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=note |
| 63 |
|
| 64 |
|
| 65 |
// POS_ONLY: Extensions enabled for the given AArch64 target |
| 66 |
// POS_ONLY-EMPTY: |
| 67 |
// POS_ONLY-NEXT: Architecture Feature(s) Description |
| 68 |
// POS_ONLY-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 69 |
// POS_ONLY-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 70 |
// POS_ONLY-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 71 |
// POS_ONLY-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 72 |
// POS_ONLY-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions |
| 73 |
// POS_ONLY-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 74 |
|
| 75 |
// POS_NEG: Extensions enabled for the given AArch64 target |
| 76 |
// POS_NEG-EMPTY: |
| 77 |
// POS_NEG-NEXT: Architecture Feature(s) Description |
| 78 |
// POS_NEG-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 79 |
// POS_NEG-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 80 |
// POS_NEG-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 81 |
// POS_NEG-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 82 |
// POS_NEG-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 83 |
|
| 84 |
// NEG_POS: Extensions enabled for the given AArch64 target |
| 85 |
// NEG_POS-EMPTY: |
| 86 |
// NEG_POS-NEXT: Architecture Feature(s) Description |
| 87 |
// NEG_POS-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 88 |
// NEG_POS-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 89 |
// NEG_POS-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 90 |
// NEG_POS-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 91 |
// NEG_POS-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions |
| 92 |
// NEG_POS-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 93 |
|
| 94 |
// NEG_ONLY: Extensions enabled for the given AArch64 target |
| 95 |
// NEG_ONLY-EMPTY: |
| 96 |
// NEG_ONLY-NEXT: Architecture Feature(s) Description |
| 97 |
// NEG_ONLY-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 98 |
// NEG_ONLY-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 99 |
// NEG_ONLY-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 100 |
// NEG_ONLY-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 101 |
|
| 102 |
// DISABLE_DEP: Extensions enabled for the given AArch64 target |
| 103 |
// DISABLE_DEP-EMPTY: |
| 104 |
// DISABLE_DEP-NEXT: Architecture Feature(s) Description |
| 105 |
// DISABLE_DEP-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 106 |
// DISABLE_DEP-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 107 |
// DISABLE_DEP-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 108 |
// DISABLE_DEP-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 109 |
// DISABLE_DEP-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 110 |
|
| 111 |
// DISABLE_DEP2: Extensions enabled for the given AArch64 target |
| 112 |
// DISABLE_DEP2-EMPTY: |
| 113 |
// DISABLE_DEP2-NEXT: Architecture Feature(s) Description |
| 114 |
// DISABLE_DEP2-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 115 |
// DISABLE_DEP2-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 116 |
// DISABLE_DEP2-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 117 |
// DISABLE_DEP2-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 118 |
// DISABLE_DEP2-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions |
| 119 |
// DISABLE_DEP2-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions |
| 120 |
// DISABLE_DEP2-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 121 |
|
| 122 |
// DISABLE_VIA_XCLANG: Extensions enabled for the given AArch64 target |
| 123 |
// DISABLE_VIA_XCLANG-EMPTY: |
| 124 |
// DISABLE_VIA_XCLANG-NEXT: Architecture Feature(s) Description |
| 125 |
// DISABLE_VIA_XCLANG-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions |
| 126 |
// DISABLE_VIA_XCLANG-NEXT: FEAT_ETE Enable Embedded Trace Extension |
| 127 |
// DISABLE_VIA_XCLANG-NEXT: FEAT_FP Enable Armv8.0-A Floating Point Extensions |
| 128 |
// DISABLE_VIA_XCLANG-NEXT: FEAT_FP16 Enable half-precision floating-point data processing |
| 129 |
// DISABLE_VIA_XCLANG-NEXT: FEAT_TRBE Enable Trace Buffer Extension |
| 130 |
|
| 131 |
#if __ARM_FEATURE_SVE2 |
| 132 |
#warning "SVE2 is enabled" |
| 133 |
// expected-warning@-1 {{SVE2 is enabled}} |
| 134 |
#endif |
| 135 |
|
| 136 |
void fn_that_requires_sve2() { |
| 137 |
__asm__("ldnt1sh z0.s, p0/z, [z1.s]"); |
| 138 |
// expected-error@-1 {{instruction requires: sve2}} |
| 139 |
} |