diff --git a/tests/in/operators.wgsl b/tests/in/operators.wgsl index eaf16ab8ff..40d1ce8ead 100644 --- a/tests/in/operators.wgsl +++ b/tests/in/operators.wgsl @@ -41,215 +41,242 @@ fn bool_cast(x: vec3) -> vec3 { } fn logical() { + let t = true; + let f = false; + // unary - let neg0 = !true; - let neg1 = !vec2(true); + let neg0 = !t; + let neg1 = !vec2(t); // binary - let or = true || false; - let and = true && false; - let bitwise_or0 = true | false; - let bitwise_or1 = vec3(true) | vec3(false); - let bitwise_and0 = true & false; - let bitwise_and1 = vec4(true) & vec4(false); + let or = t || f; + let and = t && f; + let bitwise_or0 = t | f; + let bitwise_or1 = vec3(t) | vec3(f); + let bitwise_and0 = t & f; + let bitwise_and1 = vec4(t) & vec4(f); } fn arithmetic() { + let one_i = 1i; + let one_u = 1u; + let one_f = 1.0; + let two_i = 2i; + let two_u = 2u; + let two_f = 2.0; + // unary - let neg0 = -1.0; - let neg1 = -vec2(1); - let neg2 = -vec2(1.0); + let neg0 = -one_f; + let neg1 = -vec2(one_i); + let neg2 = -vec2(one_f); // binary // Addition - let add0 = 2 + 1; - let add1 = 2u + 1u; - let add2 = 2.0 + 1.0; - let add3 = vec2(2) + vec2(1); - let add4 = vec3(2u) + vec3(1u); - let add5 = vec4(2.0) + vec4(1.0); + let add0 = two_i + one_i; + let add1 = two_u + one_u; + let add2 = two_f + one_f; + let add3 = vec2(two_i) + vec2(one_i); + let add4 = vec3(two_u) + vec3(one_u); + let add5 = vec4(two_f) + vec4(one_f); // Subtraction - let sub0 = 2 - 1; - let sub1 = 2u - 1u; - let sub2 = 2.0 - 1.0; - let sub3 = vec2(2) - vec2(1); - let sub4 = vec3(2u) - vec3(1u); - let sub5 = vec4(2.0) - vec4(1.0); + let sub0 = two_i - one_i; + let sub1 = two_u - one_u; + let sub2 = two_f - one_f; + let sub3 = vec2(two_i) - vec2(one_i); + let sub4 = vec3(two_u) - vec3(one_u); + let sub5 = vec4(two_f) - vec4(one_f); // Multiplication - let mul0 = 2 * 1; - let mul1 = 2u * 1u; - let mul2 = 2.0 * 1.0; - let mul3 = vec2(2) * vec2(1); - let mul4 = vec3(2u) * vec3(1u); - let mul5 = vec4(2.0) * vec4(1.0); + let mul0 = two_i * one_i; + let mul1 = two_u * one_u; + let mul2 = two_f * one_f; + let mul3 = vec2(two_i) * vec2(one_i); + let mul4 = vec3(two_u) * vec3(one_u); + let mul5 = vec4(two_f) * vec4(one_f); // Division - let div0 = 2 / 1; - let div1 = 2u / 1u; - let div2 = 2.0 / 1.0; - let div3 = vec2(2) / vec2(1); - let div4 = vec3(2u) / vec3(1u); - let div5 = vec4(2.0) / vec4(1.0); + let div0 = two_i / one_i; + let div1 = two_u / one_u; + let div2 = two_f / one_f; + let div3 = vec2(two_i) / vec2(one_i); + let div4 = vec3(two_u) / vec3(one_u); + let div5 = vec4(two_f) / vec4(one_f); // Remainder - let rem0 = 2 % 1; - let rem1 = 2u % 1u; - let rem2 = 2.0 % 1.0; - let rem3 = vec2(2) % vec2(1); - let rem4 = vec3(2u) % vec3(1u); - let rem5 = vec4(2.0) % vec4(1.0); + let rem0 = two_i % one_i; + let rem1 = two_u % one_u; + let rem2 = two_f % one_f; + let rem3 = vec2(two_i) % vec2(one_i); + let rem4 = vec3(two_u) % vec3(one_u); + let rem5 = vec4(two_f) % vec4(one_f); // Binary arithmetic expressions with mixed scalar and vector operands { - let add0 = vec2(2) + 1; - let add1 = 2 + vec2(1); - let add2 = vec2(2u) + 1u; - let add3 = 2u + vec2(1u); - let add4 = vec2(2.0) + 1.0; - let add5 = 2.0 + vec2(1.0); - - let sub0 = vec2(2) - 1; - let sub1 = 2 - vec2(1); - let sub2 = vec2(2u) - 1u; - let sub3 = 2u - vec2(1u); - let sub4 = vec2(2.0) - 1.0; - let sub5 = 2.0 - vec2(1.0); - - let mul0 = vec2(2) * 1; - let mul1 = 2 * vec2(1); - let mul2 = vec2(2u) * 1u; - let mul3 = 2u * vec2(1u); - let mul4 = vec2(2.0) * 1.0; - let mul5 = 2.0 * vec2(1.0); - - let div0 = vec2(2) / 1; - let div1 = 2 / vec2(1); - let div2 = vec2(2u) / 1u; - let div3 = 2u / vec2(1u); - let div4 = vec2(2.0) / 1.0; - let div5 = 2.0 / vec2(1.0); - - let rem0 = vec2(2) % 1; - let rem1 = 2 % vec2(1); - let rem2 = vec2(2u) % 1u; - let rem3 = 2u % vec2(1u); - let rem4 = vec2(2.0) % 1.0; - let rem5 = 2.0 % vec2(1.0); + let add0 = vec2(two_i) + one_i; + let add1 = two_i + vec2(one_i); + let add2 = vec2(two_u) + one_u; + let add3 = two_u + vec2(one_u); + let add4 = vec2(two_f) + one_f; + let add5 = two_f + vec2(one_f); + + let sub0 = vec2(two_i) - one_i; + let sub1 = two_i - vec2(one_i); + let sub2 = vec2(two_u) - one_u; + let sub3 = two_u - vec2(one_u); + let sub4 = vec2(two_f) - one_f; + let sub5 = two_f - vec2(one_f); + + let mul0 = vec2(two_i) * one_i; + let mul1 = two_i * vec2(one_i); + let mul2 = vec2(two_u) * one_u; + let mul3 = two_u * vec2(one_u); + let mul4 = vec2(two_f) * one_f; + let mul5 = two_f * vec2(one_f); + + let div0 = vec2(two_i) / one_i; + let div1 = two_i / vec2(one_i); + let div2 = vec2(two_u) / one_u; + let div3 = two_u / vec2(one_u); + let div4 = vec2(two_f) / one_f; + let div5 = two_f / vec2(one_f); + + let rem0 = vec2(two_i) % one_i; + let rem1 = two_i % vec2(one_i); + let rem2 = vec2(two_u) % one_u; + let rem3 = two_u % vec2(one_u); + let rem4 = vec2(two_f) % one_f; + let rem5 = two_f % vec2(one_f); } // Matrix arithmetic let add = mat3x3() + mat3x3(); let sub = mat3x3() - mat3x3(); - let mul_scalar0 = mat3x3() * 1.0; - let mul_scalar1 = 2.0 * mat3x3(); + let mul_scalar0 = mat3x3() * one_f; + let mul_scalar1 = two_f * mat3x3(); - let mul_vector0 = mat4x3() * vec4(1.0); - let mul_vector1 = vec3f(2.0) * mat4x3f(); + let mul_vector0 = mat4x3() * vec4(one_f); + let mul_vector1 = vec3f(two_f) * mat4x3f(); let mul = mat4x3() * mat3x4(); } fn bit() { + let one_i = 1i; + let one_u = 1u; + let two_i = 2i; + let two_u = 2u; + // unary - let flip0 = ~1; - let flip1 = ~1u; - let flip2 = ~vec2(1); - let flip3 = ~vec3(1u); + let flip0 = ~one_i; + let flip1 = ~one_u; + let flip2 = ~vec2(one_i); + let flip3 = ~vec3(one_u); // binary - let or0 = 2 | 1; - let or1 = 2u | 1u; - let or2 = vec2(2) | vec2(1); - let or3 = vec3(2u) | vec3(1u); - - let and0 = 2 & 1; - let and1 = 2u & 1u; - let and2 = vec2(2) & vec2(1); - let and3 = vec3(2u) & vec3(1u); - - let xor0 = 2 ^ 1; - let xor1 = 2u ^ 1u; - let xor2 = vec2(2) ^ vec2(1); - let xor3 = vec3(2u) ^ vec3(1u); - - let shl0 = 2 << 1u; - let shl1 = 2u << 1u; - let shl2 = vec2(2) << vec2(1u); - let shl3 = vec3(2u) << vec3(1u); - - let shr0 = 2 >> 1u; - let shr1 = 2u >> 1u; - let shr2 = vec2(2) >> vec2(1u); - let shr3 = vec3(2u) >> vec3(1u); + let or0 = two_i | one_i; + let or1 = two_u | one_u; + let or2 = vec2(two_i) | vec2(one_i); + let or3 = vec3(two_u) | vec3(one_u); + + let and0 = two_i & one_i; + let and1 = two_u & one_u; + let and2 = vec2(two_i) & vec2(one_i); + let and3 = vec3(two_u) & vec3(one_u); + + let xor0 = two_i ^ one_i; + let xor1 = two_u ^ one_u; + let xor2 = vec2(two_i) ^ vec2(one_i); + let xor3 = vec3(two_u) ^ vec3(one_u); + + let shl0 = two_i << one_u; + let shl1 = two_u << one_u; + let shl2 = vec2(two_i) << vec2(one_u); + let shl3 = vec3(two_u) << vec3(one_u); + + let shr0 = two_i >> one_u; + let shr1 = two_u >> one_u; + let shr2 = vec2(two_i) >> vec2(one_u); + let shr3 = vec3(two_u) >> vec3(one_u); } fn comparison() { - let eq0 = 2 == 1; - let eq1 = 2u == 1u; - let eq2 = 2.0 == 1.0; - let eq3 = vec2(2) == vec2(1); - let eq4 = vec3(2u) == vec3(1u); - let eq5 = vec4(2.0) == vec4(1.0); - - let neq0 = 2 != 1; - let neq1 = 2u != 1u; - let neq2 = 2.0 != 1.0; - let neq3 = vec2(2) != vec2(1); - let neq4 = vec3(2u) != vec3(1u); - let neq5 = vec4(2.0) != vec4(1.0); - - let lt0 = 2 < 1; - let lt1 = 2u < 1u; - let lt2 = 2.0 < 1.0; - let lt3 = vec2(2) < vec2(1); - let lt4 = vec3(2u) < vec3(1u); - let lt5 = vec4(2.0) < vec4(1.0); - - let lte0 = 2 <= 1; - let lte1 = 2u <= 1u; - let lte2 = 2.0 <= 1.0; - let lte3 = vec2(2) <= vec2(1); - let lte4 = vec3(2u) <= vec3(1u); - let lte5 = vec4(2.0) <= vec4(1.0); - - let gt0 = 2 > 1; - let gt1 = 2u > 1u; - let gt2 = 2.0 > 1.0; - let gt3 = vec2(2) > vec2(1); - let gt4 = vec3(2u) > vec3(1u); - let gt5 = vec4(2.0) > vec4(1.0); - - let gte0 = 2 >= 1; - let gte1 = 2u >= 1u; - let gte2 = 2.0 >= 1.0; - let gte3 = vec2(2) >= vec2(1); - let gte4 = vec3(2u) >= vec3(1u); - let gte5 = vec4(2.0) >= vec4(1.0); + let one_i = 1i; + let one_u = 1u; + let one_f = 1.0; + let two_i = 2i; + let two_u = 2u; + let two_f = 2.0; + + let eq0 = two_i == one_i; + let eq1 = two_u == one_u; + let eq2 = two_f == one_f; + let eq3 = vec2(two_i) == vec2(one_i); + let eq4 = vec3(two_u) == vec3(one_u); + let eq5 = vec4(two_f) == vec4(one_f); + + let neq0 = two_i != one_i; + let neq1 = two_u != one_u; + let neq2 = two_f != one_f; + let neq3 = vec2(two_i) != vec2(one_i); + let neq4 = vec3(two_u) != vec3(one_u); + let neq5 = vec4(two_f) != vec4(one_f); + + let lt0 = two_i < one_i; + let lt1 = two_u < one_u; + let lt2 = two_f < one_f; + let lt3 = vec2(two_i) < vec2(one_i); + let lt4 = vec3(two_u) < vec3(one_u); + let lt5 = vec4(two_f) < vec4(one_f); + + let lte0 = two_i <= one_i; + let lte1 = two_u <= one_u; + let lte2 = two_f <= one_f; + let lte3 = vec2(two_i) <= vec2(one_i); + let lte4 = vec3(two_u) <= vec3(one_u); + let lte5 = vec4(two_f) <= vec4(one_f); + + let gt0 = two_i > one_i; + let gt1 = two_u > one_u; + let gt2 = two_f > one_f; + let gt3 = vec2(two_i) > vec2(one_i); + let gt4 = vec3(two_u) > vec3(one_u); + let gt5 = vec4(two_f) > vec4(one_f); + + let gte0 = two_i >= one_i; + let gte1 = two_u >= one_u; + let gte2 = two_f >= one_f; + let gte3 = vec2(two_i) >= vec2(one_i); + let gte4 = vec3(two_u) >= vec3(one_u); + let gte5 = vec4(two_f) >= vec4(one_f); } fn assignment() { - var a = 1; + let zero_i = 0i; + let one_i = 1i; + let one_u = 1u; + let two_u = 2u; + + var a = one_i; - a += 1; - a -= 1; + a += one_i; + a -= one_i; a *= a; a /= a; - a %= 1; - a &= 0; - a |= 0; - a ^= 0; - a <<= 2u; - a >>= 1u; + a %= one_i; + a &= zero_i; + a |= zero_i; + a ^= zero_i; + a <<= two_u; + a >>= one_u; a++; a--; var vec0: vec3 = vec3(); - vec0[1]++; - vec0[1]--; + vec0[one_i]++; + vec0[one_i]--; } @compute @workgroup_size(1) @@ -266,12 +293,13 @@ fn main() { } fn negation_avoids_prefix_decrement() { - let p0 = -1; - let p1 = - -2; - let p2 = -(-3); - let p3 = -(- 4); - let p4 = - - -5; - let p5 = - - - - 6; - let p6 = - - -(- -7); - let p7 = (- - - - -8); + let x = 1; + let p0 = -x; + let p1 = - -x; + let p2 = -(-x); + let p3 = -(- x); + let p4 = - - -x; + let p5 = - - - - x; + let p6 = - - -(- -x); + let p7 = (- - - - -x); } diff --git a/tests/out/glsl/operators.main.Compute.glsl b/tests/out/glsl/operators.main.Compute.glsl index a1a7131e99..83dd56f8a4 100644 --- a/tests/out/glsl/operators.main.Compute.glsl +++ b/tests/out/glsl/operators.main.Compute.glsl @@ -47,7 +47,10 @@ vec3 bool_cast(vec3 x) { } void logical() { - bvec2 neg1_ = bvec2(false, false); + bool neg0_ = !(true); + bvec2 neg1_ = not(bvec2(true)); + bool or = (true || false); + bool and = (true && false); bool bitwise_or0_ = (true || false); bvec3 bitwise_or1_ = bvec3(bvec3(true).x || bvec3(false).x, bvec3(true).y || bvec3(false).y, bvec3(true).z || bvec3(false).z); bool bitwise_and0_ = (true && false); @@ -55,138 +58,192 @@ void logical() { } void arithmetic() { - ivec2 neg1_1 = ivec2(-1, -1); - vec2 neg2_ = vec2(-1.0, -1.0); + float neg0_1 = -(1.0); + ivec2 neg1_1 = -(ivec2(1)); + vec2 neg2_ = -(vec2(1.0)); + int add0_ = (2 + 1); + uint add1_ = (2u + 1u); + float add2_ = (2.0 + 1.0); ivec2 add3_ = (ivec2(2) + ivec2(1)); uvec3 add4_ = (uvec3(2u) + uvec3(1u)); vec4 add5_ = (vec4(2.0) + vec4(1.0)); + int sub0_ = (2 - 1); + uint sub1_ = (2u - 1u); + float sub2_ = (2.0 - 1.0); ivec2 sub3_ = (ivec2(2) - ivec2(1)); uvec3 sub4_ = (uvec3(2u) - uvec3(1u)); vec4 sub5_ = (vec4(2.0) - vec4(1.0)); + int mul0_ = (2 * 1); + uint mul1_ = (2u * 1u); + float mul2_ = (2.0 * 1.0); ivec2 mul3_ = (ivec2(2) * ivec2(1)); uvec3 mul4_ = (uvec3(2u) * uvec3(1u)); vec4 mul5_ = (vec4(2.0) * vec4(1.0)); + int div0_ = (2 / 1); + uint div1_ = (2u / 1u); + float div2_ = (2.0 / 1.0); ivec2 div3_ = (ivec2(2) / ivec2(1)); uvec3 div4_ = (uvec3(2u) / uvec3(1u)); vec4 div5_ = (vec4(2.0) / vec4(1.0)); + int rem0_ = (2 % 1); + uint rem1_ = (2u % 1u); + float rem2_ = (2.0 - 1.0 * trunc(2.0 / 1.0)); ivec2 rem3_ = (ivec2(2) % ivec2(1)); uvec3 rem4_ = (uvec3(2u) % uvec3(1u)); vec4 rem5_ = (vec4(2.0) - vec4(1.0) * trunc(vec4(2.0) / vec4(1.0))); { - ivec2 add0_ = (ivec2(2) + ivec2(1)); - ivec2 add1_ = (ivec2(2) + ivec2(1)); - uvec2 add2_ = (uvec2(2u) + uvec2(1u)); + ivec2 add0_1 = (ivec2(2) + ivec2(1)); + ivec2 add1_1 = (ivec2(2) + ivec2(1)); + uvec2 add2_1 = (uvec2(2u) + uvec2(1u)); uvec2 add3_1 = (uvec2(2u) + uvec2(1u)); vec2 add4_1 = (vec2(2.0) + vec2(1.0)); vec2 add5_1 = (vec2(2.0) + vec2(1.0)); - ivec2 sub0_ = (ivec2(2) - ivec2(1)); - ivec2 sub1_ = (ivec2(2) - ivec2(1)); - uvec2 sub2_ = (uvec2(2u) - uvec2(1u)); + ivec2 sub0_1 = (ivec2(2) - ivec2(1)); + ivec2 sub1_1 = (ivec2(2) - ivec2(1)); + uvec2 sub2_1 = (uvec2(2u) - uvec2(1u)); uvec2 sub3_1 = (uvec2(2u) - uvec2(1u)); vec2 sub4_1 = (vec2(2.0) - vec2(1.0)); vec2 sub5_1 = (vec2(2.0) - vec2(1.0)); - ivec2 mul0_ = ivec2(2, 2); - ivec2 mul1_ = ivec2(2, 2); - uvec2 mul2_ = uvec2(2u, 2u); - uvec2 mul3_1 = uvec2(2u, 2u); - vec2 mul4_1 = vec2(2.0, 2.0); - vec2 mul5_1 = vec2(2.0, 2.0); - ivec2 div0_ = (ivec2(2) / ivec2(1)); - ivec2 div1_ = (ivec2(2) / ivec2(1)); - uvec2 div2_ = (uvec2(2u) / uvec2(1u)); + ivec2 mul0_1 = (ivec2(2) * 1); + ivec2 mul1_1 = (2 * ivec2(1)); + uvec2 mul2_1 = (uvec2(2u) * 1u); + uvec2 mul3_1 = (2u * uvec2(1u)); + vec2 mul4_1 = (vec2(2.0) * 1.0); + vec2 mul5_1 = (2.0 * vec2(1.0)); + ivec2 div0_1 = (ivec2(2) / ivec2(1)); + ivec2 div1_1 = (ivec2(2) / ivec2(1)); + uvec2 div2_1 = (uvec2(2u) / uvec2(1u)); uvec2 div3_1 = (uvec2(2u) / uvec2(1u)); vec2 div4_1 = (vec2(2.0) / vec2(1.0)); vec2 div5_1 = (vec2(2.0) / vec2(1.0)); - ivec2 rem0_ = (ivec2(2) % ivec2(1)); - ivec2 rem1_ = (ivec2(2) % ivec2(1)); - uvec2 rem2_ = (uvec2(2u) % uvec2(1u)); + ivec2 rem0_1 = (ivec2(2) % ivec2(1)); + ivec2 rem1_1 = (ivec2(2) % ivec2(1)); + uvec2 rem2_1 = (uvec2(2u) % uvec2(1u)); uvec2 rem3_1 = (uvec2(2u) % uvec2(1u)); vec2 rem4_1 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); vec2 rem5_1 = (vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0))); } mat3x3 add = (mat3x3(0.0) + mat3x3(0.0)); mat3x3 sub = (mat3x3(0.0) - mat3x3(0.0)); - mat3x3 mul_scalar0_ = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); - mat3x3 mul_scalar1_ = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + mat3x3 mul_scalar0_ = (mat3x3(0.0) * 1.0); + mat3x3 mul_scalar1_ = (2.0 * mat3x3(0.0)); vec3 mul_vector0_ = (mat4x3(0.0) * vec4(1.0)); vec4 mul_vector1_ = (vec3(2.0) * mat4x3(0.0)); mat3x3 mul = (mat4x3(0.0) * mat3x4(0.0)); } void bit() { - ivec2 flip2_ = ivec2(-2, -2); - uvec3 flip3_ = uvec3(4294967294u, 4294967294u, 4294967294u); + int flip0_ = ~(1); + uint flip1_ = ~(1u); + ivec2 flip2_ = ~(ivec2(1)); + uvec3 flip3_ = ~(uvec3(1u)); + int or0_ = (2 | 1); + uint or1_ = (2u | 1u); ivec2 or2_ = (ivec2(2) | ivec2(1)); uvec3 or3_ = (uvec3(2u) | uvec3(1u)); + int and0_ = (2 & 1); + uint and1_ = (2u & 1u); ivec2 and2_ = (ivec2(2) & ivec2(1)); uvec3 and3_ = (uvec3(2u) & uvec3(1u)); + int xor0_ = (2 ^ 1); + uint xor1_ = (2u ^ 1u); ivec2 xor2_ = (ivec2(2) ^ ivec2(1)); uvec3 xor3_ = (uvec3(2u) ^ uvec3(1u)); + int shl0_ = (2 << 1u); + uint shl1_ = (2u << 1u); ivec2 shl2_ = (ivec2(2) << uvec2(1u)); uvec3 shl3_ = (uvec3(2u) << uvec3(1u)); + int shr0_ = (2 >> 1u); + uint shr1_ = (2u >> 1u); ivec2 shr2_ = (ivec2(2) >> uvec2(1u)); uvec3 shr3_ = (uvec3(2u) >> uvec3(1u)); } void comparison() { + bool eq0_ = (2 == 1); + bool eq1_ = (2u == 1u); + bool eq2_ = (2.0 == 1.0); bvec2 eq3_ = equal(ivec2(2), ivec2(1)); bvec3 eq4_ = equal(uvec3(2u), uvec3(1u)); bvec4 eq5_ = equal(vec4(2.0), vec4(1.0)); + bool neq0_ = (2 != 1); + bool neq1_ = (2u != 1u); + bool neq2_ = (2.0 != 1.0); bvec2 neq3_ = notEqual(ivec2(2), ivec2(1)); bvec3 neq4_ = notEqual(uvec3(2u), uvec3(1u)); bvec4 neq5_ = notEqual(vec4(2.0), vec4(1.0)); + bool lt0_ = (2 < 1); + bool lt1_ = (2u < 1u); + bool lt2_ = (2.0 < 1.0); bvec2 lt3_ = lessThan(ivec2(2), ivec2(1)); bvec3 lt4_ = lessThan(uvec3(2u), uvec3(1u)); bvec4 lt5_ = lessThan(vec4(2.0), vec4(1.0)); + bool lte0_ = (2 <= 1); + bool lte1_ = (2u <= 1u); + bool lte2_ = (2.0 <= 1.0); bvec2 lte3_ = lessThanEqual(ivec2(2), ivec2(1)); bvec3 lte4_ = lessThanEqual(uvec3(2u), uvec3(1u)); bvec4 lte5_ = lessThanEqual(vec4(2.0), vec4(1.0)); + bool gt0_ = (2 > 1); + bool gt1_ = (2u > 1u); + bool gt2_ = (2.0 > 1.0); bvec2 gt3_ = greaterThan(ivec2(2), ivec2(1)); bvec3 gt4_ = greaterThan(uvec3(2u), uvec3(1u)); bvec4 gt5_ = greaterThan(vec4(2.0), vec4(1.0)); + bool gte0_ = (2 >= 1); + bool gte1_ = (2u >= 1u); + bool gte2_ = (2.0 >= 1.0); bvec2 gte3_ = greaterThanEqual(ivec2(2), ivec2(1)); bvec3 gte4_ = greaterThanEqual(uvec3(2u), uvec3(1u)); bvec4 gte5_ = greaterThanEqual(vec4(2.0), vec4(1.0)); } void assignment() { - int a_1 = 1; + int a_1 = 0; ivec3 vec0_ = ivec3(0); - int _e3 = a_1; - a_1 = (_e3 + 1); - int _e6 = a_1; - a_1 = (_e6 - 1); - int _e8 = a_1; + a_1 = 1; + int _e5 = a_1; + a_1 = (_e5 + 1); + int _e7 = a_1; + a_1 = (_e7 - 1); int _e9 = a_1; - a_1 = (_e9 * _e8); - int _e11 = a_1; + int _e10 = a_1; + a_1 = (_e10 * _e9); int _e12 = a_1; - a_1 = (_e12 / _e11); + int _e13 = a_1; + a_1 = (_e13 / _e12); int _e15 = a_1; a_1 = (_e15 % 1); - int _e18 = a_1; - a_1 = (_e18 & 0); + int _e17 = a_1; + a_1 = (_e17 & 0); + int _e19 = a_1; + a_1 = (_e19 | 0); int _e21 = a_1; - a_1 = (_e21 | 0); - int _e24 = a_1; - a_1 = (_e24 ^ 0); - int _e27 = a_1; - a_1 = (_e27 << 2u); - int _e30 = a_1; - a_1 = (_e30 >> 1u); - int _e33 = a_1; - a_1 = (_e33 + 1); - int _e36 = a_1; - a_1 = (_e36 - 1); - int _e42 = vec0_.y; - vec0_.y = (_e42 + 1); - int _e46 = vec0_.y; - vec0_.y = (_e46 - 1); + a_1 = (_e21 ^ 0); + int _e23 = a_1; + a_1 = (_e23 << 2u); + int _e25 = a_1; + a_1 = (_e25 >> 1u); + int _e28 = a_1; + a_1 = (_e28 + 1); + int _e31 = a_1; + a_1 = (_e31 - 1); + int _e37 = vec0_[1]; + vec0_[1] = (_e37 + 1); + int _e41 = vec0_[1]; + vec0_[1] = (_e41 - 1); return; } void negation_avoids_prefix_decrement() { - return; + int p0_ = -(1); + int p1_ = -(-(1)); + int p2_ = -(-(1)); + int p3_ = -(-(1)); + int p4_ = -(-(-(1))); + int p5_ = -(-(-(-(1)))); + int p6_ = -(-(-(-(-(1))))); + int p7_ = -(-(-(-(-(1))))); } void main() { diff --git a/tests/out/hlsl/operators.hlsl b/tests/out/hlsl/operators.hlsl index 7074d1d562..6d18d07ed6 100644 --- a/tests/out/hlsl/operators.hlsl +++ b/tests/out/hlsl/operators.hlsl @@ -45,7 +45,10 @@ float3 bool_cast(float3 x) void logical() { - bool2 neg1_ = bool2(false, false); + bool neg0_ = !(true); + bool2 neg1_ = !((true).xx); + bool or_ = (true || false); + bool and_ = (true && false); bool bitwise_or0_ = (true | false); bool3 bitwise_or1_ = ((true).xxx | (false).xxx); bool bitwise_and0_ = (true & false); @@ -54,59 +57,75 @@ void logical() void arithmetic() { - int2 neg1_1 = int2(-1, -1); - float2 neg2_ = float2(-1.0, -1.0); + float neg0_1 = -(1.0); + int2 neg1_1 = -((1).xx); + float2 neg2_ = -((1.0).xx); + int add0_ = (2 + 1); + uint add1_ = (2u + 1u); + float add2_ = (2.0 + 1.0); int2 add3_ = ((2).xx + (1).xx); uint3 add4_ = ((2u).xxx + (1u).xxx); float4 add5_ = ((2.0).xxxx + (1.0).xxxx); + int sub0_ = (2 - 1); + uint sub1_ = (2u - 1u); + float sub2_ = (2.0 - 1.0); int2 sub3_ = ((2).xx - (1).xx); uint3 sub4_ = ((2u).xxx - (1u).xxx); float4 sub5_ = ((2.0).xxxx - (1.0).xxxx); + int mul0_ = (2 * 1); + uint mul1_ = (2u * 1u); + float mul2_ = (2.0 * 1.0); int2 mul3_ = ((2).xx * (1).xx); uint3 mul4_ = ((2u).xxx * (1u).xxx); float4 mul5_ = ((2.0).xxxx * (1.0).xxxx); + int div0_ = (2 / 1); + uint div1_ = (2u / 1u); + float div2_ = (2.0 / 1.0); int2 div3_ = ((2).xx / (1).xx); uint3 div4_ = ((2u).xxx / (1u).xxx); float4 div5_ = ((2.0).xxxx / (1.0).xxxx); + int rem0_ = (2 % 1); + uint rem1_ = (2u % 1u); + float rem2_ = fmod(2.0, 1.0); int2 rem3_ = ((2).xx % (1).xx); uint3 rem4_ = ((2u).xxx % (1u).xxx); float4 rem5_ = fmod((2.0).xxxx, (1.0).xxxx); { - int2 add0_ = ((2).xx + (1).xx); - int2 add1_ = ((2).xx + (1).xx); - uint2 add2_ = ((2u).xx + (1u).xx); + int2 add0_1 = ((2).xx + (1).xx); + int2 add1_1 = ((2).xx + (1).xx); + uint2 add2_1 = ((2u).xx + (1u).xx); uint2 add3_1 = ((2u).xx + (1u).xx); float2 add4_1 = ((2.0).xx + (1.0).xx); float2 add5_1 = ((2.0).xx + (1.0).xx); - int2 sub0_ = ((2).xx - (1).xx); - int2 sub1_ = ((2).xx - (1).xx); - uint2 sub2_ = ((2u).xx - (1u).xx); + int2 sub0_1 = ((2).xx - (1).xx); + int2 sub1_1 = ((2).xx - (1).xx); + uint2 sub2_1 = ((2u).xx - (1u).xx); uint2 sub3_1 = ((2u).xx - (1u).xx); float2 sub4_1 = ((2.0).xx - (1.0).xx); float2 sub5_1 = ((2.0).xx - (1.0).xx); - int2 mul0_ = int2(2, 2); - int2 mul1_ = int2(2, 2); - uint2 mul2_ = uint2(2u, 2u); - uint2 mul3_1 = uint2(2u, 2u); - float2 mul4_1 = float2(2.0, 2.0); - float2 mul5_1 = float2(2.0, 2.0); - int2 div0_ = ((2).xx / (1).xx); - int2 div1_ = ((2).xx / (1).xx); - uint2 div2_ = ((2u).xx / (1u).xx); + int2 mul0_1 = ((2).xx * 1); + int2 mul1_1 = (2 * (1).xx); + uint2 mul2_1 = ((2u).xx * 1u); + uint2 mul3_1 = (2u * (1u).xx); + float2 mul4_1 = ((2.0).xx * 1.0); + float2 mul5_1 = (2.0 * (1.0).xx); + int2 div0_1 = ((2).xx / (1).xx); + int2 div1_1 = ((2).xx / (1).xx); + uint2 div2_1 = ((2u).xx / (1u).xx); uint2 div3_1 = ((2u).xx / (1u).xx); float2 div4_1 = ((2.0).xx / (1.0).xx); float2 div5_1 = ((2.0).xx / (1.0).xx); - int2 rem0_ = ((2).xx % (1).xx); - int2 rem1_ = ((2).xx % (1).xx); - uint2 rem2_ = ((2u).xx % (1u).xx); + int2 rem0_1 = ((2).xx % (1).xx); + int2 rem1_1 = ((2).xx % (1).xx); + uint2 rem2_1 = ((2u).xx % (1u).xx); uint2 rem3_1 = ((2u).xx % (1u).xx); float2 rem4_1 = fmod((2.0).xx, (1.0).xx); float2 rem5_1 = fmod((2.0).xx, (1.0).xx); } float3x3 add = ((float3x3)0 + (float3x3)0); float3x3 sub = ((float3x3)0 - (float3x3)0); - float3x3 mul_scalar0_ = float3x3(float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)); - float3x3 mul_scalar1_ = float3x3(float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)); + float3x3 mul_scalar0_ = mul(1.0, (float3x3)0); + float3x3 mul_scalar1_ = mul((float3x3)0, 2.0); float3 mul_vector0_ = mul((1.0).xxxx, (float4x3)0); float4 mul_vector1_ = mul((float4x3)0, (2.0).xxx); float3x3 mul_ = mul((float3x4)0, (float4x3)0); @@ -114,37 +133,67 @@ void arithmetic() void bit() { - int2 flip2_ = int2(-2, -2); - uint3 flip3_ = uint3(4294967294u, 4294967294u, 4294967294u); + int flip0_ = ~(1); + uint flip1_ = ~(1u); + int2 flip2_ = ~((1).xx); + uint3 flip3_ = ~((1u).xxx); + int or0_ = (2 | 1); + uint or1_ = (2u | 1u); int2 or2_ = ((2).xx | (1).xx); uint3 or3_ = ((2u).xxx | (1u).xxx); + int and0_ = (2 & 1); + uint and1_ = (2u & 1u); int2 and2_ = ((2).xx & (1).xx); uint3 and3_ = ((2u).xxx & (1u).xxx); + int xor0_ = (2 ^ 1); + uint xor1_ = (2u ^ 1u); int2 xor2_ = ((2).xx ^ (1).xx); uint3 xor3_ = ((2u).xxx ^ (1u).xxx); + int shl0_ = (2 << 1u); + uint shl1_ = (2u << 1u); int2 shl2_ = ((2).xx << (1u).xx); uint3 shl3_ = ((2u).xxx << (1u).xxx); + int shr0_ = (2 >> 1u); + uint shr1_ = (2u >> 1u); int2 shr2_ = ((2).xx >> (1u).xx); uint3 shr3_ = ((2u).xxx >> (1u).xxx); } void comparison() { + bool eq0_ = (2 == 1); + bool eq1_ = (2u == 1u); + bool eq2_ = (2.0 == 1.0); bool2 eq3_ = ((2).xx == (1).xx); bool3 eq4_ = ((2u).xxx == (1u).xxx); bool4 eq5_ = ((2.0).xxxx == (1.0).xxxx); + bool neq0_ = (2 != 1); + bool neq1_ = (2u != 1u); + bool neq2_ = (2.0 != 1.0); bool2 neq3_ = ((2).xx != (1).xx); bool3 neq4_ = ((2u).xxx != (1u).xxx); bool4 neq5_ = ((2.0).xxxx != (1.0).xxxx); + bool lt0_ = (2 < 1); + bool lt1_ = (2u < 1u); + bool lt2_ = (2.0 < 1.0); bool2 lt3_ = ((2).xx < (1).xx); bool3 lt4_ = ((2u).xxx < (1u).xxx); bool4 lt5_ = ((2.0).xxxx < (1.0).xxxx); + bool lte0_ = (2 <= 1); + bool lte1_ = (2u <= 1u); + bool lte2_ = (2.0 <= 1.0); bool2 lte3_ = ((2).xx <= (1).xx); bool3 lte4_ = ((2u).xxx <= (1u).xxx); bool4 lte5_ = ((2.0).xxxx <= (1.0).xxxx); + bool gt0_ = (2 > 1); + bool gt1_ = (2u > 1u); + bool gt2_ = (2.0 > 1.0); bool2 gt3_ = ((2).xx > (1).xx); bool3 gt4_ = ((2u).xxx > (1u).xxx); bool4 gt5_ = ((2.0).xxxx > (1.0).xxxx); + bool gte0_ = (2 >= 1); + bool gte1_ = (2u >= 1u); + bool gte2_ = (2.0 >= 1.0); bool2 gte3_ = ((2).xx >= (1).xx); bool3 gte4_ = ((2u).xxx >= (1u).xxx); bool4 gte5_ = ((2.0).xxxx >= (1.0).xxxx); @@ -152,45 +201,53 @@ void comparison() void assignment() { - int a_1 = 1; + int a_1 = (int)0; int3 vec0_ = (int3)0; - int _expr3 = a_1; - a_1 = (_expr3 + 1); - int _expr6 = a_1; - a_1 = (_expr6 - 1); - int _expr8 = a_1; + a_1 = 1; + int _expr5 = a_1; + a_1 = (_expr5 + 1); + int _expr7 = a_1; + a_1 = (_expr7 - 1); int _expr9 = a_1; - a_1 = (_expr9 * _expr8); - int _expr11 = a_1; + int _expr10 = a_1; + a_1 = (_expr10 * _expr9); int _expr12 = a_1; - a_1 = (_expr12 / _expr11); + int _expr13 = a_1; + a_1 = (_expr13 / _expr12); int _expr15 = a_1; a_1 = (_expr15 % 1); - int _expr18 = a_1; - a_1 = (_expr18 & 0); + int _expr17 = a_1; + a_1 = (_expr17 & 0); + int _expr19 = a_1; + a_1 = (_expr19 | 0); int _expr21 = a_1; - a_1 = (_expr21 | 0); - int _expr24 = a_1; - a_1 = (_expr24 ^ 0); - int _expr27 = a_1; - a_1 = (_expr27 << 2u); - int _expr30 = a_1; - a_1 = (_expr30 >> 1u); - int _expr33 = a_1; - a_1 = (_expr33 + 1); - int _expr36 = a_1; - a_1 = (_expr36 - 1); - int _expr42 = vec0_.y; - vec0_.y = (_expr42 + 1); - int _expr46 = vec0_.y; - vec0_.y = (_expr46 - 1); + a_1 = (_expr21 ^ 0); + int _expr23 = a_1; + a_1 = (_expr23 << 2u); + int _expr25 = a_1; + a_1 = (_expr25 >> 1u); + int _expr28 = a_1; + a_1 = (_expr28 + 1); + int _expr31 = a_1; + a_1 = (_expr31 - 1); + int _expr37 = vec0_[1]; + vec0_[1] = (_expr37 + 1); + int _expr41 = vec0_[1]; + vec0_[1] = (_expr41 - 1); return; } void negation_avoids_prefix_decrement() { - return; + int p0_ = -(1); + int p1_ = -(-(1)); + int p2_ = -(-(1)); + int p3_ = -(-(1)); + int p4_ = -(-(-(1))); + int p5_ = -(-(-(-(1)))); + int p6_ = -(-(-(-(-(1))))); + int p7_ = -(-(-(-(-(1))))); } [numthreads(1, 1, 1)] diff --git a/tests/out/msl/operators.msl b/tests/out/msl/operators.msl index 2a7463646f..114865451a 100644 --- a/tests/out/msl/operators.msl +++ b/tests/out/msl/operators.msl @@ -51,7 +51,10 @@ metal::float3 bool_cast( void logical( ) { - metal::bool2 neg1_ = metal::bool2(false, false); + bool neg0_ = !(true); + metal::bool2 neg1_ = !(metal::bool2(true)); + bool or_ = true || false; + bool and_ = true && false; bool bitwise_or0_ = true | false; metal::bool3 bitwise_or1_ = metal::bool3(true) | metal::bool3(false); bool bitwise_and0_ = true & false; @@ -60,59 +63,75 @@ void logical( void arithmetic( ) { - metal::int2 neg1_1 = metal::int2(-1, -1); - metal::float2 neg2_ = metal::float2(-1.0, -1.0); + float neg0_1 = -(1.0); + metal::int2 neg1_1 = -(metal::int2(1)); + metal::float2 neg2_ = -(metal::float2(1.0)); + int add0_ = 2 + 1; + uint add1_ = 2u + 1u; + float add2_ = 2.0 + 1.0; metal::int2 add3_ = metal::int2(2) + metal::int2(1); metal::uint3 add4_ = metal::uint3(2u) + metal::uint3(1u); metal::float4 add5_ = metal::float4(2.0) + metal::float4(1.0); + int sub0_ = 2 - 1; + uint sub1_ = 2u - 1u; + float sub2_ = 2.0 - 1.0; metal::int2 sub3_ = metal::int2(2) - metal::int2(1); metal::uint3 sub4_ = metal::uint3(2u) - metal::uint3(1u); metal::float4 sub5_ = metal::float4(2.0) - metal::float4(1.0); + int mul0_ = 2 * 1; + uint mul1_ = 2u * 1u; + float mul2_ = 2.0 * 1.0; metal::int2 mul3_ = metal::int2(2) * metal::int2(1); metal::uint3 mul4_ = metal::uint3(2u) * metal::uint3(1u); metal::float4 mul5_ = metal::float4(2.0) * metal::float4(1.0); + int div0_ = 2 / 1; + uint div1_ = 2u / 1u; + float div2_ = 2.0 / 1.0; metal::int2 div3_ = metal::int2(2) / metal::int2(1); metal::uint3 div4_ = metal::uint3(2u) / metal::uint3(1u); metal::float4 div5_ = metal::float4(2.0) / metal::float4(1.0); + int rem0_ = 2 % 1; + uint rem1_ = 2u % 1u; + float rem2_ = metal::fmod(2.0, 1.0); metal::int2 rem3_ = metal::int2(2) % metal::int2(1); metal::uint3 rem4_ = metal::uint3(2u) % metal::uint3(1u); metal::float4 rem5_ = metal::fmod(metal::float4(2.0), metal::float4(1.0)); { - metal::int2 add0_ = metal::int2(2) + metal::int2(1); - metal::int2 add1_ = metal::int2(2) + metal::int2(1); - metal::uint2 add2_ = metal::uint2(2u) + metal::uint2(1u); + metal::int2 add0_1 = metal::int2(2) + metal::int2(1); + metal::int2 add1_1 = metal::int2(2) + metal::int2(1); + metal::uint2 add2_1 = metal::uint2(2u) + metal::uint2(1u); metal::uint2 add3_1 = metal::uint2(2u) + metal::uint2(1u); metal::float2 add4_1 = metal::float2(2.0) + metal::float2(1.0); metal::float2 add5_1 = metal::float2(2.0) + metal::float2(1.0); - metal::int2 sub0_ = metal::int2(2) - metal::int2(1); - metal::int2 sub1_ = metal::int2(2) - metal::int2(1); - metal::uint2 sub2_ = metal::uint2(2u) - metal::uint2(1u); + metal::int2 sub0_1 = metal::int2(2) - metal::int2(1); + metal::int2 sub1_1 = metal::int2(2) - metal::int2(1); + metal::uint2 sub2_1 = metal::uint2(2u) - metal::uint2(1u); metal::uint2 sub3_1 = metal::uint2(2u) - metal::uint2(1u); metal::float2 sub4_1 = metal::float2(2.0) - metal::float2(1.0); metal::float2 sub5_1 = metal::float2(2.0) - metal::float2(1.0); - metal::int2 mul0_ = metal::int2(2, 2); - metal::int2 mul1_ = metal::int2(2, 2); - metal::uint2 mul2_ = metal::uint2(2u, 2u); - metal::uint2 mul3_1 = metal::uint2(2u, 2u); - metal::float2 mul4_1 = metal::float2(2.0, 2.0); - metal::float2 mul5_1 = metal::float2(2.0, 2.0); - metal::int2 div0_ = metal::int2(2) / metal::int2(1); - metal::int2 div1_ = metal::int2(2) / metal::int2(1); - metal::uint2 div2_ = metal::uint2(2u) / metal::uint2(1u); + metal::int2 mul0_1 = metal::int2(2) * 1; + metal::int2 mul1_1 = 2 * metal::int2(1); + metal::uint2 mul2_1 = metal::uint2(2u) * 1u; + metal::uint2 mul3_1 = 2u * metal::uint2(1u); + metal::float2 mul4_1 = metal::float2(2.0) * 1.0; + metal::float2 mul5_1 = 2.0 * metal::float2(1.0); + metal::int2 div0_1 = metal::int2(2) / metal::int2(1); + metal::int2 div1_1 = metal::int2(2) / metal::int2(1); + metal::uint2 div2_1 = metal::uint2(2u) / metal::uint2(1u); metal::uint2 div3_1 = metal::uint2(2u) / metal::uint2(1u); metal::float2 div4_1 = metal::float2(2.0) / metal::float2(1.0); metal::float2 div5_1 = metal::float2(2.0) / metal::float2(1.0); - metal::int2 rem0_ = metal::int2(2) % metal::int2(1); - metal::int2 rem1_ = metal::int2(2) % metal::int2(1); - metal::uint2 rem2_ = metal::uint2(2u) % metal::uint2(1u); + metal::int2 rem0_1 = metal::int2(2) % metal::int2(1); + metal::int2 rem1_1 = metal::int2(2) % metal::int2(1); + metal::uint2 rem2_1 = metal::uint2(2u) % metal::uint2(1u); metal::uint2 rem3_1 = metal::uint2(2u) % metal::uint2(1u); metal::float2 rem4_1 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); metal::float2 rem5_1 = metal::fmod(metal::float2(2.0), metal::float2(1.0)); } metal::float3x3 add = metal::float3x3 {} + metal::float3x3 {}; metal::float3x3 sub = metal::float3x3 {} - metal::float3x3 {}; - metal::float3x3 mul_scalar0_ = metal::float3x3(metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0)); - metal::float3x3 mul_scalar1_ = metal::float3x3(metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0)); + metal::float3x3 mul_scalar0_ = metal::float3x3 {} * 1.0; + metal::float3x3 mul_scalar1_ = 2.0 * metal::float3x3 {}; metal::float3 mul_vector0_ = metal::float4x3 {} * metal::float4(1.0); metal::float4 mul_vector1_ = metal::float3(2.0) * metal::float4x3 {}; metal::float3x3 mul = metal::float4x3 {} * metal::float3x4 {}; @@ -120,37 +139,67 @@ void arithmetic( void bit( ) { - metal::int2 flip2_ = metal::int2(-2, -2); - metal::uint3 flip3_ = metal::uint3(4294967294u, 4294967294u, 4294967294u); + int flip0_ = ~(1); + uint flip1_ = ~(1u); + metal::int2 flip2_ = ~(metal::int2(1)); + metal::uint3 flip3_ = ~(metal::uint3(1u)); + int or0_ = 2 | 1; + uint or1_ = 2u | 1u; metal::int2 or2_ = metal::int2(2) | metal::int2(1); metal::uint3 or3_ = metal::uint3(2u) | metal::uint3(1u); + int and0_ = 2 & 1; + uint and1_ = 2u & 1u; metal::int2 and2_ = metal::int2(2) & metal::int2(1); metal::uint3 and3_ = metal::uint3(2u) & metal::uint3(1u); + int xor0_ = 2 ^ 1; + uint xor1_ = 2u ^ 1u; metal::int2 xor2_ = metal::int2(2) ^ metal::int2(1); metal::uint3 xor3_ = metal::uint3(2u) ^ metal::uint3(1u); + int shl0_ = 2 << 1u; + uint shl1_ = 2u << 1u; metal::int2 shl2_ = metal::int2(2) << metal::uint2(1u); metal::uint3 shl3_ = metal::uint3(2u) << metal::uint3(1u); + int shr0_ = 2 >> 1u; + uint shr1_ = 2u >> 1u; metal::int2 shr2_ = metal::int2(2) >> metal::uint2(1u); metal::uint3 shr3_ = metal::uint3(2u) >> metal::uint3(1u); } void comparison( ) { + bool eq0_ = 2 == 1; + bool eq1_ = 2u == 1u; + bool eq2_ = 2.0 == 1.0; metal::bool2 eq3_ = metal::int2(2) == metal::int2(1); metal::bool3 eq4_ = metal::uint3(2u) == metal::uint3(1u); metal::bool4 eq5_ = metal::float4(2.0) == metal::float4(1.0); + bool neq0_ = 2 != 1; + bool neq1_ = 2u != 1u; + bool neq2_ = 2.0 != 1.0; metal::bool2 neq3_ = metal::int2(2) != metal::int2(1); metal::bool3 neq4_ = metal::uint3(2u) != metal::uint3(1u); metal::bool4 neq5_ = metal::float4(2.0) != metal::float4(1.0); + bool lt0_ = 2 < 1; + bool lt1_ = 2u < 1u; + bool lt2_ = 2.0 < 1.0; metal::bool2 lt3_ = metal::int2(2) < metal::int2(1); metal::bool3 lt4_ = metal::uint3(2u) < metal::uint3(1u); metal::bool4 lt5_ = metal::float4(2.0) < metal::float4(1.0); + bool lte0_ = 2 <= 1; + bool lte1_ = 2u <= 1u; + bool lte2_ = 2.0 <= 1.0; metal::bool2 lte3_ = metal::int2(2) <= metal::int2(1); metal::bool3 lte4_ = metal::uint3(2u) <= metal::uint3(1u); metal::bool4 lte5_ = metal::float4(2.0) <= metal::float4(1.0); + bool gt0_ = 2 > 1; + bool gt1_ = 2u > 1u; + bool gt2_ = 2.0 > 1.0; metal::bool2 gt3_ = metal::int2(2) > metal::int2(1); metal::bool3 gt4_ = metal::uint3(2u) > metal::uint3(1u); metal::bool4 gt5_ = metal::float4(2.0) > metal::float4(1.0); + bool gte0_ = 2 >= 1; + bool gte1_ = 2u >= 1u; + bool gte2_ = 2.0 >= 1.0; metal::bool2 gte3_ = metal::int2(2) >= metal::int2(1); metal::bool3 gte4_ = metal::uint3(2u) >= metal::uint3(1u); metal::bool4 gte5_ = metal::float4(2.0) >= metal::float4(1.0); @@ -158,44 +207,52 @@ void comparison( void assignment( ) { - int a_1 = 1; + int a_1 = {}; metal::int3 vec0_ = metal::int3 {}; - int _e3 = a_1; - a_1 = _e3 + 1; - int _e6 = a_1; - a_1 = _e6 - 1; - int _e8 = a_1; + a_1 = 1; + int _e5 = a_1; + a_1 = _e5 + 1; + int _e7 = a_1; + a_1 = _e7 - 1; int _e9 = a_1; - a_1 = _e9 * _e8; - int _e11 = a_1; + int _e10 = a_1; + a_1 = _e10 * _e9; int _e12 = a_1; - a_1 = _e12 / _e11; + int _e13 = a_1; + a_1 = _e13 / _e12; int _e15 = a_1; a_1 = _e15 % 1; - int _e18 = a_1; - a_1 = _e18 & 0; + int _e17 = a_1; + a_1 = _e17 & 0; + int _e19 = a_1; + a_1 = _e19 | 0; int _e21 = a_1; - a_1 = _e21 | 0; - int _e24 = a_1; - a_1 = _e24 ^ 0; - int _e27 = a_1; - a_1 = _e27 << 2u; - int _e30 = a_1; - a_1 = _e30 >> 1u; - int _e33 = a_1; - a_1 = _e33 + 1; - int _e36 = a_1; - a_1 = _e36 - 1; - int _e42 = vec0_.y; - vec0_.y = _e42 + 1; - int _e46 = vec0_.y; - vec0_.y = _e46 - 1; + a_1 = _e21 ^ 0; + int _e23 = a_1; + a_1 = _e23 << 2u; + int _e25 = a_1; + a_1 = _e25 >> 1u; + int _e28 = a_1; + a_1 = _e28 + 1; + int _e31 = a_1; + a_1 = _e31 - 1; + int _e37 = vec0_[1]; + vec0_[1] = _e37 + 1; + int _e41 = vec0_[1]; + vec0_[1] = _e41 - 1; return; } void negation_avoids_prefix_decrement( ) { - return; + int p0_ = -(1); + int p1_ = -(-(1)); + int p2_ = -(-(1)); + int p3_ = -(-(1)); + int p4_ = -(-(-(1))); + int p5_ = -(-(-(-(1)))); + int p6_ = -(-(-(-(-(1))))); + int p7_ = -(-(-(-(-(1))))); } kernel void main_( diff --git a/tests/out/spv/operators.spvasm b/tests/out/spv/operators.spvasm index 538c080e36..89bc4ccf28 100644 --- a/tests/out/spv/operators.spvasm +++ b/tests/out/spv/operators.spvasm @@ -1,12 +1,12 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 308 +; Bound: 377 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %297 "main" -OpExecutionMode %297 LocalSize 1 1 1 +OpEntryPoint GLCompute %366 "main" +OpExecutionMode %366 LocalSize 1 1 1 %2 = OpTypeVoid %4 = OpTypeFloat 32 %3 = OpTypeVector %4 4 @@ -16,352 +16,422 @@ OpExecutionMode %297 LocalSize 1 1 1 %7 = OpTypeVector %8 4 %9 = OpTypeVector %4 2 %10 = OpTypeVector %4 3 -%11 = OpTypeVector %8 2 -%12 = OpTypeVector %6 2 -%14 = OpTypeInt 32 0 -%13 = OpTypeVector %14 3 -%15 = OpTypeVector %14 2 -%16 = OpTypeMatrix %10 3 -%17 = OpTypeMatrix %10 4 -%18 = OpTypeMatrix %3 3 -%19 = OpTypeVector %6 3 -%20 = OpConstant %4 1.0 -%21 = OpConstantComposite %3 %20 %20 %20 %20 -%22 = OpConstant %4 0.0 -%23 = OpConstantComposite %3 %22 %22 %22 %22 -%24 = OpConstant %4 0.5 -%25 = OpConstantComposite %3 %24 %24 %24 %24 -%26 = OpConstant %6 1 -%27 = OpConstantComposite %5 %26 %26 %26 %26 -%30 = OpTypeFunction %3 -%31 = OpConstantTrue %8 -%32 = OpConstant %6 0 -%33 = OpConstantFalse %8 -%34 = OpConstantComposite %7 %33 %33 %33 %33 -%35 = OpConstant %4 0.1 -%36 = OpConstantComposite %5 %32 %32 %32 %32 -%58 = OpConstant %4 2.0 +%11 = OpTypeMatrix %10 3 +%12 = OpTypeMatrix %10 4 +%13 = OpTypeMatrix %3 3 +%14 = OpTypeVector %6 3 +%15 = OpConstant %4 1.0 +%16 = OpConstantComposite %3 %15 %15 %15 %15 +%17 = OpConstant %4 0.0 +%18 = OpConstantComposite %3 %17 %17 %17 %17 +%19 = OpConstant %4 0.5 +%20 = OpConstantComposite %3 %19 %19 %19 %19 +%21 = OpConstant %6 1 +%22 = OpConstantComposite %5 %21 %21 %21 %21 +%25 = OpTypeFunction %3 +%26 = OpConstantTrue %8 +%27 = OpConstant %6 0 +%28 = OpConstantFalse %8 +%29 = OpConstantComposite %7 %28 %28 %28 %28 +%30 = OpConstant %4 0.1 +%31 = OpConstantComposite %5 %27 %27 %27 %27 +%53 = OpConstant %4 2.0 +%54 = OpConstantComposite %9 %53 %53 +%55 = OpConstantComposite %9 %15 %15 +%56 = OpConstant %4 3.0 +%57 = OpConstantComposite %9 %56 %56 +%58 = OpConstant %4 4.0 %59 = OpConstantComposite %9 %58 %58 -%60 = OpConstantComposite %9 %20 %20 -%61 = OpConstant %4 3.0 -%62 = OpConstantComposite %9 %61 %61 -%63 = OpConstant %4 4.0 -%64 = OpConstantComposite %9 %63 %63 -%65 = OpConstant %6 5 -%66 = OpConstantComposite %5 %65 %65 %65 %65 -%67 = OpConstant %6 2 -%68 = OpConstantComposite %5 %67 %67 %67 %67 -%79 = OpTypeFunction %9 -%81 = OpTypePointer Function %9 -%93 = OpTypeFunction %10 %10 -%95 = OpTypeVector %8 3 -%96 = OpConstantComposite %10 %22 %22 %22 -%98 = OpConstantComposite %10 %20 %20 %20 -%102 = OpTypeFunction %2 -%103 = OpConstantComposite %11 %33 %33 -%104 = OpConstantComposite %95 %31 %31 %31 -%105 = OpConstantComposite %95 %33 %33 %33 -%106 = OpConstantComposite %7 %31 %31 %31 %31 -%107 = OpConstantComposite %7 %33 %33 %33 %33 -%115 = OpConstant %4 -1.0 -%116 = OpConstant %6 -1 -%117 = OpConstantComposite %12 %116 %116 -%118 = OpConstantComposite %9 %115 %115 -%119 = OpConstant %6 3 -%120 = OpConstant %14 3 -%121 = OpConstantComposite %12 %67 %67 -%122 = OpConstantComposite %12 %26 %26 -%123 = OpConstant %14 2 -%124 = OpConstantComposite %13 %123 %123 %123 -%125 = OpConstant %14 1 -%126 = OpConstantComposite %13 %125 %125 %125 -%127 = OpConstantComposite %3 %58 %58 %58 %58 -%128 = OpConstantComposite %3 %20 %20 %20 %20 -%129 = OpConstant %14 0 -%130 = OpConstantComposite %15 %123 %123 -%131 = OpConstantComposite %15 %125 %125 -%132 = OpConstantComposite %12 %67 %67 -%133 = OpConstantComposite %15 %123 %123 -%134 = OpConstantComposite %9 %58 %58 -%135 = OpConstantNull %16 -%136 = OpConstantComposite %10 %22 %22 %22 -%137 = OpConstantComposite %16 %136 %136 %136 -%138 = OpConstantNull %17 -%139 = OpConstantComposite %10 %58 %58 %58 -%140 = OpConstantNull %18 -%208 = OpConstant %6 -2 -%209 = OpConstant %14 4294967294 -%210 = OpConstantComposite %12 %208 %208 -%211 = OpConstantComposite %13 %209 %209 %209 -%212 = OpConstant %6 4 -%213 = OpConstant %14 4 -%248 = OpConstantNull %19 -%250 = OpTypePointer Function %6 -%252 = OpTypePointer Function %19 -%280 = OpTypePointer Function %6 -%291 = OpConstant %6 -5 -%292 = OpConstant %6 6 -%293 = OpConstant %6 -7 -%294 = OpConstant %6 -8 -%298 = OpConstantComposite %10 %20 %20 %20 -%29 = OpFunction %3 None %30 -%28 = OpLabel -OpBranch %37 -%37 = OpLabel -%38 = OpSelect %6 %31 %26 %32 -%40 = OpCompositeConstruct %7 %31 %31 %31 %31 -%39 = OpSelect %3 %40 %21 %23 -%41 = OpSelect %3 %34 %23 %21 -%42 = OpExtInst %3 %1 FMix %23 %21 %25 -%44 = OpCompositeConstruct %3 %35 %35 %35 %35 -%43 = OpExtInst %3 %1 FMix %23 %21 %44 -%45 = OpBitcast %4 %26 -%46 = OpBitcast %3 %27 -%47 = OpCompositeConstruct %5 %38 %38 %38 %38 -%48 = OpIAdd %5 %47 %36 -%49 = OpConvertSToF %3 %48 -%50 = OpFAdd %3 %49 %39 -%51 = OpFAdd %3 %50 %42 -%52 = OpFAdd %3 %51 %43 -%53 = OpCompositeConstruct %3 %45 %45 %45 %45 -%54 = OpFAdd %3 %52 %53 -%55 = OpFAdd %3 %54 %46 -OpReturnValue %55 +%60 = OpConstant %6 5 +%61 = OpConstantComposite %5 %60 %60 %60 %60 +%62 = OpConstant %6 2 +%63 = OpConstantComposite %5 %62 %62 %62 %62 +%74 = OpTypeFunction %9 +%76 = OpTypePointer Function %9 +%88 = OpTypeFunction %10 %10 +%90 = OpTypeVector %8 3 +%91 = OpConstantComposite %10 %17 %17 %17 +%93 = OpConstantComposite %10 %15 %15 %15 +%97 = OpTypeFunction %2 +%98 = OpTypeVector %8 2 +%99 = OpConstantComposite %98 %26 %26 +%100 = OpConstantComposite %90 %26 %26 %26 +%101 = OpConstantComposite %90 %28 %28 %28 +%102 = OpConstantComposite %7 %26 %26 %26 %26 +%103 = OpConstantComposite %7 %28 %28 %28 %28 +%115 = OpTypeInt 32 0 +%116 = OpConstant %115 1 +%117 = OpConstant %115 2 +%118 = OpTypeVector %6 2 +%119 = OpConstantComposite %118 %21 %21 +%120 = OpConstantComposite %118 %62 %62 +%121 = OpTypeVector %115 3 +%122 = OpConstantComposite %121 %117 %117 %117 +%123 = OpConstantComposite %121 %116 %116 %116 +%124 = OpConstantComposite %3 %53 %53 %53 %53 +%125 = OpConstantComposite %3 %15 %15 %15 %15 +%126 = OpTypeVector %115 2 +%127 = OpConstantComposite %126 %117 %117 +%128 = OpConstantComposite %126 %116 %116 +%129 = OpConstantNull %11 +%130 = OpConstantNull %12 +%131 = OpConstantComposite %10 %53 %53 %53 +%132 = OpConstantNull %13 +%296 = OpConstantNull %14 +%298 = OpTypePointer Function %6 +%299 = OpConstantNull %6 +%301 = OpTypePointer Function %14 +%329 = OpTypePointer Function %6 +%367 = OpConstantComposite %10 %15 %15 %15 +%24 = OpFunction %3 None %25 +%23 = OpLabel +OpBranch %32 +%32 = OpLabel +%33 = OpSelect %6 %26 %21 %27 +%35 = OpCompositeConstruct %7 %26 %26 %26 %26 +%34 = OpSelect %3 %35 %16 %18 +%36 = OpSelect %3 %29 %18 %16 +%37 = OpExtInst %3 %1 FMix %18 %16 %20 +%39 = OpCompositeConstruct %3 %30 %30 %30 %30 +%38 = OpExtInst %3 %1 FMix %18 %16 %39 +%40 = OpBitcast %4 %21 +%41 = OpBitcast %3 %22 +%42 = OpCompositeConstruct %5 %33 %33 %33 %33 +%43 = OpIAdd %5 %42 %31 +%44 = OpConvertSToF %3 %43 +%45 = OpFAdd %3 %44 %34 +%46 = OpFAdd %3 %45 %37 +%47 = OpFAdd %3 %46 %38 +%48 = OpCompositeConstruct %3 %40 %40 %40 %40 +%49 = OpFAdd %3 %47 %48 +%50 = OpFAdd %3 %49 %41 +OpReturnValue %50 OpFunctionEnd -%57 = OpFunction %3 None %30 -%56 = OpLabel -OpBranch %69 -%69 = OpLabel -%70 = OpFAdd %9 %60 %59 -%71 = OpFSub %9 %70 %62 -%72 = OpFDiv %9 %71 %64 -%73 = OpSRem %5 %66 %68 -%74 = OpVectorShuffle %3 %72 %72 0 1 0 1 -%75 = OpConvertSToF %3 %73 -%76 = OpFAdd %3 %74 %75 -OpReturnValue %76 +%52 = OpFunction %3 None %25 +%51 = OpLabel +OpBranch %64 +%64 = OpLabel +%65 = OpFAdd %9 %55 %54 +%66 = OpFSub %9 %65 %57 +%67 = OpFDiv %9 %66 %59 +%68 = OpSRem %5 %61 %63 +%69 = OpVectorShuffle %3 %67 %67 0 1 0 1 +%70 = OpConvertSToF %3 %68 +%71 = OpFAdd %3 %69 %70 +OpReturnValue %71 OpFunctionEnd -%78 = OpFunction %9 None %79 +%73 = OpFunction %9 None %74 +%72 = OpLabel +%75 = OpVariable %76 Function %54 +OpBranch %77 %77 = OpLabel -%80 = OpVariable %81 Function %59 -OpBranch %82 -%82 = OpLabel -%83 = OpLoad %9 %80 -%84 = OpFAdd %9 %83 %60 -OpStore %80 %84 -%85 = OpLoad %9 %80 -%86 = OpFSub %9 %85 %62 -OpStore %80 %86 -%87 = OpLoad %9 %80 -%88 = OpFDiv %9 %87 %64 -OpStore %80 %88 -%89 = OpLoad %9 %80 -OpReturnValue %89 +%78 = OpLoad %9 %75 +%79 = OpFAdd %9 %78 %55 +OpStore %75 %79 +%80 = OpLoad %9 %75 +%81 = OpFSub %9 %80 %57 +OpStore %75 %81 +%82 = OpLoad %9 %75 +%83 = OpFDiv %9 %82 %59 +OpStore %75 %83 +%84 = OpLoad %9 %75 +OpReturnValue %84 OpFunctionEnd -%92 = OpFunction %10 None %93 -%91 = OpFunctionParameter %10 -%90 = OpLabel -OpBranch %94 -%94 = OpLabel -%97 = OpFUnordNotEqual %95 %91 %96 -%99 = OpSelect %10 %97 %98 %96 -OpReturnValue %99 +%87 = OpFunction %10 None %88 +%86 = OpFunctionParameter %10 +%85 = OpLabel +OpBranch %89 +%89 = OpLabel +%92 = OpFUnordNotEqual %90 %86 %91 +%94 = OpSelect %10 %92 %93 %91 +OpReturnValue %94 OpFunctionEnd -%101 = OpFunction %2 None %102 -%100 = OpLabel -OpBranch %108 -%108 = OpLabel -%109 = OpLogicalOr %8 %31 %33 -%110 = OpLogicalOr %95 %104 %105 -%111 = OpLogicalAnd %8 %31 %33 -%112 = OpLogicalAnd %7 %106 %107 +%96 = OpFunction %2 None %97 +%95 = OpLabel +OpBranch %104 +%104 = OpLabel +%105 = OpLogicalNot %8 %26 +%106 = OpLogicalNot %98 %99 +%107 = OpLogicalOr %8 %26 %28 +%108 = OpLogicalAnd %8 %26 %28 +%109 = OpLogicalOr %8 %26 %28 +%110 = OpLogicalOr %90 %100 %101 +%111 = OpLogicalAnd %8 %26 %28 +%112 = OpLogicalAnd %7 %102 %103 OpReturn OpFunctionEnd -%114 = OpFunction %2 None %102 +%114 = OpFunction %2 None %97 %113 = OpLabel -OpBranch %141 -%141 = OpLabel -%142 = OpIAdd %12 %121 %122 -%143 = OpIAdd %13 %124 %126 -%144 = OpFAdd %3 %127 %128 -%145 = OpISub %12 %121 %122 -%146 = OpISub %13 %124 %126 -%147 = OpFSub %3 %127 %128 -%148 = OpIMul %12 %121 %122 -%149 = OpIMul %13 %124 %126 -%150 = OpFMul %3 %127 %128 -%151 = OpSDiv %12 %121 %122 -%152 = OpUDiv %13 %124 %126 -%153 = OpFDiv %3 %127 %128 -%154 = OpSRem %12 %121 %122 -%155 = OpUMod %13 %124 %126 -%156 = OpFRem %3 %127 %128 -OpBranch %157 -%157 = OpLabel -%159 = OpIAdd %12 %121 %122 -%160 = OpIAdd %12 %121 %122 -%161 = OpIAdd %15 %130 %131 -%162 = OpIAdd %15 %130 %131 -%163 = OpFAdd %9 %59 %60 -%164 = OpFAdd %9 %59 %60 -%165 = OpISub %12 %121 %122 -%166 = OpISub %12 %121 %122 -%167 = OpISub %15 %130 %131 -%168 = OpISub %15 %130 %131 -%169 = OpFSub %9 %59 %60 -%170 = OpFSub %9 %59 %60 -%171 = OpSDiv %12 %121 %122 -%172 = OpSDiv %12 %121 %122 -%173 = OpUDiv %15 %130 %131 -%174 = OpUDiv %15 %130 %131 -%175 = OpFDiv %9 %59 %60 -%176 = OpFDiv %9 %59 %60 -%177 = OpSRem %12 %121 %122 -%178 = OpSRem %12 %121 %122 -%179 = OpUMod %15 %130 %131 -%180 = OpUMod %15 %130 %131 -%181 = OpFRem %9 %59 %60 -%182 = OpFRem %9 %59 %60 -OpBranch %158 -%158 = OpLabel -%184 = OpCompositeExtract %10 %135 0 -%185 = OpCompositeExtract %10 %135 0 -%186 = OpFAdd %10 %184 %185 -%187 = OpCompositeExtract %10 %135 1 -%188 = OpCompositeExtract %10 %135 1 -%189 = OpFAdd %10 %187 %188 -%190 = OpCompositeExtract %10 %135 2 -%191 = OpCompositeExtract %10 %135 2 -%192 = OpFAdd %10 %190 %191 -%183 = OpCompositeConstruct %16 %186 %189 %192 -%194 = OpCompositeExtract %10 %135 0 -%195 = OpCompositeExtract %10 %135 0 -%196 = OpFSub %10 %194 %195 -%197 = OpCompositeExtract %10 %135 1 -%198 = OpCompositeExtract %10 %135 1 -%199 = OpFSub %10 %197 %198 -%200 = OpCompositeExtract %10 %135 2 -%201 = OpCompositeExtract %10 %135 2 -%202 = OpFSub %10 %200 %201 -%193 = OpCompositeConstruct %16 %196 %199 %202 -%203 = OpMatrixTimesVector %10 %138 %128 -%204 = OpVectorTimesMatrix %3 %139 %138 -%205 = OpMatrixTimesMatrix %16 %138 %140 +OpBranch %133 +%133 = OpLabel +%134 = OpFNegate %4 %15 +%135 = OpSNegate %118 %119 +%136 = OpFNegate %9 %55 +%137 = OpIAdd %6 %62 %21 +%138 = OpIAdd %115 %117 %116 +%139 = OpFAdd %4 %53 %15 +%140 = OpIAdd %118 %120 %119 +%141 = OpIAdd %121 %122 %123 +%142 = OpFAdd %3 %124 %125 +%143 = OpISub %6 %62 %21 +%144 = OpISub %115 %117 %116 +%145 = OpFSub %4 %53 %15 +%146 = OpISub %118 %120 %119 +%147 = OpISub %121 %122 %123 +%148 = OpFSub %3 %124 %125 +%149 = OpIMul %6 %62 %21 +%150 = OpIMul %115 %117 %116 +%151 = OpFMul %4 %53 %15 +%152 = OpIMul %118 %120 %119 +%153 = OpIMul %121 %122 %123 +%154 = OpFMul %3 %124 %125 +%155 = OpSDiv %6 %62 %21 +%156 = OpUDiv %115 %117 %116 +%157 = OpFDiv %4 %53 %15 +%158 = OpSDiv %118 %120 %119 +%159 = OpUDiv %121 %122 %123 +%160 = OpFDiv %3 %124 %125 +%161 = OpSRem %6 %62 %21 +%162 = OpUMod %115 %117 %116 +%163 = OpFRem %4 %53 %15 +%164 = OpSRem %118 %120 %119 +%165 = OpUMod %121 %122 %123 +%166 = OpFRem %3 %124 %125 +OpBranch %167 +%167 = OpLabel +%169 = OpIAdd %118 %120 %119 +%170 = OpIAdd %118 %120 %119 +%171 = OpIAdd %126 %127 %128 +%172 = OpIAdd %126 %127 %128 +%173 = OpFAdd %9 %54 %55 +%174 = OpFAdd %9 %54 %55 +%175 = OpISub %118 %120 %119 +%176 = OpISub %118 %120 %119 +%177 = OpISub %126 %127 %128 +%178 = OpISub %126 %127 %128 +%179 = OpFSub %9 %54 %55 +%180 = OpFSub %9 %54 %55 +%182 = OpCompositeConstruct %118 %21 %21 +%181 = OpIMul %118 %120 %182 +%184 = OpCompositeConstruct %118 %62 %62 +%183 = OpIMul %118 %119 %184 +%186 = OpCompositeConstruct %126 %116 %116 +%185 = OpIMul %126 %127 %186 +%188 = OpCompositeConstruct %126 %117 %117 +%187 = OpIMul %126 %128 %188 +%189 = OpVectorTimesScalar %9 %54 %15 +%190 = OpVectorTimesScalar %9 %55 %53 +%191 = OpSDiv %118 %120 %119 +%192 = OpSDiv %118 %120 %119 +%193 = OpUDiv %126 %127 %128 +%194 = OpUDiv %126 %127 %128 +%195 = OpFDiv %9 %54 %55 +%196 = OpFDiv %9 %54 %55 +%197 = OpSRem %118 %120 %119 +%198 = OpSRem %118 %120 %119 +%199 = OpUMod %126 %127 %128 +%200 = OpUMod %126 %127 %128 +%201 = OpFRem %9 %54 %55 +%202 = OpFRem %9 %54 %55 +OpBranch %168 +%168 = OpLabel +%204 = OpCompositeExtract %10 %129 0 +%205 = OpCompositeExtract %10 %129 0 +%206 = OpFAdd %10 %204 %205 +%207 = OpCompositeExtract %10 %129 1 +%208 = OpCompositeExtract %10 %129 1 +%209 = OpFAdd %10 %207 %208 +%210 = OpCompositeExtract %10 %129 2 +%211 = OpCompositeExtract %10 %129 2 +%212 = OpFAdd %10 %210 %211 +%203 = OpCompositeConstruct %11 %206 %209 %212 +%214 = OpCompositeExtract %10 %129 0 +%215 = OpCompositeExtract %10 %129 0 +%216 = OpFSub %10 %214 %215 +%217 = OpCompositeExtract %10 %129 1 +%218 = OpCompositeExtract %10 %129 1 +%219 = OpFSub %10 %217 %218 +%220 = OpCompositeExtract %10 %129 2 +%221 = OpCompositeExtract %10 %129 2 +%222 = OpFSub %10 %220 %221 +%213 = OpCompositeConstruct %11 %216 %219 %222 +%223 = OpMatrixTimesScalar %11 %129 %15 +%224 = OpMatrixTimesScalar %11 %129 %53 +%225 = OpMatrixTimesVector %10 %130 %125 +%226 = OpVectorTimesMatrix %3 %131 %130 +%227 = OpMatrixTimesMatrix %11 %130 %132 OpReturn OpFunctionEnd -%207 = OpFunction %2 None %102 -%206 = OpLabel -OpBranch %214 -%214 = OpLabel -%215 = OpBitwiseOr %12 %121 %122 -%216 = OpBitwiseOr %13 %124 %126 -%217 = OpBitwiseAnd %12 %121 %122 -%218 = OpBitwiseAnd %13 %124 %126 -%219 = OpBitwiseXor %12 %121 %122 -%220 = OpBitwiseXor %13 %124 %126 -%221 = OpShiftLeftLogical %12 %121 %131 -%222 = OpShiftLeftLogical %13 %124 %126 -%223 = OpShiftRightArithmetic %12 %121 %131 -%224 = OpShiftRightLogical %13 %124 %126 +%229 = OpFunction %2 None %97 +%228 = OpLabel +OpBranch %230 +%230 = OpLabel +%231 = OpNot %6 %21 +%232 = OpNot %115 %116 +%233 = OpNot %118 %119 +%234 = OpNot %121 %123 +%235 = OpBitwiseOr %6 %62 %21 +%236 = OpBitwiseOr %115 %117 %116 +%237 = OpBitwiseOr %118 %120 %119 +%238 = OpBitwiseOr %121 %122 %123 +%239 = OpBitwiseAnd %6 %62 %21 +%240 = OpBitwiseAnd %115 %117 %116 +%241 = OpBitwiseAnd %118 %120 %119 +%242 = OpBitwiseAnd %121 %122 %123 +%243 = OpBitwiseXor %6 %62 %21 +%244 = OpBitwiseXor %115 %117 %116 +%245 = OpBitwiseXor %118 %120 %119 +%246 = OpBitwiseXor %121 %122 %123 +%247 = OpShiftLeftLogical %6 %62 %116 +%248 = OpShiftLeftLogical %115 %117 %116 +%249 = OpShiftLeftLogical %118 %120 %128 +%250 = OpShiftLeftLogical %121 %122 %123 +%251 = OpShiftRightArithmetic %6 %62 %116 +%252 = OpShiftRightLogical %115 %117 %116 +%253 = OpShiftRightArithmetic %118 %120 %128 +%254 = OpShiftRightLogical %121 %122 %123 OpReturn OpFunctionEnd -%226 = OpFunction %2 None %102 -%225 = OpLabel -OpBranch %227 -%227 = OpLabel -%228 = OpIEqual %11 %121 %122 -%229 = OpIEqual %95 %124 %126 -%230 = OpFOrdEqual %7 %127 %128 -%231 = OpINotEqual %11 %121 %122 -%232 = OpINotEqual %95 %124 %126 -%233 = OpFOrdNotEqual %7 %127 %128 -%234 = OpSLessThan %11 %121 %122 -%235 = OpULessThan %95 %124 %126 -%236 = OpFOrdLessThan %7 %127 %128 -%237 = OpSLessThanEqual %11 %121 %122 -%238 = OpULessThanEqual %95 %124 %126 -%239 = OpFOrdLessThanEqual %7 %127 %128 -%240 = OpSGreaterThan %11 %121 %122 -%241 = OpUGreaterThan %95 %124 %126 -%242 = OpFOrdGreaterThan %7 %127 %128 -%243 = OpSGreaterThanEqual %11 %121 %122 -%244 = OpUGreaterThanEqual %95 %124 %126 -%245 = OpFOrdGreaterThanEqual %7 %127 %128 +%256 = OpFunction %2 None %97 +%255 = OpLabel +OpBranch %257 +%257 = OpLabel +%258 = OpIEqual %8 %62 %21 +%259 = OpIEqual %8 %117 %116 +%260 = OpFOrdEqual %8 %53 %15 +%261 = OpIEqual %98 %120 %119 +%262 = OpIEqual %90 %122 %123 +%263 = OpFOrdEqual %7 %124 %125 +%264 = OpINotEqual %8 %62 %21 +%265 = OpINotEqual %8 %117 %116 +%266 = OpFOrdNotEqual %8 %53 %15 +%267 = OpINotEqual %98 %120 %119 +%268 = OpINotEqual %90 %122 %123 +%269 = OpFOrdNotEqual %7 %124 %125 +%270 = OpSLessThan %8 %62 %21 +%271 = OpULessThan %8 %117 %116 +%272 = OpFOrdLessThan %8 %53 %15 +%273 = OpSLessThan %98 %120 %119 +%274 = OpULessThan %90 %122 %123 +%275 = OpFOrdLessThan %7 %124 %125 +%276 = OpSLessThanEqual %8 %62 %21 +%277 = OpULessThanEqual %8 %117 %116 +%278 = OpFOrdLessThanEqual %8 %53 %15 +%279 = OpSLessThanEqual %98 %120 %119 +%280 = OpULessThanEqual %90 %122 %123 +%281 = OpFOrdLessThanEqual %7 %124 %125 +%282 = OpSGreaterThan %8 %62 %21 +%283 = OpUGreaterThan %8 %117 %116 +%284 = OpFOrdGreaterThan %8 %53 %15 +%285 = OpSGreaterThan %98 %120 %119 +%286 = OpUGreaterThan %90 %122 %123 +%287 = OpFOrdGreaterThan %7 %124 %125 +%288 = OpSGreaterThanEqual %8 %62 %21 +%289 = OpUGreaterThanEqual %8 %117 %116 +%290 = OpFOrdGreaterThanEqual %8 %53 %15 +%291 = OpSGreaterThanEqual %98 %120 %119 +%292 = OpUGreaterThanEqual %90 %122 %123 +%293 = OpFOrdGreaterThanEqual %7 %124 %125 OpReturn OpFunctionEnd -%247 = OpFunction %2 None %102 -%246 = OpLabel -%249 = OpVariable %250 Function %26 -%251 = OpVariable %252 Function %248 -OpBranch %253 -%253 = OpLabel -%254 = OpLoad %6 %249 -%255 = OpIAdd %6 %254 %26 -OpStore %249 %255 -%256 = OpLoad %6 %249 -%257 = OpISub %6 %256 %26 -OpStore %249 %257 -%258 = OpLoad %6 %249 -%259 = OpLoad %6 %249 -%260 = OpIMul %6 %259 %258 -OpStore %249 %260 -%261 = OpLoad %6 %249 -%262 = OpLoad %6 %249 -%263 = OpSDiv %6 %262 %261 -OpStore %249 %263 -%264 = OpLoad %6 %249 -%265 = OpSRem %6 %264 %26 -OpStore %249 %265 -%266 = OpLoad %6 %249 -%267 = OpBitwiseAnd %6 %266 %32 -OpStore %249 %267 -%268 = OpLoad %6 %249 -%269 = OpBitwiseOr %6 %268 %32 -OpStore %249 %269 -%270 = OpLoad %6 %249 -%271 = OpBitwiseXor %6 %270 %32 -OpStore %249 %271 -%272 = OpLoad %6 %249 -%273 = OpShiftLeftLogical %6 %272 %123 -OpStore %249 %273 -%274 = OpLoad %6 %249 -%275 = OpShiftRightArithmetic %6 %274 %125 -OpStore %249 %275 -%276 = OpLoad %6 %249 -%277 = OpIAdd %6 %276 %26 -OpStore %249 %277 -%278 = OpLoad %6 %249 -%279 = OpISub %6 %278 %26 -OpStore %249 %279 -%281 = OpAccessChain %280 %251 %125 -%282 = OpLoad %6 %281 -%283 = OpIAdd %6 %282 %26 -%284 = OpAccessChain %280 %251 %125 -OpStore %284 %283 -%285 = OpAccessChain %280 %251 %125 -%286 = OpLoad %6 %285 -%287 = OpISub %6 %286 %26 -%288 = OpAccessChain %280 %251 %125 -OpStore %288 %287 +%295 = OpFunction %2 None %97 +%294 = OpLabel +%297 = OpVariable %298 Function %299 +%300 = OpVariable %301 Function %296 +OpBranch %302 +%302 = OpLabel +OpStore %297 %21 +%303 = OpLoad %6 %297 +%304 = OpIAdd %6 %303 %21 +OpStore %297 %304 +%305 = OpLoad %6 %297 +%306 = OpISub %6 %305 %21 +OpStore %297 %306 +%307 = OpLoad %6 %297 +%308 = OpLoad %6 %297 +%309 = OpIMul %6 %308 %307 +OpStore %297 %309 +%310 = OpLoad %6 %297 +%311 = OpLoad %6 %297 +%312 = OpSDiv %6 %311 %310 +OpStore %297 %312 +%313 = OpLoad %6 %297 +%314 = OpSRem %6 %313 %21 +OpStore %297 %314 +%315 = OpLoad %6 %297 +%316 = OpBitwiseAnd %6 %315 %27 +OpStore %297 %316 +%317 = OpLoad %6 %297 +%318 = OpBitwiseOr %6 %317 %27 +OpStore %297 %318 +%319 = OpLoad %6 %297 +%320 = OpBitwiseXor %6 %319 %27 +OpStore %297 %320 +%321 = OpLoad %6 %297 +%322 = OpShiftLeftLogical %6 %321 %117 +OpStore %297 %322 +%323 = OpLoad %6 %297 +%324 = OpShiftRightArithmetic %6 %323 %116 +OpStore %297 %324 +%325 = OpLoad %6 %297 +%326 = OpIAdd %6 %325 %21 +OpStore %297 %326 +%327 = OpLoad %6 %297 +%328 = OpISub %6 %327 %21 +OpStore %297 %328 +%330 = OpAccessChain %329 %300 %21 +%331 = OpLoad %6 %330 +%332 = OpIAdd %6 %331 %21 +%333 = OpAccessChain %329 %300 %21 +OpStore %333 %332 +%334 = OpAccessChain %329 %300 %21 +%335 = OpLoad %6 %334 +%336 = OpISub %6 %335 %21 +%337 = OpAccessChain %329 %300 %21 +OpStore %337 %336 OpReturn OpFunctionEnd -%290 = OpFunction %2 None %102 -%289 = OpLabel -OpBranch %295 -%295 = OpLabel +%339 = OpFunction %2 None %97 +%338 = OpLabel +OpBranch %340 +%340 = OpLabel +%341 = OpSNegate %6 %21 +%342 = OpSNegate %6 %21 +%343 = OpSNegate %6 %342 +%344 = OpSNegate %6 %21 +%345 = OpSNegate %6 %344 +%346 = OpSNegate %6 %21 +%347 = OpSNegate %6 %346 +%348 = OpSNegate %6 %21 +%349 = OpSNegate %6 %348 +%350 = OpSNegate %6 %349 +%351 = OpSNegate %6 %21 +%352 = OpSNegate %6 %351 +%353 = OpSNegate %6 %352 +%354 = OpSNegate %6 %353 +%355 = OpSNegate %6 %21 +%356 = OpSNegate %6 %355 +%357 = OpSNegate %6 %356 +%358 = OpSNegate %6 %357 +%359 = OpSNegate %6 %358 +%360 = OpSNegate %6 %21 +%361 = OpSNegate %6 %360 +%362 = OpSNegate %6 %361 +%363 = OpSNegate %6 %362 +%364 = OpSNegate %6 %363 OpReturn OpFunctionEnd -%297 = OpFunction %2 None %102 -%296 = OpLabel -OpBranch %299 -%299 = OpLabel -%300 = OpFunctionCall %3 %29 -%301 = OpFunctionCall %3 %57 -%302 = OpFunctionCall %10 %92 %298 -%303 = OpFunctionCall %2 %101 -%304 = OpFunctionCall %2 %114 -%305 = OpFunctionCall %2 %207 -%306 = OpFunctionCall %2 %226 -%307 = OpFunctionCall %2 %247 +%366 = OpFunction %2 None %97 +%365 = OpLabel +OpBranch %368 +%368 = OpLabel +%369 = OpFunctionCall %3 %24 +%370 = OpFunctionCall %3 %52 +%371 = OpFunctionCall %10 %87 %367 +%372 = OpFunctionCall %2 %96 +%373 = OpFunctionCall %2 %114 +%374 = OpFunctionCall %2 %229 +%375 = OpFunctionCall %2 %256 +%376 = OpFunctionCall %2 %295 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/tests/out/wgsl/operators.wgsl b/tests/out/wgsl/operators.wgsl index 9c07526d39..5038bdc853 100644 --- a/tests/out/wgsl/operators.wgsl +++ b/tests/out/wgsl/operators.wgsl @@ -40,7 +40,10 @@ fn bool_cast(x: vec3) -> vec3 { } fn logical() { - let neg1_ = vec2(false, false); + let neg0_ = !(true); + let neg1_ = !(vec2(true)); + let or = (true || false); + let and = (true && false); let bitwise_or0_ = (true | false); let bitwise_or1_ = (vec3(true) | vec3(false)); let bitwise_and0_ = (true & false); @@ -48,139 +51,193 @@ fn logical() { } fn arithmetic() { - let neg1_1 = vec2(-1, -1); - let neg2_ = vec2(-1.0, -1.0); + let neg0_1 = -(1.0); + let neg1_1 = -(vec2(1)); + let neg2_ = -(vec2(1.0)); + let add0_ = (2 + 1); + let add1_ = (2u + 1u); + let add2_ = (2.0 + 1.0); let add3_ = (vec2(2) + vec2(1)); let add4_ = (vec3(2u) + vec3(1u)); let add5_ = (vec4(2.0) + vec4(1.0)); + let sub0_ = (2 - 1); + let sub1_ = (2u - 1u); + let sub2_ = (2.0 - 1.0); let sub3_ = (vec2(2) - vec2(1)); let sub4_ = (vec3(2u) - vec3(1u)); let sub5_ = (vec4(2.0) - vec4(1.0)); + let mul0_ = (2 * 1); + let mul1_ = (2u * 1u); + let mul2_ = (2.0 * 1.0); let mul3_ = (vec2(2) * vec2(1)); let mul4_ = (vec3(2u) * vec3(1u)); let mul5_ = (vec4(2.0) * vec4(1.0)); + let div0_ = (2 / 1); + let div1_ = (2u / 1u); + let div2_ = (2.0 / 1.0); let div3_ = (vec2(2) / vec2(1)); let div4_ = (vec3(2u) / vec3(1u)); let div5_ = (vec4(2.0) / vec4(1.0)); + let rem0_ = (2 % 1); + let rem1_ = (2u % 1u); + let rem2_ = (2.0 % 1.0); let rem3_ = (vec2(2) % vec2(1)); let rem4_ = (vec3(2u) % vec3(1u)); let rem5_ = (vec4(2.0) % vec4(1.0)); { - let add0_ = (vec2(2) + vec2(1)); - let add1_ = (vec2(2) + vec2(1)); - let add2_ = (vec2(2u) + vec2(1u)); + let add0_1 = (vec2(2) + vec2(1)); + let add1_1 = (vec2(2) + vec2(1)); + let add2_1 = (vec2(2u) + vec2(1u)); let add3_1 = (vec2(2u) + vec2(1u)); let add4_1 = (vec2(2.0) + vec2(1.0)); let add5_1 = (vec2(2.0) + vec2(1.0)); - let sub0_ = (vec2(2) - vec2(1)); - let sub1_ = (vec2(2) - vec2(1)); - let sub2_ = (vec2(2u) - vec2(1u)); + let sub0_1 = (vec2(2) - vec2(1)); + let sub1_1 = (vec2(2) - vec2(1)); + let sub2_1 = (vec2(2u) - vec2(1u)); let sub3_1 = (vec2(2u) - vec2(1u)); let sub4_1 = (vec2(2.0) - vec2(1.0)); let sub5_1 = (vec2(2.0) - vec2(1.0)); - let mul0_ = vec2(2, 2); - let mul1_ = vec2(2, 2); - let mul2_ = vec2(2u, 2u); - let mul3_1 = vec2(2u, 2u); - let mul4_1 = vec2(2.0, 2.0); - let mul5_1 = vec2(2.0, 2.0); - let div0_ = (vec2(2) / vec2(1)); - let div1_ = (vec2(2) / vec2(1)); - let div2_ = (vec2(2u) / vec2(1u)); + let mul0_1 = (vec2(2) * 1); + let mul1_1 = (2 * vec2(1)); + let mul2_1 = (vec2(2u) * 1u); + let mul3_1 = (2u * vec2(1u)); + let mul4_1 = (vec2(2.0) * 1.0); + let mul5_1 = (2.0 * vec2(1.0)); + let div0_1 = (vec2(2) / vec2(1)); + let div1_1 = (vec2(2) / vec2(1)); + let div2_1 = (vec2(2u) / vec2(1u)); let div3_1 = (vec2(2u) / vec2(1u)); let div4_1 = (vec2(2.0) / vec2(1.0)); let div5_1 = (vec2(2.0) / vec2(1.0)); - let rem0_ = (vec2(2) % vec2(1)); - let rem1_ = (vec2(2) % vec2(1)); - let rem2_ = (vec2(2u) % vec2(1u)); + let rem0_1 = (vec2(2) % vec2(1)); + let rem1_1 = (vec2(2) % vec2(1)); + let rem2_1 = (vec2(2u) % vec2(1u)); let rem3_1 = (vec2(2u) % vec2(1u)); let rem4_1 = (vec2(2.0) % vec2(1.0)); let rem5_1 = (vec2(2.0) % vec2(1.0)); } let add = (mat3x3() + mat3x3()); let sub = (mat3x3() - mat3x3()); - let mul_scalar0_ = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); - let mul_scalar1_ = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + let mul_scalar0_ = (mat3x3() * 1.0); + let mul_scalar1_ = (2.0 * mat3x3()); let mul_vector0_ = (mat4x3() * vec4(1.0)); let mul_vector1_ = (vec3(2.0) * mat4x3()); let mul = (mat4x3() * mat3x4()); } fn bit() { - let flip2_ = vec2(-2, -2); - let flip3_ = vec3(4294967294u, 4294967294u, 4294967294u); + let flip0_ = ~(1); + let flip1_ = ~(1u); + let flip2_ = !(vec2(1)); + let flip3_ = !(vec3(1u)); + let or0_ = (2 | 1); + let or1_ = (2u | 1u); let or2_ = (vec2(2) | vec2(1)); let or3_ = (vec3(2u) | vec3(1u)); + let and0_ = (2 & 1); + let and1_ = (2u & 1u); let and2_ = (vec2(2) & vec2(1)); let and3_ = (vec3(2u) & vec3(1u)); + let xor0_ = (2 ^ 1); + let xor1_ = (2u ^ 1u); let xor2_ = (vec2(2) ^ vec2(1)); let xor3_ = (vec3(2u) ^ vec3(1u)); + let shl0_ = (2 << 1u); + let shl1_ = (2u << 1u); let shl2_ = (vec2(2) << vec2(1u)); let shl3_ = (vec3(2u) << vec3(1u)); + let shr0_ = (2 >> 1u); + let shr1_ = (2u >> 1u); let shr2_ = (vec2(2) >> vec2(1u)); let shr3_ = (vec3(2u) >> vec3(1u)); } fn comparison() { + let eq0_ = (2 == 1); + let eq1_ = (2u == 1u); + let eq2_ = (2.0 == 1.0); let eq3_ = (vec2(2) == vec2(1)); let eq4_ = (vec3(2u) == vec3(1u)); let eq5_ = (vec4(2.0) == vec4(1.0)); + let neq0_ = (2 != 1); + let neq1_ = (2u != 1u); + let neq2_ = (2.0 != 1.0); let neq3_ = (vec2(2) != vec2(1)); let neq4_ = (vec3(2u) != vec3(1u)); let neq5_ = (vec4(2.0) != vec4(1.0)); + let lt0_ = (2 < 1); + let lt1_ = (2u < 1u); + let lt2_ = (2.0 < 1.0); let lt3_ = (vec2(2) < vec2(1)); let lt4_ = (vec3(2u) < vec3(1u)); let lt5_ = (vec4(2.0) < vec4(1.0)); + let lte0_ = (2 <= 1); + let lte1_ = (2u <= 1u); + let lte2_ = (2.0 <= 1.0); let lte3_ = (vec2(2) <= vec2(1)); let lte4_ = (vec3(2u) <= vec3(1u)); let lte5_ = (vec4(2.0) <= vec4(1.0)); + let gt0_ = (2 > 1); + let gt1_ = (2u > 1u); + let gt2_ = (2.0 > 1.0); let gt3_ = (vec2(2) > vec2(1)); let gt4_ = (vec3(2u) > vec3(1u)); let gt5_ = (vec4(2.0) > vec4(1.0)); + let gte0_ = (2 >= 1); + let gte1_ = (2u >= 1u); + let gte2_ = (2.0 >= 1.0); let gte3_ = (vec2(2) >= vec2(1)); let gte4_ = (vec3(2u) >= vec3(1u)); let gte5_ = (vec4(2.0) >= vec4(1.0)); } fn assignment() { - var a_1: i32 = 1; + var a_1: i32; var vec0_: vec3 = vec3(); - let _e3 = a_1; - a_1 = (_e3 + 1); - let _e6 = a_1; - a_1 = (_e6 - 1); - let _e8 = a_1; + a_1 = 1; + let _e5 = a_1; + a_1 = (_e5 + 1); + let _e7 = a_1; + a_1 = (_e7 - 1); let _e9 = a_1; - a_1 = (_e9 * _e8); - let _e11 = a_1; + let _e10 = a_1; + a_1 = (_e10 * _e9); let _e12 = a_1; - a_1 = (_e12 / _e11); + let _e13 = a_1; + a_1 = (_e13 / _e12); let _e15 = a_1; a_1 = (_e15 % 1); - let _e18 = a_1; - a_1 = (_e18 & 0); + let _e17 = a_1; + a_1 = (_e17 & 0); + let _e19 = a_1; + a_1 = (_e19 | 0); let _e21 = a_1; - a_1 = (_e21 | 0); - let _e24 = a_1; - a_1 = (_e24 ^ 0); - let _e27 = a_1; - a_1 = (_e27 << 2u); - let _e30 = a_1; - a_1 = (_e30 >> 1u); - let _e33 = a_1; - a_1 = (_e33 + 1); - let _e36 = a_1; - a_1 = (_e36 - 1); - let _e42 = vec0_.y; - vec0_.y = (_e42 + 1); - let _e46 = vec0_.y; - vec0_.y = (_e46 - 1); + a_1 = (_e21 ^ 0); + let _e23 = a_1; + a_1 = (_e23 << 2u); + let _e25 = a_1; + a_1 = (_e25 >> 1u); + let _e28 = a_1; + a_1 = (_e28 + 1); + let _e31 = a_1; + a_1 = (_e31 - 1); + let _e37 = vec0_[1]; + vec0_[1] = (_e37 + 1); + let _e41 = vec0_[1]; + vec0_[1] = (_e41 - 1); return; } fn negation_avoids_prefix_decrement() { - return; + let p0_ = -(1); + let p1_ = -(-(1)); + let p2_ = -(-(1)); + let p3_ = -(-(1)); + let p4_ = -(-(-(1))); + let p5_ = -(-(-(-(1)))); + let p6_ = -(-(-(-(-(1))))); + let p7_ = -(-(-(-(-(1))))); } @compute @workgroup_size(1, 1, 1)