blob: 20a35cdb5c35a1277296e06391e9b4d2304eee88 [file] [log] [blame]
David Neto1e19b552021-06-17 09:10:04 +00001#include <metal_stdlib>
2
3using namespace metal;
Ben Claytonf47887d2022-06-24 17:01:59 +00004
5template<typename T, size_t N>
6struct tint_array {
7 const constant T& operator[](size_t i) const constant { return elements[i]; }
8 device T& operator[](size_t i) device { return elements[i]; }
9 const device T& operator[](size_t i) const device { return elements[i]; }
10 thread T& operator[](size_t i) thread { return elements[i]; }
11 const thread T& operator[](size_t i) const thread { return elements[i]; }
12 threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
13 const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
14 T elements[N];
David Neto1e19b552021-06-17 09:10:04 +000015};
Ben Clayton8ec32a62022-02-09 23:55:51 +000016
David Neto1e19b552021-06-17 09:10:04 +000017struct S {
Ben Claytonf47887d2022-06-24 17:01:59 +000018 /* 0x0000 */ tint_array<int4, 4> arr;
David Neto1e19b552021-06-17 09:10:04 +000019};
Ben Clayton8ec32a62022-02-09 23:55:51 +000020
Ben Claytonf47887d2022-06-24 17:01:59 +000021tint_array<int4, 4> ret_arr() {
22 tint_array<int4, 4> const tint_symbol_1 = tint_array<int4, 4>{};
David Neto1e19b552021-06-17 09:10:04 +000023 return tint_symbol_1;
24}
25
Antonio Maiorano93baaae2022-03-15 15:35:13 +000026S ret_struct_arr() {
dan sinclair3abad2c2022-08-11 02:28:01 +000027 S const tint_symbol_2 = S{};
Antonio Maiorano93baaae2022-03-15 15:35:13 +000028 return tint_symbol_2;
29}
30
dan sinclair6c167a02022-06-28 02:06:05 +000031void foo(tint_array<int4, 4> src_param, threadgroup tint_array<int4, 4>* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8) {
32 thread tint_array<int4, 4> tint_symbol_4 = {};
33 thread tint_array<int4, 4> tint_symbol_5 = {};
34 thread tint_array<tint_array<tint_array<int, 2>, 3>, 4> tint_symbol_9 = {};
Ben Claytonf47887d2022-06-24 17:01:59 +000035 tint_array<int4, 4> src_function = {};
36 tint_array<int4, 4> const tint_symbol_3 = tint_array<int4, 4>{int4(1), int4(2), int4(3), int4(3)};
dan sinclair6c167a02022-06-28 02:06:05 +000037 tint_symbol_4 = tint_symbol_3;
38 tint_symbol_4 = src_param;
39 tint_symbol_4 = ret_arr();
Ben Claytonf47887d2022-06-24 17:01:59 +000040 tint_array<int4, 4> const src_let = tint_array<int4, 4>{};
dan sinclair6c167a02022-06-28 02:06:05 +000041 tint_symbol_4 = src_let;
42 tint_symbol_4 = src_function;
43 tint_symbol_4 = tint_symbol_5;
44 tint_symbol_4 = *(tint_symbol_6);
Antonio Maiorano93baaae2022-03-15 15:35:13 +000045 S const tint_symbol = ret_struct_arr();
dan sinclair6c167a02022-06-28 02:06:05 +000046 tint_symbol_4 = tint_symbol.arr;
47 tint_symbol_4 = (*(tint_symbol_7)).arr;
48 tint_symbol_4 = (*(tint_symbol_8)).arr;
Ben Claytonf47887d2022-06-24 17:01:59 +000049 tint_array<tint_array<tint_array<int, 2>, 3>, 4> src_nested = {};
dan sinclair6c167a02022-06-28 02:06:05 +000050 tint_symbol_9 = src_nested;
David Neto1e19b552021-06-17 09:10:04 +000051}
52