blob: 7d9458b0cf41fb37e181517d44bcc90e08aba3c9 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct Inner {
int scalar_i32;
float scalar_f32;
half scalar_f16;
};
struct S {
float scalar_f32;
int scalar_i32;
uint scalar_u32;
half scalar_f16;
float2 vec2_f32;
int2 vec2_i32;
uint2 vec2_u32;
half2 vec2_f16;
float3 vec3_f32;
int3 vec3_i32;
uint3 vec3_u32;
half3 vec3_f16;
float4 vec4_f32;
int4 vec4_i32;
uint4 vec4_u32;
half4 vec4_f16;
float2x2 mat2x2_f32;
float2x3 mat2x3_f32;
float2x4 mat2x4_f32;
float3x2 mat3x2_f32;
float3x3 mat3x3_f32;
float3x4 mat3x4_f32;
float4x2 mat4x2_f32;
float4x3 mat4x3_f32;
float4x4 mat4x4_f32;
half2x2 mat2x2_f16;
half2x3 mat2x3_f16;
half2x4 mat2x4_f16;
half3x2 mat3x2_f16;
half3x3 mat3x3_f16;
half3x4 mat3x4_f16;
half4x2 mat4x2_f16;
half4x3 mat4x3_f16;
half4x4 mat4x4_f16;
tint_array<float3, 2> arr2_vec3_f32;
tint_array<half4x2, 2> arr2_mat4x2_f16;
Inner struct_inner;
tint_array<Inner, 4> array_struct_inner;
};
struct tint_module_vars_struct {
const constant S* ub;
device int* s;
};
int tint_f16_to_i32(half value) {
return select(2147483647, select((-2147483647 - 1), int(value), (value >= -65504.0h)), (value <= 65504.0h));
}
int tint_f32_to_i32(float value) {
return select(2147483647, select((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
kernel void tint_symbol(const constant S* ub [[buffer(0)]], device int* s [[buffer(1)]]) {
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.ub=ub, .s=s};
float const scalar_f32 = (*tint_module_vars.ub).scalar_f32;
int const scalar_i32 = (*tint_module_vars.ub).scalar_i32;
uint const scalar_u32 = (*tint_module_vars.ub).scalar_u32;
half const scalar_f16 = (*tint_module_vars.ub).scalar_f16;
float2 const vec2_f32 = (*tint_module_vars.ub).vec2_f32;
int2 const vec2_i32 = (*tint_module_vars.ub).vec2_i32;
uint2 const vec2_u32 = (*tint_module_vars.ub).vec2_u32;
half2 const vec2_f16 = (*tint_module_vars.ub).vec2_f16;
float3 const vec3_f32 = (*tint_module_vars.ub).vec3_f32;
int3 const vec3_i32 = (*tint_module_vars.ub).vec3_i32;
uint3 const vec3_u32 = (*tint_module_vars.ub).vec3_u32;
half3 const vec3_f16 = (*tint_module_vars.ub).vec3_f16;
float4 const vec4_f32 = (*tint_module_vars.ub).vec4_f32;
int4 const vec4_i32 = (*tint_module_vars.ub).vec4_i32;
uint4 const vec4_u32 = (*tint_module_vars.ub).vec4_u32;
half4 const vec4_f16 = (*tint_module_vars.ub).vec4_f16;
float2x2 const mat2x2_f32 = (*tint_module_vars.ub).mat2x2_f32;
float2x3 const mat2x3_f32 = (*tint_module_vars.ub).mat2x3_f32;
float2x4 const mat2x4_f32 = (*tint_module_vars.ub).mat2x4_f32;
float3x2 const mat3x2_f32 = (*tint_module_vars.ub).mat3x2_f32;
float3x3 const mat3x3_f32 = (*tint_module_vars.ub).mat3x3_f32;
float3x4 const mat3x4_f32 = (*tint_module_vars.ub).mat3x4_f32;
float4x2 const mat4x2_f32 = (*tint_module_vars.ub).mat4x2_f32;
float4x3 const mat4x3_f32 = (*tint_module_vars.ub).mat4x3_f32;
float4x4 const mat4x4_f32 = (*tint_module_vars.ub).mat4x4_f32;
half2x2 const mat2x2_f16 = (*tint_module_vars.ub).mat2x2_f16;
half2x3 const mat2x3_f16 = (*tint_module_vars.ub).mat2x3_f16;
half2x4 const mat2x4_f16 = (*tint_module_vars.ub).mat2x4_f16;
half3x2 const mat3x2_f16 = (*tint_module_vars.ub).mat3x2_f16;
half3x3 const mat3x3_f16 = (*tint_module_vars.ub).mat3x3_f16;
half3x4 const mat3x4_f16 = (*tint_module_vars.ub).mat3x4_f16;
half4x2 const mat4x2_f16 = (*tint_module_vars.ub).mat4x2_f16;
half4x3 const mat4x3_f16 = (*tint_module_vars.ub).mat4x3_f16;
half4x4 const mat4x4_f16 = (*tint_module_vars.ub).mat4x4_f16;
tint_array<float3, 2> const arr2_vec3_f32 = (*tint_module_vars.ub).arr2_vec3_f32;
tint_array<half4x2, 2> const arr2_mat4x2_f16 = (*tint_module_vars.ub).arr2_mat4x2_f16;
Inner const struct_inner = (*tint_module_vars.ub).struct_inner;
tint_array<Inner, 4> const array_struct_inner = (*tint_module_vars.ub).array_struct_inner;
int const v = (tint_f32_to_i32(scalar_f32) + scalar_i32);
int const v_1 = (v + int(scalar_u32));
int const v_2 = (v_1 + tint_f16_to_i32(scalar_f16));
int const v_3 = ((v_2 + tint_f32_to_i32(vec2_f32[0u])) + vec2_i32[0u]);
int const v_4 = (v_3 + int(vec2_u32[0u]));
int const v_5 = (v_4 + tint_f16_to_i32(vec2_f16[0u]));
int const v_6 = ((v_5 + tint_f32_to_i32(vec3_f32[1u])) + vec3_i32[1u]);
int const v_7 = (v_6 + int(vec3_u32[1u]));
int const v_8 = (v_7 + tint_f16_to_i32(vec3_f16[1u]));
int const v_9 = ((v_8 + tint_f32_to_i32(vec4_f32[2u])) + vec4_i32[2u]);
int const v_10 = (v_9 + int(vec4_u32[2u]));
int const v_11 = (v_10 + tint_f16_to_i32(vec4_f16[2u]));
int const v_12 = (v_11 + tint_f32_to_i32(mat2x2_f32[0][0u]));
int const v_13 = (v_12 + tint_f32_to_i32(mat2x3_f32[0][0u]));
int const v_14 = (v_13 + tint_f32_to_i32(mat2x4_f32[0][0u]));
int const v_15 = (v_14 + tint_f32_to_i32(mat3x2_f32[0][0u]));
int const v_16 = (v_15 + tint_f32_to_i32(mat3x3_f32[0][0u]));
int const v_17 = (v_16 + tint_f32_to_i32(mat3x4_f32[0][0u]));
int const v_18 = (v_17 + tint_f32_to_i32(mat4x2_f32[0][0u]));
int const v_19 = (v_18 + tint_f32_to_i32(mat4x3_f32[0][0u]));
int const v_20 = (v_19 + tint_f32_to_i32(mat4x4_f32[0][0u]));
int const v_21 = (v_20 + tint_f16_to_i32(mat2x2_f16[0][0u]));
int const v_22 = (v_21 + tint_f16_to_i32(mat2x3_f16[0][0u]));
int const v_23 = (v_22 + tint_f16_to_i32(mat2x4_f16[0][0u]));
int const v_24 = (v_23 + tint_f16_to_i32(mat3x2_f16[0][0u]));
int const v_25 = (v_24 + tint_f16_to_i32(mat3x3_f16[0][0u]));
int const v_26 = (v_25 + tint_f16_to_i32(mat3x4_f16[0][0u]));
int const v_27 = (v_26 + tint_f16_to_i32(mat4x2_f16[0][0u]));
int const v_28 = (v_27 + tint_f16_to_i32(mat4x3_f16[0][0u]));
int const v_29 = (v_28 + tint_f16_to_i32(mat4x4_f16[0][0u]));
int const v_30 = (v_29 + tint_f32_to_i32(arr2_vec3_f32[0][0u]));
(*tint_module_vars.s) = (((v_30 + tint_f16_to_i32(arr2_mat4x2_f16[0][0][0u])) + struct_inner.scalar_i32) + array_struct_inner[0].scalar_i32);
}