1 // RUN: %clang_cc1 -fenable-matrix -fsyntax-only %s -verify
3 typedef char cx4x4
__attribute__((matrix_type(4, 4)));
4 typedef int ix4x4
__attribute__((matrix_type(4, 4)));
5 typedef short sx4x4
__attribute__((matrix_type(4, 4)));
6 typedef int ix5x5
__attribute__((matrix_type(5, 5)));
7 typedef float fx5x5
__attribute__((matrix_type(5, 5)));
8 typedef int vec
__attribute__((vector_size(4)));
9 typedef struct test_struct
{
24 m4
= (ix5x5
)m3
; // expected-error {{conversion between matrix types 'ix5x5' (aka 'int __attribute__\
25 ((matrix_type(5, 5)))') and 'sx4x4
' (aka 'short __attribute__((matrix_type(4, 4)))') of different size \
27 m5 = (ix5x5)m4; // expected-error {{assigning to 'fx5x5
' (aka \
28 'float __attribute__((matrix_type(5, 5)))') from incompatible type 'ix5x5
' (aka 'int __attribute__((matrix_type(5, 5)))')}}
29 i = (int)m4; // expected-error {{conversion between matrix type 'ix5x5
' (aka 'int __attribute__\
30 ((matrix_type(5, 5)))') and incompatible type 'int' is not allowed}}
31 m4 = (ix5x5)i; // expected-error {{conversion between matrix type 'ix5x5
' (aka 'int __attribute__\
32 ((matrix_type(5, 5)))') and incompatible type 'int' is not allowed}}
33 v = (vec)m4; // expected-error {{conversion between matrix type 'ix5x5
' (aka 'int __attribute__\
34 ((matrix_type(5, 5)))') and incompatible type 'vec
' (vector of 1 'int' value) is not allowed}}
35 m4 = (ix5x5)v; // expected-error {{conversion between matrix type 'ix5x5
' (aka 'int __attribute__\
36 ((matrix_type(5, 5)))') and incompatible type 'vec
' (vector of 1 'int' value) is not allowed}}
37 s = (test_struct *)m3; // expected-error {{conversion between matrix type 'sx4x4
' (aka 'short \
38 __attribute__((matrix_type(4, 4)))') and incompatible type 'test_struct
*' (aka 'struct test_struct
*') is not allowed}}
39 m3 = (sx4x4)s; // expected-error {{conversion between matrix type 'sx4x4
' (aka 'short \
40 __attribute__((matrix_type(4, 4)))') and incompatible type 'test_struct
*' (aka 'struct test_struct
*') is not allowed}}
45 typedef float float2_8x8 __attribute__((matrix_type(8, 8)));
46 typedef double double_10x10 __attribute__((matrix_type(10, 10)));
47 typedef double double_8x8 __attribute__((matrix_type(8, 8)));
48 typedef signed int signed_int_12x12 __attribute__((matrix_type(12, 12)));
49 typedef unsigned int unsigned_int_12x12 __attribute__((matrix_type(12, 12)));
50 typedef unsigned int unsigned_int_10x10 __attribute__((matrix_type(10, 10)));
57 unsigned_int_12x12 m5;
58 unsigned_int_10x10 m6;
61 m2 = (double_10x10)m1; // expected-error {{conversion between matrix types 'double_10x10
' \
62 (aka 'double __attribute__((matrix_type(10, 10)))') and 'float2_8x8
' (aka 'float __attribute__\
63 ((matrix_type(8, 8)))') of different size is not allowed}}
66 m5 = (unsigned_int_12x12)m4;
67 m4 = (signed_int_12x12)m5;
68 m6 = (unsigned_int_10x10)m4; // expected-error {{conversion between matrix types 'unsigned_int_10x10
' \
69 (aka 'unsigned int __attribute__((matrix_type(10, 10)))') and 'signed_int_12x12
' (aka 'int __attribute__\
70 ((matrix_type(12, 12)))') of different size is not allowed}}
71 f = (float)m4; // expected-error {{conversion between matrix type 'signed_int_12x12
' \
72 (aka 'int __attribute__((matrix_type(12, 12)))') and incompatible type 'float' is not allowed}}
73 m4 = (signed_int_12x12)f; // expected-error {{conversion between matrix type 'signed_int_12x12
' \
74 (aka 'int __attribute__((matrix_type(12, 12)))') and incompatible type 'float' is not allowed}}