Index: lib/Basic/Targets/ARM.h =================================================================== --- lib/Basic/Targets/ARM.h +++ lib/Basic/Targets/ARM.h @@ -69,6 +69,7 @@ unsigned Crypto : 1; unsigned DSP : 1; unsigned Unaligned : 1; + unsigned DotProd : 1; enum { LDREX_B = (1 << 0), /// byte (8-bit) Index: lib/Basic/Targets/ARM.cpp =================================================================== --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -390,6 +390,7 @@ Unaligned = 1; SoftFloat = SoftFloatABI = false; HWDiv = 0; + DotProd = 0; // This does not diagnose illegal cases like having both // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp". @@ -432,6 +433,8 @@ HW_FP |= HW_FP_HP; } else if (Feature == "+fullfp16") { HasLegalHalfType = true; + } else if (Feature == "+dotprod") { + DotProd = true; } } HW_FP &= ~HW_FP_remove; @@ -731,6 +734,8 @@ if (HasLegalHalfType) Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1"); + if (DotProd) + Builder.defineMacro("__ARM_FEATURE_DOTPROD", "1"); switch (ArchKind) { default: Index: test/Preprocessor/arm-target-features.c =================================================================== --- test/Preprocessor/arm-target-features.c +++ test/Preprocessor/arm-target-features.c @@ -6,6 +6,7 @@ // CHECK-V8A: #define __ARM_FEATURE_DIRECTED_ROUNDING 1 // CHECK-V8A: #define __ARM_FEATURE_NUMERIC_MAXMIN 1 // CHECK-V8A-NOT: #define __ARM_FP 0x +// CHECK-V8A-NOT: #define __ARM_FEATURE_DOTPROD // RUN: %clang -target armv8a-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s // RUN: %clang -target armv8a-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s @@ -18,6 +19,7 @@ // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP 0xe // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1 +// CHECK-V8A-ALLOW-FP-INSTR-V8A-NOT: #define __ARM_FEATURE_DOTPROD // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1 @@ -30,6 +32,9 @@ // CHECK-FULLFP16-SCALAR-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1 // CHECK-FULLFP16-SCALAR: #define __ARM_FP 0xe // CHECK-FULLFP16-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1 +// +// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+dotprod -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DOTPROD %s +// CHECK-DOTPROD: #define __ARM_FEATURE_DOTPROD 1 // RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s // CHECK-V8R: #define __ARMEL__ 1