blob: f915603465dbf09d4294f9d901c6b5eaf6d4b821 [file] [log] [blame]
Anders Carlsson695dbb62007-11-30 04:21:22 +00001// RUN: clang %s -verify -fsyntax-only -flax-vector-conversions
2typedef unsigned int v2u __attribute__ ((vector_size (8)));
3typedef signed int v2s __attribute__ ((vector_size (8)));
4typedef signed int v1s __attribute__ ((vector_size (4)));
5typedef float v2f __attribute__ ((vector_size(8)));
6typedef signed short v4ss __attribute__ ((vector_size (8)));
7
8void f() {
9 v2s v1;
10 v2u v2;
11 v1s v3;
12 v2f v4;
13 v4ss v5;
14
15 v1 = v2;
Chris Lattner5cf216b2008-01-04 18:04:52 +000016 v1 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2s'}}
17 v1 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v2s'}}
Anders Carlsson695dbb62007-11-30 04:21:22 +000018 v1 = v5;
19
20 v2 = v1;
Chris Lattner5cf216b2008-01-04 18:04:52 +000021 v2 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2u'}}
22 v2 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v2u'}}
Anders Carlsson695dbb62007-11-30 04:21:22 +000023 v2 = v5;
24
Chris Lattner5cf216b2008-01-04 18:04:52 +000025 v3 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v1s'}}
26 v3 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v1s'}}
27 v3 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v1s'}}
28 v3 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v1s'}}
Anders Carlsson695dbb62007-11-30 04:21:22 +000029
Chris Lattner5cf216b2008-01-04 18:04:52 +000030 v4 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v2f'}}
31 v4 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v2f'}}
32 v4 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2f'}}
33 v4 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v2f'}}
Anders Carlsson695dbb62007-11-30 04:21:22 +000034
35 v5 = v1;
36 v5 = v2;
Chris Lattner5cf216b2008-01-04 18:04:52 +000037 v5 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v4ss'}}
38 v5 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v4ss'}}
Anders Carlsson695dbb62007-11-30 04:21:22 +000039}
Chris Lattnera989def2008-05-12 18:31:17 +000040
41// PR2263
42float f2(__attribute__((vector_size(16))) float a, int b) {
43 return a[b];
44}
45