aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/attr-mode-vector-types.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/attr-mode-vector-types.c')
-rw-r--r--test/Sema/attr-mode-vector-types.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Sema/attr-mode-vector-types.c b/test/Sema/attr-mode-vector-types.c
new file mode 100644
index 000000000000..3893922a6a6d
--- /dev/null
+++ b/test/Sema/attr-mode-vector-types.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-linux-gnu %s
+
+// Correct cases.
+typedef int __attribute__((mode(byte))) __attribute__((vector_size(256))) vec_t1;
+typedef int __attribute__((mode(QI))) __attribute__((vector_size(256))) vec_t2;
+typedef int __attribute__((mode(SI))) __attribute__((vector_size(256))) vec_t3;
+typedef int __attribute__((mode(DI))) __attribute__((vector_size(256)))vec_t4;
+typedef float __attribute__((mode(SF))) __attribute__((vector_size(256))) vec_t5;
+typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) vec_t6;
+typedef float __attribute__((mode(XF))) __attribute__((vector_size(256))) vec_t7;
+
+// Incorrect cases.
+typedef float __attribute__((mode(QC))) __attribute__((vector_size(256))) vec_t8;
+// expected-error@-1{{unsupported machine mode 'QC'}}
+// expected-error@-2{{type of machine mode does not match type of base type}}
+typedef _Complex float __attribute__((mode(HC))) __attribute__((vector_size(256))) vec_t9;
+// expected-error@-1{{unsupported machine mode 'HC'}}
+// expected-error@-2{{invalid vector element type '_Complex float'}}
+typedef int __attribute__((mode(SC))) __attribute__((vector_size(256))) vec_t10;
+// expected-error@-1{{type of machine mode does not match type of base type}}
+// expected-error@-2{{type of machine mode does not support base vector types}}
+typedef float __attribute__((mode(DC))) __attribute__((vector_size(256))) vec_t11;
+// expected-error@-1{{type of machine mode does not match type of base type}}
+// expected-error@-2{{type of machine mode does not support base vector types}}
+typedef _Complex float __attribute__((mode(XC))) __attribute__((vector_size(256))) vec_t12;
+// expected-error@-1{{invalid vector element type '_Complex float'}}