Add error checking to reject neon_vector_type attribute on targets without NEON.
Patch by Artyom Skrobov. llvm-svn: 190801
This commit is contained in:
parent
f5bcccee76
commit
8c3de546d6
|
@ -1785,6 +1785,8 @@ def err_attribute_too_few_arguments : Error<
|
|||
def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
|
||||
def err_attribute_bad_neon_vector_size : Error<
|
||||
"Neon vector size must be 64 or 128 bits">;
|
||||
def err_attribute_unsupported : Error<
|
||||
"%0 attribute is not supported for this target">;
|
||||
def err_aligned_attribute_argument_not_int : Error<
|
||||
"'aligned' attribute requires integer constant">;
|
||||
def err_alignas_attribute_wrong_decl_type : Error<
|
||||
|
|
|
@ -3711,9 +3711,7 @@ public:
|
|||
.Case("arm", true)
|
||||
.Case("softfloat", SoftFloat)
|
||||
.Case("thumb", IsThumb)
|
||||
.Case("neon", (FPU & NeonFPU) && !SoftFloat &&
|
||||
(StringRef(getCPUDefineSuffix(CPU)).startswith("7") ||
|
||||
StringRef(getCPUDefineSuffix(CPU)).startswith("8")))
|
||||
.Case("neon", (FPU & NeonFPU) && !SoftFloat)
|
||||
.Default(false);
|
||||
}
|
||||
// FIXME: Should we actually have some table instead of these switches?
|
||||
|
|
|
@ -4735,6 +4735,12 @@ static bool isPermittedNeonBaseType(QualType &Ty,
|
|||
static void HandleNeonVectorTypeAttr(QualType& CurType,
|
||||
const AttributeList &Attr, Sema &S,
|
||||
VectorType::VectorKind VecKind) {
|
||||
// Target must have NEON
|
||||
if (!S.Context.getTargetInfo().hasFeature("neon")) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) << Attr.getName();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple thumbv7-apple-ios0.0.0 -analyze -analyzer-checker=core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
|
||||
// RUN: %clang_cc1 -triple thumbv7-apple-ios0.0.0 -target-feature +neon -analyze -analyzer-checker=core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
// <rdar://problem/11405978> - Handle casts of vectors to structs, and loading
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// REQUIRES: arm-registered-target
|
||||
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
|
||||
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
|
||||
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-feature +neon -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
|
||||
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-feature +neon -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
|
||||
|
||||
// APCS-GNU-LABEL: define signext i8 @f0()
|
||||
// AAPCS-LABEL: define arm_aapcscc signext i8 @f0()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: arm-registered-target
|
||||
// RUN: not %clang_cc1 -triple armv7 %s -S -o /dev/null 2>&1 | FileCheck %s
|
||||
// RUN: not %clang_cc1 -triple armv7 -target-feature +neon %s -S -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
// rdar://13446483
|
||||
typedef __attribute__((neon_vector_type(2))) long long int64x2_t;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: arm-registered-target
|
||||
// RUN: %clang_cc1 -triple armv7 %s -emit-llvm -o /dev/null
|
||||
// RUN: %clang_cc1 -triple armv7 -target-feature +neon %s -emit-llvm -o /dev/null
|
||||
|
||||
char bar();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: arm-registered-target
|
||||
// RUN: %clang_cc1 -S -triple armv7-apple-darwin %s -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -S -triple armv7-apple-darwin -target-feature +neon %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
typedef struct _zend_ini_entry zend_ini_entry;
|
||||
struct _zend_ini_entry {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: arm-registered-target
|
||||
// RUN: %clang_cc1 -S -emit-llvm -triple armv7a-apple-darwin %s -o /dev/null
|
||||
// RUN: %clang_cc1 -S -emit-llvm -triple armv7a-apple-darwin -target-feature +neon %s -o /dev/null
|
||||
typedef unsigned short uint16_t;
|
||||
typedef __attribute__((neon_vector_type(8))) uint16_t uint16x8_t;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: aarch64-registered-target
|
||||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu %s -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple arm-none-linux-gnueabi %s -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-feature +neon %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
typedef float float32_t;
|
||||
typedef __fp16 float16_t;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: aarch64-registered-target
|
||||
// RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -fsyntax-only -verify
|
||||
// RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +neon -fsyntax-only -verify
|
||||
|
||||
typedef float float32_t;
|
||||
typedef unsigned char poly8_t;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -triple armv7 -fsyntax-only -verify
|
||||
|
||||
typedef __attribute__((neon_vector_type(2))) int int32x2_t; // expected-error{{'neon_vector_type' attribute is not supported for this target}}
|
||||
typedef __attribute__((neon_polyvector_type(16))) short poly8x16_t; // expected-error{{'neon_polyvector_type' attribute is not supported for this target}}
|
|
@ -1,4 +1,5 @@
|
|||
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
||||
// RUN: %clang_cc1 %s -triple armv7 -target-feature +neon -fsyntax-only -verify
|
||||
// RUN: %clang_cc1 %s -triple armv8 -target-feature +neon -fsyntax-only -verify
|
||||
|
||||
typedef float float32_t;
|
||||
typedef signed char poly8_t;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify "-triple" "thumbv7-apple-ios3.0.0" %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify "-triple" "thumbv7-apple-ios3.0.0" -target-feature +neon %s
|
||||
// rdar://9208404
|
||||
|
||||
typedef int MP4Err;
|
||||
|
|
Loading…
Reference in New Issue