diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs index 657de486f3..6e600ba591 100644 --- a/src/front/wgsl/mod.rs +++ b/src/front/wgsl/mod.rs @@ -916,29 +916,8 @@ impl<'a> ExpressionContext<'a, '_, '_> { let mut right = self.apply_load_rule(unloaded_right); let end = lexer.current_byte_offset() as u32; - // Insert splats, if needed by the non-'*' operations. - // (`BinaryOperator::Multiply` handles splats itself.) - if op != crate::BinaryOperator::Multiply { - let left_size = match *self.resolve_type(left)? { - crate::TypeInner::Vector { size, .. } => Some(size), - _ => None, - }; - match (left_size, self.resolve_type(right)?) { - (Some(size), &crate::TypeInner::Scalar { .. }) => { - right = self.expressions.append( - crate::Expression::Splat { size, value: right }, - self.expressions.get_span(right), - ); - } - (None, &crate::TypeInner::Vector { size, .. }) => { - left = self.expressions.append( - crate::Expression::Splat { size, value: left }, - self.expressions.get_span(left), - ); - } - _ => {} - } - } + self.binary_op_splat(op, &mut left, &mut right)?; + accumulator = TypedExpression::non_reference(self.expressions.append( crate::Expression::Binary { op, left, right }, NagaSpan::new(start, end), @@ -947,6 +926,41 @@ impl<'a> ExpressionContext<'a, '_, '_> { Ok(accumulator) } + /// Insert splats, if needed by the non-'*' operations. + fn binary_op_splat( + &mut self, + op: crate::BinaryOperator, + left: &mut Handle, + right: &mut Handle, + ) -> Result<(), Error<'a>> { + if op != crate::BinaryOperator::Multiply { + let left_size = match *self.resolve_type(*left)? { + crate::TypeInner::Vector { size, .. } => Some(size), + _ => None, + }; + match (left_size, self.resolve_type(*right)?) { + (Some(size), &crate::TypeInner::Scalar { .. }) => { + *right = self.expressions.append( + crate::Expression::Splat { + size, + value: *right, + }, + self.expressions.get_span(*right), + ); + } + (None, &crate::TypeInner::Vector { size, .. }) => { + *left = self.expressions.append( + crate::Expression::Splat { size, value: *left }, + self.expressions.get_span(*left), + ); + } + _ => {} + } + } + + Ok(()) + } + /// Add a single expression to the expression table that is not covered by `self.emitter`. /// /// This is useful for `CallResult` and `AtomicResult` expressions, which should not be covered by @@ -3321,13 +3335,16 @@ impl Parser { //Note: `consume_token` shouldn't produce any other assignment ops _ => unreachable!(), }; - let left = context.expressions.append( + let mut left = context.expressions.append( crate::Expression::Load { pointer: reference.handle, }, lhs_span.into(), ); - let right = self.parse_general_expression(lexer, context.reborrow())?; + let mut right = self.parse_general_expression(lexer, context.reborrow())?; + + context.binary_op_splat(op, &mut left, &mut right)?; + context .expressions .append(crate::Expression::Binary { op, left, right }, span.into()) diff --git a/tests/in/operators.wgsl b/tests/in/operators.wgsl index 6cee25f2ca..1f6155397b 100644 --- a/tests/in/operators.wgsl +++ b/tests/in/operators.wgsl @@ -28,6 +28,14 @@ fn splat() -> vec4 { return a.xyxy + vec4(b); } +fn splat_assignment() -> vec2 { + var a = vec2(2.0); + a += 1.0; + a -= 3.0; + a /= 4.0; + return a; +} + fn bool_cast(x: vec3) -> vec3 { let y = vec3(x); return vec3(y); diff --git a/tests/out/glsl/operators.main.Compute.glsl b/tests/out/glsl/operators.main.Compute.glsl index ab232d5532..32716658fb 100644 --- a/tests/out/glsl/operators.main.Compute.glsl +++ b/tests/out/glsl/operators.main.Compute.glsl @@ -23,9 +23,22 @@ vec4 builtins() { } vec4 splat() { - vec2 a_1 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); + vec2 a_2 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); ivec4 b = (ivec4(5) % ivec4(2)); - return (a_1.xyxy + vec4(b)); + return (a_2.xyxy + vec4(b)); +} + +vec2 splat_assignment() { + vec2 a = vec2(0.0); + a = vec2(2.0); + vec2 _e7 = a; + a = (_e7 + vec2(1.0)); + vec2 _e11 = a; + a = (_e11 - vec2(3.0)); + vec2 _e15 = a; + a = (_e15 / vec2(4.0)); + vec2 _e19 = a; + return _e19; } vec3 bool_cast(vec3 x) { @@ -203,34 +216,34 @@ void comparison() { } void assignment() { - int a = 1; + int a_1 = 1; ivec3 vec0_ = ivec3(0, 0, 0); - int _e6 = a; - a = (_e6 + 1); - int _e9 = a; - a = (_e9 - 1); - int _e12 = a; - int _e13 = a; - a = (_e12 * _e13); - int _e15 = a; - int _e16 = a; - a = (_e15 / _e16); - int _e18 = a; - a = (_e18 % 1); - int _e21 = a; - a = (_e21 & 0); - int _e24 = a; - a = (_e24 | 0); - int _e27 = a; - a = (_e27 ^ 0); - int _e30 = a; - a = (_e30 << 2u); - int _e33 = a; - a = (_e33 >> 1u); - int _e36 = a; - a = (_e36 + 1); - int _e39 = a; - a = (_e39 - 1); + int _e6 = a_1; + a_1 = (_e6 + 1); + int _e9 = a_1; + a_1 = (_e9 - 1); + int _e12 = a_1; + int _e13 = a_1; + a_1 = (_e12 * _e13); + int _e15 = a_1; + int _e16 = a_1; + a_1 = (_e15 / _e16); + int _e18 = a_1; + a_1 = (_e18 % 1); + int _e21 = a_1; + a_1 = (_e21 & 0); + int _e24 = a_1; + a_1 = (_e24 | 0); + int _e27 = a_1; + a_1 = (_e27 ^ 0); + int _e30 = a_1; + a_1 = (_e30 << 2u); + int _e33 = a_1; + a_1 = (_e33 >> 1u); + int _e36 = a_1; + a_1 = (_e36 + 1); + int _e39 = a_1; + a_1 = (_e39 - 1); int _e46 = vec0_.y; vec0_.y = (_e46 + 1); int _e51 = vec0_.y; diff --git a/tests/out/hlsl/operators.hlsl b/tests/out/hlsl/operators.hlsl index 01ffb90360..48e8fee09e 100644 --- a/tests/out/hlsl/operators.hlsl +++ b/tests/out/hlsl/operators.hlsl @@ -39,9 +39,24 @@ float4 builtins() float4 splat() { - float2 a_1 = ((((1.0).xx + (2.0).xx) - (3.0).xx) / (4.0).xx); + float2 a_2 = ((((1.0).xx + (2.0).xx) - (3.0).xx) / (4.0).xx); int4 b = ((5).xxxx % (2).xxxx); - return (a_1.xyxy + float4(b)); + return (a_2.xyxy + float4(b)); +} + +float2 splat_assignment() +{ + float2 a = (float2)0; + + a = (2.0).xx; + float2 _expr7 = a; + a = (_expr7 + (1.0).xx); + float2 _expr11 = a; + a = (_expr11 - (3.0).xx); + float2 _expr15 = a; + a = (_expr15 / (4.0).xx); + float2 _expr19 = a; + return _expr19; } float3 bool_cast(float3 x) @@ -233,35 +248,35 @@ void comparison() void assignment() { - int a = 1; + int a_1 = 1; int3 vec0_ = int3(0, 0, 0); - int _expr6 = a; - a = (_expr6 + 1); - int _expr9 = a; - a = (_expr9 - 1); - int _expr12 = a; - int _expr13 = a; - a = (_expr12 * _expr13); - int _expr15 = a; - int _expr16 = a; - a = (_expr15 / _expr16); - int _expr18 = a; - a = (_expr18 % 1); - int _expr21 = a; - a = (_expr21 & 0); - int _expr24 = a; - a = (_expr24 | 0); - int _expr27 = a; - a = (_expr27 ^ 0); - int _expr30 = a; - a = (_expr30 << 2u); - int _expr33 = a; - a = (_expr33 >> 1u); - int _expr36 = a; - a = (_expr36 + 1); - int _expr39 = a; - a = (_expr39 - 1); + int _expr6 = a_1; + a_1 = (_expr6 + 1); + int _expr9 = a_1; + a_1 = (_expr9 - 1); + int _expr12 = a_1; + int _expr13 = a_1; + a_1 = (_expr12 * _expr13); + int _expr15 = a_1; + int _expr16 = a_1; + a_1 = (_expr15 / _expr16); + int _expr18 = a_1; + a_1 = (_expr18 % 1); + int _expr21 = a_1; + a_1 = (_expr21 & 0); + int _expr24 = a_1; + a_1 = (_expr24 | 0); + int _expr27 = a_1; + a_1 = (_expr27 ^ 0); + int _expr30 = a_1; + a_1 = (_expr30 << 2u); + int _expr33 = a_1; + a_1 = (_expr33 >> 1u); + int _expr36 = a_1; + a_1 = (_expr36 + 1); + int _expr39 = a_1; + a_1 = (_expr39 - 1); int _expr46 = vec0_.y; vec0_.y = (_expr46 + 1); int _expr51 = vec0_.y; diff --git a/tests/out/msl/operators.msl b/tests/out/msl/operators.msl index 294fa58125..0c3872000f 100644 --- a/tests/out/msl/operators.msl +++ b/tests/out/msl/operators.msl @@ -19,15 +19,15 @@ constant metal::float4 v_f32_zero = {0.0, 0.0, 0.0, 0.0}; constant metal::float4 v_f32_half = {0.5, 0.5, 0.5, 0.5}; constant metal::int4 v_i32_one = {1, 1, 1, 1}; constant metal::uint2 const_type_11_ = {0u, 0u}; -constant metal::float2 const_type_6_ = {0.0, 0.0}; -constant metal::float2x2 const_type_7_ = {const_type_6_, const_type_6_}; +constant metal::float2 const_type_4_ = {0.0, 0.0}; +constant metal::float2x2 const_type_7_ = {const_type_4_, const_type_4_}; constant metal::float4 const_type = {0.0, 0.0, 0.0, 0.0}; constant Foo const_Foo = {const_type, 0}; constant type_12 const_type_12_ = {const_Foo, const_Foo, const_Foo}; -constant metal::float3 const_type_4_ = {0.0, 0.0, 0.0}; -constant metal::float2x3 const_type_14_ = {const_type_4_, const_type_4_}; -constant metal::float3x3 const_type_15_ = {const_type_4_, const_type_4_, const_type_4_}; -constant metal::float4x3 const_type_16_ = {const_type_4_, const_type_4_, const_type_4_, const_type_4_}; +constant metal::float3 const_type_5_ = {0.0, 0.0, 0.0}; +constant metal::float2x3 const_type_14_ = {const_type_5_, const_type_5_}; +constant metal::float3x3 const_type_15_ = {const_type_5_, const_type_5_, const_type_5_}; +constant metal::float4x3 const_type_16_ = {const_type_5_, const_type_5_, const_type_5_, const_type_5_}; constant metal::float3x4 const_type_17_ = {const_type, const_type, const_type}; constant metal::int3 const_type_18_ = {0, 0, 0}; @@ -46,9 +46,23 @@ metal::float4 builtins( metal::float4 splat( ) { - metal::float2 a_1 = ((metal::float2(1.0) + metal::float2(2.0)) - metal::float2(3.0)) / metal::float2(4.0); + metal::float2 a_2 = ((metal::float2(1.0) + metal::float2(2.0)) - metal::float2(3.0)) / metal::float2(4.0); metal::int4 b = metal::int4(5) % metal::int4(2); - return a_1.xyxy + static_cast(b); + return a_2.xyxy + static_cast(b); +} + +metal::float2 splat_assignment( +) { + metal::float2 a = {}; + a = metal::float2(2.0); + metal::float2 _e7 = a; + a = _e7 + metal::float2(1.0); + metal::float2 _e11 = a; + a = _e11 - metal::float2(3.0); + metal::float2 _e15 = a; + a = _e15 / metal::float2(4.0); + metal::float2 _e19 = a; + return _e19; } metal::float3 bool_cast( @@ -234,34 +248,34 @@ void comparison( void assignment( ) { - int a = 1; + int a_1 = 1; metal::int3 vec0_ = const_type_18_; - int _e6 = a; - a = _e6 + 1; - int _e9 = a; - a = _e9 - 1; - int _e12 = a; - int _e13 = a; - a = _e12 * _e13; - int _e15 = a; - int _e16 = a; - a = _e15 / _e16; - int _e18 = a; - a = _e18 % 1; - int _e21 = a; - a = _e21 & 0; - int _e24 = a; - a = _e24 | 0; - int _e27 = a; - a = _e27 ^ 0; - int _e30 = a; - a = _e30 << 2u; - int _e33 = a; - a = _e33 >> 1u; - int _e36 = a; - a = _e36 + 1; - int _e39 = a; - a = _e39 - 1; + int _e6 = a_1; + a_1 = _e6 + 1; + int _e9 = a_1; + a_1 = _e9 - 1; + int _e12 = a_1; + int _e13 = a_1; + a_1 = _e12 * _e13; + int _e15 = a_1; + int _e16 = a_1; + a_1 = _e15 / _e16; + int _e18 = a_1; + a_1 = _e18 % 1; + int _e21 = a_1; + a_1 = _e21 & 0; + int _e24 = a_1; + a_1 = _e24 | 0; + int _e27 = a_1; + a_1 = _e27 ^ 0; + int _e30 = a_1; + a_1 = _e30 << 2u; + int _e33 = a_1; + a_1 = _e33 >> 1u; + int _e36 = a_1; + a_1 = _e36 + 1; + int _e39 = a_1; + a_1 = _e39 - 1; int _e46 = vec0_.y; vec0_.y = _e46 + 1; int _e51 = vec0_.y; diff --git a/tests/out/spv/operators.spvasm b/tests/out/spv/operators.spvasm index bdd3551109..0fde0a7072 100644 --- a/tests/out/spv/operators.spvasm +++ b/tests/out/spv/operators.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 525 +; Bound: 543 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %513 "main" -OpExecutionMode %513 LocalSize 1 1 1 -OpMemberDecorate %30 0 Offset 0 -OpMemberDecorate %30 1 Offset 16 +OpEntryPoint GLCompute %531 "main" +OpExecutionMode %531 LocalSize 1 1 1 +OpMemberDecorate %31 0 Offset 0 +OpMemberDecorate %31 1 Offset 16 OpDecorate %35 ArrayStride 32 OpDecorate %36 ArrayStride 4 %2 = OpTypeVoid @@ -38,17 +38,17 @@ OpDecorate %36 ArrayStride 4 %26 = OpTypeVector %4 4 %27 = OpTypeVector %8 4 %28 = OpTypeVector %10 4 -%29 = OpTypeVector %4 3 -%30 = OpTypeStruct %26 %8 -%31 = OpTypeVector %4 2 -%32 = OpTypeMatrix %31 2 +%29 = OpTypeVector %4 2 +%30 = OpTypeVector %4 3 +%31 = OpTypeStruct %26 %8 +%32 = OpTypeMatrix %29 2 %33 = OpTypeMatrix %26 4 %34 = OpTypeVector %20 2 -%35 = OpTypeArray %30 %21 +%35 = OpTypeArray %31 %21 %36 = OpTypeArray %8 %22 -%37 = OpTypeMatrix %29 2 -%38 = OpTypeMatrix %29 3 -%39 = OpTypeMatrix %29 4 +%37 = OpTypeMatrix %30 2 +%38 = OpTypeMatrix %30 3 +%39 = OpTypeMatrix %30 4 %40 = OpTypeMatrix %26 3 %41 = OpTypeVector %8 3 %42 = OpConstantComposite %26 %3 %3 %3 %3 @@ -56,32 +56,35 @@ OpDecorate %36 ArrayStride 4 %44 = OpConstantComposite %26 %6 %6 %6 %6 %45 = OpConstantComposite %27 %7 %7 %7 %7 %46 = OpConstantComposite %34 %19 %19 -%47 = OpConstantComposite %31 %5 %5 +%47 = OpConstantComposite %29 %5 %5 %48 = OpConstantComposite %32 %47 %47 %49 = OpConstantComposite %26 %5 %5 %5 %5 -%50 = OpConstantComposite %30 %49 %11 +%50 = OpConstantComposite %31 %49 %11 %51 = OpConstantComposite %35 %50 %50 %50 -%52 = OpConstantComposite %29 %5 %5 %5 +%52 = OpConstantComposite %30 %5 %5 %5 %53 = OpConstantComposite %37 %52 %52 %54 = OpConstantComposite %38 %52 %52 %52 %55 = OpConstantComposite %39 %52 %52 %52 %52 %56 = OpConstantComposite %40 %49 %49 %49 %57 = OpConstantComposite %41 %11 %11 %11 %60 = OpTypeFunction %26 -%102 = OpTypeFunction %29 %29 -%104 = OpTypeVector %10 3 -%111 = OpTypePointer Function %30 -%112 = OpConstantNull %30 -%115 = OpTypeFunction %4 -%140 = OpTypePointer Function %26 -%141 = OpTypePointer Function %4 -%146 = OpTypeFunction %2 -%149 = OpTypeVector %10 2 -%165 = OpTypeVector %8 2 -%176 = OpTypeVector %20 3 -%471 = OpTypePointer Function %8 -%473 = OpTypePointer Function %41 -%503 = OpTypePointer Function %8 +%100 = OpTypePointer Function %29 +%101 = OpConstantNull %29 +%104 = OpTypeFunction %29 +%120 = OpTypeFunction %30 %30 +%122 = OpTypeVector %10 3 +%129 = OpTypePointer Function %31 +%130 = OpConstantNull %31 +%133 = OpTypeFunction %4 +%158 = OpTypePointer Function %26 +%159 = OpTypePointer Function %4 +%164 = OpTypeFunction %2 +%167 = OpTypeVector %10 2 +%183 = OpTypeVector %8 2 +%194 = OpTypeVector %20 3 +%489 = OpTypePointer Function %8 +%491 = OpTypePointer Function %41 +%521 = OpTypePointer Function %8 %59 = OpFunction %26 None %60 %58 = OpLabel OpBranch %61 @@ -113,13 +116,13 @@ OpFunctionEnd %83 = OpLabel OpBranch %85 %85 = OpLabel -%86 = OpCompositeConstruct %31 %14 %14 -%87 = OpCompositeConstruct %31 %3 %3 -%88 = OpFAdd %31 %87 %86 -%89 = OpCompositeConstruct %31 %15 %15 -%90 = OpFSub %31 %88 %89 -%91 = OpCompositeConstruct %31 %16 %16 -%92 = OpFDiv %31 %90 %91 +%86 = OpCompositeConstruct %29 %14 %14 +%87 = OpCompositeConstruct %29 %3 %3 +%88 = OpFAdd %29 %87 %86 +%89 = OpCompositeConstruct %29 %15 %15 +%90 = OpFSub %29 %88 %89 +%91 = OpCompositeConstruct %29 %16 %16 +%92 = OpFDiv %29 %90 %91 %93 = OpCompositeConstruct %27 %17 %17 %17 %17 %94 = OpCompositeConstruct %27 %18 %18 %18 %18 %95 = OpSRem %27 %93 %94 @@ -128,448 +131,470 @@ OpBranch %85 %98 = OpFAdd %26 %96 %97 OpReturnValue %98 OpFunctionEnd -%101 = OpFunction %29 None %102 -%100 = OpFunctionParameter %29 -%99 = OpLabel -OpBranch %103 -%103 = OpLabel -%105 = OpCompositeConstruct %29 %5 %5 %5 -%106 = OpFUnordNotEqual %104 %100 %105 -%107 = OpCompositeConstruct %29 %5 %5 %5 -%108 = OpCompositeConstruct %29 %3 %3 %3 -%109 = OpSelect %29 %106 %108 %107 -OpReturnValue %109 +%103 = OpFunction %29 None %104 +%102 = OpLabel +%99 = OpVariable %100 Function %101 +OpBranch %105 +%105 = OpLabel +%106 = OpCompositeConstruct %29 %14 %14 +OpStore %99 %106 +%107 = OpLoad %29 %99 +%108 = OpCompositeConstruct %29 %3 %3 +%109 = OpFAdd %29 %107 %108 +OpStore %99 %109 +%110 = OpLoad %29 %99 +%111 = OpCompositeConstruct %29 %15 %15 +%112 = OpFSub %29 %110 %111 +OpStore %99 %112 +%113 = OpLoad %29 %99 +%114 = OpCompositeConstruct %29 %16 %16 +%115 = OpFDiv %29 %113 %114 +OpStore %99 %115 +%116 = OpLoad %29 %99 +OpReturnValue %116 OpFunctionEnd -%114 = OpFunction %4 None %115 -%113 = OpLabel -%110 = OpVariable %111 Function %112 -OpBranch %116 -%116 = OpLabel -%117 = OpCompositeConstruct %26 %3 %3 %3 %3 -%118 = OpCompositeConstruct %30 %117 %7 -OpStore %110 %118 -%119 = OpCompositeConstruct %31 %3 %5 -%120 = OpCompositeConstruct %31 %5 %3 -%121 = OpCompositeConstruct %32 %119 %120 -%122 = OpCompositeConstruct %26 %3 %5 %5 %5 -%123 = OpCompositeConstruct %26 %5 %3 %5 %5 -%124 = OpCompositeConstruct %26 %5 %5 %3 %5 -%125 = OpCompositeConstruct %26 %5 %5 %5 %3 -%126 = OpCompositeConstruct %33 %122 %123 %124 %125 -%127 = OpCompositeConstruct %34 %19 %19 -%128 = OpCompositeConstruct %31 %5 %5 -%129 = OpCompositeConstruct %31 %5 %5 -%130 = OpCompositeConstruct %32 %128 %129 -%131 = OpCompositeConstruct %36 %11 %7 %18 %21 -%137 = OpCopyObject %37 %53 -%139 = OpCopyObject %37 %53 -%142 = OpAccessChain %141 %110 %19 %19 -%143 = OpLoad %4 %142 -OpReturnValue %143 +%119 = OpFunction %30 None %120 +%118 = OpFunctionParameter %30 +%117 = OpLabel +OpBranch %121 +%121 = OpLabel +%123 = OpCompositeConstruct %30 %5 %5 %5 +%124 = OpFUnordNotEqual %122 %118 %123 +%125 = OpCompositeConstruct %30 %5 %5 %5 +%126 = OpCompositeConstruct %30 %3 %3 %3 +%127 = OpSelect %30 %124 %126 %125 +OpReturnValue %127 OpFunctionEnd -%145 = OpFunction %2 None %146 -%144 = OpLabel -OpBranch %147 -%147 = OpLabel -%148 = OpLogicalNot %10 %9 -%150 = OpCompositeConstruct %149 %9 %9 -%151 = OpLogicalNot %149 %150 -%152 = OpLogicalOr %10 %9 %12 -%153 = OpLogicalAnd %10 %9 %12 -%154 = OpLogicalOr %10 %9 %12 -%155 = OpCompositeConstruct %104 %9 %9 %9 -%156 = OpCompositeConstruct %104 %12 %12 %12 -%157 = OpLogicalOr %104 %155 %156 -%158 = OpLogicalAnd %10 %9 %12 -%159 = OpCompositeConstruct %28 %9 %9 %9 %9 -%160 = OpCompositeConstruct %28 %12 %12 %12 %12 -%161 = OpLogicalAnd %28 %159 %160 +%132 = OpFunction %4 None %133 +%131 = OpLabel +%128 = OpVariable %129 Function %130 +OpBranch %134 +%134 = OpLabel +%135 = OpCompositeConstruct %26 %3 %3 %3 %3 +%136 = OpCompositeConstruct %31 %135 %7 +OpStore %128 %136 +%137 = OpCompositeConstruct %29 %3 %5 +%138 = OpCompositeConstruct %29 %5 %3 +%139 = OpCompositeConstruct %32 %137 %138 +%140 = OpCompositeConstruct %26 %3 %5 %5 %5 +%141 = OpCompositeConstruct %26 %5 %3 %5 %5 +%142 = OpCompositeConstruct %26 %5 %5 %3 %5 +%143 = OpCompositeConstruct %26 %5 %5 %5 %3 +%144 = OpCompositeConstruct %33 %140 %141 %142 %143 +%145 = OpCompositeConstruct %34 %19 %19 +%146 = OpCompositeConstruct %29 %5 %5 +%147 = OpCompositeConstruct %29 %5 %5 +%148 = OpCompositeConstruct %32 %146 %147 +%149 = OpCompositeConstruct %36 %11 %7 %18 %21 +%155 = OpCopyObject %37 %53 +%157 = OpCopyObject %37 %53 +%160 = OpAccessChain %159 %128 %19 %19 +%161 = OpLoad %4 %160 +OpReturnValue %161 +OpFunctionEnd +%163 = OpFunction %2 None %164 +%162 = OpLabel +OpBranch %165 +%165 = OpLabel +%166 = OpLogicalNot %10 %9 +%168 = OpCompositeConstruct %167 %9 %9 +%169 = OpLogicalNot %167 %168 +%170 = OpLogicalOr %10 %9 %12 +%171 = OpLogicalAnd %10 %9 %12 +%172 = OpLogicalOr %10 %9 %12 +%173 = OpCompositeConstruct %122 %9 %9 %9 +%174 = OpCompositeConstruct %122 %12 %12 %12 +%175 = OpLogicalOr %122 %173 %174 +%176 = OpLogicalAnd %10 %9 %12 +%177 = OpCompositeConstruct %28 %9 %9 %9 %9 +%178 = OpCompositeConstruct %28 %12 %12 %12 %12 +%179 = OpLogicalAnd %28 %177 %178 OpReturn OpFunctionEnd -%163 = OpFunction %2 None %146 -%162 = OpLabel -OpBranch %164 -%164 = OpLabel -%166 = OpCompositeConstruct %165 %7 %7 -%167 = OpSNegate %165 %166 -%168 = OpCompositeConstruct %31 %3 %3 -%169 = OpFNegate %31 %168 -%170 = OpIAdd %8 %18 %7 -%171 = OpIAdd %20 %24 %25 -%172 = OpFAdd %4 %14 %3 -%173 = OpCompositeConstruct %165 %18 %18 -%174 = OpCompositeConstruct %165 %7 %7 -%175 = OpIAdd %165 %173 %174 -%177 = OpCompositeConstruct %176 %24 %24 %24 -%178 = OpCompositeConstruct %176 %25 %25 %25 -%179 = OpIAdd %176 %177 %178 -%180 = OpCompositeConstruct %26 %14 %14 %14 %14 -%181 = OpCompositeConstruct %26 %3 %3 %3 %3 -%182 = OpFAdd %26 %180 %181 -%183 = OpISub %8 %18 %7 -%184 = OpISub %20 %24 %25 -%185 = OpFSub %4 %14 %3 -%186 = OpCompositeConstruct %165 %18 %18 -%187 = OpCompositeConstruct %165 %7 %7 -%188 = OpISub %165 %186 %187 -%189 = OpCompositeConstruct %176 %24 %24 %24 -%190 = OpCompositeConstruct %176 %25 %25 %25 -%191 = OpISub %176 %189 %190 -%192 = OpCompositeConstruct %26 %14 %14 %14 %14 -%193 = OpCompositeConstruct %26 %3 %3 %3 %3 -%194 = OpFSub %26 %192 %193 -%195 = OpIMul %8 %18 %7 -%196 = OpIMul %20 %24 %25 -%197 = OpFMul %4 %14 %3 -%198 = OpCompositeConstruct %165 %18 %18 -%199 = OpCompositeConstruct %165 %7 %7 -%200 = OpIMul %165 %198 %199 -%201 = OpCompositeConstruct %176 %24 %24 %24 -%202 = OpCompositeConstruct %176 %25 %25 %25 -%203 = OpIMul %176 %201 %202 -%204 = OpCompositeConstruct %26 %14 %14 %14 %14 -%205 = OpCompositeConstruct %26 %3 %3 %3 %3 -%206 = OpFMul %26 %204 %205 -%207 = OpSDiv %8 %18 %7 -%208 = OpUDiv %20 %24 %25 -%209 = OpFDiv %4 %14 %3 -%210 = OpCompositeConstruct %165 %18 %18 -%211 = OpCompositeConstruct %165 %7 %7 -%212 = OpSDiv %165 %210 %211 -%213 = OpCompositeConstruct %176 %24 %24 %24 -%214 = OpCompositeConstruct %176 %25 %25 %25 -%215 = OpUDiv %176 %213 %214 -%216 = OpCompositeConstruct %26 %14 %14 %14 %14 -%217 = OpCompositeConstruct %26 %3 %3 %3 %3 -%218 = OpFDiv %26 %216 %217 -%219 = OpSRem %8 %18 %7 -%220 = OpUMod %20 %24 %25 -%221 = OpFRem %4 %14 %3 -%222 = OpCompositeConstruct %165 %18 %18 -%223 = OpCompositeConstruct %165 %7 %7 -%224 = OpSRem %165 %222 %223 -%225 = OpCompositeConstruct %176 %24 %24 %24 -%226 = OpCompositeConstruct %176 %25 %25 %25 -%227 = OpUMod %176 %225 %226 -%228 = OpCompositeConstruct %26 %14 %14 %14 %14 -%229 = OpCompositeConstruct %26 %3 %3 %3 %3 -%230 = OpFRem %26 %228 %229 -%231 = OpCompositeConstruct %165 %18 %18 -%232 = OpCompositeConstruct %165 %7 %7 -%233 = OpIAdd %165 %231 %232 -%234 = OpCompositeConstruct %165 %7 %7 -%235 = OpCompositeConstruct %165 %18 %18 -%236 = OpIAdd %165 %235 %234 -%237 = OpCompositeConstruct %34 %24 %24 -%238 = OpCompositeConstruct %34 %25 %25 -%239 = OpIAdd %34 %237 %238 -%240 = OpCompositeConstruct %34 %25 %25 -%241 = OpCompositeConstruct %34 %24 %24 -%242 = OpIAdd %34 %241 %240 -%243 = OpCompositeConstruct %31 %14 %14 -%244 = OpCompositeConstruct %31 %3 %3 -%245 = OpFAdd %31 %243 %244 -%246 = OpCompositeConstruct %31 %3 %3 -%247 = OpCompositeConstruct %31 %14 %14 -%248 = OpFAdd %31 %247 %246 -%249 = OpCompositeConstruct %165 %18 %18 -%250 = OpCompositeConstruct %165 %7 %7 -%251 = OpISub %165 %249 %250 -%252 = OpCompositeConstruct %165 %7 %7 -%253 = OpCompositeConstruct %165 %18 %18 -%254 = OpISub %165 %253 %252 +%181 = OpFunction %2 None %164 +%180 = OpLabel +OpBranch %182 +%182 = OpLabel +%184 = OpCompositeConstruct %183 %7 %7 +%185 = OpSNegate %183 %184 +%186 = OpCompositeConstruct %29 %3 %3 +%187 = OpFNegate %29 %186 +%188 = OpIAdd %8 %18 %7 +%189 = OpIAdd %20 %24 %25 +%190 = OpFAdd %4 %14 %3 +%191 = OpCompositeConstruct %183 %18 %18 +%192 = OpCompositeConstruct %183 %7 %7 +%193 = OpIAdd %183 %191 %192 +%195 = OpCompositeConstruct %194 %24 %24 %24 +%196 = OpCompositeConstruct %194 %25 %25 %25 +%197 = OpIAdd %194 %195 %196 +%198 = OpCompositeConstruct %26 %14 %14 %14 %14 +%199 = OpCompositeConstruct %26 %3 %3 %3 %3 +%200 = OpFAdd %26 %198 %199 +%201 = OpISub %8 %18 %7 +%202 = OpISub %20 %24 %25 +%203 = OpFSub %4 %14 %3 +%204 = OpCompositeConstruct %183 %18 %18 +%205 = OpCompositeConstruct %183 %7 %7 +%206 = OpISub %183 %204 %205 +%207 = OpCompositeConstruct %194 %24 %24 %24 +%208 = OpCompositeConstruct %194 %25 %25 %25 +%209 = OpISub %194 %207 %208 +%210 = OpCompositeConstruct %26 %14 %14 %14 %14 +%211 = OpCompositeConstruct %26 %3 %3 %3 %3 +%212 = OpFSub %26 %210 %211 +%213 = OpIMul %8 %18 %7 +%214 = OpIMul %20 %24 %25 +%215 = OpFMul %4 %14 %3 +%216 = OpCompositeConstruct %183 %18 %18 +%217 = OpCompositeConstruct %183 %7 %7 +%218 = OpIMul %183 %216 %217 +%219 = OpCompositeConstruct %194 %24 %24 %24 +%220 = OpCompositeConstruct %194 %25 %25 %25 +%221 = OpIMul %194 %219 %220 +%222 = OpCompositeConstruct %26 %14 %14 %14 %14 +%223 = OpCompositeConstruct %26 %3 %3 %3 %3 +%224 = OpFMul %26 %222 %223 +%225 = OpSDiv %8 %18 %7 +%226 = OpUDiv %20 %24 %25 +%227 = OpFDiv %4 %14 %3 +%228 = OpCompositeConstruct %183 %18 %18 +%229 = OpCompositeConstruct %183 %7 %7 +%230 = OpSDiv %183 %228 %229 +%231 = OpCompositeConstruct %194 %24 %24 %24 +%232 = OpCompositeConstruct %194 %25 %25 %25 +%233 = OpUDiv %194 %231 %232 +%234 = OpCompositeConstruct %26 %14 %14 %14 %14 +%235 = OpCompositeConstruct %26 %3 %3 %3 %3 +%236 = OpFDiv %26 %234 %235 +%237 = OpSRem %8 %18 %7 +%238 = OpUMod %20 %24 %25 +%239 = OpFRem %4 %14 %3 +%240 = OpCompositeConstruct %183 %18 %18 +%241 = OpCompositeConstruct %183 %7 %7 +%242 = OpSRem %183 %240 %241 +%243 = OpCompositeConstruct %194 %24 %24 %24 +%244 = OpCompositeConstruct %194 %25 %25 %25 +%245 = OpUMod %194 %243 %244 +%246 = OpCompositeConstruct %26 %14 %14 %14 %14 +%247 = OpCompositeConstruct %26 %3 %3 %3 %3 +%248 = OpFRem %26 %246 %247 +%249 = OpCompositeConstruct %183 %18 %18 +%250 = OpCompositeConstruct %183 %7 %7 +%251 = OpIAdd %183 %249 %250 +%252 = OpCompositeConstruct %183 %7 %7 +%253 = OpCompositeConstruct %183 %18 %18 +%254 = OpIAdd %183 %253 %252 %255 = OpCompositeConstruct %34 %24 %24 %256 = OpCompositeConstruct %34 %25 %25 -%257 = OpISub %34 %255 %256 +%257 = OpIAdd %34 %255 %256 %258 = OpCompositeConstruct %34 %25 %25 %259 = OpCompositeConstruct %34 %24 %24 -%260 = OpISub %34 %259 %258 -%261 = OpCompositeConstruct %31 %14 %14 -%262 = OpCompositeConstruct %31 %3 %3 -%263 = OpFSub %31 %261 %262 -%264 = OpCompositeConstruct %31 %3 %3 -%265 = OpCompositeConstruct %31 %14 %14 -%266 = OpFSub %31 %265 %264 -%267 = OpCompositeConstruct %165 %18 %18 -%269 = OpCompositeConstruct %165 %7 %7 -%268 = OpIMul %165 %267 %269 -%270 = OpCompositeConstruct %165 %7 %7 -%272 = OpCompositeConstruct %165 %18 %18 -%271 = OpIMul %165 %270 %272 +%260 = OpIAdd %34 %259 %258 +%261 = OpCompositeConstruct %29 %14 %14 +%262 = OpCompositeConstruct %29 %3 %3 +%263 = OpFAdd %29 %261 %262 +%264 = OpCompositeConstruct %29 %3 %3 +%265 = OpCompositeConstruct %29 %14 %14 +%266 = OpFAdd %29 %265 %264 +%267 = OpCompositeConstruct %183 %18 %18 +%268 = OpCompositeConstruct %183 %7 %7 +%269 = OpISub %183 %267 %268 +%270 = OpCompositeConstruct %183 %7 %7 +%271 = OpCompositeConstruct %183 %18 %18 +%272 = OpISub %183 %271 %270 %273 = OpCompositeConstruct %34 %24 %24 -%275 = OpCompositeConstruct %34 %25 %25 -%274 = OpIMul %34 %273 %275 +%274 = OpCompositeConstruct %34 %25 %25 +%275 = OpISub %34 %273 %274 %276 = OpCompositeConstruct %34 %25 %25 -%278 = OpCompositeConstruct %34 %24 %24 -%277 = OpIMul %34 %276 %278 -%279 = OpCompositeConstruct %31 %14 %14 -%280 = OpVectorTimesScalar %31 %279 %3 -%281 = OpCompositeConstruct %31 %3 %3 -%282 = OpVectorTimesScalar %31 %281 %14 -%283 = OpCompositeConstruct %165 %18 %18 -%284 = OpCompositeConstruct %165 %7 %7 -%285 = OpSDiv %165 %283 %284 -%286 = OpCompositeConstruct %165 %7 %7 -%287 = OpCompositeConstruct %165 %18 %18 -%288 = OpSDiv %165 %287 %286 -%289 = OpCompositeConstruct %34 %24 %24 -%290 = OpCompositeConstruct %34 %25 %25 -%291 = OpUDiv %34 %289 %290 -%292 = OpCompositeConstruct %34 %25 %25 -%293 = OpCompositeConstruct %34 %24 %24 -%294 = OpUDiv %34 %293 %292 -%295 = OpCompositeConstruct %31 %14 %14 -%296 = OpCompositeConstruct %31 %3 %3 -%297 = OpFDiv %31 %295 %296 -%298 = OpCompositeConstruct %31 %3 %3 -%299 = OpCompositeConstruct %31 %14 %14 -%300 = OpFDiv %31 %299 %298 -%301 = OpCompositeConstruct %165 %18 %18 -%302 = OpCompositeConstruct %165 %7 %7 -%303 = OpSRem %165 %301 %302 -%304 = OpCompositeConstruct %165 %7 %7 -%305 = OpCompositeConstruct %165 %18 %18 -%306 = OpSRem %165 %305 %304 +%277 = OpCompositeConstruct %34 %24 %24 +%278 = OpISub %34 %277 %276 +%279 = OpCompositeConstruct %29 %14 %14 +%280 = OpCompositeConstruct %29 %3 %3 +%281 = OpFSub %29 %279 %280 +%282 = OpCompositeConstruct %29 %3 %3 +%283 = OpCompositeConstruct %29 %14 %14 +%284 = OpFSub %29 %283 %282 +%285 = OpCompositeConstruct %183 %18 %18 +%287 = OpCompositeConstruct %183 %7 %7 +%286 = OpIMul %183 %285 %287 +%288 = OpCompositeConstruct %183 %7 %7 +%290 = OpCompositeConstruct %183 %18 %18 +%289 = OpIMul %183 %288 %290 +%291 = OpCompositeConstruct %34 %24 %24 +%293 = OpCompositeConstruct %34 %25 %25 +%292 = OpIMul %34 %291 %293 +%294 = OpCompositeConstruct %34 %25 %25 +%296 = OpCompositeConstruct %34 %24 %24 +%295 = OpIMul %34 %294 %296 +%297 = OpCompositeConstruct %29 %14 %14 +%298 = OpVectorTimesScalar %29 %297 %3 +%299 = OpCompositeConstruct %29 %3 %3 +%300 = OpVectorTimesScalar %29 %299 %14 +%301 = OpCompositeConstruct %183 %18 %18 +%302 = OpCompositeConstruct %183 %7 %7 +%303 = OpSDiv %183 %301 %302 +%304 = OpCompositeConstruct %183 %7 %7 +%305 = OpCompositeConstruct %183 %18 %18 +%306 = OpSDiv %183 %305 %304 %307 = OpCompositeConstruct %34 %24 %24 %308 = OpCompositeConstruct %34 %25 %25 -%309 = OpUMod %34 %307 %308 +%309 = OpUDiv %34 %307 %308 %310 = OpCompositeConstruct %34 %25 %25 %311 = OpCompositeConstruct %34 %24 %24 -%312 = OpUMod %34 %311 %310 -%313 = OpCompositeConstruct %31 %14 %14 -%314 = OpCompositeConstruct %31 %3 %3 -%315 = OpFRem %31 %313 %314 -%316 = OpCompositeConstruct %31 %3 %3 -%317 = OpCompositeConstruct %31 %14 %14 -%318 = OpFRem %31 %317 %316 -%320 = OpCompositeExtract %29 %54 0 -%321 = OpCompositeExtract %29 %54 0 -%322 = OpFAdd %29 %320 %321 -%323 = OpCompositeExtract %29 %54 1 -%324 = OpCompositeExtract %29 %54 1 -%325 = OpFAdd %29 %323 %324 -%326 = OpCompositeExtract %29 %54 2 -%327 = OpCompositeExtract %29 %54 2 -%328 = OpFAdd %29 %326 %327 -%319 = OpCompositeConstruct %38 %322 %325 %328 -%330 = OpCompositeExtract %29 %54 0 -%331 = OpCompositeExtract %29 %54 0 -%332 = OpFSub %29 %330 %331 -%333 = OpCompositeExtract %29 %54 1 -%334 = OpCompositeExtract %29 %54 1 -%335 = OpFSub %29 %333 %334 -%336 = OpCompositeExtract %29 %54 2 -%337 = OpCompositeExtract %29 %54 2 -%338 = OpFSub %29 %336 %337 -%329 = OpCompositeConstruct %38 %332 %335 %338 -%339 = OpMatrixTimesScalar %38 %54 %3 -%340 = OpMatrixTimesScalar %38 %54 %14 -%341 = OpCompositeConstruct %26 %3 %3 %3 %3 -%342 = OpMatrixTimesVector %29 %55 %341 -%343 = OpCompositeConstruct %29 %14 %14 %14 -%344 = OpVectorTimesMatrix %26 %343 %55 -%345 = OpMatrixTimesMatrix %38 %55 %56 +%312 = OpUDiv %34 %311 %310 +%313 = OpCompositeConstruct %29 %14 %14 +%314 = OpCompositeConstruct %29 %3 %3 +%315 = OpFDiv %29 %313 %314 +%316 = OpCompositeConstruct %29 %3 %3 +%317 = OpCompositeConstruct %29 %14 %14 +%318 = OpFDiv %29 %317 %316 +%319 = OpCompositeConstruct %183 %18 %18 +%320 = OpCompositeConstruct %183 %7 %7 +%321 = OpSRem %183 %319 %320 +%322 = OpCompositeConstruct %183 %7 %7 +%323 = OpCompositeConstruct %183 %18 %18 +%324 = OpSRem %183 %323 %322 +%325 = OpCompositeConstruct %34 %24 %24 +%326 = OpCompositeConstruct %34 %25 %25 +%327 = OpUMod %34 %325 %326 +%328 = OpCompositeConstruct %34 %25 %25 +%329 = OpCompositeConstruct %34 %24 %24 +%330 = OpUMod %34 %329 %328 +%331 = OpCompositeConstruct %29 %14 %14 +%332 = OpCompositeConstruct %29 %3 %3 +%333 = OpFRem %29 %331 %332 +%334 = OpCompositeConstruct %29 %3 %3 +%335 = OpCompositeConstruct %29 %14 %14 +%336 = OpFRem %29 %335 %334 +%338 = OpCompositeExtract %30 %54 0 +%339 = OpCompositeExtract %30 %54 0 +%340 = OpFAdd %30 %338 %339 +%341 = OpCompositeExtract %30 %54 1 +%342 = OpCompositeExtract %30 %54 1 +%343 = OpFAdd %30 %341 %342 +%344 = OpCompositeExtract %30 %54 2 +%345 = OpCompositeExtract %30 %54 2 +%346 = OpFAdd %30 %344 %345 +%337 = OpCompositeConstruct %38 %340 %343 %346 +%348 = OpCompositeExtract %30 %54 0 +%349 = OpCompositeExtract %30 %54 0 +%350 = OpFSub %30 %348 %349 +%351 = OpCompositeExtract %30 %54 1 +%352 = OpCompositeExtract %30 %54 1 +%353 = OpFSub %30 %351 %352 +%354 = OpCompositeExtract %30 %54 2 +%355 = OpCompositeExtract %30 %54 2 +%356 = OpFSub %30 %354 %355 +%347 = OpCompositeConstruct %38 %350 %353 %356 +%357 = OpMatrixTimesScalar %38 %54 %3 +%358 = OpMatrixTimesScalar %38 %54 %14 +%359 = OpCompositeConstruct %26 %3 %3 %3 %3 +%360 = OpMatrixTimesVector %30 %55 %359 +%361 = OpCompositeConstruct %30 %14 %14 %14 +%362 = OpVectorTimesMatrix %26 %361 %55 +%363 = OpMatrixTimesMatrix %38 %55 %56 OpReturn OpFunctionEnd -%347 = OpFunction %2 None %146 -%346 = OpLabel -OpBranch %348 -%348 = OpLabel -%349 = OpNot %8 %7 -%350 = OpNot %20 %25 -%351 = OpCompositeConstruct %165 %7 %7 -%352 = OpNot %165 %351 -%353 = OpCompositeConstruct %176 %25 %25 %25 -%354 = OpNot %176 %353 -%355 = OpBitwiseOr %8 %18 %7 -%356 = OpBitwiseOr %20 %24 %25 -%357 = OpCompositeConstruct %165 %18 %18 -%358 = OpCompositeConstruct %165 %7 %7 -%359 = OpBitwiseOr %165 %357 %358 -%360 = OpCompositeConstruct %176 %24 %24 %24 -%361 = OpCompositeConstruct %176 %25 %25 %25 -%362 = OpBitwiseOr %176 %360 %361 -%363 = OpBitwiseAnd %8 %18 %7 -%364 = OpBitwiseAnd %20 %24 %25 -%365 = OpCompositeConstruct %165 %18 %18 -%366 = OpCompositeConstruct %165 %7 %7 -%367 = OpBitwiseAnd %165 %365 %366 -%368 = OpCompositeConstruct %176 %24 %24 %24 -%369 = OpCompositeConstruct %176 %25 %25 %25 -%370 = OpBitwiseAnd %176 %368 %369 -%371 = OpBitwiseXor %8 %18 %7 -%372 = OpBitwiseXor %20 %24 %25 -%373 = OpCompositeConstruct %165 %18 %18 -%374 = OpCompositeConstruct %165 %7 %7 -%375 = OpBitwiseXor %165 %373 %374 -%376 = OpCompositeConstruct %176 %24 %24 %24 -%377 = OpCompositeConstruct %176 %25 %25 %25 -%378 = OpBitwiseXor %176 %376 %377 -%379 = OpShiftLeftLogical %8 %18 %25 -%380 = OpShiftLeftLogical %20 %24 %25 -%381 = OpCompositeConstruct %165 %18 %18 -%382 = OpCompositeConstruct %34 %25 %25 -%383 = OpShiftLeftLogical %165 %381 %382 -%384 = OpCompositeConstruct %176 %24 %24 %24 -%385 = OpCompositeConstruct %176 %25 %25 %25 -%386 = OpShiftLeftLogical %176 %384 %385 -%387 = OpShiftRightArithmetic %8 %18 %25 -%388 = OpShiftRightLogical %20 %24 %25 -%389 = OpCompositeConstruct %165 %18 %18 -%390 = OpCompositeConstruct %34 %25 %25 -%391 = OpShiftRightArithmetic %165 %389 %390 -%392 = OpCompositeConstruct %176 %24 %24 %24 -%393 = OpCompositeConstruct %176 %25 %25 %25 -%394 = OpShiftRightLogical %176 %392 %393 +%365 = OpFunction %2 None %164 +%364 = OpLabel +OpBranch %366 +%366 = OpLabel +%367 = OpNot %8 %7 +%368 = OpNot %20 %25 +%369 = OpCompositeConstruct %183 %7 %7 +%370 = OpNot %183 %369 +%371 = OpCompositeConstruct %194 %25 %25 %25 +%372 = OpNot %194 %371 +%373 = OpBitwiseOr %8 %18 %7 +%374 = OpBitwiseOr %20 %24 %25 +%375 = OpCompositeConstruct %183 %18 %18 +%376 = OpCompositeConstruct %183 %7 %7 +%377 = OpBitwiseOr %183 %375 %376 +%378 = OpCompositeConstruct %194 %24 %24 %24 +%379 = OpCompositeConstruct %194 %25 %25 %25 +%380 = OpBitwiseOr %194 %378 %379 +%381 = OpBitwiseAnd %8 %18 %7 +%382 = OpBitwiseAnd %20 %24 %25 +%383 = OpCompositeConstruct %183 %18 %18 +%384 = OpCompositeConstruct %183 %7 %7 +%385 = OpBitwiseAnd %183 %383 %384 +%386 = OpCompositeConstruct %194 %24 %24 %24 +%387 = OpCompositeConstruct %194 %25 %25 %25 +%388 = OpBitwiseAnd %194 %386 %387 +%389 = OpBitwiseXor %8 %18 %7 +%390 = OpBitwiseXor %20 %24 %25 +%391 = OpCompositeConstruct %183 %18 %18 +%392 = OpCompositeConstruct %183 %7 %7 +%393 = OpBitwiseXor %183 %391 %392 +%394 = OpCompositeConstruct %194 %24 %24 %24 +%395 = OpCompositeConstruct %194 %25 %25 %25 +%396 = OpBitwiseXor %194 %394 %395 +%397 = OpShiftLeftLogical %8 %18 %25 +%398 = OpShiftLeftLogical %20 %24 %25 +%399 = OpCompositeConstruct %183 %18 %18 +%400 = OpCompositeConstruct %34 %25 %25 +%401 = OpShiftLeftLogical %183 %399 %400 +%402 = OpCompositeConstruct %194 %24 %24 %24 +%403 = OpCompositeConstruct %194 %25 %25 %25 +%404 = OpShiftLeftLogical %194 %402 %403 +%405 = OpShiftRightArithmetic %8 %18 %25 +%406 = OpShiftRightLogical %20 %24 %25 +%407 = OpCompositeConstruct %183 %18 %18 +%408 = OpCompositeConstruct %34 %25 %25 +%409 = OpShiftRightArithmetic %183 %407 %408 +%410 = OpCompositeConstruct %194 %24 %24 %24 +%411 = OpCompositeConstruct %194 %25 %25 %25 +%412 = OpShiftRightLogical %194 %410 %411 OpReturn OpFunctionEnd -%396 = OpFunction %2 None %146 -%395 = OpLabel -OpBranch %397 -%397 = OpLabel -%398 = OpIEqual %10 %18 %7 -%399 = OpIEqual %10 %24 %25 -%400 = OpFOrdEqual %10 %14 %3 -%401 = OpCompositeConstruct %165 %18 %18 -%402 = OpCompositeConstruct %165 %7 %7 -%403 = OpIEqual %149 %401 %402 -%404 = OpCompositeConstruct %176 %24 %24 %24 -%405 = OpCompositeConstruct %176 %25 %25 %25 -%406 = OpIEqual %104 %404 %405 -%407 = OpCompositeConstruct %26 %14 %14 %14 %14 -%408 = OpCompositeConstruct %26 %3 %3 %3 %3 -%409 = OpFOrdEqual %28 %407 %408 -%410 = OpINotEqual %10 %18 %7 -%411 = OpINotEqual %10 %24 %25 -%412 = OpFOrdNotEqual %10 %14 %3 -%413 = OpCompositeConstruct %165 %18 %18 -%414 = OpCompositeConstruct %165 %7 %7 -%415 = OpINotEqual %149 %413 %414 -%416 = OpCompositeConstruct %176 %24 %24 %24 -%417 = OpCompositeConstruct %176 %25 %25 %25 -%418 = OpINotEqual %104 %416 %417 -%419 = OpCompositeConstruct %26 %14 %14 %14 %14 -%420 = OpCompositeConstruct %26 %3 %3 %3 %3 -%421 = OpFOrdNotEqual %28 %419 %420 -%422 = OpSLessThan %10 %18 %7 -%423 = OpULessThan %10 %24 %25 -%424 = OpFOrdLessThan %10 %14 %3 -%425 = OpCompositeConstruct %165 %18 %18 -%426 = OpCompositeConstruct %165 %7 %7 -%427 = OpSLessThan %149 %425 %426 -%428 = OpCompositeConstruct %176 %24 %24 %24 -%429 = OpCompositeConstruct %176 %25 %25 %25 -%430 = OpULessThan %104 %428 %429 -%431 = OpCompositeConstruct %26 %14 %14 %14 %14 -%432 = OpCompositeConstruct %26 %3 %3 %3 %3 -%433 = OpFOrdLessThan %28 %431 %432 -%434 = OpSLessThanEqual %10 %18 %7 -%435 = OpULessThanEqual %10 %24 %25 -%436 = OpFOrdLessThanEqual %10 %14 %3 -%437 = OpCompositeConstruct %165 %18 %18 -%438 = OpCompositeConstruct %165 %7 %7 -%439 = OpSLessThanEqual %149 %437 %438 -%440 = OpCompositeConstruct %176 %24 %24 %24 -%441 = OpCompositeConstruct %176 %25 %25 %25 -%442 = OpULessThanEqual %104 %440 %441 -%443 = OpCompositeConstruct %26 %14 %14 %14 %14 -%444 = OpCompositeConstruct %26 %3 %3 %3 %3 -%445 = OpFOrdLessThanEqual %28 %443 %444 -%446 = OpSGreaterThan %10 %18 %7 -%447 = OpUGreaterThan %10 %24 %25 -%448 = OpFOrdGreaterThan %10 %14 %3 -%449 = OpCompositeConstruct %165 %18 %18 -%450 = OpCompositeConstruct %165 %7 %7 -%451 = OpSGreaterThan %149 %449 %450 -%452 = OpCompositeConstruct %176 %24 %24 %24 -%453 = OpCompositeConstruct %176 %25 %25 %25 -%454 = OpUGreaterThan %104 %452 %453 -%455 = OpCompositeConstruct %26 %14 %14 %14 %14 -%456 = OpCompositeConstruct %26 %3 %3 %3 %3 -%457 = OpFOrdGreaterThan %28 %455 %456 -%458 = OpSGreaterThanEqual %10 %18 %7 -%459 = OpUGreaterThanEqual %10 %24 %25 -%460 = OpFOrdGreaterThanEqual %10 %14 %3 -%461 = OpCompositeConstruct %165 %18 %18 -%462 = OpCompositeConstruct %165 %7 %7 -%463 = OpSGreaterThanEqual %149 %461 %462 -%464 = OpCompositeConstruct %176 %24 %24 %24 -%465 = OpCompositeConstruct %176 %25 %25 %25 -%466 = OpUGreaterThanEqual %104 %464 %465 -%467 = OpCompositeConstruct %26 %14 %14 %14 %14 -%468 = OpCompositeConstruct %26 %3 %3 %3 %3 -%469 = OpFOrdGreaterThanEqual %28 %467 %468 +%414 = OpFunction %2 None %164 +%413 = OpLabel +OpBranch %415 +%415 = OpLabel +%416 = OpIEqual %10 %18 %7 +%417 = OpIEqual %10 %24 %25 +%418 = OpFOrdEqual %10 %14 %3 +%419 = OpCompositeConstruct %183 %18 %18 +%420 = OpCompositeConstruct %183 %7 %7 +%421 = OpIEqual %167 %419 %420 +%422 = OpCompositeConstruct %194 %24 %24 %24 +%423 = OpCompositeConstruct %194 %25 %25 %25 +%424 = OpIEqual %122 %422 %423 +%425 = OpCompositeConstruct %26 %14 %14 %14 %14 +%426 = OpCompositeConstruct %26 %3 %3 %3 %3 +%427 = OpFOrdEqual %28 %425 %426 +%428 = OpINotEqual %10 %18 %7 +%429 = OpINotEqual %10 %24 %25 +%430 = OpFOrdNotEqual %10 %14 %3 +%431 = OpCompositeConstruct %183 %18 %18 +%432 = OpCompositeConstruct %183 %7 %7 +%433 = OpINotEqual %167 %431 %432 +%434 = OpCompositeConstruct %194 %24 %24 %24 +%435 = OpCompositeConstruct %194 %25 %25 %25 +%436 = OpINotEqual %122 %434 %435 +%437 = OpCompositeConstruct %26 %14 %14 %14 %14 +%438 = OpCompositeConstruct %26 %3 %3 %3 %3 +%439 = OpFOrdNotEqual %28 %437 %438 +%440 = OpSLessThan %10 %18 %7 +%441 = OpULessThan %10 %24 %25 +%442 = OpFOrdLessThan %10 %14 %3 +%443 = OpCompositeConstruct %183 %18 %18 +%444 = OpCompositeConstruct %183 %7 %7 +%445 = OpSLessThan %167 %443 %444 +%446 = OpCompositeConstruct %194 %24 %24 %24 +%447 = OpCompositeConstruct %194 %25 %25 %25 +%448 = OpULessThan %122 %446 %447 +%449 = OpCompositeConstruct %26 %14 %14 %14 %14 +%450 = OpCompositeConstruct %26 %3 %3 %3 %3 +%451 = OpFOrdLessThan %28 %449 %450 +%452 = OpSLessThanEqual %10 %18 %7 +%453 = OpULessThanEqual %10 %24 %25 +%454 = OpFOrdLessThanEqual %10 %14 %3 +%455 = OpCompositeConstruct %183 %18 %18 +%456 = OpCompositeConstruct %183 %7 %7 +%457 = OpSLessThanEqual %167 %455 %456 +%458 = OpCompositeConstruct %194 %24 %24 %24 +%459 = OpCompositeConstruct %194 %25 %25 %25 +%460 = OpULessThanEqual %122 %458 %459 +%461 = OpCompositeConstruct %26 %14 %14 %14 %14 +%462 = OpCompositeConstruct %26 %3 %3 %3 %3 +%463 = OpFOrdLessThanEqual %28 %461 %462 +%464 = OpSGreaterThan %10 %18 %7 +%465 = OpUGreaterThan %10 %24 %25 +%466 = OpFOrdGreaterThan %10 %14 %3 +%467 = OpCompositeConstruct %183 %18 %18 +%468 = OpCompositeConstruct %183 %7 %7 +%469 = OpSGreaterThan %167 %467 %468 +%470 = OpCompositeConstruct %194 %24 %24 %24 +%471 = OpCompositeConstruct %194 %25 %25 %25 +%472 = OpUGreaterThan %122 %470 %471 +%473 = OpCompositeConstruct %26 %14 %14 %14 %14 +%474 = OpCompositeConstruct %26 %3 %3 %3 %3 +%475 = OpFOrdGreaterThan %28 %473 %474 +%476 = OpSGreaterThanEqual %10 %18 %7 +%477 = OpUGreaterThanEqual %10 %24 %25 +%478 = OpFOrdGreaterThanEqual %10 %14 %3 +%479 = OpCompositeConstruct %183 %18 %18 +%480 = OpCompositeConstruct %183 %7 %7 +%481 = OpSGreaterThanEqual %167 %479 %480 +%482 = OpCompositeConstruct %194 %24 %24 %24 +%483 = OpCompositeConstruct %194 %25 %25 %25 +%484 = OpUGreaterThanEqual %122 %482 %483 +%485 = OpCompositeConstruct %26 %14 %14 %14 %14 +%486 = OpCompositeConstruct %26 %3 %3 %3 %3 +%487 = OpFOrdGreaterThanEqual %28 %485 %486 OpReturn OpFunctionEnd -%475 = OpFunction %2 None %146 -%474 = OpLabel -%470 = OpVariable %471 Function %7 -%472 = OpVariable %473 Function %57 -OpBranch %476 -%476 = OpLabel -%477 = OpLoad %8 %470 -%478 = OpIAdd %8 %477 %7 -OpStore %470 %478 -%479 = OpLoad %8 %470 -%480 = OpISub %8 %479 %7 -OpStore %470 %480 -%481 = OpLoad %8 %470 -%482 = OpLoad %8 %470 -%483 = OpIMul %8 %481 %482 -OpStore %470 %483 -%484 = OpLoad %8 %470 -%485 = OpLoad %8 %470 -%486 = OpSDiv %8 %484 %485 -OpStore %470 %486 -%487 = OpLoad %8 %470 -%488 = OpSRem %8 %487 %7 -OpStore %470 %488 -%489 = OpLoad %8 %470 -%490 = OpBitwiseAnd %8 %489 %11 -OpStore %470 %490 -%491 = OpLoad %8 %470 -%492 = OpBitwiseOr %8 %491 %11 -OpStore %470 %492 -%493 = OpLoad %8 %470 -%494 = OpBitwiseXor %8 %493 %11 -OpStore %470 %494 -%495 = OpLoad %8 %470 -%496 = OpShiftLeftLogical %8 %495 %24 -OpStore %470 %496 -%497 = OpLoad %8 %470 -%498 = OpShiftRightArithmetic %8 %497 %25 -OpStore %470 %498 -%499 = OpLoad %8 %470 -%500 = OpIAdd %8 %499 %7 -OpStore %470 %500 -%501 = OpLoad %8 %470 -%502 = OpISub %8 %501 %7 -OpStore %470 %502 -%504 = OpAccessChain %503 %472 %25 -%505 = OpLoad %8 %504 -%506 = OpIAdd %8 %505 %7 -%507 = OpAccessChain %503 %472 %25 -OpStore %507 %506 -%508 = OpAccessChain %503 %472 %25 -%509 = OpLoad %8 %508 -%510 = OpISub %8 %509 %7 -%511 = OpAccessChain %503 %472 %25 -OpStore %511 %510 +%493 = OpFunction %2 None %164 +%492 = OpLabel +%488 = OpVariable %489 Function %7 +%490 = OpVariable %491 Function %57 +OpBranch %494 +%494 = OpLabel +%495 = OpLoad %8 %488 +%496 = OpIAdd %8 %495 %7 +OpStore %488 %496 +%497 = OpLoad %8 %488 +%498 = OpISub %8 %497 %7 +OpStore %488 %498 +%499 = OpLoad %8 %488 +%500 = OpLoad %8 %488 +%501 = OpIMul %8 %499 %500 +OpStore %488 %501 +%502 = OpLoad %8 %488 +%503 = OpLoad %8 %488 +%504 = OpSDiv %8 %502 %503 +OpStore %488 %504 +%505 = OpLoad %8 %488 +%506 = OpSRem %8 %505 %7 +OpStore %488 %506 +%507 = OpLoad %8 %488 +%508 = OpBitwiseAnd %8 %507 %11 +OpStore %488 %508 +%509 = OpLoad %8 %488 +%510 = OpBitwiseOr %8 %509 %11 +OpStore %488 %510 +%511 = OpLoad %8 %488 +%512 = OpBitwiseXor %8 %511 %11 +OpStore %488 %512 +%513 = OpLoad %8 %488 +%514 = OpShiftLeftLogical %8 %513 %24 +OpStore %488 %514 +%515 = OpLoad %8 %488 +%516 = OpShiftRightArithmetic %8 %515 %25 +OpStore %488 %516 +%517 = OpLoad %8 %488 +%518 = OpIAdd %8 %517 %7 +OpStore %488 %518 +%519 = OpLoad %8 %488 +%520 = OpISub %8 %519 %7 +OpStore %488 %520 +%522 = OpAccessChain %521 %490 %25 +%523 = OpLoad %8 %522 +%524 = OpIAdd %8 %523 %7 +%525 = OpAccessChain %521 %490 %25 +OpStore %525 %524 +%526 = OpAccessChain %521 %490 %25 +%527 = OpLoad %8 %526 +%528 = OpISub %8 %527 %7 +%529 = OpAccessChain %521 %490 %25 +OpStore %529 %528 OpReturn OpFunctionEnd -%513 = OpFunction %2 None %146 -%512 = OpLabel -OpBranch %514 -%514 = OpLabel -%515 = OpFunctionCall %26 %59 -%516 = OpFunctionCall %26 %84 -%517 = OpVectorShuffle %29 %42 %42 0 1 2 -%518 = OpFunctionCall %29 %101 %517 -%519 = OpFunctionCall %4 %114 -%520 = OpFunctionCall %2 %145 -%521 = OpFunctionCall %2 %163 -%522 = OpFunctionCall %2 %347 -%523 = OpFunctionCall %2 %396 -%524 = OpFunctionCall %2 %475 +%531 = OpFunction %2 None %164 +%530 = OpLabel +OpBranch %532 +%532 = OpLabel +%533 = OpFunctionCall %26 %59 +%534 = OpFunctionCall %26 %84 +%535 = OpVectorShuffle %30 %42 %42 0 1 2 +%536 = OpFunctionCall %30 %119 %535 +%537 = OpFunctionCall %4 %132 +%538 = OpFunctionCall %2 %163 +%539 = OpFunctionCall %2 %181 +%540 = OpFunctionCall %2 %365 +%541 = OpFunctionCall %2 %414 +%542 = OpFunctionCall %2 %493 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/tests/out/wgsl/operators.wgsl b/tests/out/wgsl/operators.wgsl index 2aa21785e1..a8a488dff6 100644 --- a/tests/out/wgsl/operators.wgsl +++ b/tests/out/wgsl/operators.wgsl @@ -20,9 +20,23 @@ fn builtins() -> vec4 { } fn splat() -> vec4 { - let a_1 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); + let a_2 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); let b = (vec4(5) % vec4(2)); - return (a_1.xyxy + vec4(b)); + return (a_2.xyxy + vec4(b)); +} + +fn splat_assignment() -> vec2 { + var a: vec2; + + a = vec2(2.0); + let _e7 = a; + a = (_e7 + vec2(1.0)); + let _e11 = a; + a = (_e11 - vec2(3.0)); + let _e15 = a; + a = (_e15 / vec2(4.0)); + let _e19 = a; + return _e19; } fn bool_cast(x: vec3) -> vec3 { @@ -201,35 +215,35 @@ fn comparison() { } fn assignment() { - var a: i32 = 1; + var a_1: i32 = 1; var vec0_: vec3 = vec3(0, 0, 0); - let _e6 = a; - a = (_e6 + 1); - let _e9 = a; - a = (_e9 - 1); - let _e12 = a; - let _e13 = a; - a = (_e12 * _e13); - let _e15 = a; - let _e16 = a; - a = (_e15 / _e16); - let _e18 = a; - a = (_e18 % 1); - let _e21 = a; - a = (_e21 & 0); - let _e24 = a; - a = (_e24 | 0); - let _e27 = a; - a = (_e27 ^ 0); - let _e30 = a; - a = (_e30 << 2u); - let _e33 = a; - a = (_e33 >> 1u); - let _e36 = a; - a = (_e36 + 1); - let _e39 = a; - a = (_e39 - 1); + let _e6 = a_1; + a_1 = (_e6 + 1); + let _e9 = a_1; + a_1 = (_e9 - 1); + let _e12 = a_1; + let _e13 = a_1; + a_1 = (_e12 * _e13); + let _e15 = a_1; + let _e16 = a_1; + a_1 = (_e15 / _e16); + let _e18 = a_1; + a_1 = (_e18 % 1); + let _e21 = a_1; + a_1 = (_e21 & 0); + let _e24 = a_1; + a_1 = (_e24 | 0); + let _e27 = a_1; + a_1 = (_e27 ^ 0); + let _e30 = a_1; + a_1 = (_e30 << 2u); + let _e33 = a_1; + a_1 = (_e33 >> 1u); + let _e36 = a_1; + a_1 = (_e36 + 1); + let _e39 = a_1; + a_1 = (_e39 - 1); let _e46 = vec0_.y; vec0_.y = (_e46 + 1); let _e51 = vec0_.y;