diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/Sema/vector-assign.c | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/Sema/vector-assign.c')
-rw-r--r-- | test/Sema/vector-assign.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c new file mode 100644 index 0000000..5162e1a --- /dev/null +++ b/test/Sema/vector-assign.c @@ -0,0 +1,45 @@ +// RUN: clang-cc %s -verify -fsyntax-only -Wvector-conversions +typedef unsigned int v2u __attribute__ ((vector_size (8))); +typedef signed int v2s __attribute__ ((vector_size (8))); +typedef signed int v1s __attribute__ ((vector_size (4))); +typedef float v2f __attribute__ ((vector_size(8))); +typedef signed short v4ss __attribute__ ((vector_size (8))); + +void f() { + v2s v1; + v2u v2; + v1s v3; + v2f v4; + v4ss v5; + + v1 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v2s'}} + v1 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2s'}} + v1 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v2s'}} + v1 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2s'}} + + v2 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v2u'}} + v2 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2u'}} + v2 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v2u'}} + v2 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2u'}} + + v3 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v1s'}} + v3 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v1s'}} + v3 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v1s'}} + v3 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v1s'}} + + v4 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v2f'}} + v4 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v2f'}} + v4 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2f'}} + v4 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2f'}} + + v5 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v4ss'}} + v5 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v4ss'}} + v5 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v4ss'}} + v5 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v4ss'}} +} + +// PR2263 +float f2(__attribute__((vector_size(16))) float a, int b) { + return a[b]; +} + |