summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/builtins-mips-features.c
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2019-11-27 19:09:50 +0300
committerSimon Atanasyan <simon@atanasyan.com>2019-11-29 00:23:00 +0300
commitf4d32ae75bf515f443a2c99dce5c882f460c82bd (patch)
treeffc43fd73637e320bd7a8e178dba01f260ef9e95 /clang/test/Sema/builtins-mips-features.c
parentec3efcf11ff2fcdb5a754e3bda942dd5bef0928e (diff)
downloadbcm5719-llvm-f4d32ae75bf515f443a2c99dce5c882f460c82bd.tar.gz
bcm5719-llvm-f4d32ae75bf515f443a2c99dce5c882f460c82bd.zip
[mips] Check that features required by built-ins are enabled
Now Clang does not check that features required by built-in functions are enabled. That causes errors in the backend reported in PR44018. This patch fixes this bug by checking that required features are enabled. This should fix PR44018. Differential Revision: https://reviews.llvm.org/D70808
Diffstat (limited to 'clang/test/Sema/builtins-mips-features.c')
-rw-r--r--clang/test/Sema/builtins-mips-features.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/Sema/builtins-mips-features.c b/clang/test/Sema/builtins-mips-features.c
new file mode 100644
index 00000000000..4ea36d7f24d
--- /dev/null
+++ b/clang/test/Sema/builtins-mips-features.c
@@ -0,0 +1,37 @@
+// REQUIRES: mips-registered-target
+// RUN: %clang_cc1 -triple mips64 -fsyntax-only -verify %s
+
+typedef signed char v4i8 __attribute__ ((vector_size(4)));
+typedef signed char v4q7 __attribute__ ((vector_size(4)));
+typedef signed char v16i8 __attribute__((vector_size(16), aligned(16)));
+typedef unsigned char v16u8 __attribute__((vector_size(16), aligned(16)));
+
+void dsp() {
+ v4i8 a;
+ void* p;
+
+ // expected-error@+1 {{this builtin requires 'dsp' ASE, please use -mdsp}}
+ __builtin_mips_addu_qb(a, a);
+ // expected-error@+1 {{this builtin requires 'dsp' ASE, please use -mdsp}}
+ __builtin_mips_lwx(p, 32);
+}
+
+void dspr2() {
+ v4i8 a;
+ v4q7 b;
+
+ // expected-error@+1 {{this builtin requires 'dsp r2' ASE, please use -mdspr2}}
+ __builtin_mips_absq_s_qb(b);
+ // expected-error@+1 {{this builtin requires 'dsp r2' ASE, please use -mdspr2}}
+ __builtin_mips_subuh_r_qb(a, a);
+}
+
+void msa() {
+ v16i8 a;
+ v16u8 b;
+
+ // expected-error@+1 {{this builtin requires 'msa' ASE, please use -mmsa}}
+ __builtin_msa_add_a_b(a, a);
+ // expected-error@+1 {{this builtin requires 'msa' ASE, please use -mmsa}}
+ __builtin_msa_xori_b(b, 5);
+}
OpenPOWER on IntegriCloud