Files
TheRock/compiler/amd-llvm/clang/test/Sema/matrix-cast.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

75 lines
3.7 KiB
C

// RUN: %clang_cc1 -fenable-matrix -fsyntax-only %s -verify
typedef char cx4x4 __attribute__((matrix_type(4, 4)));
typedef int ix4x4 __attribute__((matrix_type(4, 4)));
typedef short sx4x4 __attribute__((matrix_type(4, 4)));
typedef int ix5x5 __attribute__((matrix_type(5, 5)));
typedef float fx5x5 __attribute__((matrix_type(5, 5)));
typedef int vec __attribute__((vector_size(4)));
typedef struct test_struct {
} test_struct;
void f1(void) {
cx4x4 m1;
ix4x4 m2;
sx4x4 m3;
ix5x5 m4;
fx5x5 m5;
int i;
vec v;
test_struct *s;
m2 = (ix4x4)m1;
m3 = (sx4x4)m2;
m4 = (ix5x5)m3; // expected-error {{conversion between matrix types 'ix5x5' (aka 'int __attribute__\
((matrix_type(5, 5)))') and 'sx4x4' (aka 'short __attribute__((matrix_type(4, 4)))') of different size \
is not allowed}}
m5 = (ix5x5)m4; // expected-error {{assigning to 'fx5x5' (aka \
'float __attribute__((matrix_type(5, 5)))') from incompatible type 'ix5x5' (aka 'int __attribute__((matrix_type(5, 5)))')}}
i = (int)m4; // expected-error {{conversion between matrix type 'ix5x5' (aka 'int __attribute__\
((matrix_type(5, 5)))') and incompatible type 'int' is not allowed}}
m4 = (ix5x5)i; // expected-error {{conversion between matrix type 'ix5x5' (aka 'int __attribute__\
((matrix_type(5, 5)))') and incompatible type 'int' is not allowed}}
v = (vec)m4; // expected-error {{conversion between matrix type 'ix5x5' (aka 'int __attribute__\
((matrix_type(5, 5)))') and incompatible type 'vec' (vector of 1 'int' value) is not allowed}}
m4 = (ix5x5)v; // expected-error {{conversion between matrix type 'ix5x5' (aka 'int __attribute__\
((matrix_type(5, 5)))') and incompatible type 'vec' (vector of 1 'int' value) is not allowed}}
s = (test_struct *)m3; // expected-error {{conversion between matrix type 'sx4x4' (aka 'short \
__attribute__((matrix_type(4, 4)))') and incompatible type 'test_struct *' (aka 'struct test_struct *') is not allowed}}
m3 = (sx4x4)s; // expected-error {{conversion between matrix type 'sx4x4' (aka 'short \
__attribute__((matrix_type(4, 4)))') and incompatible type 'test_struct *' (aka 'struct test_struct *') is not allowed}}
m4 = (ix5x5)m5;
}
typedef float float2_8x8 __attribute__((matrix_type(8, 8)));
typedef double double_10x10 __attribute__((matrix_type(10, 10)));
typedef double double_8x8 __attribute__((matrix_type(8, 8)));
typedef signed int signed_int_12x12 __attribute__((matrix_type(12, 12)));
typedef unsigned int unsigned_int_12x12 __attribute__((matrix_type(12, 12)));
typedef unsigned int unsigned_int_10x10 __attribute__((matrix_type(10, 10)));
void f2(void) {
float2_8x8 m1;
double_10x10 m2;
double_8x8 m3;
signed_int_12x12 m4;
unsigned_int_12x12 m5;
unsigned_int_10x10 m6;
float f;
m2 = (double_10x10)m1; // expected-error {{conversion between matrix types 'double_10x10' \
(aka 'double __attribute__((matrix_type(10, 10)))') and 'float2_8x8' (aka 'float __attribute__\
((matrix_type(8, 8)))') of different size is not allowed}}
m3 = (double_8x8)m1;
m5 = (unsigned_int_12x12)m4;
m4 = (signed_int_12x12)m5;
m6 = (unsigned_int_10x10)m4; // expected-error {{conversion between matrix types 'unsigned_int_10x10' \
(aka 'unsigned int __attribute__((matrix_type(10, 10)))') and 'signed_int_12x12' (aka 'int __attribute__\
((matrix_type(12, 12)))') of different size is not allowed}}
f = (float)m4; // expected-error {{conversion between matrix type 'signed_int_12x12' \
(aka 'int __attribute__((matrix_type(12, 12)))') and incompatible type 'float' is not allowed}}
m4 = (signed_int_12x12)f; // expected-error {{conversion between matrix type 'signed_int_12x12' \
(aka 'int __attribute__((matrix_type(12, 12)))') and incompatible type 'float' is not allowed}}
}