From 0fa81d282b41cd78cba461bc1092cdada5fabbd1 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 30 Mar 2023 19:31:59 +0200 Subject: [PATCH] add constructors test file --- tests/in/constructors.param.ron | 2 + tests/in/constructors.wgsl | 67 + tests/in/operators.wgsl | 50 - tests/out/glsl/constructors.main.Compute.glsl | 43 + tests/out/glsl/operators.main.Compute.glsl | 313 ++--- tests/out/hlsl/constructors.hlsl | 60 + tests/out/hlsl/constructors.hlsl.config | 3 + tests/out/hlsl/operators.hlsl | 332 ++--- tests/out/msl/constructors.msl | 50 + tests/out/msl/operators.msl | 320 ++--- tests/out/spv/constructors.spvasm | 97 ++ tests/out/spv/operators.spvasm | 1165 ++++++++--------- tests/out/wgsl/constructors.wgsl | 37 + tests/out/wgsl/operators.wgsl | 27 - tests/snapshots.rs | 4 + 15 files changed, 1346 insertions(+), 1224 deletions(-) create mode 100644 tests/in/constructors.param.ron create mode 100644 tests/in/constructors.wgsl create mode 100644 tests/out/glsl/constructors.main.Compute.glsl create mode 100644 tests/out/hlsl/constructors.hlsl create mode 100644 tests/out/hlsl/constructors.hlsl.config create mode 100644 tests/out/msl/constructors.msl create mode 100644 tests/out/spv/constructors.spvasm create mode 100644 tests/out/wgsl/constructors.wgsl diff --git a/tests/in/constructors.param.ron b/tests/in/constructors.param.ron new file mode 100644 index 0000000000..72873dd667 --- /dev/null +++ b/tests/in/constructors.param.ron @@ -0,0 +1,2 @@ +( +) diff --git a/tests/in/constructors.wgsl b/tests/in/constructors.wgsl new file mode 100644 index 0000000000..cb3d19cefd --- /dev/null +++ b/tests/in/constructors.wgsl @@ -0,0 +1,67 @@ +struct Foo { + a: vec4, + b: i32, +} + +// const const1 = vec3(0.0); // TODO: this is now a splat and we need to const eval it +const const2 = vec3(0.0, 0.0, 0.0); +const const3 = mat2x2(0.0, 0.0, 0.0, 0.0); +const const4 = array, 1>(mat2x2(0.0, 0.0, 0.0, 0.0)); + +// zero value constructors +const cz0 = bool(); +const cz1 = i32(); +const cz2 = u32(); +const cz3 = f32(); +const cz4 = vec2(); +const cz5 = mat2x2(); +const cz6 = array(); +const cz7 = Foo(); + +// constructors that infer their type from their parameters +// TODO: these also contain splats +// const cp1 = vec2(0u); +// const cp2 = mat2x2(vec2(0.), vec2(0.)); +const cp3 = array(0, 1, 2, 3); + +@compute @workgroup_size(1) +fn main() { + var foo: Foo; + foo = Foo(vec4(1.0), 1); + + _ = mat2x2( + 1.0, 0.0, + 0.0, 1.0, + ); + _ = mat4x4( + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0, + ); + + // zero value constructors + _ = bool(); + _ = i32(); + _ = u32(); + _ = f32(); + _ = vec2(); + _ = mat2x2(); + _ = array(); + _ = Foo(); + + // constructors that infer their type from their parameters + _ = vec2(0u); + _ = mat2x2(vec2(0.), vec2(0.)); + _ = array(0, 1, 2, 3); + + // identity constructors + _ = bool(bool()); + _ = i32(i32()); + _ = u32(u32()); + _ = f32(f32()); + _ = vec2(vec2()); + _ = mat2x3(mat2x3()); + _ = vec2(vec2()); + _ = mat2x3(mat2x3()); +} diff --git a/tests/in/operators.wgsl b/tests/in/operators.wgsl index eadafbdc11..acc1508e96 100644 --- a/tests/in/operators.wgsl +++ b/tests/in/operators.wgsl @@ -1,4 +1,3 @@ -//TODO: support splatting constructors for globals? const v_f32_one = vec4(1.0, 1.0, 1.0, 1.0); const v_f32_zero = vec4(0.0, 0.0, 0.0, 0.0); const v_f32_half = vec4(0.5, 0.5, 0.5, 0.5); @@ -41,54 +40,6 @@ fn bool_cast(x: vec3) -> vec3 { return vec3(y); } -struct Foo { - a: vec4, - b: i32, -} - -fn constructors() -> f32 { - var foo: Foo; - foo = Foo(vec4(1.0), 1); - - let mat2comp = mat2x2( - 1.0, 0.0, - 0.0, 1.0, - ); - let mat4comp = mat4x4( - 1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0, - ); - - // zero value constructors - _ = bool(); - _ = i32(); - _ = u32(); - _ = f32(); - _ = vec2(); - _ = mat2x2(); - _ = array(); - _ = Foo(); - - // constructors that infer their type from their parameters - _ = vec2(0u); - _ = mat2x2(vec2(0.), vec2(0.)); - _ = array(0, 1, 2, 3); - - // identity constructors - _ = bool(bool()); - _ = i32(i32()); - _ = u32(u32()); - _ = f32(f32()); - _ = vec2(vec2()); - _ = mat2x3(mat2x3()); - _ = vec2(vec2()); - _ = mat2x3(mat2x3()); - - return foo.a.x; -} - fn logical() { // unary _ = !true; @@ -304,7 +255,6 @@ fn main() { _ = builtins(); _ = splat(); _ = bool_cast(v_f32_one.xyz); - _ = constructors(); logical(); arithmetic(); diff --git a/tests/out/glsl/constructors.main.Compute.glsl b/tests/out/glsl/constructors.main.Compute.glsl new file mode 100644 index 0000000000..119d3a1efa --- /dev/null +++ b/tests/out/glsl/constructors.main.Compute.glsl @@ -0,0 +1,43 @@ +#version 310 es + +precision highp float; +precision highp int; + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +const vec3 const2_ = vec3(0.0, 0.0, 0.0); +const mat2x2 const3_ = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); +const mat2x2 const4_ = mat2x2[1](mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0))); +const bool cz0_ = false; +const int cz1_ = 0; +const uint cz2_ = 0u; +const float cz3_ = 0.0; +const uvec2 cz4_ = uvec2(0u); +const mat2x2 cz5_ = mat2x2(0.0); +const Foo cz6_ = Foo[3](Foo(vec4(0.0), 0), Foo(vec4(0.0), 0), Foo(vec4(0.0), 0)); +const Foo cz7_ = Foo(vec4(0.0), 0); +const int cp3_ = int[4](0, 1, 2, 3); + +struct Foo { + vec4 a; + int b; +}; + +void main() { + Foo foo = Foo(vec4(0.0), 0); + foo = Foo(vec4(1.0), 1); + mat2x2 unnamed = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + mat4x4 unnamed_1 = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + uvec2 unnamed_2 = uvec2(0u); + mat2x2 unnamed_3 = mat2x2(vec2(0.0), vec2(0.0)); + int unnamed_4[4] = int[4](0, 1, 2, 3); + bool unnamed_5 = bool(false); + int unnamed_6 = int(0); + uint unnamed_7 = uint(0u); + float unnamed_8 = float(0.0); + uvec2 unnamed_9 = uvec2(uvec2(0u)); + mat2x3 unnamed_10 = mat2x3(mat2x3(0.0)); + uvec2 unnamed_11 = uvec2(0u); + mat2x3 unnamed_12 = mat2x3(0.0); +} + diff --git a/tests/out/glsl/operators.main.Compute.glsl b/tests/out/glsl/operators.main.Compute.glsl index 1986158838..efb09167e0 100644 --- a/tests/out/glsl/operators.main.Compute.glsl +++ b/tests/out/glsl/operators.main.Compute.glsl @@ -10,10 +10,6 @@ const vec4 v_f32_zero = vec4(0.0, 0.0, 0.0, 0.0); const vec4 v_f32_half = vec4(0.5, 0.5, 0.5, 0.5); const ivec4 v_i32_one = ivec4(1, 1, 1, 1); -struct Foo { - vec4 a; - int b; -}; vec4 builtins() { int s1_ = (true ? 1 : 0); @@ -51,173 +47,153 @@ vec3 bool_cast(vec3 x) { return vec3(y); } -float constructors() { - Foo foo = Foo(vec4(0.0), 0); - foo = Foo(vec4(1.0), 1); - mat2x2 mat2comp = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - mat4x4 mat4comp = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); - uvec2 unnamed = uvec2(0u); - mat2x2 unnamed_1 = mat2x2(vec2(0.0), vec2(0.0)); - int unnamed_2[4] = int[4](0, 1, 2, 3); - bool unnamed_3 = bool(false); - int unnamed_4 = int(0); - uint unnamed_5 = uint(0u); - float unnamed_6 = float(0.0); - uvec2 unnamed_7 = uvec2(uvec2(0u)); - mat2x3 unnamed_8 = mat2x3(mat2x3(0.0)); - uvec2 unnamed_9 = uvec2(0u); - mat2x3 unnamed_10 = mat2x3(0.0); - float _e71 = foo.a.x; - return _e71; -} - void logical() { - bool unnamed_11 = !(true); - bvec2 unnamed_12 = not(bvec2(true)); - bool unnamed_13 = (true || false); - bool unnamed_14 = (true && false); - bool unnamed_15 = (true || false); - bvec3 unnamed_16 = bvec3(bvec3(true).x || bvec3(false).x, bvec3(true).y || bvec3(false).y, bvec3(true).z || bvec3(false).z); - bool unnamed_17 = (true && false); - bvec4 unnamed_18 = bvec4(bvec4(true).x && bvec4(false).x, bvec4(true).y && bvec4(false).y, bvec4(true).z && bvec4(false).z, bvec4(true).w && bvec4(false).w); + bool unnamed = !(true); + bvec2 unnamed_1 = not(bvec2(true)); + bool unnamed_2 = (true || false); + bool unnamed_3 = (true && false); + bool unnamed_4 = (true || false); + bvec3 unnamed_5 = bvec3(bvec3(true).x || bvec3(false).x, bvec3(true).y || bvec3(false).y, bvec3(true).z || bvec3(false).z); + bool unnamed_6 = (true && false); + bvec4 unnamed_7 = bvec4(bvec4(true).x && bvec4(false).x, bvec4(true).y && bvec4(false).y, bvec4(true).z && bvec4(false).z, bvec4(true).w && bvec4(false).w); } void arithmetic() { - ivec2 unnamed_19 = -(ivec2(1)); - vec2 unnamed_20 = -(vec2(1.0)); - int unnamed_21 = (2 + 1); - uint unnamed_22 = (2u + 1u); - float unnamed_23 = (2.0 + 1.0); - ivec2 unnamed_24 = (ivec2(2) + ivec2(1)); - uvec3 unnamed_25 = (uvec3(2u) + uvec3(1u)); - vec4 unnamed_26 = (vec4(2.0) + vec4(1.0)); - int unnamed_27 = (2 - 1); - uint unnamed_28 = (2u - 1u); - float unnamed_29 = (2.0 - 1.0); - ivec2 unnamed_30 = (ivec2(2) - ivec2(1)); - uvec3 unnamed_31 = (uvec3(2u) - uvec3(1u)); - vec4 unnamed_32 = (vec4(2.0) - vec4(1.0)); - int unnamed_33 = (2 * 1); - uint unnamed_34 = (2u * 1u); - float unnamed_35 = (2.0 * 1.0); - ivec2 unnamed_36 = (ivec2(2) * ivec2(1)); - uvec3 unnamed_37 = (uvec3(2u) * uvec3(1u)); - vec4 unnamed_38 = (vec4(2.0) * vec4(1.0)); - int unnamed_39 = (2 / 1); - uint unnamed_40 = (2u / 1u); - float unnamed_41 = (2.0 / 1.0); - ivec2 unnamed_42 = (ivec2(2) / ivec2(1)); - uvec3 unnamed_43 = (uvec3(2u) / uvec3(1u)); - vec4 unnamed_44 = (vec4(2.0) / vec4(1.0)); - int unnamed_45 = (2 % 1); - uint unnamed_46 = (2u % 1u); - float unnamed_47 = (2.0 - 1.0 * trunc(2.0 / 1.0)); - ivec2 unnamed_48 = (ivec2(2) % ivec2(1)); - uvec3 unnamed_49 = (uvec3(2u) % uvec3(1u)); - vec4 unnamed_50 = (vec4(2.0) - vec4(1.0) * trunc(vec4(2.0) / vec4(1.0))); - ivec2 unnamed_51 = (ivec2(2) + ivec2(1)); - ivec2 unnamed_52 = (ivec2(2) + ivec2(1)); - uvec2 unnamed_53 = (uvec2(2u) + uvec2(1u)); - uvec2 unnamed_54 = (uvec2(2u) + uvec2(1u)); - vec2 unnamed_55 = (vec2(2.0) + vec2(1.0)); - vec2 unnamed_56 = (vec2(2.0) + vec2(1.0)); - ivec2 unnamed_57 = (ivec2(2) - ivec2(1)); - ivec2 unnamed_58 = (ivec2(2) - ivec2(1)); - uvec2 unnamed_59 = (uvec2(2u) - uvec2(1u)); - uvec2 unnamed_60 = (uvec2(2u) - uvec2(1u)); - vec2 unnamed_61 = (vec2(2.0) - vec2(1.0)); - vec2 unnamed_62 = (vec2(2.0) - vec2(1.0)); - ivec2 unnamed_63 = (ivec2(2) * 1); - ivec2 unnamed_64 = (2 * ivec2(1)); - uvec2 unnamed_65 = (uvec2(2u) * 1u); - uvec2 unnamed_66 = (2u * uvec2(1u)); - vec2 unnamed_67 = (vec2(2.0) * 1.0); - vec2 unnamed_68 = (2.0 * vec2(1.0)); - ivec2 unnamed_69 = (ivec2(2) / ivec2(1)); - ivec2 unnamed_70 = (ivec2(2) / ivec2(1)); - uvec2 unnamed_71 = (uvec2(2u) / uvec2(1u)); - uvec2 unnamed_72 = (uvec2(2u) / uvec2(1u)); - vec2 unnamed_73 = (vec2(2.0) / vec2(1.0)); - vec2 unnamed_74 = (vec2(2.0) / vec2(1.0)); - ivec2 unnamed_75 = (ivec2(2) % ivec2(1)); - ivec2 unnamed_76 = (ivec2(2) % ivec2(1)); - uvec2 unnamed_77 = (uvec2(2u) % uvec2(1u)); - uvec2 unnamed_78 = (uvec2(2u) % uvec2(1u)); - vec2 unnamed_79 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); - vec2 unnamed_80 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); - mat3x3 unnamed_81 = (mat3x3(0.0) + mat3x3(0.0)); - mat3x3 unnamed_82 = (mat3x3(0.0) - mat3x3(0.0)); - mat3x3 unnamed_83 = (mat3x3(0.0) * 1.0); - mat3x3 unnamed_84 = (2.0 * mat3x3(0.0)); - vec3 unnamed_85 = (mat4x3(0.0) * vec4(1.0)); - vec4 unnamed_86 = (vec3(2.0) * mat4x3(0.0)); - mat3x3 unnamed_87 = (mat4x3(0.0) * mat3x4(0.0)); + ivec2 unnamed_8 = -(ivec2(1)); + vec2 unnamed_9 = -(vec2(1.0)); + int unnamed_10 = (2 + 1); + uint unnamed_11 = (2u + 1u); + float unnamed_12 = (2.0 + 1.0); + ivec2 unnamed_13 = (ivec2(2) + ivec2(1)); + uvec3 unnamed_14 = (uvec3(2u) + uvec3(1u)); + vec4 unnamed_15 = (vec4(2.0) + vec4(1.0)); + int unnamed_16 = (2 - 1); + uint unnamed_17 = (2u - 1u); + float unnamed_18 = (2.0 - 1.0); + ivec2 unnamed_19 = (ivec2(2) - ivec2(1)); + uvec3 unnamed_20 = (uvec3(2u) - uvec3(1u)); + vec4 unnamed_21 = (vec4(2.0) - vec4(1.0)); + int unnamed_22 = (2 * 1); + uint unnamed_23 = (2u * 1u); + float unnamed_24 = (2.0 * 1.0); + ivec2 unnamed_25 = (ivec2(2) * ivec2(1)); + uvec3 unnamed_26 = (uvec3(2u) * uvec3(1u)); + vec4 unnamed_27 = (vec4(2.0) * vec4(1.0)); + int unnamed_28 = (2 / 1); + uint unnamed_29 = (2u / 1u); + float unnamed_30 = (2.0 / 1.0); + ivec2 unnamed_31 = (ivec2(2) / ivec2(1)); + uvec3 unnamed_32 = (uvec3(2u) / uvec3(1u)); + vec4 unnamed_33 = (vec4(2.0) / vec4(1.0)); + int unnamed_34 = (2 % 1); + uint unnamed_35 = (2u % 1u); + float unnamed_36 = (2.0 - 1.0 * trunc(2.0 / 1.0)); + ivec2 unnamed_37 = (ivec2(2) % ivec2(1)); + uvec3 unnamed_38 = (uvec3(2u) % uvec3(1u)); + vec4 unnamed_39 = (vec4(2.0) - vec4(1.0) * trunc(vec4(2.0) / vec4(1.0))); + ivec2 unnamed_40 = (ivec2(2) + ivec2(1)); + ivec2 unnamed_41 = (ivec2(2) + ivec2(1)); + uvec2 unnamed_42 = (uvec2(2u) + uvec2(1u)); + uvec2 unnamed_43 = (uvec2(2u) + uvec2(1u)); + vec2 unnamed_44 = (vec2(2.0) + vec2(1.0)); + vec2 unnamed_45 = (vec2(2.0) + vec2(1.0)); + ivec2 unnamed_46 = (ivec2(2) - ivec2(1)); + ivec2 unnamed_47 = (ivec2(2) - ivec2(1)); + uvec2 unnamed_48 = (uvec2(2u) - uvec2(1u)); + uvec2 unnamed_49 = (uvec2(2u) - uvec2(1u)); + vec2 unnamed_50 = (vec2(2.0) - vec2(1.0)); + vec2 unnamed_51 = (vec2(2.0) - vec2(1.0)); + ivec2 unnamed_52 = (ivec2(2) * 1); + ivec2 unnamed_53 = (2 * ivec2(1)); + uvec2 unnamed_54 = (uvec2(2u) * 1u); + uvec2 unnamed_55 = (2u * uvec2(1u)); + vec2 unnamed_56 = (vec2(2.0) * 1.0); + vec2 unnamed_57 = (2.0 * vec2(1.0)); + ivec2 unnamed_58 = (ivec2(2) / ivec2(1)); + ivec2 unnamed_59 = (ivec2(2) / ivec2(1)); + uvec2 unnamed_60 = (uvec2(2u) / uvec2(1u)); + uvec2 unnamed_61 = (uvec2(2u) / uvec2(1u)); + vec2 unnamed_62 = (vec2(2.0) / vec2(1.0)); + vec2 unnamed_63 = (vec2(2.0) / vec2(1.0)); + ivec2 unnamed_64 = (ivec2(2) % ivec2(1)); + ivec2 unnamed_65 = (ivec2(2) % ivec2(1)); + uvec2 unnamed_66 = (uvec2(2u) % uvec2(1u)); + uvec2 unnamed_67 = (uvec2(2u) % uvec2(1u)); + vec2 unnamed_68 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); + vec2 unnamed_69 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); + mat3x3 unnamed_70 = (mat3x3(0.0) + mat3x3(0.0)); + mat3x3 unnamed_71 = (mat3x3(0.0) - mat3x3(0.0)); + mat3x3 unnamed_72 = (mat3x3(0.0) * 1.0); + mat3x3 unnamed_73 = (2.0 * mat3x3(0.0)); + vec3 unnamed_74 = (mat4x3(0.0) * vec4(1.0)); + vec4 unnamed_75 = (vec3(2.0) * mat4x3(0.0)); + mat3x3 unnamed_76 = (mat4x3(0.0) * mat3x4(0.0)); } void bit() { - int unnamed_88 = ~(1); - uint unnamed_89 = ~(1u); - ivec2 unnamed_90 = ~(ivec2(1)); - uvec3 unnamed_91 = ~(uvec3(1u)); - int unnamed_92 = (2 | 1); - uint unnamed_93 = (2u | 1u); - ivec2 unnamed_94 = (ivec2(2) | ivec2(1)); - uvec3 unnamed_95 = (uvec3(2u) | uvec3(1u)); - int unnamed_96 = (2 & 1); - uint unnamed_97 = (2u & 1u); - ivec2 unnamed_98 = (ivec2(2) & ivec2(1)); - uvec3 unnamed_99 = (uvec3(2u) & uvec3(1u)); - int unnamed_100 = (2 ^ 1); - uint unnamed_101 = (2u ^ 1u); - ivec2 unnamed_102 = (ivec2(2) ^ ivec2(1)); - uvec3 unnamed_103 = (uvec3(2u) ^ uvec3(1u)); - int unnamed_104 = (2 << 1u); - uint unnamed_105 = (2u << 1u); - ivec2 unnamed_106 = (ivec2(2) << uvec2(1u)); - uvec3 unnamed_107 = (uvec3(2u) << uvec3(1u)); - int unnamed_108 = (2 >> 1u); - uint unnamed_109 = (2u >> 1u); - ivec2 unnamed_110 = (ivec2(2) >> uvec2(1u)); - uvec3 unnamed_111 = (uvec3(2u) >> uvec3(1u)); + int unnamed_77 = ~(1); + uint unnamed_78 = ~(1u); + ivec2 unnamed_79 = ~(ivec2(1)); + uvec3 unnamed_80 = ~(uvec3(1u)); + int unnamed_81 = (2 | 1); + uint unnamed_82 = (2u | 1u); + ivec2 unnamed_83 = (ivec2(2) | ivec2(1)); + uvec3 unnamed_84 = (uvec3(2u) | uvec3(1u)); + int unnamed_85 = (2 & 1); + uint unnamed_86 = (2u & 1u); + ivec2 unnamed_87 = (ivec2(2) & ivec2(1)); + uvec3 unnamed_88 = (uvec3(2u) & uvec3(1u)); + int unnamed_89 = (2 ^ 1); + uint unnamed_90 = (2u ^ 1u); + ivec2 unnamed_91 = (ivec2(2) ^ ivec2(1)); + uvec3 unnamed_92 = (uvec3(2u) ^ uvec3(1u)); + int unnamed_93 = (2 << 1u); + uint unnamed_94 = (2u << 1u); + ivec2 unnamed_95 = (ivec2(2) << uvec2(1u)); + uvec3 unnamed_96 = (uvec3(2u) << uvec3(1u)); + int unnamed_97 = (2 >> 1u); + uint unnamed_98 = (2u >> 1u); + ivec2 unnamed_99 = (ivec2(2) >> uvec2(1u)); + uvec3 unnamed_100 = (uvec3(2u) >> uvec3(1u)); } void comparison() { - bool unnamed_112 = (2 == 1); - bool unnamed_113 = (2u == 1u); - bool unnamed_114 = (2.0 == 1.0); - bvec2 unnamed_115 = equal(ivec2(2), ivec2(1)); - bvec3 unnamed_116 = equal(uvec3(2u), uvec3(1u)); - bvec4 unnamed_117 = equal(vec4(2.0), vec4(1.0)); - bool unnamed_118 = (2 != 1); - bool unnamed_119 = (2u != 1u); - bool unnamed_120 = (2.0 != 1.0); - bvec2 unnamed_121 = notEqual(ivec2(2), ivec2(1)); - bvec3 unnamed_122 = notEqual(uvec3(2u), uvec3(1u)); - bvec4 unnamed_123 = notEqual(vec4(2.0), vec4(1.0)); - bool unnamed_124 = (2 < 1); - bool unnamed_125 = (2u < 1u); - bool unnamed_126 = (2.0 < 1.0); - bvec2 unnamed_127 = lessThan(ivec2(2), ivec2(1)); - bvec3 unnamed_128 = lessThan(uvec3(2u), uvec3(1u)); - bvec4 unnamed_129 = lessThan(vec4(2.0), vec4(1.0)); - bool unnamed_130 = (2 <= 1); - bool unnamed_131 = (2u <= 1u); - bool unnamed_132 = (2.0 <= 1.0); - bvec2 unnamed_133 = lessThanEqual(ivec2(2), ivec2(1)); - bvec3 unnamed_134 = lessThanEqual(uvec3(2u), uvec3(1u)); - bvec4 unnamed_135 = lessThanEqual(vec4(2.0), vec4(1.0)); - bool unnamed_136 = (2 > 1); - bool unnamed_137 = (2u > 1u); - bool unnamed_138 = (2.0 > 1.0); - bvec2 unnamed_139 = greaterThan(ivec2(2), ivec2(1)); - bvec3 unnamed_140 = greaterThan(uvec3(2u), uvec3(1u)); - bvec4 unnamed_141 = greaterThan(vec4(2.0), vec4(1.0)); - bool unnamed_142 = (2 >= 1); - bool unnamed_143 = (2u >= 1u); - bool unnamed_144 = (2.0 >= 1.0); - bvec2 unnamed_145 = greaterThanEqual(ivec2(2), ivec2(1)); - bvec3 unnamed_146 = greaterThanEqual(uvec3(2u), uvec3(1u)); - bvec4 unnamed_147 = greaterThanEqual(vec4(2.0), vec4(1.0)); + bool unnamed_101 = (2 == 1); + bool unnamed_102 = (2u == 1u); + bool unnamed_103 = (2.0 == 1.0); + bvec2 unnamed_104 = equal(ivec2(2), ivec2(1)); + bvec3 unnamed_105 = equal(uvec3(2u), uvec3(1u)); + bvec4 unnamed_106 = equal(vec4(2.0), vec4(1.0)); + bool unnamed_107 = (2 != 1); + bool unnamed_108 = (2u != 1u); + bool unnamed_109 = (2.0 != 1.0); + bvec2 unnamed_110 = notEqual(ivec2(2), ivec2(1)); + bvec3 unnamed_111 = notEqual(uvec3(2u), uvec3(1u)); + bvec4 unnamed_112 = notEqual(vec4(2.0), vec4(1.0)); + bool unnamed_113 = (2 < 1); + bool unnamed_114 = (2u < 1u); + bool unnamed_115 = (2.0 < 1.0); + bvec2 unnamed_116 = lessThan(ivec2(2), ivec2(1)); + bvec3 unnamed_117 = lessThan(uvec3(2u), uvec3(1u)); + bvec4 unnamed_118 = lessThan(vec4(2.0), vec4(1.0)); + bool unnamed_119 = (2 <= 1); + bool unnamed_120 = (2u <= 1u); + bool unnamed_121 = (2.0 <= 1.0); + bvec2 unnamed_122 = lessThanEqual(ivec2(2), ivec2(1)); + bvec3 unnamed_123 = lessThanEqual(uvec3(2u), uvec3(1u)); + bvec4 unnamed_124 = lessThanEqual(vec4(2.0), vec4(1.0)); + bool unnamed_125 = (2 > 1); + bool unnamed_126 = (2u > 1u); + bool unnamed_127 = (2.0 > 1.0); + bvec2 unnamed_128 = greaterThan(ivec2(2), ivec2(1)); + bvec3 unnamed_129 = greaterThan(uvec3(2u), uvec3(1u)); + bvec4 unnamed_130 = greaterThan(vec4(2.0), vec4(1.0)); + bool unnamed_131 = (2 >= 1); + bool unnamed_132 = (2u >= 1u); + bool unnamed_133 = (2.0 >= 1.0); + bvec2 unnamed_134 = greaterThanEqual(ivec2(2), ivec2(1)); + bvec3 unnamed_135 = greaterThanEqual(uvec3(2u), uvec3(1u)); + bvec4 unnamed_136 = greaterThanEqual(vec4(2.0), vec4(1.0)); } void assignment() { @@ -259,20 +235,19 @@ void assignment() { } void negation_avoids_prefix_decrement() { - int unnamed_148 = -(-2); - int unnamed_149 = -(-3); - int unnamed_150 = -(-(4)); - int unnamed_151 = -(-(-5)); - int unnamed_152 = -(-(-(-(6)))); - int unnamed_153 = -(-(-(-(-7)))); - int unnamed_154 = -(-(-(-(-8)))); + int unnamed_137 = -(-2); + int unnamed_138 = -(-3); + int unnamed_139 = -(-(4)); + int unnamed_140 = -(-(-5)); + int unnamed_141 = -(-(-(-(6)))); + int unnamed_142 = -(-(-(-(-7)))); + int unnamed_143 = -(-(-(-(-8)))); } void main() { vec4 _e0 = builtins(); vec4 _e1 = splat(); vec3 _e4 = bool_cast(v_f32_one.xyz); - float _e5 = constructors(); logical(); arithmetic(); bit(); diff --git a/tests/out/hlsl/constructors.hlsl b/tests/out/hlsl/constructors.hlsl new file mode 100644 index 0000000000..2b6c467ceb --- /dev/null +++ b/tests/out/hlsl/constructors.hlsl @@ -0,0 +1,60 @@ +struct Foo { + float4 a; + int b; + int _end_pad_0; + int _end_pad_1; + int _end_pad_2; +}; + +typedef float2x2 ret_Constructarray1_float2x2_[1]; +ret_Constructarray1_float2x2_ Constructarray1_float2x2_(float2x2 arg0) { + float2x2 ret[1] = { arg0 }; + return ret; +} + +typedef int ret_Constructarray4_int_[4]; +ret_Constructarray4_int_ Constructarray4_int_(int arg0, int arg1, int arg2, int arg3) { + int ret[4] = { arg0, arg1, arg2, arg3 }; + return ret; +} + +static const float3 const2_ = float3(0.0, 0.0, 0.0); +static const float2x2 const3_ = float2x2(float2(0.0, 0.0), float2(0.0, 0.0)); +static const float2x2 const4_[1] = Constructarray1_float2x2_(float2x2(float2(0.0, 0.0), float2(0.0, 0.0))); +static const bool cz0_ = (bool)0; +static const int cz1_ = (int)0; +static const uint cz2_ = (uint)0; +static const float cz3_ = (float)0; +static const uint2 cz4_ = (uint2)0; +static const float2x2 cz5_ = (float2x2)0; +static const Foo cz6_[3] = (Foo[3])0; +static const Foo cz7_ = (Foo)0; +static const int cp3_[4] = Constructarray4_int_(0, 1, 2, 3); + +Foo ConstructFoo(float4 arg0, int arg1) { + Foo ret = (Foo)0; + ret.a = arg0; + ret.b = arg1; + return ret; +} + +[numthreads(1, 1, 1)] +void main() +{ + Foo foo = (Foo)0; + + foo = ConstructFoo((1.0).xxxx, 1); + float2x2 unnamed = float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); + float4x4 unnamed_1 = float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)); + uint2 unnamed_2 = (0u).xx; + float2x2 unnamed_3 = float2x2((0.0).xx, (0.0).xx); + int unnamed_4[4] = Constructarray4_int_(0, 1, 2, 3); + bool unnamed_5 = bool((bool)0); + int unnamed_6 = int((int)0); + uint unnamed_7 = uint((uint)0); + float unnamed_8 = float((float)0); + uint2 unnamed_9 = uint2((uint2)0); + float2x3 unnamed_10 = float2x3((float2x3)0); + uint2 unnamed_11 = asuint((uint2)0); + float2x3 unnamed_12 = asfloat((float2x3)0); +} diff --git a/tests/out/hlsl/constructors.hlsl.config b/tests/out/hlsl/constructors.hlsl.config new file mode 100644 index 0000000000..246c485cf7 --- /dev/null +++ b/tests/out/hlsl/constructors.hlsl.config @@ -0,0 +1,3 @@ +vertex=() +fragment=() +compute=(main:cs_5_1 ) diff --git a/tests/out/hlsl/operators.hlsl b/tests/out/hlsl/operators.hlsl index e924ec6115..6f0a41ff60 100644 --- a/tests/out/hlsl/operators.hlsl +++ b/tests/out/hlsl/operators.hlsl @@ -1,11 +1,3 @@ -struct Foo { - float4 a; - int b; - int _end_pad_0; - int _end_pad_1; - int _end_pad_2; -}; - static const float4 v_f32_one = float4(1.0, 1.0, 1.0, 1.0); static const float4 v_f32_zero = float4(0.0, 0.0, 0.0, 0.0); static const float4 v_f32_half = float4(0.5, 0.5, 0.5, 0.5); @@ -52,192 +44,157 @@ float3 bool_cast(float3 x) return float3(y); } -Foo ConstructFoo(float4 arg0, int arg1) { - Foo ret = (Foo)0; - ret.a = arg0; - ret.b = arg1; - return ret; -} - -typedef int ret_Constructarray4_int_[4]; -ret_Constructarray4_int_ Constructarray4_int_(int arg0, int arg1, int arg2, int arg3) { - int ret[4] = { arg0, arg1, arg2, arg3 }; - return ret; -} - -float constructors() -{ - Foo foo = (Foo)0; - - foo = ConstructFoo((1.0).xxxx, 1); - float2x2 mat2comp = float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); - float4x4 mat4comp = float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)); - uint2 unnamed = (0u).xx; - float2x2 unnamed_1 = float2x2((0.0).xx, (0.0).xx); - int unnamed_2[4] = Constructarray4_int_(0, 1, 2, 3); - bool unnamed_3 = bool((bool)0); - int unnamed_4 = int((int)0); - uint unnamed_5 = uint((uint)0); - float unnamed_6 = float((float)0); - uint2 unnamed_7 = uint2((uint2)0); - float2x3 unnamed_8 = float2x3((float2x3)0); - uint2 unnamed_9 = asuint((uint2)0); - float2x3 unnamed_10 = asfloat((float2x3)0); - float _expr71 = foo.a.x; - return _expr71; -} - void logical() { - bool unnamed_11 = !(true); - bool2 unnamed_12 = !((true).xx); - bool unnamed_13 = (true || false); - bool unnamed_14 = (true && false); - bool unnamed_15 = (true | false); - bool3 unnamed_16 = ((true).xxx | (false).xxx); - bool unnamed_17 = (true & false); - bool4 unnamed_18 = ((true).xxxx & (false).xxxx); + bool unnamed = !(true); + bool2 unnamed_1 = !((true).xx); + bool unnamed_2 = (true || false); + bool unnamed_3 = (true && false); + bool unnamed_4 = (true | false); + bool3 unnamed_5 = ((true).xxx | (false).xxx); + bool unnamed_6 = (true & false); + bool4 unnamed_7 = ((true).xxxx & (false).xxxx); } void arithmetic() { - int2 unnamed_19 = -((1).xx); - float2 unnamed_20 = -((1.0).xx); - int unnamed_21 = (2 + 1); - uint unnamed_22 = (2u + 1u); - float unnamed_23 = (2.0 + 1.0); - int2 unnamed_24 = ((2).xx + (1).xx); - uint3 unnamed_25 = ((2u).xxx + (1u).xxx); - float4 unnamed_26 = ((2.0).xxxx + (1.0).xxxx); - int unnamed_27 = (2 - 1); - uint unnamed_28 = (2u - 1u); - float unnamed_29 = (2.0 - 1.0); - int2 unnamed_30 = ((2).xx - (1).xx); - uint3 unnamed_31 = ((2u).xxx - (1u).xxx); - float4 unnamed_32 = ((2.0).xxxx - (1.0).xxxx); - int unnamed_33 = (2 * 1); - uint unnamed_34 = (2u * 1u); - float unnamed_35 = (2.0 * 1.0); - int2 unnamed_36 = ((2).xx * (1).xx); - uint3 unnamed_37 = ((2u).xxx * (1u).xxx); - float4 unnamed_38 = ((2.0).xxxx * (1.0).xxxx); - int unnamed_39 = (2 / 1); - uint unnamed_40 = (2u / 1u); - float unnamed_41 = (2.0 / 1.0); - int2 unnamed_42 = ((2).xx / (1).xx); - uint3 unnamed_43 = ((2u).xxx / (1u).xxx); - float4 unnamed_44 = ((2.0).xxxx / (1.0).xxxx); - int unnamed_45 = (2 % 1); - uint unnamed_46 = (2u % 1u); - float unnamed_47 = fmod(2.0, 1.0); - int2 unnamed_48 = ((2).xx % (1).xx); - uint3 unnamed_49 = ((2u).xxx % (1u).xxx); - float4 unnamed_50 = fmod((2.0).xxxx, (1.0).xxxx); - int2 unnamed_51 = ((2).xx + (1).xx); - int2 unnamed_52 = ((2).xx + (1).xx); - uint2 unnamed_53 = ((2u).xx + (1u).xx); - uint2 unnamed_54 = ((2u).xx + (1u).xx); - float2 unnamed_55 = ((2.0).xx + (1.0).xx); - float2 unnamed_56 = ((2.0).xx + (1.0).xx); - int2 unnamed_57 = ((2).xx - (1).xx); - int2 unnamed_58 = ((2).xx - (1).xx); - uint2 unnamed_59 = ((2u).xx - (1u).xx); - uint2 unnamed_60 = ((2u).xx - (1u).xx); - float2 unnamed_61 = ((2.0).xx - (1.0).xx); - float2 unnamed_62 = ((2.0).xx - (1.0).xx); - int2 unnamed_63 = ((2).xx * 1); - int2 unnamed_64 = (2 * (1).xx); - uint2 unnamed_65 = ((2u).xx * 1u); - uint2 unnamed_66 = (2u * (1u).xx); - float2 unnamed_67 = ((2.0).xx * 1.0); - float2 unnamed_68 = (2.0 * (1.0).xx); - int2 unnamed_69 = ((2).xx / (1).xx); - int2 unnamed_70 = ((2).xx / (1).xx); - uint2 unnamed_71 = ((2u).xx / (1u).xx); - uint2 unnamed_72 = ((2u).xx / (1u).xx); - float2 unnamed_73 = ((2.0).xx / (1.0).xx); - float2 unnamed_74 = ((2.0).xx / (1.0).xx); - int2 unnamed_75 = ((2).xx % (1).xx); - int2 unnamed_76 = ((2).xx % (1).xx); - uint2 unnamed_77 = ((2u).xx % (1u).xx); - uint2 unnamed_78 = ((2u).xx % (1u).xx); - float2 unnamed_79 = fmod((2.0).xx, (1.0).xx); - float2 unnamed_80 = fmod((2.0).xx, (1.0).xx); - float3x3 unnamed_81 = ((float3x3)0 + (float3x3)0); - float3x3 unnamed_82 = ((float3x3)0 - (float3x3)0); - float3x3 unnamed_83 = mul(1.0, (float3x3)0); - float3x3 unnamed_84 = mul((float3x3)0, 2.0); - float3 unnamed_85 = mul((1.0).xxxx, (float4x3)0); - float4 unnamed_86 = mul((float4x3)0, (2.0).xxx); - float3x3 unnamed_87 = mul((float3x4)0, (float4x3)0); + int2 unnamed_8 = -((1).xx); + float2 unnamed_9 = -((1.0).xx); + int unnamed_10 = (2 + 1); + uint unnamed_11 = (2u + 1u); + float unnamed_12 = (2.0 + 1.0); + int2 unnamed_13 = ((2).xx + (1).xx); + uint3 unnamed_14 = ((2u).xxx + (1u).xxx); + float4 unnamed_15 = ((2.0).xxxx + (1.0).xxxx); + int unnamed_16 = (2 - 1); + uint unnamed_17 = (2u - 1u); + float unnamed_18 = (2.0 - 1.0); + int2 unnamed_19 = ((2).xx - (1).xx); + uint3 unnamed_20 = ((2u).xxx - (1u).xxx); + float4 unnamed_21 = ((2.0).xxxx - (1.0).xxxx); + int unnamed_22 = (2 * 1); + uint unnamed_23 = (2u * 1u); + float unnamed_24 = (2.0 * 1.0); + int2 unnamed_25 = ((2).xx * (1).xx); + uint3 unnamed_26 = ((2u).xxx * (1u).xxx); + float4 unnamed_27 = ((2.0).xxxx * (1.0).xxxx); + int unnamed_28 = (2 / 1); + uint unnamed_29 = (2u / 1u); + float unnamed_30 = (2.0 / 1.0); + int2 unnamed_31 = ((2).xx / (1).xx); + uint3 unnamed_32 = ((2u).xxx / (1u).xxx); + float4 unnamed_33 = ((2.0).xxxx / (1.0).xxxx); + int unnamed_34 = (2 % 1); + uint unnamed_35 = (2u % 1u); + float unnamed_36 = fmod(2.0, 1.0); + int2 unnamed_37 = ((2).xx % (1).xx); + uint3 unnamed_38 = ((2u).xxx % (1u).xxx); + float4 unnamed_39 = fmod((2.0).xxxx, (1.0).xxxx); + int2 unnamed_40 = ((2).xx + (1).xx); + int2 unnamed_41 = ((2).xx + (1).xx); + uint2 unnamed_42 = ((2u).xx + (1u).xx); + uint2 unnamed_43 = ((2u).xx + (1u).xx); + float2 unnamed_44 = ((2.0).xx + (1.0).xx); + float2 unnamed_45 = ((2.0).xx + (1.0).xx); + int2 unnamed_46 = ((2).xx - (1).xx); + int2 unnamed_47 = ((2).xx - (1).xx); + uint2 unnamed_48 = ((2u).xx - (1u).xx); + uint2 unnamed_49 = ((2u).xx - (1u).xx); + float2 unnamed_50 = ((2.0).xx - (1.0).xx); + float2 unnamed_51 = ((2.0).xx - (1.0).xx); + int2 unnamed_52 = ((2).xx * 1); + int2 unnamed_53 = (2 * (1).xx); + uint2 unnamed_54 = ((2u).xx * 1u); + uint2 unnamed_55 = (2u * (1u).xx); + float2 unnamed_56 = ((2.0).xx * 1.0); + float2 unnamed_57 = (2.0 * (1.0).xx); + int2 unnamed_58 = ((2).xx / (1).xx); + int2 unnamed_59 = ((2).xx / (1).xx); + uint2 unnamed_60 = ((2u).xx / (1u).xx); + uint2 unnamed_61 = ((2u).xx / (1u).xx); + float2 unnamed_62 = ((2.0).xx / (1.0).xx); + float2 unnamed_63 = ((2.0).xx / (1.0).xx); + int2 unnamed_64 = ((2).xx % (1).xx); + int2 unnamed_65 = ((2).xx % (1).xx); + uint2 unnamed_66 = ((2u).xx % (1u).xx); + uint2 unnamed_67 = ((2u).xx % (1u).xx); + float2 unnamed_68 = fmod((2.0).xx, (1.0).xx); + float2 unnamed_69 = fmod((2.0).xx, (1.0).xx); + float3x3 unnamed_70 = ((float3x3)0 + (float3x3)0); + float3x3 unnamed_71 = ((float3x3)0 - (float3x3)0); + float3x3 unnamed_72 = mul(1.0, (float3x3)0); + float3x3 unnamed_73 = mul((float3x3)0, 2.0); + float3 unnamed_74 = mul((1.0).xxxx, (float4x3)0); + float4 unnamed_75 = mul((float4x3)0, (2.0).xxx); + float3x3 unnamed_76 = mul((float3x4)0, (float4x3)0); } void bit() { - int unnamed_88 = ~(1); - uint unnamed_89 = ~(1u); - int2 unnamed_90 = ~((1).xx); - uint3 unnamed_91 = ~((1u).xxx); - int unnamed_92 = (2 | 1); - uint unnamed_93 = (2u | 1u); - int2 unnamed_94 = ((2).xx | (1).xx); - uint3 unnamed_95 = ((2u).xxx | (1u).xxx); - int unnamed_96 = (2 & 1); - uint unnamed_97 = (2u & 1u); - int2 unnamed_98 = ((2).xx & (1).xx); - uint3 unnamed_99 = ((2u).xxx & (1u).xxx); - int unnamed_100 = (2 ^ 1); - uint unnamed_101 = (2u ^ 1u); - int2 unnamed_102 = ((2).xx ^ (1).xx); - uint3 unnamed_103 = ((2u).xxx ^ (1u).xxx); - int unnamed_104 = (2 << 1u); - uint unnamed_105 = (2u << 1u); - int2 unnamed_106 = ((2).xx << (1u).xx); - uint3 unnamed_107 = ((2u).xxx << (1u).xxx); - int unnamed_108 = (2 >> 1u); - uint unnamed_109 = (2u >> 1u); - int2 unnamed_110 = ((2).xx >> (1u).xx); - uint3 unnamed_111 = ((2u).xxx >> (1u).xxx); + int unnamed_77 = ~(1); + uint unnamed_78 = ~(1u); + int2 unnamed_79 = ~((1).xx); + uint3 unnamed_80 = ~((1u).xxx); + int unnamed_81 = (2 | 1); + uint unnamed_82 = (2u | 1u); + int2 unnamed_83 = ((2).xx | (1).xx); + uint3 unnamed_84 = ((2u).xxx | (1u).xxx); + int unnamed_85 = (2 & 1); + uint unnamed_86 = (2u & 1u); + int2 unnamed_87 = ((2).xx & (1).xx); + uint3 unnamed_88 = ((2u).xxx & (1u).xxx); + int unnamed_89 = (2 ^ 1); + uint unnamed_90 = (2u ^ 1u); + int2 unnamed_91 = ((2).xx ^ (1).xx); + uint3 unnamed_92 = ((2u).xxx ^ (1u).xxx); + int unnamed_93 = (2 << 1u); + uint unnamed_94 = (2u << 1u); + int2 unnamed_95 = ((2).xx << (1u).xx); + uint3 unnamed_96 = ((2u).xxx << (1u).xxx); + int unnamed_97 = (2 >> 1u); + uint unnamed_98 = (2u >> 1u); + int2 unnamed_99 = ((2).xx >> (1u).xx); + uint3 unnamed_100 = ((2u).xxx >> (1u).xxx); } void comparison() { - bool unnamed_112 = (2 == 1); - bool unnamed_113 = (2u == 1u); - bool unnamed_114 = (2.0 == 1.0); - bool2 unnamed_115 = ((2).xx == (1).xx); - bool3 unnamed_116 = ((2u).xxx == (1u).xxx); - bool4 unnamed_117 = ((2.0).xxxx == (1.0).xxxx); - bool unnamed_118 = (2 != 1); - bool unnamed_119 = (2u != 1u); - bool unnamed_120 = (2.0 != 1.0); - bool2 unnamed_121 = ((2).xx != (1).xx); - bool3 unnamed_122 = ((2u).xxx != (1u).xxx); - bool4 unnamed_123 = ((2.0).xxxx != (1.0).xxxx); - bool unnamed_124 = (2 < 1); - bool unnamed_125 = (2u < 1u); - bool unnamed_126 = (2.0 < 1.0); - bool2 unnamed_127 = ((2).xx < (1).xx); - bool3 unnamed_128 = ((2u).xxx < (1u).xxx); - bool4 unnamed_129 = ((2.0).xxxx < (1.0).xxxx); - bool unnamed_130 = (2 <= 1); - bool unnamed_131 = (2u <= 1u); - bool unnamed_132 = (2.0 <= 1.0); - bool2 unnamed_133 = ((2).xx <= (1).xx); - bool3 unnamed_134 = ((2u).xxx <= (1u).xxx); - bool4 unnamed_135 = ((2.0).xxxx <= (1.0).xxxx); - bool unnamed_136 = (2 > 1); - bool unnamed_137 = (2u > 1u); - bool unnamed_138 = (2.0 > 1.0); - bool2 unnamed_139 = ((2).xx > (1).xx); - bool3 unnamed_140 = ((2u).xxx > (1u).xxx); - bool4 unnamed_141 = ((2.0).xxxx > (1.0).xxxx); - bool unnamed_142 = (2 >= 1); - bool unnamed_143 = (2u >= 1u); - bool unnamed_144 = (2.0 >= 1.0); - bool2 unnamed_145 = ((2).xx >= (1).xx); - bool3 unnamed_146 = ((2u).xxx >= (1u).xxx); - bool4 unnamed_147 = ((2.0).xxxx >= (1.0).xxxx); + bool unnamed_101 = (2 == 1); + bool unnamed_102 = (2u == 1u); + bool unnamed_103 = (2.0 == 1.0); + bool2 unnamed_104 = ((2).xx == (1).xx); + bool3 unnamed_105 = ((2u).xxx == (1u).xxx); + bool4 unnamed_106 = ((2.0).xxxx == (1.0).xxxx); + bool unnamed_107 = (2 != 1); + bool unnamed_108 = (2u != 1u); + bool unnamed_109 = (2.0 != 1.0); + bool2 unnamed_110 = ((2).xx != (1).xx); + bool3 unnamed_111 = ((2u).xxx != (1u).xxx); + bool4 unnamed_112 = ((2.0).xxxx != (1.0).xxxx); + bool unnamed_113 = (2 < 1); + bool unnamed_114 = (2u < 1u); + bool unnamed_115 = (2.0 < 1.0); + bool2 unnamed_116 = ((2).xx < (1).xx); + bool3 unnamed_117 = ((2u).xxx < (1u).xxx); + bool4 unnamed_118 = ((2.0).xxxx < (1.0).xxxx); + bool unnamed_119 = (2 <= 1); + bool unnamed_120 = (2u <= 1u); + bool unnamed_121 = (2.0 <= 1.0); + bool2 unnamed_122 = ((2).xx <= (1).xx); + bool3 unnamed_123 = ((2u).xxx <= (1u).xxx); + bool4 unnamed_124 = ((2.0).xxxx <= (1.0).xxxx); + bool unnamed_125 = (2 > 1); + bool unnamed_126 = (2u > 1u); + bool unnamed_127 = (2.0 > 1.0); + bool2 unnamed_128 = ((2).xx > (1).xx); + bool3 unnamed_129 = ((2u).xxx > (1u).xxx); + bool4 unnamed_130 = ((2.0).xxxx > (1.0).xxxx); + bool unnamed_131 = (2 >= 1); + bool unnamed_132 = (2u >= 1u); + bool unnamed_133 = (2.0 >= 1.0); + bool2 unnamed_134 = ((2).xx >= (1).xx); + bool3 unnamed_135 = ((2u).xxx >= (1u).xxx); + bool4 unnamed_136 = ((2.0).xxxx >= (1.0).xxxx); } void assignment() @@ -282,13 +239,13 @@ void assignment() void negation_avoids_prefix_decrement() { - int unnamed_148 = -(-2); - int unnamed_149 = -(-3); - int unnamed_150 = -(-(4)); - int unnamed_151 = -(-(-5)); - int unnamed_152 = -(-(-(-(6)))); - int unnamed_153 = -(-(-(-(-7)))); - int unnamed_154 = -(-(-(-(-8)))); + int unnamed_137 = -(-2); + int unnamed_138 = -(-3); + int unnamed_139 = -(-(4)); + int unnamed_140 = -(-(-5)); + int unnamed_141 = -(-(-(-(6)))); + int unnamed_142 = -(-(-(-(-7)))); + int unnamed_143 = -(-(-(-(-8)))); } [numthreads(1, 1, 1)] @@ -297,7 +254,6 @@ void main() const float4 _e0 = builtins(); const float4 _e1 = splat(); const float3 _e4 = bool_cast(v_f32_one.xyz); - const float _e5 = constructors(); logical(); arithmetic(); bit(); diff --git a/tests/out/msl/constructors.msl b/tests/out/msl/constructors.msl new file mode 100644 index 0000000000..3144782074 --- /dev/null +++ b/tests/out/msl/constructors.msl @@ -0,0 +1,50 @@ +// language: metal2.0 +#include +#include + +using metal::uint; + +struct Foo { + metal::float4 a; + int b; +}; +struct type_5 { + metal::float2x2 inner[1]; +}; +struct type_10 { + Foo inner[3]; +}; +struct type_11 { + int inner[4]; +}; +constant metal::float3 const2_ = metal::float3(0.0, 0.0, 0.0); +constant metal::float2x2 const3_ = metal::float2x2(metal::float2(0.0, 0.0), metal::float2(0.0, 0.0)); +constant type_5 const4_ = type_5 {metal::float2x2(metal::float2(0.0, 0.0), metal::float2(0.0, 0.0))}; +constant bool cz0_ = bool {}; +constant int cz1_ = int {}; +constant uint cz2_ = uint {}; +constant float cz3_ = float {}; +constant metal::uint2 cz4_ = metal::uint2 {}; +constant metal::float2x2 cz5_ = metal::float2x2 {}; +constant type_10 cz6_ = type_10 {}; +constant Foo cz7_ = Foo {}; +constant type_11 cp3_ = type_11 {0, 1, 2, 3}; + +kernel void main_( +) { + Foo foo = {}; + foo = Foo {metal::float4(1.0), 1}; + metal::float2x2 unnamed = metal::float2x2(metal::float2(1.0, 0.0), metal::float2(0.0, 1.0)); + metal::float4x4 unnamed_1 = metal::float4x4(metal::float4(1.0, 0.0, 0.0, 0.0), metal::float4(0.0, 1.0, 0.0, 0.0), metal::float4(0.0, 0.0, 1.0, 0.0), metal::float4(0.0, 0.0, 0.0, 1.0)); + metal::uint2 unnamed_2 = metal::uint2(0u); + metal::float2x2 unnamed_3 = metal::float2x2(metal::float2(0.0), metal::float2(0.0)); + type_11 unnamed_4 = type_11 {0, 1, 2, 3}; + bool unnamed_5 = static_cast(bool {}); + int unnamed_6 = static_cast(int {}); + uint unnamed_7 = static_cast(uint {}); + float unnamed_8 = static_cast(float {}); + metal::uint2 unnamed_9 = static_cast(metal::uint2 {}); + metal::float2x3 unnamed_10 = metal::float2x3(metal::float2x3 {}); + metal::uint2 unnamed_11 = as_type(metal::uint2 {}); + metal::float2x3 unnamed_12 = metal::float2x3(metal::float2x3 {}); +} diff --git a/tests/out/msl/operators.msl b/tests/out/msl/operators.msl index 7e684b4b8d..d80de3f208 100644 --- a/tests/out/msl/operators.msl +++ b/tests/out/msl/operators.msl @@ -4,16 +4,6 @@ using metal::uint; -struct Foo { - metal::float4 a; - int b; -}; -struct type_13 { - Foo inner[3]; -}; -struct type_14 { - int inner[4]; -}; constant metal::float4 v_f32_one = metal::float4(1.0, 1.0, 1.0, 1.0); constant metal::float4 v_f32_zero = metal::float4(0.0, 0.0, 0.0, 0.0); constant metal::float4 v_f32_half = metal::float4(0.5, 0.5, 0.5, 0.5); @@ -60,178 +50,157 @@ metal::float3 bool_cast( return static_cast(y); } -float constructors( -) { - Foo foo = {}; - foo = Foo {metal::float4(1.0), 1}; - metal::float2x2 mat2comp = metal::float2x2(metal::float2(1.0, 0.0), metal::float2(0.0, 1.0)); - metal::float4x4 mat4comp = metal::float4x4(metal::float4(1.0, 0.0, 0.0, 0.0), metal::float4(0.0, 1.0, 0.0, 0.0), metal::float4(0.0, 0.0, 1.0, 0.0), metal::float4(0.0, 0.0, 0.0, 1.0)); - metal::uint2 unnamed = metal::uint2(0u); - metal::float2x2 unnamed_1 = metal::float2x2(metal::float2(0.0), metal::float2(0.0)); - type_14 unnamed_2 = type_14 {0, 1, 2, 3}; - bool unnamed_3 = static_cast(bool {}); - int unnamed_4 = static_cast(int {}); - uint unnamed_5 = static_cast(uint {}); - float unnamed_6 = static_cast(float {}); - metal::uint2 unnamed_7 = static_cast(metal::uint2 {}); - metal::float2x3 unnamed_8 = metal::float2x3(metal::float2x3 {}); - metal::uint2 unnamed_9 = as_type(metal::uint2 {}); - metal::float2x3 unnamed_10 = metal::float2x3(metal::float2x3 {}); - float _e71 = foo.a.x; - return _e71; -} - void logical( ) { - bool unnamed_11 = !(true); - metal::bool2 unnamed_12 = !(metal::bool2(true)); - bool unnamed_13 = true || false; - bool unnamed_14 = true && false; - bool unnamed_15 = true | false; - metal::bool3 unnamed_16 = metal::bool3(true) | metal::bool3(false); - bool unnamed_17 = true & false; - metal::bool4 unnamed_18 = metal::bool4(true) & metal::bool4(false); + bool unnamed = !(true); + metal::bool2 unnamed_1 = !(metal::bool2(true)); + bool unnamed_2 = true || false; + bool unnamed_3 = true && false; + bool unnamed_4 = true | false; + metal::bool3 unnamed_5 = metal::bool3(true) | metal::bool3(false); + bool unnamed_6 = true & false; + metal::bool4 unnamed_7 = metal::bool4(true) & metal::bool4(false); } void arithmetic( ) { - metal::int2 unnamed_19 = -(metal::int2(1)); - metal::float2 unnamed_20 = -(metal::float2(1.0)); - int unnamed_21 = 2 + 1; - uint unnamed_22 = 2u + 1u; - float unnamed_23 = 2.0 + 1.0; - metal::int2 unnamed_24 = metal::int2(2) + metal::int2(1); - metal::uint3 unnamed_25 = metal::uint3(2u) + metal::uint3(1u); - metal::float4 unnamed_26 = metal::float4(2.0) + metal::float4(1.0); - int unnamed_27 = 2 - 1; - uint unnamed_28 = 2u - 1u; - float unnamed_29 = 2.0 - 1.0; - metal::int2 unnamed_30 = metal::int2(2) - metal::int2(1); - metal::uint3 unnamed_31 = metal::uint3(2u) - metal::uint3(1u); - metal::float4 unnamed_32 = metal::float4(2.0) - metal::float4(1.0); - int unnamed_33 = 2 * 1; - uint unnamed_34 = 2u * 1u; - float unnamed_35 = 2.0 * 1.0; - metal::int2 unnamed_36 = metal::int2(2) * metal::int2(1); - metal::uint3 unnamed_37 = metal::uint3(2u) * metal::uint3(1u); - metal::float4 unnamed_38 = metal::float4(2.0) * metal::float4(1.0); - int unnamed_39 = 2 / 1; - uint unnamed_40 = 2u / 1u; - float unnamed_41 = 2.0 / 1.0; - metal::int2 unnamed_42 = metal::int2(2) / metal::int2(1); - metal::uint3 unnamed_43 = metal::uint3(2u) / metal::uint3(1u); - metal::float4 unnamed_44 = metal::float4(2.0) / metal::float4(1.0); - int unnamed_45 = 2 % 1; - uint unnamed_46 = 2u % 1u; - float unnamed_47 = metal::fmod(2.0, 1.0); - metal::int2 unnamed_48 = metal::int2(2) % metal::int2(1); - metal::uint3 unnamed_49 = metal::uint3(2u) % metal::uint3(1u); - metal::float4 unnamed_50 = metal::fmod(metal::float4(2.0), metal::float4(1.0)); - metal::int2 unnamed_51 = metal::int2(2) + metal::int2(1); - metal::int2 unnamed_52 = metal::int2(2) + metal::int2(1); - metal::uint2 unnamed_53 = metal::uint2(2u) + metal::uint2(1u); - metal::uint2 unnamed_54 = metal::uint2(2u) + metal::uint2(1u); - metal::float2 unnamed_55 = metal::float2(2.0) + metal::float2(1.0); - metal::float2 unnamed_56 = metal::float2(2.0) + metal::float2(1.0); - metal::int2 unnamed_57 = metal::int2(2) - metal::int2(1); - metal::int2 unnamed_58 = metal::int2(2) - metal::int2(1); - metal::uint2 unnamed_59 = metal::uint2(2u) - metal::uint2(1u); - metal::uint2 unnamed_60 = metal::uint2(2u) - metal::uint2(1u); - metal::float2 unnamed_61 = metal::float2(2.0) - metal::float2(1.0); - metal::float2 unnamed_62 = metal::float2(2.0) - metal::float2(1.0); - metal::int2 unnamed_63 = metal::int2(2) * 1; - metal::int2 unnamed_64 = 2 * metal::int2(1); - metal::uint2 unnamed_65 = metal::uint2(2u) * 1u; - metal::uint2 unnamed_66 = 2u * metal::uint2(1u); - metal::float2 unnamed_67 = metal::float2(2.0) * 1.0; - metal::float2 unnamed_68 = 2.0 * metal::float2(1.0); - metal::int2 unnamed_69 = metal::int2(2) / metal::int2(1); - metal::int2 unnamed_70 = metal::int2(2) / metal::int2(1); - metal::uint2 unnamed_71 = metal::uint2(2u) / metal::uint2(1u); - metal::uint2 unnamed_72 = metal::uint2(2u) / metal::uint2(1u); - metal::float2 unnamed_73 = metal::float2(2.0) / metal::float2(1.0); - metal::float2 unnamed_74 = metal::float2(2.0) / metal::float2(1.0); - metal::int2 unnamed_75 = metal::int2(2) % metal::int2(1); - metal::int2 unnamed_76 = metal::int2(2) % metal::int2(1); - metal::uint2 unnamed_77 = metal::uint2(2u) % metal::uint2(1u); - metal::uint2 unnamed_78 = metal::uint2(2u) % metal::uint2(1u); - metal::float2 unnamed_79 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); - metal::float2 unnamed_80 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); - metal::float3x3 unnamed_81 = metal::float3x3 {} + metal::float3x3 {}; - metal::float3x3 unnamed_82 = metal::float3x3 {} - metal::float3x3 {}; - metal::float3x3 unnamed_83 = metal::float3x3 {} * 1.0; - metal::float3x3 unnamed_84 = 2.0 * metal::float3x3 {}; - metal::float3 unnamed_85 = metal::float4x3 {} * metal::float4(1.0); - metal::float4 unnamed_86 = metal::float3(2.0) * metal::float4x3 {}; - metal::float3x3 unnamed_87 = metal::float4x3 {} * metal::float3x4 {}; + metal::int2 unnamed_8 = -(metal::int2(1)); + metal::float2 unnamed_9 = -(metal::float2(1.0)); + int unnamed_10 = 2 + 1; + uint unnamed_11 = 2u + 1u; + float unnamed_12 = 2.0 + 1.0; + metal::int2 unnamed_13 = metal::int2(2) + metal::int2(1); + metal::uint3 unnamed_14 = metal::uint3(2u) + metal::uint3(1u); + metal::float4 unnamed_15 = metal::float4(2.0) + metal::float4(1.0); + int unnamed_16 = 2 - 1; + uint unnamed_17 = 2u - 1u; + float unnamed_18 = 2.0 - 1.0; + metal::int2 unnamed_19 = metal::int2(2) - metal::int2(1); + metal::uint3 unnamed_20 = metal::uint3(2u) - metal::uint3(1u); + metal::float4 unnamed_21 = metal::float4(2.0) - metal::float4(1.0); + int unnamed_22 = 2 * 1; + uint unnamed_23 = 2u * 1u; + float unnamed_24 = 2.0 * 1.0; + metal::int2 unnamed_25 = metal::int2(2) * metal::int2(1); + metal::uint3 unnamed_26 = metal::uint3(2u) * metal::uint3(1u); + metal::float4 unnamed_27 = metal::float4(2.0) * metal::float4(1.0); + int unnamed_28 = 2 / 1; + uint unnamed_29 = 2u / 1u; + float unnamed_30 = 2.0 / 1.0; + metal::int2 unnamed_31 = metal::int2(2) / metal::int2(1); + metal::uint3 unnamed_32 = metal::uint3(2u) / metal::uint3(1u); + metal::float4 unnamed_33 = metal::float4(2.0) / metal::float4(1.0); + int unnamed_34 = 2 % 1; + uint unnamed_35 = 2u % 1u; + float unnamed_36 = metal::fmod(2.0, 1.0); + metal::int2 unnamed_37 = metal::int2(2) % metal::int2(1); + metal::uint3 unnamed_38 = metal::uint3(2u) % metal::uint3(1u); + metal::float4 unnamed_39 = metal::fmod(metal::float4(2.0), metal::float4(1.0)); + metal::int2 unnamed_40 = metal::int2(2) + metal::int2(1); + metal::int2 unnamed_41 = metal::int2(2) + metal::int2(1); + metal::uint2 unnamed_42 = metal::uint2(2u) + metal::uint2(1u); + metal::uint2 unnamed_43 = metal::uint2(2u) + metal::uint2(1u); + metal::float2 unnamed_44 = metal::float2(2.0) + metal::float2(1.0); + metal::float2 unnamed_45 = metal::float2(2.0) + metal::float2(1.0); + metal::int2 unnamed_46 = metal::int2(2) - metal::int2(1); + metal::int2 unnamed_47 = metal::int2(2) - metal::int2(1); + metal::uint2 unnamed_48 = metal::uint2(2u) - metal::uint2(1u); + metal::uint2 unnamed_49 = metal::uint2(2u) - metal::uint2(1u); + metal::float2 unnamed_50 = metal::float2(2.0) - metal::float2(1.0); + metal::float2 unnamed_51 = metal::float2(2.0) - metal::float2(1.0); + metal::int2 unnamed_52 = metal::int2(2) * 1; + metal::int2 unnamed_53 = 2 * metal::int2(1); + metal::uint2 unnamed_54 = metal::uint2(2u) * 1u; + metal::uint2 unnamed_55 = 2u * metal::uint2(1u); + metal::float2 unnamed_56 = metal::float2(2.0) * 1.0; + metal::float2 unnamed_57 = 2.0 * metal::float2(1.0); + metal::int2 unnamed_58 = metal::int2(2) / metal::int2(1); + metal::int2 unnamed_59 = metal::int2(2) / metal::int2(1); + metal::uint2 unnamed_60 = metal::uint2(2u) / metal::uint2(1u); + metal::uint2 unnamed_61 = metal::uint2(2u) / metal::uint2(1u); + metal::float2 unnamed_62 = metal::float2(2.0) / metal::float2(1.0); + metal::float2 unnamed_63 = metal::float2(2.0) / metal::float2(1.0); + metal::int2 unnamed_64 = metal::int2(2) % metal::int2(1); + metal::int2 unnamed_65 = metal::int2(2) % metal::int2(1); + metal::uint2 unnamed_66 = metal::uint2(2u) % metal::uint2(1u); + metal::uint2 unnamed_67 = metal::uint2(2u) % metal::uint2(1u); + metal::float2 unnamed_68 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); + metal::float2 unnamed_69 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); + metal::float3x3 unnamed_70 = metal::float3x3 {} + metal::float3x3 {}; + metal::float3x3 unnamed_71 = metal::float3x3 {} - metal::float3x3 {}; + metal::float3x3 unnamed_72 = metal::float3x3 {} * 1.0; + metal::float3x3 unnamed_73 = 2.0 * metal::float3x3 {}; + metal::float3 unnamed_74 = metal::float4x3 {} * metal::float4(1.0); + metal::float4 unnamed_75 = metal::float3(2.0) * metal::float4x3 {}; + metal::float3x3 unnamed_76 = metal::float4x3 {} * metal::float3x4 {}; } void bit( ) { - int unnamed_88 = ~(1); - uint unnamed_89 = ~(1u); - metal::int2 unnamed_90 = ~(metal::int2(1)); - metal::uint3 unnamed_91 = ~(metal::uint3(1u)); - int unnamed_92 = 2 | 1; - uint unnamed_93 = 2u | 1u; - metal::int2 unnamed_94 = metal::int2(2) | metal::int2(1); - metal::uint3 unnamed_95 = metal::uint3(2u) | metal::uint3(1u); - int unnamed_96 = 2 & 1; - uint unnamed_97 = 2u & 1u; - metal::int2 unnamed_98 = metal::int2(2) & metal::int2(1); - metal::uint3 unnamed_99 = metal::uint3(2u) & metal::uint3(1u); - int unnamed_100 = 2 ^ 1; - uint unnamed_101 = 2u ^ 1u; - metal::int2 unnamed_102 = metal::int2(2) ^ metal::int2(1); - metal::uint3 unnamed_103 = metal::uint3(2u) ^ metal::uint3(1u); - int unnamed_104 = 2 << 1u; - uint unnamed_105 = 2u << 1u; - metal::int2 unnamed_106 = metal::int2(2) << metal::uint2(1u); - metal::uint3 unnamed_107 = metal::uint3(2u) << metal::uint3(1u); - int unnamed_108 = 2 >> 1u; - uint unnamed_109 = 2u >> 1u; - metal::int2 unnamed_110 = metal::int2(2) >> metal::uint2(1u); - metal::uint3 unnamed_111 = metal::uint3(2u) >> metal::uint3(1u); + int unnamed_77 = ~(1); + uint unnamed_78 = ~(1u); + metal::int2 unnamed_79 = ~(metal::int2(1)); + metal::uint3 unnamed_80 = ~(metal::uint3(1u)); + int unnamed_81 = 2 | 1; + uint unnamed_82 = 2u | 1u; + metal::int2 unnamed_83 = metal::int2(2) | metal::int2(1); + metal::uint3 unnamed_84 = metal::uint3(2u) | metal::uint3(1u); + int unnamed_85 = 2 & 1; + uint unnamed_86 = 2u & 1u; + metal::int2 unnamed_87 = metal::int2(2) & metal::int2(1); + metal::uint3 unnamed_88 = metal::uint3(2u) & metal::uint3(1u); + int unnamed_89 = 2 ^ 1; + uint unnamed_90 = 2u ^ 1u; + metal::int2 unnamed_91 = metal::int2(2) ^ metal::int2(1); + metal::uint3 unnamed_92 = metal::uint3(2u) ^ metal::uint3(1u); + int unnamed_93 = 2 << 1u; + uint unnamed_94 = 2u << 1u; + metal::int2 unnamed_95 = metal::int2(2) << metal::uint2(1u); + metal::uint3 unnamed_96 = metal::uint3(2u) << metal::uint3(1u); + int unnamed_97 = 2 >> 1u; + uint unnamed_98 = 2u >> 1u; + metal::int2 unnamed_99 = metal::int2(2) >> metal::uint2(1u); + metal::uint3 unnamed_100 = metal::uint3(2u) >> metal::uint3(1u); } void comparison( ) { - bool unnamed_112 = 2 == 1; - bool unnamed_113 = 2u == 1u; - bool unnamed_114 = 2.0 == 1.0; - metal::bool2 unnamed_115 = metal::int2(2) == metal::int2(1); - metal::bool3 unnamed_116 = metal::uint3(2u) == metal::uint3(1u); - metal::bool4 unnamed_117 = metal::float4(2.0) == metal::float4(1.0); - bool unnamed_118 = 2 != 1; - bool unnamed_119 = 2u != 1u; - bool unnamed_120 = 2.0 != 1.0; - metal::bool2 unnamed_121 = metal::int2(2) != metal::int2(1); - metal::bool3 unnamed_122 = metal::uint3(2u) != metal::uint3(1u); - metal::bool4 unnamed_123 = metal::float4(2.0) != metal::float4(1.0); - bool unnamed_124 = 2 < 1; - bool unnamed_125 = 2u < 1u; - bool unnamed_126 = 2.0 < 1.0; - metal::bool2 unnamed_127 = metal::int2(2) < metal::int2(1); - metal::bool3 unnamed_128 = metal::uint3(2u) < metal::uint3(1u); - metal::bool4 unnamed_129 = metal::float4(2.0) < metal::float4(1.0); - bool unnamed_130 = 2 <= 1; - bool unnamed_131 = 2u <= 1u; - bool unnamed_132 = 2.0 <= 1.0; - metal::bool2 unnamed_133 = metal::int2(2) <= metal::int2(1); - metal::bool3 unnamed_134 = metal::uint3(2u) <= metal::uint3(1u); - metal::bool4 unnamed_135 = metal::float4(2.0) <= metal::float4(1.0); - bool unnamed_136 = 2 > 1; - bool unnamed_137 = 2u > 1u; - bool unnamed_138 = 2.0 > 1.0; - metal::bool2 unnamed_139 = metal::int2(2) > metal::int2(1); - metal::bool3 unnamed_140 = metal::uint3(2u) > metal::uint3(1u); - metal::bool4 unnamed_141 = metal::float4(2.0) > metal::float4(1.0); - bool unnamed_142 = 2 >= 1; - bool unnamed_143 = 2u >= 1u; - bool unnamed_144 = 2.0 >= 1.0; - metal::bool2 unnamed_145 = metal::int2(2) >= metal::int2(1); - metal::bool3 unnamed_146 = metal::uint3(2u) >= metal::uint3(1u); - metal::bool4 unnamed_147 = metal::float4(2.0) >= metal::float4(1.0); + bool unnamed_101 = 2 == 1; + bool unnamed_102 = 2u == 1u; + bool unnamed_103 = 2.0 == 1.0; + metal::bool2 unnamed_104 = metal::int2(2) == metal::int2(1); + metal::bool3 unnamed_105 = metal::uint3(2u) == metal::uint3(1u); + metal::bool4 unnamed_106 = metal::float4(2.0) == metal::float4(1.0); + bool unnamed_107 = 2 != 1; + bool unnamed_108 = 2u != 1u; + bool unnamed_109 = 2.0 != 1.0; + metal::bool2 unnamed_110 = metal::int2(2) != metal::int2(1); + metal::bool3 unnamed_111 = metal::uint3(2u) != metal::uint3(1u); + metal::bool4 unnamed_112 = metal::float4(2.0) != metal::float4(1.0); + bool unnamed_113 = 2 < 1; + bool unnamed_114 = 2u < 1u; + bool unnamed_115 = 2.0 < 1.0; + metal::bool2 unnamed_116 = metal::int2(2) < metal::int2(1); + metal::bool3 unnamed_117 = metal::uint3(2u) < metal::uint3(1u); + metal::bool4 unnamed_118 = metal::float4(2.0) < metal::float4(1.0); + bool unnamed_119 = 2 <= 1; + bool unnamed_120 = 2u <= 1u; + bool unnamed_121 = 2.0 <= 1.0; + metal::bool2 unnamed_122 = metal::int2(2) <= metal::int2(1); + metal::bool3 unnamed_123 = metal::uint3(2u) <= metal::uint3(1u); + metal::bool4 unnamed_124 = metal::float4(2.0) <= metal::float4(1.0); + bool unnamed_125 = 2 > 1; + bool unnamed_126 = 2u > 1u; + bool unnamed_127 = 2.0 > 1.0; + metal::bool2 unnamed_128 = metal::int2(2) > metal::int2(1); + metal::bool3 unnamed_129 = metal::uint3(2u) > metal::uint3(1u); + metal::bool4 unnamed_130 = metal::float4(2.0) > metal::float4(1.0); + bool unnamed_131 = 2 >= 1; + bool unnamed_132 = 2u >= 1u; + bool unnamed_133 = 2.0 >= 1.0; + metal::bool2 unnamed_134 = metal::int2(2) >= metal::int2(1); + metal::bool3 unnamed_135 = metal::uint3(2u) >= metal::uint3(1u); + metal::bool4 unnamed_136 = metal::float4(2.0) >= metal::float4(1.0); } void assignment( @@ -275,13 +244,13 @@ void assignment( void negation_avoids_prefix_decrement( ) { - int unnamed_148 = -(-2); - int unnamed_149 = -(-3); - int unnamed_150 = -(-(4)); - int unnamed_151 = -(-(-5)); - int unnamed_152 = -(-(-(-(6)))); - int unnamed_153 = -(-(-(-(-7)))); - int unnamed_154 = -(-(-(-(-8)))); + int unnamed_137 = -(-2); + int unnamed_138 = -(-3); + int unnamed_139 = -(-(4)); + int unnamed_140 = -(-(-5)); + int unnamed_141 = -(-(-(-(6)))); + int unnamed_142 = -(-(-(-(-7)))); + int unnamed_143 = -(-(-(-(-8)))); } kernel void main_( @@ -289,7 +258,6 @@ kernel void main_( metal::float4 _e0 = builtins(); metal::float4 _e1 = splat(); metal::float3 _e4 = bool_cast(v_f32_one.xyz); - float _e5 = constructors(); logical(); arithmetic(); bit(); diff --git a/tests/out/spv/constructors.spvasm b/tests/out/spv/constructors.spvasm new file mode 100644 index 0000000000..d7623478ce --- /dev/null +++ b/tests/out/spv/constructors.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.1 +; Generator: rspirv +; Bound: 87 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %43 "main" +OpExecutionMode %43 LocalSize 1 1 1 +OpMemberDecorate %6 0 Offset 0 +OpMemberDecorate %6 1 Offset 16 +OpDecorate %10 ArrayStride 16 +OpDecorate %15 ArrayStride 32 +OpDecorate %17 ArrayStride 4 +%2 = OpTypeVoid +%4 = OpTypeFloat 32 +%3 = OpTypeVector %4 4 +%5 = OpTypeInt 32 1 +%6 = OpTypeStruct %3 %5 +%7 = OpTypeVector %4 3 +%9 = OpTypeVector %4 2 +%8 = OpTypeMatrix %9 2 +%12 = OpTypeInt 32 0 +%11 = OpConstant %12 1 +%10 = OpTypeArray %8 %11 +%13 = OpTypeBool +%14 = OpTypeVector %12 2 +%16 = OpConstant %12 3 +%15 = OpTypeArray %6 %16 +%18 = OpConstant %12 4 +%17 = OpTypeArray %5 %18 +%19 = OpTypeMatrix %3 4 +%20 = OpTypeMatrix %7 2 +%21 = OpConstant %4 0.0 +%22 = OpConstantComposite %7 %21 %21 %21 +%23 = OpConstantComposite %9 %21 %21 +%24 = OpConstantComposite %8 %23 %23 +%25 = OpConstant %5 1 +%26 = OpConstantComposite %10 %24 +%27 = OpConstantNull %13 +%28 = OpConstantNull %5 +%29 = OpConstantNull %12 +%30 = OpConstantNull %4 +%31 = OpConstantNull %14 +%32 = OpConstantNull %8 +%33 = OpConstant %5 3 +%34 = OpConstantNull %15 +%35 = OpConstantNull %6 +%36 = OpConstant %5 0 +%37 = OpConstant %5 2 +%38 = OpConstantComposite %17 %36 %25 %37 %33 +%40 = OpTypePointer Function %6 +%41 = OpConstantNull %6 +%44 = OpTypeFunction %2 +%45 = OpConstant %4 1.0 +%46 = OpConstantNull %13 +%47 = OpConstantNull %5 +%48 = OpConstantNull %12 +%49 = OpConstantNull %4 +%50 = OpConstantNull %14 +%51 = OpConstantNull %8 +%52 = OpConstantNull %15 +%53 = OpConstantNull %6 +%54 = OpConstant %12 0 +%55 = OpConstantNull %13 +%56 = OpConstantNull %5 +%57 = OpConstantNull %12 +%58 = OpConstantNull %4 +%59 = OpConstantNull %14 +%60 = OpConstantNull %20 +%61 = OpConstantNull %14 +%62 = OpConstantNull %20 +%43 = OpFunction %2 None %44 +%42 = OpLabel +%39 = OpVariable %40 Function %41 +OpBranch %63 +%63 = OpLabel +%64 = OpCompositeConstruct %3 %45 %45 %45 %45 +%65 = OpCompositeConstruct %6 %64 %25 +OpStore %39 %65 +%66 = OpCompositeConstruct %9 %45 %21 +%67 = OpCompositeConstruct %9 %21 %45 +%68 = OpCompositeConstruct %8 %66 %67 +%69 = OpCompositeConstruct %3 %45 %21 %21 %21 +%70 = OpCompositeConstruct %3 %21 %45 %21 %21 +%71 = OpCompositeConstruct %3 %21 %21 %45 %21 +%72 = OpCompositeConstruct %3 %21 %21 %21 %45 +%73 = OpCompositeConstruct %19 %69 %70 %71 %72 +%74 = OpCompositeConstruct %14 %54 %54 +%75 = OpCompositeConstruct %9 %21 %21 +%76 = OpCompositeConstruct %9 %21 %21 +%77 = OpCompositeConstruct %8 %75 %76 +%78 = OpCompositeConstruct %17 %36 %25 %37 %33 +%84 = OpCopyObject %20 %60 +%86 = OpCopyObject %20 %62 +OpReturn +OpFunctionEnd \ No newline at end of file diff --git a/tests/out/spv/operators.spvasm b/tests/out/spv/operators.spvasm index 34ac4d5f13..21a6216b0f 100644 --- a/tests/out/spv/operators.spvasm +++ b/tests/out/spv/operators.spvasm @@ -1,16 +1,12 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 589 +; Bound: 528 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %577 "main" -OpExecutionMode %577 LocalSize 1 1 1 -OpMemberDecorate %12 0 Offset 0 -OpMemberDecorate %12 1 Offset 16 -OpDecorate %17 ArrayStride 32 -OpDecorate %19 ArrayStride 4 +OpEntryPoint GLCompute %517 "main" +OpExecutionMode %517 LocalSize 1 1 1 %2 = OpTypeVoid %4 = OpTypeFloat 32 %3 = OpTypeVector %4 4 @@ -21,631 +17,572 @@ OpDecorate %19 ArrayStride 4 %9 = OpTypeVector %4 2 %10 = OpTypeVector %4 3 %11 = OpTypeVector %8 3 -%12 = OpTypeStruct %3 %6 -%13 = OpTypeMatrix %9 2 -%14 = OpTypeMatrix %3 4 -%15 = OpTypeInt 32 0 -%16 = OpTypeVector %15 2 -%18 = OpConstant %15 3 -%17 = OpTypeArray %12 %18 -%20 = OpConstant %15 4 -%19 = OpTypeArray %6 %20 -%21 = OpTypeMatrix %10 2 -%22 = OpTypeMatrix %10 3 -%23 = OpTypeMatrix %10 4 -%24 = OpTypeMatrix %3 3 -%25 = OpTypeVector %6 3 -%26 = OpConstant %4 1.0 -%27 = OpConstantComposite %3 %26 %26 %26 %26 -%28 = OpConstant %4 0.0 -%29 = OpConstantComposite %3 %28 %28 %28 %28 -%30 = OpConstant %4 0.5 -%31 = OpConstantComposite %3 %30 %30 %30 %30 -%32 = OpConstant %6 1 -%33 = OpConstantComposite %5 %32 %32 %32 %32 -%34 = OpConstant %6 3 -%37 = OpTypeFunction %3 -%38 = OpConstantTrue %8 -%39 = OpConstant %6 0 -%40 = OpConstantFalse %8 -%41 = OpConstant %4 0.1 -%66 = OpConstant %4 2.0 -%67 = OpConstant %4 3.0 -%68 = OpConstant %4 4.0 -%69 = OpConstant %6 5 -%70 = OpConstant %6 2 -%86 = OpTypePointer Function %9 -%87 = OpConstantNull %9 -%90 = OpTypeFunction %9 -%106 = OpTypeFunction %10 %10 -%108 = OpConstantComposite %10 %28 %28 %28 -%110 = OpConstantComposite %10 %26 %26 %26 -%113 = OpTypePointer Function %12 -%114 = OpConstantNull %12 -%117 = OpTypeFunction %4 -%118 = OpConstantNull %8 -%119 = OpConstantNull %6 -%120 = OpConstantNull %15 -%121 = OpConstantNull %4 -%122 = OpConstantNull %16 -%123 = OpConstantNull %13 -%124 = OpConstantNull %17 +%12 = OpTypeMatrix %10 3 +%13 = OpTypeMatrix %10 4 +%14 = OpTypeMatrix %3 3 +%15 = OpTypeVector %6 3 +%16 = OpConstant %4 1.0 +%17 = OpConstantComposite %3 %16 %16 %16 %16 +%18 = OpConstant %4 0.0 +%19 = OpConstantComposite %3 %18 %18 %18 %18 +%20 = OpConstant %4 0.5 +%21 = OpConstantComposite %3 %20 %20 %20 %20 +%22 = OpConstant %6 1 +%23 = OpConstantComposite %5 %22 %22 %22 %22 +%26 = OpTypeFunction %3 +%27 = OpConstantTrue %8 +%28 = OpConstant %6 0 +%29 = OpConstantFalse %8 +%30 = OpConstant %4 0.1 +%55 = OpConstant %4 2.0 +%56 = OpConstant %4 3.0 +%57 = OpConstant %4 4.0 +%58 = OpConstant %6 5 +%59 = OpConstant %6 2 +%75 = OpTypePointer Function %9 +%76 = OpConstantNull %9 +%79 = OpTypeFunction %9 +%95 = OpTypeFunction %10 %10 +%97 = OpConstantComposite %10 %18 %18 %18 +%99 = OpConstantComposite %10 %16 %16 %16 +%103 = OpTypeFunction %2 +%106 = OpTypeVector %8 2 +%121 = OpConstant %4 -1.0 +%122 = OpTypeInt 32 0 +%123 = OpConstant %122 2 +%124 = OpConstant %122 1 %125 = OpConstantNull %12 -%126 = OpConstant %15 0 -%127 = OpConstantNull %8 -%128 = OpConstantNull %6 -%129 = OpConstantNull %15 -%130 = OpConstantNull %4 -%131 = OpConstantNull %16 -%132 = OpConstantNull %21 -%133 = OpConstantNull %16 -%134 = OpConstantNull %21 -%159 = OpTypePointer Function %3 -%160 = OpTypePointer Function %4 -%165 = OpTypeFunction %2 -%168 = OpTypeVector %8 2 -%183 = OpConstant %4 -1.0 -%184 = OpConstant %15 2 -%185 = OpConstant %15 1 -%186 = OpConstantNull %22 -%187 = OpConstantNull %22 -%188 = OpConstantNull %22 -%189 = OpConstantNull %22 -%190 = OpConstantNull %22 -%191 = OpConstantNull %22 -%192 = OpConstantNull %23 -%193 = OpConstantNull %23 -%194 = OpConstantNull %23 -%195 = OpConstantNull %24 -%197 = OpTypeVector %6 2 -%208 = OpTypeVector %15 3 -%503 = OpTypePointer Function %6 -%504 = OpConstantNull %6 -%506 = OpTypePointer Function %25 -%507 = OpConstantNull %25 -%510 = OpConstantNull %25 -%538 = OpTypePointer Function %6 -%549 = OpConstant %6 -1 -%550 = OpConstant %6 -2 -%551 = OpConstant %6 -3 -%552 = OpConstant %6 4 -%553 = OpConstant %6 -5 -%554 = OpConstant %6 6 -%555 = OpConstant %6 -7 -%556 = OpConstant %6 -8 -%36 = OpFunction %3 None %37 -%35 = OpLabel -OpBranch %42 -%42 = OpLabel -%43 = OpSelect %6 %38 %32 %39 -%45 = OpCompositeConstruct %7 %38 %38 %38 %38 -%44 = OpSelect %3 %45 %27 %29 -%46 = OpCompositeConstruct %7 %40 %40 %40 %40 -%47 = OpSelect %3 %46 %29 %27 -%48 = OpExtInst %3 %1 FMix %29 %27 %31 +%126 = OpConstantNull %12 +%127 = OpConstantNull %12 +%128 = OpConstantNull %12 +%129 = OpConstantNull %12 +%130 = OpConstantNull %12 +%131 = OpConstantNull %13 +%132 = OpConstantNull %13 +%133 = OpConstantNull %13 +%134 = OpConstantNull %14 +%136 = OpTypeVector %6 2 +%147 = OpTypeVector %122 3 +%208 = OpTypeVector %122 2 +%443 = OpTypePointer Function %6 +%444 = OpConstantNull %6 +%446 = OpTypePointer Function %15 +%447 = OpConstantNull %15 +%450 = OpConstantNull %15 +%478 = OpTypePointer Function %6 +%489 = OpConstant %6 -1 +%490 = OpConstant %6 -2 +%491 = OpConstant %6 -3 +%492 = OpConstant %6 4 +%493 = OpConstant %6 -5 +%494 = OpConstant %6 6 +%495 = OpConstant %6 -7 +%496 = OpConstant %6 -8 +%25 = OpFunction %3 None %26 +%24 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSelect %6 %27 %22 %28 +%34 = OpCompositeConstruct %7 %27 %27 %27 %27 +%33 = OpSelect %3 %34 %17 %19 +%35 = OpCompositeConstruct %7 %29 %29 %29 %29 +%36 = OpSelect %3 %35 %19 %17 +%37 = OpExtInst %3 %1 FMix %19 %17 %21 +%39 = OpCompositeConstruct %3 %30 %30 %30 %30 +%38 = OpExtInst %3 %1 FMix %19 %17 %39 +%40 = OpCompositeExtract %6 %23 0 +%41 = OpBitcast %4 %40 +%42 = OpBitcast %3 %23 +%43 = OpConvertFToS %5 %19 +%44 = OpCompositeConstruct %5 %32 %32 %32 %32 +%45 = OpIAdd %5 %44 %43 +%46 = OpConvertSToF %3 %45 +%47 = OpFAdd %3 %46 %33 +%48 = OpFAdd %3 %47 %37 +%49 = OpFAdd %3 %48 %38 %50 = OpCompositeConstruct %3 %41 %41 %41 %41 -%49 = OpExtInst %3 %1 FMix %29 %27 %50 -%51 = OpCompositeExtract %6 %33 0 -%52 = OpBitcast %4 %51 -%53 = OpBitcast %3 %33 -%54 = OpConvertFToS %5 %29 -%55 = OpCompositeConstruct %5 %43 %43 %43 %43 -%56 = OpIAdd %5 %55 %54 -%57 = OpConvertSToF %3 %56 -%58 = OpFAdd %3 %57 %44 -%59 = OpFAdd %3 %58 %48 -%60 = OpFAdd %3 %59 %49 -%61 = OpCompositeConstruct %3 %52 %52 %52 %52 -%62 = OpFAdd %3 %60 %61 -%63 = OpFAdd %3 %62 %53 -OpReturnValue %63 +%51 = OpFAdd %3 %49 %50 +%52 = OpFAdd %3 %51 %42 +OpReturnValue %52 OpFunctionEnd -%65 = OpFunction %3 None %37 -%64 = OpLabel -OpBranch %71 -%71 = OpLabel -%72 = OpCompositeConstruct %9 %66 %66 -%73 = OpCompositeConstruct %9 %26 %26 -%74 = OpFAdd %9 %73 %72 -%75 = OpCompositeConstruct %9 %67 %67 -%76 = OpFSub %9 %74 %75 -%77 = OpCompositeConstruct %9 %68 %68 -%78 = OpFDiv %9 %76 %77 -%79 = OpCompositeConstruct %5 %69 %69 %69 %69 -%80 = OpCompositeConstruct %5 %70 %70 %70 %70 -%81 = OpSRem %5 %79 %80 -%82 = OpVectorShuffle %3 %78 %78 0 1 0 1 -%83 = OpConvertSToF %3 %81 -%84 = OpFAdd %3 %82 %83 -OpReturnValue %84 +%54 = OpFunction %3 None %26 +%53 = OpLabel +OpBranch %60 +%60 = OpLabel +%61 = OpCompositeConstruct %9 %55 %55 +%62 = OpCompositeConstruct %9 %16 %16 +%63 = OpFAdd %9 %62 %61 +%64 = OpCompositeConstruct %9 %56 %56 +%65 = OpFSub %9 %63 %64 +%66 = OpCompositeConstruct %9 %57 %57 +%67 = OpFDiv %9 %65 %66 +%68 = OpCompositeConstruct %5 %58 %58 %58 %58 +%69 = OpCompositeConstruct %5 %59 %59 %59 %59 +%70 = OpSRem %5 %68 %69 +%71 = OpVectorShuffle %3 %67 %67 0 1 0 1 +%72 = OpConvertSToF %3 %70 +%73 = OpFAdd %3 %71 %72 +OpReturnValue %73 OpFunctionEnd -%89 = OpFunction %9 None %90 -%88 = OpLabel -%85 = OpVariable %86 Function %87 -OpBranch %91 -%91 = OpLabel -%92 = OpCompositeConstruct %9 %66 %66 -OpStore %85 %92 -%93 = OpLoad %9 %85 -%94 = OpCompositeConstruct %9 %26 %26 -%95 = OpFAdd %9 %93 %94 -OpStore %85 %95 -%96 = OpLoad %9 %85 -%97 = OpCompositeConstruct %9 %67 %67 -%98 = OpFSub %9 %96 %97 -OpStore %85 %98 -%99 = OpLoad %9 %85 -%100 = OpCompositeConstruct %9 %68 %68 -%101 = OpFDiv %9 %99 %100 -OpStore %85 %101 -%102 = OpLoad %9 %85 -OpReturnValue %102 +%78 = OpFunction %9 None %79 +%77 = OpLabel +%74 = OpVariable %75 Function %76 +OpBranch %80 +%80 = OpLabel +%81 = OpCompositeConstruct %9 %55 %55 +OpStore %74 %81 +%82 = OpLoad %9 %74 +%83 = OpCompositeConstruct %9 %16 %16 +%84 = OpFAdd %9 %82 %83 +OpStore %74 %84 +%85 = OpLoad %9 %74 +%86 = OpCompositeConstruct %9 %56 %56 +%87 = OpFSub %9 %85 %86 +OpStore %74 %87 +%88 = OpLoad %9 %74 +%89 = OpCompositeConstruct %9 %57 %57 +%90 = OpFDiv %9 %88 %89 +OpStore %74 %90 +%91 = OpLoad %9 %74 +OpReturnValue %91 OpFunctionEnd -%105 = OpFunction %10 None %106 -%104 = OpFunctionParameter %10 -%103 = OpLabel -OpBranch %107 -%107 = OpLabel -%109 = OpFUnordNotEqual %11 %104 %108 -%111 = OpSelect %10 %109 %110 %108 -OpReturnValue %111 +%94 = OpFunction %10 None %95 +%93 = OpFunctionParameter %10 +%92 = OpLabel +OpBranch %96 +%96 = OpLabel +%98 = OpFUnordNotEqual %11 %93 %97 +%100 = OpSelect %10 %98 %99 %97 +OpReturnValue %100 OpFunctionEnd -%116 = OpFunction %4 None %117 -%115 = OpLabel -%112 = OpVariable %113 Function %114 -OpBranch %135 -%135 = OpLabel -%136 = OpCompositeConstruct %3 %26 %26 %26 %26 -%137 = OpCompositeConstruct %12 %136 %32 -OpStore %112 %137 -%138 = OpCompositeConstruct %9 %26 %28 -%139 = OpCompositeConstruct %9 %28 %26 -%140 = OpCompositeConstruct %13 %138 %139 -%141 = OpCompositeConstruct %3 %26 %28 %28 %28 -%142 = OpCompositeConstruct %3 %28 %26 %28 %28 -%143 = OpCompositeConstruct %3 %28 %28 %26 %28 -%144 = OpCompositeConstruct %3 %28 %28 %28 %26 -%145 = OpCompositeConstruct %14 %141 %142 %143 %144 -%146 = OpCompositeConstruct %16 %126 %126 -%147 = OpCompositeConstruct %9 %28 %28 -%148 = OpCompositeConstruct %9 %28 %28 -%149 = OpCompositeConstruct %13 %147 %148 -%150 = OpCompositeConstruct %19 %39 %32 %70 %34 -%156 = OpCopyObject %21 %132 -%158 = OpCopyObject %21 %134 -%161 = OpAccessChain %160 %112 %126 %126 -%162 = OpLoad %4 %161 -OpReturnValue %162 -OpFunctionEnd -%164 = OpFunction %2 None %165 -%163 = OpLabel -OpBranch %166 -%166 = OpLabel -%167 = OpLogicalNot %8 %38 -%169 = OpCompositeConstruct %168 %38 %38 -%170 = OpLogicalNot %168 %169 -%171 = OpLogicalOr %8 %38 %40 -%172 = OpLogicalAnd %8 %38 %40 -%173 = OpLogicalOr %8 %38 %40 -%174 = OpCompositeConstruct %11 %38 %38 %38 -%175 = OpCompositeConstruct %11 %40 %40 %40 -%176 = OpLogicalOr %11 %174 %175 -%177 = OpLogicalAnd %8 %38 %40 -%178 = OpCompositeConstruct %7 %38 %38 %38 %38 -%179 = OpCompositeConstruct %7 %40 %40 %40 %40 -%180 = OpLogicalAnd %7 %178 %179 +%102 = OpFunction %2 None %103 +%101 = OpLabel +OpBranch %104 +%104 = OpLabel +%105 = OpLogicalNot %8 %27 +%107 = OpCompositeConstruct %106 %27 %27 +%108 = OpLogicalNot %106 %107 +%109 = OpLogicalOr %8 %27 %29 +%110 = OpLogicalAnd %8 %27 %29 +%111 = OpLogicalOr %8 %27 %29 +%112 = OpCompositeConstruct %11 %27 %27 %27 +%113 = OpCompositeConstruct %11 %29 %29 %29 +%114 = OpLogicalOr %11 %112 %113 +%115 = OpLogicalAnd %8 %27 %29 +%116 = OpCompositeConstruct %7 %27 %27 %27 %27 +%117 = OpCompositeConstruct %7 %29 %29 %29 %29 +%118 = OpLogicalAnd %7 %116 %117 OpReturn OpFunctionEnd -%182 = OpFunction %2 None %165 -%181 = OpLabel -OpBranch %196 -%196 = OpLabel -%198 = OpCompositeConstruct %197 %32 %32 -%199 = OpSNegate %197 %198 -%200 = OpCompositeConstruct %9 %26 %26 -%201 = OpFNegate %9 %200 -%202 = OpIAdd %6 %70 %32 -%203 = OpIAdd %15 %184 %185 -%204 = OpFAdd %4 %66 %26 -%205 = OpCompositeConstruct %197 %70 %70 -%206 = OpCompositeConstruct %197 %32 %32 -%207 = OpIAdd %197 %205 %206 -%209 = OpCompositeConstruct %208 %184 %184 %184 -%210 = OpCompositeConstruct %208 %185 %185 %185 +%120 = OpFunction %2 None %103 +%119 = OpLabel +OpBranch %135 +%135 = OpLabel +%137 = OpCompositeConstruct %136 %22 %22 +%138 = OpSNegate %136 %137 +%139 = OpCompositeConstruct %9 %16 %16 +%140 = OpFNegate %9 %139 +%141 = OpIAdd %6 %59 %22 +%142 = OpIAdd %122 %123 %124 +%143 = OpFAdd %4 %55 %16 +%144 = OpCompositeConstruct %136 %59 %59 +%145 = OpCompositeConstruct %136 %22 %22 +%146 = OpIAdd %136 %144 %145 +%148 = OpCompositeConstruct %147 %123 %123 %123 +%149 = OpCompositeConstruct %147 %124 %124 %124 +%150 = OpIAdd %147 %148 %149 +%151 = OpCompositeConstruct %3 %55 %55 %55 %55 +%152 = OpCompositeConstruct %3 %16 %16 %16 %16 +%153 = OpFAdd %3 %151 %152 +%154 = OpISub %6 %59 %22 +%155 = OpISub %122 %123 %124 +%156 = OpFSub %4 %55 %16 +%157 = OpCompositeConstruct %136 %59 %59 +%158 = OpCompositeConstruct %136 %22 %22 +%159 = OpISub %136 %157 %158 +%160 = OpCompositeConstruct %147 %123 %123 %123 +%161 = OpCompositeConstruct %147 %124 %124 %124 +%162 = OpISub %147 %160 %161 +%163 = OpCompositeConstruct %3 %55 %55 %55 %55 +%164 = OpCompositeConstruct %3 %16 %16 %16 %16 +%165 = OpFSub %3 %163 %164 +%166 = OpIMul %6 %59 %22 +%167 = OpIMul %122 %123 %124 +%168 = OpFMul %4 %55 %16 +%169 = OpCompositeConstruct %136 %59 %59 +%170 = OpCompositeConstruct %136 %22 %22 +%171 = OpIMul %136 %169 %170 +%172 = OpCompositeConstruct %147 %123 %123 %123 +%173 = OpCompositeConstruct %147 %124 %124 %124 +%174 = OpIMul %147 %172 %173 +%175 = OpCompositeConstruct %3 %55 %55 %55 %55 +%176 = OpCompositeConstruct %3 %16 %16 %16 %16 +%177 = OpFMul %3 %175 %176 +%178 = OpSDiv %6 %59 %22 +%179 = OpUDiv %122 %123 %124 +%180 = OpFDiv %4 %55 %16 +%181 = OpCompositeConstruct %136 %59 %59 +%182 = OpCompositeConstruct %136 %22 %22 +%183 = OpSDiv %136 %181 %182 +%184 = OpCompositeConstruct %147 %123 %123 %123 +%185 = OpCompositeConstruct %147 %124 %124 %124 +%186 = OpUDiv %147 %184 %185 +%187 = OpCompositeConstruct %3 %55 %55 %55 %55 +%188 = OpCompositeConstruct %3 %16 %16 %16 %16 +%189 = OpFDiv %3 %187 %188 +%190 = OpSRem %6 %59 %22 +%191 = OpUMod %122 %123 %124 +%192 = OpFRem %4 %55 %16 +%193 = OpCompositeConstruct %136 %59 %59 +%194 = OpCompositeConstruct %136 %22 %22 +%195 = OpSRem %136 %193 %194 +%196 = OpCompositeConstruct %147 %123 %123 %123 +%197 = OpCompositeConstruct %147 %124 %124 %124 +%198 = OpUMod %147 %196 %197 +%199 = OpCompositeConstruct %3 %55 %55 %55 %55 +%200 = OpCompositeConstruct %3 %16 %16 %16 %16 +%201 = OpFRem %3 %199 %200 +%202 = OpCompositeConstruct %136 %59 %59 +%203 = OpCompositeConstruct %136 %22 %22 +%204 = OpIAdd %136 %202 %203 +%205 = OpCompositeConstruct %136 %22 %22 +%206 = OpCompositeConstruct %136 %59 %59 +%207 = OpIAdd %136 %206 %205 +%209 = OpCompositeConstruct %208 %123 %123 +%210 = OpCompositeConstruct %208 %124 %124 %211 = OpIAdd %208 %209 %210 -%212 = OpCompositeConstruct %3 %66 %66 %66 %66 -%213 = OpCompositeConstruct %3 %26 %26 %26 %26 -%214 = OpFAdd %3 %212 %213 -%215 = OpISub %6 %70 %32 -%216 = OpISub %15 %184 %185 -%217 = OpFSub %4 %66 %26 -%218 = OpCompositeConstruct %197 %70 %70 -%219 = OpCompositeConstruct %197 %32 %32 -%220 = OpISub %197 %218 %219 -%221 = OpCompositeConstruct %208 %184 %184 %184 -%222 = OpCompositeConstruct %208 %185 %185 %185 -%223 = OpISub %208 %221 %222 -%224 = OpCompositeConstruct %3 %66 %66 %66 %66 -%225 = OpCompositeConstruct %3 %26 %26 %26 %26 -%226 = OpFSub %3 %224 %225 -%227 = OpIMul %6 %70 %32 -%228 = OpIMul %15 %184 %185 -%229 = OpFMul %4 %66 %26 -%230 = OpCompositeConstruct %197 %70 %70 -%231 = OpCompositeConstruct %197 %32 %32 -%232 = OpIMul %197 %230 %231 -%233 = OpCompositeConstruct %208 %184 %184 %184 -%234 = OpCompositeConstruct %208 %185 %185 %185 -%235 = OpIMul %208 %233 %234 -%236 = OpCompositeConstruct %3 %66 %66 %66 %66 -%237 = OpCompositeConstruct %3 %26 %26 %26 %26 -%238 = OpFMul %3 %236 %237 -%239 = OpSDiv %6 %70 %32 -%240 = OpUDiv %15 %184 %185 -%241 = OpFDiv %4 %66 %26 -%242 = OpCompositeConstruct %197 %70 %70 -%243 = OpCompositeConstruct %197 %32 %32 -%244 = OpSDiv %197 %242 %243 -%245 = OpCompositeConstruct %208 %184 %184 %184 -%246 = OpCompositeConstruct %208 %185 %185 %185 -%247 = OpUDiv %208 %245 %246 -%248 = OpCompositeConstruct %3 %66 %66 %66 %66 -%249 = OpCompositeConstruct %3 %26 %26 %26 %26 -%250 = OpFDiv %3 %248 %249 -%251 = OpSRem %6 %70 %32 -%252 = OpUMod %15 %184 %185 -%253 = OpFRem %4 %66 %26 -%254 = OpCompositeConstruct %197 %70 %70 -%255 = OpCompositeConstruct %197 %32 %32 -%256 = OpSRem %197 %254 %255 -%257 = OpCompositeConstruct %208 %184 %184 %184 -%258 = OpCompositeConstruct %208 %185 %185 %185 -%259 = OpUMod %208 %257 %258 -%260 = OpCompositeConstruct %3 %66 %66 %66 %66 -%261 = OpCompositeConstruct %3 %26 %26 %26 %26 -%262 = OpFRem %3 %260 %261 -%263 = OpCompositeConstruct %197 %70 %70 -%264 = OpCompositeConstruct %197 %32 %32 -%265 = OpIAdd %197 %263 %264 -%266 = OpCompositeConstruct %197 %32 %32 -%267 = OpCompositeConstruct %197 %70 %70 -%268 = OpIAdd %197 %267 %266 -%269 = OpCompositeConstruct %16 %184 %184 -%270 = OpCompositeConstruct %16 %185 %185 -%271 = OpIAdd %16 %269 %270 -%272 = OpCompositeConstruct %16 %185 %185 -%273 = OpCompositeConstruct %16 %184 %184 -%274 = OpIAdd %16 %273 %272 -%275 = OpCompositeConstruct %9 %66 %66 -%276 = OpCompositeConstruct %9 %26 %26 -%277 = OpFAdd %9 %275 %276 -%278 = OpCompositeConstruct %9 %26 %26 -%279 = OpCompositeConstruct %9 %66 %66 -%280 = OpFAdd %9 %279 %278 -%281 = OpCompositeConstruct %197 %70 %70 -%282 = OpCompositeConstruct %197 %32 %32 -%283 = OpISub %197 %281 %282 -%284 = OpCompositeConstruct %197 %32 %32 -%285 = OpCompositeConstruct %197 %70 %70 -%286 = OpISub %197 %285 %284 -%287 = OpCompositeConstruct %16 %184 %184 -%288 = OpCompositeConstruct %16 %185 %185 -%289 = OpISub %16 %287 %288 -%290 = OpCompositeConstruct %16 %185 %185 -%291 = OpCompositeConstruct %16 %184 %184 -%292 = OpISub %16 %291 %290 -%293 = OpCompositeConstruct %9 %66 %66 -%294 = OpCompositeConstruct %9 %26 %26 -%295 = OpFSub %9 %293 %294 -%296 = OpCompositeConstruct %9 %26 %26 -%297 = OpCompositeConstruct %9 %66 %66 -%298 = OpFSub %9 %297 %296 -%299 = OpCompositeConstruct %197 %70 %70 -%301 = OpCompositeConstruct %197 %32 %32 -%300 = OpIMul %197 %299 %301 -%302 = OpCompositeConstruct %197 %32 %32 -%304 = OpCompositeConstruct %197 %70 %70 -%303 = OpIMul %197 %302 %304 -%305 = OpCompositeConstruct %16 %184 %184 -%307 = OpCompositeConstruct %16 %185 %185 -%306 = OpIMul %16 %305 %307 -%308 = OpCompositeConstruct %16 %185 %185 -%310 = OpCompositeConstruct %16 %184 %184 -%309 = OpIMul %16 %308 %310 -%311 = OpCompositeConstruct %9 %66 %66 -%312 = OpVectorTimesScalar %9 %311 %26 -%313 = OpCompositeConstruct %9 %26 %26 -%314 = OpVectorTimesScalar %9 %313 %66 -%315 = OpCompositeConstruct %197 %70 %70 -%316 = OpCompositeConstruct %197 %32 %32 -%317 = OpSDiv %197 %315 %316 -%318 = OpCompositeConstruct %197 %32 %32 -%319 = OpCompositeConstruct %197 %70 %70 -%320 = OpSDiv %197 %319 %318 -%321 = OpCompositeConstruct %16 %184 %184 -%322 = OpCompositeConstruct %16 %185 %185 -%323 = OpUDiv %16 %321 %322 -%324 = OpCompositeConstruct %16 %185 %185 -%325 = OpCompositeConstruct %16 %184 %184 -%326 = OpUDiv %16 %325 %324 -%327 = OpCompositeConstruct %9 %66 %66 -%328 = OpCompositeConstruct %9 %26 %26 -%329 = OpFDiv %9 %327 %328 -%330 = OpCompositeConstruct %9 %26 %26 -%331 = OpCompositeConstruct %9 %66 %66 -%332 = OpFDiv %9 %331 %330 -%333 = OpCompositeConstruct %197 %70 %70 -%334 = OpCompositeConstruct %197 %32 %32 -%335 = OpSRem %197 %333 %334 -%336 = OpCompositeConstruct %197 %32 %32 -%337 = OpCompositeConstruct %197 %70 %70 -%338 = OpSRem %197 %337 %336 -%339 = OpCompositeConstruct %16 %184 %184 -%340 = OpCompositeConstruct %16 %185 %185 -%341 = OpUMod %16 %339 %340 -%342 = OpCompositeConstruct %16 %185 %185 -%343 = OpCompositeConstruct %16 %184 %184 -%344 = OpUMod %16 %343 %342 -%345 = OpCompositeConstruct %9 %66 %66 -%346 = OpCompositeConstruct %9 %26 %26 -%347 = OpFRem %9 %345 %346 -%348 = OpCompositeConstruct %9 %26 %26 -%349 = OpCompositeConstruct %9 %66 %66 -%350 = OpFRem %9 %349 %348 -%352 = OpCompositeExtract %10 %186 0 -%353 = OpCompositeExtract %10 %187 0 -%354 = OpFAdd %10 %352 %353 -%355 = OpCompositeExtract %10 %186 1 -%356 = OpCompositeExtract %10 %187 1 -%357 = OpFAdd %10 %355 %356 -%358 = OpCompositeExtract %10 %186 2 -%359 = OpCompositeExtract %10 %187 2 -%360 = OpFAdd %10 %358 %359 -%351 = OpCompositeConstruct %22 %354 %357 %360 -%362 = OpCompositeExtract %10 %188 0 -%363 = OpCompositeExtract %10 %189 0 -%364 = OpFSub %10 %362 %363 -%365 = OpCompositeExtract %10 %188 1 -%366 = OpCompositeExtract %10 %189 1 -%367 = OpFSub %10 %365 %366 -%368 = OpCompositeExtract %10 %188 2 -%369 = OpCompositeExtract %10 %189 2 -%370 = OpFSub %10 %368 %369 -%361 = OpCompositeConstruct %22 %364 %367 %370 -%371 = OpMatrixTimesScalar %22 %190 %26 -%372 = OpMatrixTimesScalar %22 %191 %66 -%373 = OpCompositeConstruct %3 %26 %26 %26 %26 -%374 = OpMatrixTimesVector %10 %192 %373 -%375 = OpCompositeConstruct %10 %66 %66 %66 -%376 = OpVectorTimesMatrix %3 %375 %193 -%377 = OpMatrixTimesMatrix %22 %194 %195 +%212 = OpCompositeConstruct %208 %124 %124 +%213 = OpCompositeConstruct %208 %123 %123 +%214 = OpIAdd %208 %213 %212 +%215 = OpCompositeConstruct %9 %55 %55 +%216 = OpCompositeConstruct %9 %16 %16 +%217 = OpFAdd %9 %215 %216 +%218 = OpCompositeConstruct %9 %16 %16 +%219 = OpCompositeConstruct %9 %55 %55 +%220 = OpFAdd %9 %219 %218 +%221 = OpCompositeConstruct %136 %59 %59 +%222 = OpCompositeConstruct %136 %22 %22 +%223 = OpISub %136 %221 %222 +%224 = OpCompositeConstruct %136 %22 %22 +%225 = OpCompositeConstruct %136 %59 %59 +%226 = OpISub %136 %225 %224 +%227 = OpCompositeConstruct %208 %123 %123 +%228 = OpCompositeConstruct %208 %124 %124 +%229 = OpISub %208 %227 %228 +%230 = OpCompositeConstruct %208 %124 %124 +%231 = OpCompositeConstruct %208 %123 %123 +%232 = OpISub %208 %231 %230 +%233 = OpCompositeConstruct %9 %55 %55 +%234 = OpCompositeConstruct %9 %16 %16 +%235 = OpFSub %9 %233 %234 +%236 = OpCompositeConstruct %9 %16 %16 +%237 = OpCompositeConstruct %9 %55 %55 +%238 = OpFSub %9 %237 %236 +%239 = OpCompositeConstruct %136 %59 %59 +%241 = OpCompositeConstruct %136 %22 %22 +%240 = OpIMul %136 %239 %241 +%242 = OpCompositeConstruct %136 %22 %22 +%244 = OpCompositeConstruct %136 %59 %59 +%243 = OpIMul %136 %242 %244 +%245 = OpCompositeConstruct %208 %123 %123 +%247 = OpCompositeConstruct %208 %124 %124 +%246 = OpIMul %208 %245 %247 +%248 = OpCompositeConstruct %208 %124 %124 +%250 = OpCompositeConstruct %208 %123 %123 +%249 = OpIMul %208 %248 %250 +%251 = OpCompositeConstruct %9 %55 %55 +%252 = OpVectorTimesScalar %9 %251 %16 +%253 = OpCompositeConstruct %9 %16 %16 +%254 = OpVectorTimesScalar %9 %253 %55 +%255 = OpCompositeConstruct %136 %59 %59 +%256 = OpCompositeConstruct %136 %22 %22 +%257 = OpSDiv %136 %255 %256 +%258 = OpCompositeConstruct %136 %22 %22 +%259 = OpCompositeConstruct %136 %59 %59 +%260 = OpSDiv %136 %259 %258 +%261 = OpCompositeConstruct %208 %123 %123 +%262 = OpCompositeConstruct %208 %124 %124 +%263 = OpUDiv %208 %261 %262 +%264 = OpCompositeConstruct %208 %124 %124 +%265 = OpCompositeConstruct %208 %123 %123 +%266 = OpUDiv %208 %265 %264 +%267 = OpCompositeConstruct %9 %55 %55 +%268 = OpCompositeConstruct %9 %16 %16 +%269 = OpFDiv %9 %267 %268 +%270 = OpCompositeConstruct %9 %16 %16 +%271 = OpCompositeConstruct %9 %55 %55 +%272 = OpFDiv %9 %271 %270 +%273 = OpCompositeConstruct %136 %59 %59 +%274 = OpCompositeConstruct %136 %22 %22 +%275 = OpSRem %136 %273 %274 +%276 = OpCompositeConstruct %136 %22 %22 +%277 = OpCompositeConstruct %136 %59 %59 +%278 = OpSRem %136 %277 %276 +%279 = OpCompositeConstruct %208 %123 %123 +%280 = OpCompositeConstruct %208 %124 %124 +%281 = OpUMod %208 %279 %280 +%282 = OpCompositeConstruct %208 %124 %124 +%283 = OpCompositeConstruct %208 %123 %123 +%284 = OpUMod %208 %283 %282 +%285 = OpCompositeConstruct %9 %55 %55 +%286 = OpCompositeConstruct %9 %16 %16 +%287 = OpFRem %9 %285 %286 +%288 = OpCompositeConstruct %9 %16 %16 +%289 = OpCompositeConstruct %9 %55 %55 +%290 = OpFRem %9 %289 %288 +%292 = OpCompositeExtract %10 %125 0 +%293 = OpCompositeExtract %10 %126 0 +%294 = OpFAdd %10 %292 %293 +%295 = OpCompositeExtract %10 %125 1 +%296 = OpCompositeExtract %10 %126 1 +%297 = OpFAdd %10 %295 %296 +%298 = OpCompositeExtract %10 %125 2 +%299 = OpCompositeExtract %10 %126 2 +%300 = OpFAdd %10 %298 %299 +%291 = OpCompositeConstruct %12 %294 %297 %300 +%302 = OpCompositeExtract %10 %127 0 +%303 = OpCompositeExtract %10 %128 0 +%304 = OpFSub %10 %302 %303 +%305 = OpCompositeExtract %10 %127 1 +%306 = OpCompositeExtract %10 %128 1 +%307 = OpFSub %10 %305 %306 +%308 = OpCompositeExtract %10 %127 2 +%309 = OpCompositeExtract %10 %128 2 +%310 = OpFSub %10 %308 %309 +%301 = OpCompositeConstruct %12 %304 %307 %310 +%311 = OpMatrixTimesScalar %12 %129 %16 +%312 = OpMatrixTimesScalar %12 %130 %55 +%313 = OpCompositeConstruct %3 %16 %16 %16 %16 +%314 = OpMatrixTimesVector %10 %131 %313 +%315 = OpCompositeConstruct %10 %55 %55 %55 +%316 = OpVectorTimesMatrix %3 %315 %132 +%317 = OpMatrixTimesMatrix %12 %133 %134 OpReturn OpFunctionEnd -%379 = OpFunction %2 None %165 -%378 = OpLabel -OpBranch %380 -%380 = OpLabel -%381 = OpNot %6 %32 -%382 = OpNot %15 %185 -%383 = OpCompositeConstruct %197 %32 %32 -%384 = OpNot %197 %383 -%385 = OpCompositeConstruct %208 %185 %185 %185 -%386 = OpNot %208 %385 -%387 = OpBitwiseOr %6 %70 %32 -%388 = OpBitwiseOr %15 %184 %185 -%389 = OpCompositeConstruct %197 %70 %70 -%390 = OpCompositeConstruct %197 %32 %32 -%391 = OpBitwiseOr %197 %389 %390 -%392 = OpCompositeConstruct %208 %184 %184 %184 -%393 = OpCompositeConstruct %208 %185 %185 %185 -%394 = OpBitwiseOr %208 %392 %393 -%395 = OpBitwiseAnd %6 %70 %32 -%396 = OpBitwiseAnd %15 %184 %185 -%397 = OpCompositeConstruct %197 %70 %70 -%398 = OpCompositeConstruct %197 %32 %32 -%399 = OpBitwiseAnd %197 %397 %398 -%400 = OpCompositeConstruct %208 %184 %184 %184 -%401 = OpCompositeConstruct %208 %185 %185 %185 -%402 = OpBitwiseAnd %208 %400 %401 -%403 = OpBitwiseXor %6 %70 %32 -%404 = OpBitwiseXor %15 %184 %185 -%405 = OpCompositeConstruct %197 %70 %70 -%406 = OpCompositeConstruct %197 %32 %32 -%407 = OpBitwiseXor %197 %405 %406 -%408 = OpCompositeConstruct %208 %184 %184 %184 -%409 = OpCompositeConstruct %208 %185 %185 %185 -%410 = OpBitwiseXor %208 %408 %409 -%411 = OpShiftLeftLogical %6 %70 %185 -%412 = OpShiftLeftLogical %15 %184 %185 -%413 = OpCompositeConstruct %197 %70 %70 -%414 = OpCompositeConstruct %16 %185 %185 -%415 = OpShiftLeftLogical %197 %413 %414 -%416 = OpCompositeConstruct %208 %184 %184 %184 -%417 = OpCompositeConstruct %208 %185 %185 %185 -%418 = OpShiftLeftLogical %208 %416 %417 -%419 = OpShiftRightArithmetic %6 %70 %185 -%420 = OpShiftRightLogical %15 %184 %185 -%421 = OpCompositeConstruct %197 %70 %70 -%422 = OpCompositeConstruct %16 %185 %185 -%423 = OpShiftRightArithmetic %197 %421 %422 -%424 = OpCompositeConstruct %208 %184 %184 %184 -%425 = OpCompositeConstruct %208 %185 %185 %185 -%426 = OpShiftRightLogical %208 %424 %425 +%319 = OpFunction %2 None %103 +%318 = OpLabel +OpBranch %320 +%320 = OpLabel +%321 = OpNot %6 %22 +%322 = OpNot %122 %124 +%323 = OpCompositeConstruct %136 %22 %22 +%324 = OpNot %136 %323 +%325 = OpCompositeConstruct %147 %124 %124 %124 +%326 = OpNot %147 %325 +%327 = OpBitwiseOr %6 %59 %22 +%328 = OpBitwiseOr %122 %123 %124 +%329 = OpCompositeConstruct %136 %59 %59 +%330 = OpCompositeConstruct %136 %22 %22 +%331 = OpBitwiseOr %136 %329 %330 +%332 = OpCompositeConstruct %147 %123 %123 %123 +%333 = OpCompositeConstruct %147 %124 %124 %124 +%334 = OpBitwiseOr %147 %332 %333 +%335 = OpBitwiseAnd %6 %59 %22 +%336 = OpBitwiseAnd %122 %123 %124 +%337 = OpCompositeConstruct %136 %59 %59 +%338 = OpCompositeConstruct %136 %22 %22 +%339 = OpBitwiseAnd %136 %337 %338 +%340 = OpCompositeConstruct %147 %123 %123 %123 +%341 = OpCompositeConstruct %147 %124 %124 %124 +%342 = OpBitwiseAnd %147 %340 %341 +%343 = OpBitwiseXor %6 %59 %22 +%344 = OpBitwiseXor %122 %123 %124 +%345 = OpCompositeConstruct %136 %59 %59 +%346 = OpCompositeConstruct %136 %22 %22 +%347 = OpBitwiseXor %136 %345 %346 +%348 = OpCompositeConstruct %147 %123 %123 %123 +%349 = OpCompositeConstruct %147 %124 %124 %124 +%350 = OpBitwiseXor %147 %348 %349 +%351 = OpShiftLeftLogical %6 %59 %124 +%352 = OpShiftLeftLogical %122 %123 %124 +%353 = OpCompositeConstruct %136 %59 %59 +%354 = OpCompositeConstruct %208 %124 %124 +%355 = OpShiftLeftLogical %136 %353 %354 +%356 = OpCompositeConstruct %147 %123 %123 %123 +%357 = OpCompositeConstruct %147 %124 %124 %124 +%358 = OpShiftLeftLogical %147 %356 %357 +%359 = OpShiftRightArithmetic %6 %59 %124 +%360 = OpShiftRightLogical %122 %123 %124 +%361 = OpCompositeConstruct %136 %59 %59 +%362 = OpCompositeConstruct %208 %124 %124 +%363 = OpShiftRightArithmetic %136 %361 %362 +%364 = OpCompositeConstruct %147 %123 %123 %123 +%365 = OpCompositeConstruct %147 %124 %124 %124 +%366 = OpShiftRightLogical %147 %364 %365 OpReturn OpFunctionEnd -%428 = OpFunction %2 None %165 -%427 = OpLabel -OpBranch %429 -%429 = OpLabel -%430 = OpIEqual %8 %70 %32 -%431 = OpIEqual %8 %184 %185 -%432 = OpFOrdEqual %8 %66 %26 -%433 = OpCompositeConstruct %197 %70 %70 -%434 = OpCompositeConstruct %197 %32 %32 -%435 = OpIEqual %168 %433 %434 -%436 = OpCompositeConstruct %208 %184 %184 %184 -%437 = OpCompositeConstruct %208 %185 %185 %185 -%438 = OpIEqual %11 %436 %437 -%439 = OpCompositeConstruct %3 %66 %66 %66 %66 -%440 = OpCompositeConstruct %3 %26 %26 %26 %26 -%441 = OpFOrdEqual %7 %439 %440 -%442 = OpINotEqual %8 %70 %32 -%443 = OpINotEqual %8 %184 %185 -%444 = OpFOrdNotEqual %8 %66 %26 -%445 = OpCompositeConstruct %197 %70 %70 -%446 = OpCompositeConstruct %197 %32 %32 -%447 = OpINotEqual %168 %445 %446 -%448 = OpCompositeConstruct %208 %184 %184 %184 -%449 = OpCompositeConstruct %208 %185 %185 %185 -%450 = OpINotEqual %11 %448 %449 -%451 = OpCompositeConstruct %3 %66 %66 %66 %66 -%452 = OpCompositeConstruct %3 %26 %26 %26 %26 -%453 = OpFOrdNotEqual %7 %451 %452 -%454 = OpSLessThan %8 %70 %32 -%455 = OpULessThan %8 %184 %185 -%456 = OpFOrdLessThan %8 %66 %26 -%457 = OpCompositeConstruct %197 %70 %70 -%458 = OpCompositeConstruct %197 %32 %32 -%459 = OpSLessThan %168 %457 %458 -%460 = OpCompositeConstruct %208 %184 %184 %184 -%461 = OpCompositeConstruct %208 %185 %185 %185 -%462 = OpULessThan %11 %460 %461 -%463 = OpCompositeConstruct %3 %66 %66 %66 %66 -%464 = OpCompositeConstruct %3 %26 %26 %26 %26 -%465 = OpFOrdLessThan %7 %463 %464 -%466 = OpSLessThanEqual %8 %70 %32 -%467 = OpULessThanEqual %8 %184 %185 -%468 = OpFOrdLessThanEqual %8 %66 %26 -%469 = OpCompositeConstruct %197 %70 %70 -%470 = OpCompositeConstruct %197 %32 %32 -%471 = OpSLessThanEqual %168 %469 %470 -%472 = OpCompositeConstruct %208 %184 %184 %184 -%473 = OpCompositeConstruct %208 %185 %185 %185 -%474 = OpULessThanEqual %11 %472 %473 -%475 = OpCompositeConstruct %3 %66 %66 %66 %66 -%476 = OpCompositeConstruct %3 %26 %26 %26 %26 -%477 = OpFOrdLessThanEqual %7 %475 %476 -%478 = OpSGreaterThan %8 %70 %32 -%479 = OpUGreaterThan %8 %184 %185 -%480 = OpFOrdGreaterThan %8 %66 %26 -%481 = OpCompositeConstruct %197 %70 %70 -%482 = OpCompositeConstruct %197 %32 %32 -%483 = OpSGreaterThan %168 %481 %482 -%484 = OpCompositeConstruct %208 %184 %184 %184 -%485 = OpCompositeConstruct %208 %185 %185 %185 -%486 = OpUGreaterThan %11 %484 %485 -%487 = OpCompositeConstruct %3 %66 %66 %66 %66 -%488 = OpCompositeConstruct %3 %26 %26 %26 %26 -%489 = OpFOrdGreaterThan %7 %487 %488 -%490 = OpSGreaterThanEqual %8 %70 %32 -%491 = OpUGreaterThanEqual %8 %184 %185 -%492 = OpFOrdGreaterThanEqual %8 %66 %26 -%493 = OpCompositeConstruct %197 %70 %70 -%494 = OpCompositeConstruct %197 %32 %32 -%495 = OpSGreaterThanEqual %168 %493 %494 -%496 = OpCompositeConstruct %208 %184 %184 %184 -%497 = OpCompositeConstruct %208 %185 %185 %185 -%498 = OpUGreaterThanEqual %11 %496 %497 -%499 = OpCompositeConstruct %3 %66 %66 %66 %66 -%500 = OpCompositeConstruct %3 %26 %26 %26 %26 -%501 = OpFOrdGreaterThanEqual %7 %499 %500 +%368 = OpFunction %2 None %103 +%367 = OpLabel +OpBranch %369 +%369 = OpLabel +%370 = OpIEqual %8 %59 %22 +%371 = OpIEqual %8 %123 %124 +%372 = OpFOrdEqual %8 %55 %16 +%373 = OpCompositeConstruct %136 %59 %59 +%374 = OpCompositeConstruct %136 %22 %22 +%375 = OpIEqual %106 %373 %374 +%376 = OpCompositeConstruct %147 %123 %123 %123 +%377 = OpCompositeConstruct %147 %124 %124 %124 +%378 = OpIEqual %11 %376 %377 +%379 = OpCompositeConstruct %3 %55 %55 %55 %55 +%380 = OpCompositeConstruct %3 %16 %16 %16 %16 +%381 = OpFOrdEqual %7 %379 %380 +%382 = OpINotEqual %8 %59 %22 +%383 = OpINotEqual %8 %123 %124 +%384 = OpFOrdNotEqual %8 %55 %16 +%385 = OpCompositeConstruct %136 %59 %59 +%386 = OpCompositeConstruct %136 %22 %22 +%387 = OpINotEqual %106 %385 %386 +%388 = OpCompositeConstruct %147 %123 %123 %123 +%389 = OpCompositeConstruct %147 %124 %124 %124 +%390 = OpINotEqual %11 %388 %389 +%391 = OpCompositeConstruct %3 %55 %55 %55 %55 +%392 = OpCompositeConstruct %3 %16 %16 %16 %16 +%393 = OpFOrdNotEqual %7 %391 %392 +%394 = OpSLessThan %8 %59 %22 +%395 = OpULessThan %8 %123 %124 +%396 = OpFOrdLessThan %8 %55 %16 +%397 = OpCompositeConstruct %136 %59 %59 +%398 = OpCompositeConstruct %136 %22 %22 +%399 = OpSLessThan %106 %397 %398 +%400 = OpCompositeConstruct %147 %123 %123 %123 +%401 = OpCompositeConstruct %147 %124 %124 %124 +%402 = OpULessThan %11 %400 %401 +%403 = OpCompositeConstruct %3 %55 %55 %55 %55 +%404 = OpCompositeConstruct %3 %16 %16 %16 %16 +%405 = OpFOrdLessThan %7 %403 %404 +%406 = OpSLessThanEqual %8 %59 %22 +%407 = OpULessThanEqual %8 %123 %124 +%408 = OpFOrdLessThanEqual %8 %55 %16 +%409 = OpCompositeConstruct %136 %59 %59 +%410 = OpCompositeConstruct %136 %22 %22 +%411 = OpSLessThanEqual %106 %409 %410 +%412 = OpCompositeConstruct %147 %123 %123 %123 +%413 = OpCompositeConstruct %147 %124 %124 %124 +%414 = OpULessThanEqual %11 %412 %413 +%415 = OpCompositeConstruct %3 %55 %55 %55 %55 +%416 = OpCompositeConstruct %3 %16 %16 %16 %16 +%417 = OpFOrdLessThanEqual %7 %415 %416 +%418 = OpSGreaterThan %8 %59 %22 +%419 = OpUGreaterThan %8 %123 %124 +%420 = OpFOrdGreaterThan %8 %55 %16 +%421 = OpCompositeConstruct %136 %59 %59 +%422 = OpCompositeConstruct %136 %22 %22 +%423 = OpSGreaterThan %106 %421 %422 +%424 = OpCompositeConstruct %147 %123 %123 %123 +%425 = OpCompositeConstruct %147 %124 %124 %124 +%426 = OpUGreaterThan %11 %424 %425 +%427 = OpCompositeConstruct %3 %55 %55 %55 %55 +%428 = OpCompositeConstruct %3 %16 %16 %16 %16 +%429 = OpFOrdGreaterThan %7 %427 %428 +%430 = OpSGreaterThanEqual %8 %59 %22 +%431 = OpUGreaterThanEqual %8 %123 %124 +%432 = OpFOrdGreaterThanEqual %8 %55 %16 +%433 = OpCompositeConstruct %136 %59 %59 +%434 = OpCompositeConstruct %136 %22 %22 +%435 = OpSGreaterThanEqual %106 %433 %434 +%436 = OpCompositeConstruct %147 %123 %123 %123 +%437 = OpCompositeConstruct %147 %124 %124 %124 +%438 = OpUGreaterThanEqual %11 %436 %437 +%439 = OpCompositeConstruct %3 %55 %55 %55 %55 +%440 = OpCompositeConstruct %3 %16 %16 %16 %16 +%441 = OpFOrdGreaterThanEqual %7 %439 %440 OpReturn OpFunctionEnd -%509 = OpFunction %2 None %165 -%508 = OpLabel -%502 = OpVariable %503 Function %504 -%505 = OpVariable %506 Function %507 -OpBranch %511 -%511 = OpLabel -OpStore %502 %32 -%512 = OpLoad %6 %502 -%513 = OpIAdd %6 %512 %32 -OpStore %502 %513 -%514 = OpLoad %6 %502 -%515 = OpISub %6 %514 %32 -OpStore %502 %515 -%516 = OpLoad %6 %502 -%517 = OpLoad %6 %502 -%518 = OpIMul %6 %517 %516 -OpStore %502 %518 -%519 = OpLoad %6 %502 -%520 = OpLoad %6 %502 -%521 = OpSDiv %6 %520 %519 -OpStore %502 %521 -%522 = OpLoad %6 %502 -%523 = OpSRem %6 %522 %32 -OpStore %502 %523 -%524 = OpLoad %6 %502 -%525 = OpBitwiseAnd %6 %524 %39 -OpStore %502 %525 -%526 = OpLoad %6 %502 -%527 = OpBitwiseOr %6 %526 %39 -OpStore %502 %527 -%528 = OpLoad %6 %502 -%529 = OpBitwiseXor %6 %528 %39 -OpStore %502 %529 -%530 = OpLoad %6 %502 -%531 = OpShiftLeftLogical %6 %530 %184 -OpStore %502 %531 -%532 = OpLoad %6 %502 -%533 = OpShiftRightArithmetic %6 %532 %185 -OpStore %502 %533 -%534 = OpLoad %6 %502 -%535 = OpIAdd %6 %534 %32 -OpStore %502 %535 -%536 = OpLoad %6 %502 -%537 = OpISub %6 %536 %32 -OpStore %502 %537 -OpStore %505 %510 -%539 = OpAccessChain %538 %505 %185 -%540 = OpLoad %6 %539 -%541 = OpIAdd %6 %540 %32 -%542 = OpAccessChain %538 %505 %185 -OpStore %542 %541 -%543 = OpAccessChain %538 %505 %185 -%544 = OpLoad %6 %543 -%545 = OpISub %6 %544 %32 -%546 = OpAccessChain %538 %505 %185 -OpStore %546 %545 +%449 = OpFunction %2 None %103 +%448 = OpLabel +%442 = OpVariable %443 Function %444 +%445 = OpVariable %446 Function %447 +OpBranch %451 +%451 = OpLabel +OpStore %442 %22 +%452 = OpLoad %6 %442 +%453 = OpIAdd %6 %452 %22 +OpStore %442 %453 +%454 = OpLoad %6 %442 +%455 = OpISub %6 %454 %22 +OpStore %442 %455 +%456 = OpLoad %6 %442 +%457 = OpLoad %6 %442 +%458 = OpIMul %6 %457 %456 +OpStore %442 %458 +%459 = OpLoad %6 %442 +%460 = OpLoad %6 %442 +%461 = OpSDiv %6 %460 %459 +OpStore %442 %461 +%462 = OpLoad %6 %442 +%463 = OpSRem %6 %462 %22 +OpStore %442 %463 +%464 = OpLoad %6 %442 +%465 = OpBitwiseAnd %6 %464 %28 +OpStore %442 %465 +%466 = OpLoad %6 %442 +%467 = OpBitwiseOr %6 %466 %28 +OpStore %442 %467 +%468 = OpLoad %6 %442 +%469 = OpBitwiseXor %6 %468 %28 +OpStore %442 %469 +%470 = OpLoad %6 %442 +%471 = OpShiftLeftLogical %6 %470 %123 +OpStore %442 %471 +%472 = OpLoad %6 %442 +%473 = OpShiftRightArithmetic %6 %472 %124 +OpStore %442 %473 +%474 = OpLoad %6 %442 +%475 = OpIAdd %6 %474 %22 +OpStore %442 %475 +%476 = OpLoad %6 %442 +%477 = OpISub %6 %476 %22 +OpStore %442 %477 +OpStore %445 %450 +%479 = OpAccessChain %478 %445 %124 +%480 = OpLoad %6 %479 +%481 = OpIAdd %6 %480 %22 +%482 = OpAccessChain %478 %445 %124 +OpStore %482 %481 +%483 = OpAccessChain %478 %445 %124 +%484 = OpLoad %6 %483 +%485 = OpISub %6 %484 %22 +%486 = OpAccessChain %478 %445 %124 +OpStore %486 %485 OpReturn OpFunctionEnd -%548 = OpFunction %2 None %165 -%547 = OpLabel -OpBranch %557 -%557 = OpLabel -%558 = OpSNegate %6 %550 -%559 = OpSNegate %6 %551 -%560 = OpSNegate %6 %552 -%561 = OpSNegate %6 %560 -%562 = OpSNegate %6 %553 -%563 = OpSNegate %6 %562 -%564 = OpSNegate %6 %554 -%565 = OpSNegate %6 %564 -%566 = OpSNegate %6 %565 -%567 = OpSNegate %6 %566 -%568 = OpSNegate %6 %555 -%569 = OpSNegate %6 %568 -%570 = OpSNegate %6 %569 -%571 = OpSNegate %6 %570 -%572 = OpSNegate %6 %556 -%573 = OpSNegate %6 %572 -%574 = OpSNegate %6 %573 -%575 = OpSNegate %6 %574 +%488 = OpFunction %2 None %103 +%487 = OpLabel +OpBranch %497 +%497 = OpLabel +%498 = OpSNegate %6 %490 +%499 = OpSNegate %6 %491 +%500 = OpSNegate %6 %492 +%501 = OpSNegate %6 %500 +%502 = OpSNegate %6 %493 +%503 = OpSNegate %6 %502 +%504 = OpSNegate %6 %494 +%505 = OpSNegate %6 %504 +%506 = OpSNegate %6 %505 +%507 = OpSNegate %6 %506 +%508 = OpSNegate %6 %495 +%509 = OpSNegate %6 %508 +%510 = OpSNegate %6 %509 +%511 = OpSNegate %6 %510 +%512 = OpSNegate %6 %496 +%513 = OpSNegate %6 %512 +%514 = OpSNegate %6 %513 +%515 = OpSNegate %6 %514 OpReturn OpFunctionEnd -%577 = OpFunction %2 None %165 -%576 = OpLabel -OpBranch %578 -%578 = OpLabel -%579 = OpFunctionCall %3 %36 -%580 = OpFunctionCall %3 %65 -%581 = OpVectorShuffle %10 %27 %27 0 1 2 -%582 = OpFunctionCall %10 %105 %581 -%583 = OpFunctionCall %4 %116 -%584 = OpFunctionCall %2 %164 -%585 = OpFunctionCall %2 %182 -%586 = OpFunctionCall %2 %379 -%587 = OpFunctionCall %2 %428 -%588 = OpFunctionCall %2 %509 +%517 = OpFunction %2 None %103 +%516 = OpLabel +OpBranch %518 +%518 = OpLabel +%519 = OpFunctionCall %3 %25 +%520 = OpFunctionCall %3 %54 +%521 = OpVectorShuffle %10 %17 %17 0 1 2 +%522 = OpFunctionCall %10 %94 %521 +%523 = OpFunctionCall %2 %102 +%524 = OpFunctionCall %2 %120 +%525 = OpFunctionCall %2 %319 +%526 = OpFunctionCall %2 %368 +%527 = OpFunctionCall %2 %449 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/tests/out/wgsl/constructors.wgsl b/tests/out/wgsl/constructors.wgsl new file mode 100644 index 0000000000..645e0af4b1 --- /dev/null +++ b/tests/out/wgsl/constructors.wgsl @@ -0,0 +1,37 @@ +struct Foo { + a: vec4, + b: i32, +} + +const const2_: vec3 = vec3(0.0, 0.0, 0.0); +const const3_: mat2x2 = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); +const const4_: array, 1> = array, 1>(mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0))); +const cz0_: bool = bool(); +const cz1_: i32 = i32(); +const cz2_: u32 = u32(); +const cz3_: f32 = f32(); +const cz4_: vec2 = vec2(); +const cz5_: mat2x2 = mat2x2(); +const cz6_: array = array(); +const cz7_: Foo = Foo(); +const cp3_: array = array(0, 1, 2, 3); + +@compute @workgroup_size(1, 1, 1) +fn main() { + var foo: Foo; + + foo = Foo(vec4(1.0), 1); + _ = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + _ = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + _ = vec2(0u); + _ = mat2x2(vec2(0.0), vec2(0.0)); + _ = array(0, 1, 2, 3); + _ = bool(bool()); + _ = i32(i32()); + _ = u32(u32()); + _ = f32(f32()); + _ = vec2(vec2()); + _ = mat2x3(mat2x3()); + _ = bitcast>(vec2()); + _ = mat2x3(mat2x3()); +} diff --git a/tests/out/wgsl/operators.wgsl b/tests/out/wgsl/operators.wgsl index 344399a555..8c33354d0c 100644 --- a/tests/out/wgsl/operators.wgsl +++ b/tests/out/wgsl/operators.wgsl @@ -1,8 +1,3 @@ -struct Foo { - a: vec4, - b: i32, -} - const v_f32_one: vec4 = vec4(1.0, 1.0, 1.0, 1.0); const v_f32_zero: vec4 = vec4(0.0, 0.0, 0.0, 0.0); const v_f32_half: vec4 = vec4(0.5, 0.5, 0.5, 0.5); @@ -45,27 +40,6 @@ fn bool_cast(x: vec3) -> vec3 { return vec3(y); } -fn constructors() -> f32 { - var foo: Foo; - - foo = Foo(vec4(1.0), 1); - let mat2comp = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - let mat4comp = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); - _ = vec2(0u); - _ = mat2x2(vec2(0.0), vec2(0.0)); - _ = array(0, 1, 2, 3); - _ = bool(bool()); - _ = i32(i32()); - _ = u32(u32()); - _ = f32(f32()); - _ = vec2(vec2()); - _ = mat2x3(mat2x3()); - _ = bitcast>(vec2()); - _ = mat2x3(mat2x3()); - let _e71 = foo.a.x; - return _e71; -} - fn logical() { _ = !(true); _ = !(vec2(true)); @@ -269,7 +243,6 @@ fn main() { let _e0 = builtins(); let _e1 = splat(); let _e4 = bool_cast(v_f32_one.xyz); - let _e5 = constructors(); logical(); arithmetic(); bit(); diff --git a/tests/snapshots.rs b/tests/snapshots.rs index d968a0dfc1..b6ea7ac2af 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -572,6 +572,10 @@ fn convert_wgsl() { ("force_point_size_vertex_shader_webgl", Targets::GLSL), ("invariant", Targets::GLSL), ("ray-query", Targets::SPIRV | Targets::METAL), + ( + "constructors", + Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, + ), ]; for &(name, targets) in inputs.iter() {