[clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve.

Summary:
The following preprocessor macros are implied when `-march=armv8.6a+sve`:

```
__ARM_FEATURE_SVE 1
__ARM_FEATURE_SVE_BF16 1
__ARM_FEATURE_SVE_MATMUL_FP32 1
__ARM_FEATURE_SVE_MATMUL_INT8 1
```

Reviewers: sdesmalen, efriedma, SjoerdMeijer, rengolin

Subscribers: tschuett, kristof.beyls, danielkiss, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83079
This commit is contained in:
Francesco Petrogalli 2020-07-01 21:16:17 +00:00
parent 5a62008f35
commit 438e95e95b
2 changed files with 22 additions and 0 deletions

View File

@ -365,6 +365,10 @@ fp16_fml_fallthrough:
}
}
auto V8_6Pos = llvm::find(Features, "+v8.6a");
if (V8_6Pos != std::end(Features))
V8_6Pos = Features.insert(std::next(V8_6Pos), {"+i8mm", "+bf16"});
if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access))
if (A->getOption().matches(options::OPT_mno_unaligned_access))

View File

@ -112,6 +112,24 @@
// CHECK-SVE-F64MM: __ARM_FEATURE_SVE 1
// CHECK-SVE-F64MM: __ARM_FEATURE_SVE_MATMUL_FP64 1
// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.5-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-8_5 %s
// CHECK-SVE-8_5-NOT: __ARM_FEATURE_SVE_BF16 1
// CHECK-SVE-8_5-NOT: __ARM_FEATURE_SVE_MATMUL_FP32 1
// CHECK-SVE-8_5-NOT: __ARM_FEATURE_SVE_MATMUL_INT8 1
// CHECK-SVE-8_5: __ARM_FEATURE_SVE 1
// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.6-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-8_6 %s
// CHECK-SVE-8_6: __ARM_FEATURE_SVE 1
// CHECK-SVE-8_6: __ARM_FEATURE_SVE_BF16 1
// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_FP32 1
// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_INT8 1
// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.6-a+sve+noi8mm+nobf16+nof32mm -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-8_6-NOFEATURES %s
// CHECK-SVE-8_6-NOFEATURES-NOT: __ARM_FEATURE_SVE_BF16 1
// CHECK-SVE-8_6-NOFEATURES-NOT: __ARM_FEATURE_SVE_MATMUL_FP32 1
// CHECK-SVE-8_6-NOFEATURES-NOT: __ARM_FEATURE_SVE_MATMUL_INT8 1
// CHECK-SVE-8_6-NOFEATURES: __ARM_FEATURE_SVE 1
// The following tests may need to be revised in the future since
// SVE2 is currently still part of Future Architecture Technologies
// (https://developer.arm.com/docs/ddi0602/latest)