From 65cb20c1dbc948113bf26a02487d0ec2647001e1 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 28 Jun 2021 15:56:57 +0000 Subject: [PATCH] test: Move 'splat' tests to expressions, split up These are expressions, and not specific to `var`s. Break the tests up into finer granularity. Bug: tint:656 Change-Id: I6873407127871dfaec55d90f02e0490eef929a30 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56071 Commit-Queue: Ben Clayton Auto-Submit: Ben Clayton Reviewed-by: Antonio Maiorano Kokoro: Kokoro --- test/expressions/splat/call/bool.wgsl | 7 + .../splat/call/bool.wgsl.expected.hlsl | 14 + .../splat/call/bool.wgsl.expected.msl | 13 + .../splat/call/bool.wgsl.expected.spvasm | 53 +++ .../splat/call/bool.wgsl.expected.wgsl | 9 + test/expressions/splat/call/f32.wgsl | 7 + .../splat/call/f32.wgsl.expected.hlsl | 14 + .../splat/call/f32.wgsl.expected.msl | 13 + .../splat/call/f32.wgsl.expected.spvasm | 53 +++ .../splat/call/f32.wgsl.expected.wgsl | 9 + test/expressions/splat/call/i32.wgsl | 7 + .../splat/call/i32.wgsl.expected.hlsl | 14 + .../splat/call/i32.wgsl.expected.msl | 13 + .../splat/call/i32.wgsl.expected.spvasm | 53 +++ .../splat/call/i32.wgsl.expected.wgsl | 9 + test/expressions/splat/call/u32.wgsl | 7 + .../splat/call/u32.wgsl.expected.hlsl | 14 + .../splat/call/u32.wgsl.expected.msl | 13 + .../splat/call/u32.wgsl.expected.spvasm | 53 +++ .../splat/call/u32.wgsl.expected.wgsl | 9 + test/expressions/splat/expression/bool.wgsl | 5 + .../splat/expression/bool.wgsl.expected.hlsl | 22 ++ .../splat/expression/bool.wgsl.expected.msl | 9 + .../expression/bool.wgsl.expected.spvasm | 63 ++++ .../splat/expression/bool.wgsl.expected.wgsl | 5 + test/expressions/splat/expression/f32.wgsl | 5 + .../splat/expression/f32.wgsl.expected.hlsl | 10 + .../splat/expression/f32.wgsl.expected.msl | 9 + .../splat/expression/f32.wgsl.expected.spvasm | 48 +++ .../splat/expression/f32.wgsl.expected.wgsl | 5 + test/expressions/splat/expression/i32.wgsl | 5 + .../splat/expression/i32.wgsl.expected.hlsl | 10 + .../splat/expression/i32.wgsl.expected.msl | 9 + .../splat/expression/i32.wgsl.expected.spvasm | 48 +++ .../splat/expression/i32.wgsl.expected.wgsl | 5 + test/expressions/splat/expression/u32.wgsl | 5 + .../splat/expression/u32.wgsl.expected.hlsl | 10 + .../splat/expression/u32.wgsl.expected.msl | 9 + .../splat/expression/u32.wgsl.expected.spvasm | 48 +++ .../splat/expression/u32.wgsl.expected.wgsl | 5 + test/expressions/splat/immediate/bool.wgsl | 5 + .../splat/immediate/bool.wgsl.expected.hlsl | 10 + .../splat/immediate/bool.wgsl.expected.msl | 9 + .../splat/immediate/bool.wgsl.expected.spvasm | 44 +++ .../splat/immediate/bool.wgsl.expected.wgsl | 5 + test/expressions/splat/immediate/f32.wgsl | 5 + .../splat/immediate/f32.wgsl.expected.hlsl | 10 + .../splat/immediate/f32.wgsl.expected.msl | 9 + .../splat/immediate/f32.wgsl.expected.spvasm | 44 +++ .../splat/immediate/f32.wgsl.expected.wgsl | 5 + test/expressions/splat/immediate/i32.wgsl | 5 + .../splat/immediate/i32.wgsl.expected.hlsl | 10 + .../splat/immediate/i32.wgsl.expected.msl | 9 + .../splat/immediate/i32.wgsl.expected.spvasm | 44 +++ .../splat/immediate/i32.wgsl.expected.wgsl | 5 + test/expressions/splat/immediate/u32.wgsl | 5 + .../splat/immediate/u32.wgsl.expected.hlsl | 10 + .../splat/immediate/u32.wgsl.expected.msl | 9 + .../splat/immediate/u32.wgsl.expected.spvasm | 44 +++ .../splat/immediate/u32.wgsl.expected.wgsl | 5 + test/expressions/splat/with_swizzle/f32.wgsl | 5 + .../splat/with_swizzle/f32.wgsl.expected.hlsl | 10 + .../splat/with_swizzle/f32.wgsl.expected.msl | 9 + .../with_swizzle/f32.wgsl.expected.spvasm | 43 +++ .../splat/with_swizzle/f32.wgsl.expected.wgsl | 5 + test/var/splat.wgsl | 91 ----- test/var/splat.wgsl.expected.hlsl | 106 ------ test/var/splat.wgsl.expected.msl | 106 ------ test/var/splat.wgsl.expected.spvasm | 353 ------------------ test/var/splat.wgsl.expected.wgsl | 104 ------ 70 files changed, 1083 insertions(+), 760 deletions(-) create mode 100644 test/expressions/splat/call/bool.wgsl create mode 100644 test/expressions/splat/call/bool.wgsl.expected.hlsl create mode 100644 test/expressions/splat/call/bool.wgsl.expected.msl create mode 100644 test/expressions/splat/call/bool.wgsl.expected.spvasm create mode 100644 test/expressions/splat/call/bool.wgsl.expected.wgsl create mode 100644 test/expressions/splat/call/f32.wgsl create mode 100644 test/expressions/splat/call/f32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/call/f32.wgsl.expected.msl create mode 100644 test/expressions/splat/call/f32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/call/f32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/call/i32.wgsl create mode 100644 test/expressions/splat/call/i32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/call/i32.wgsl.expected.msl create mode 100644 test/expressions/splat/call/i32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/call/i32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/call/u32.wgsl create mode 100644 test/expressions/splat/call/u32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/call/u32.wgsl.expected.msl create mode 100644 test/expressions/splat/call/u32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/call/u32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/expression/bool.wgsl create mode 100644 test/expressions/splat/expression/bool.wgsl.expected.hlsl create mode 100644 test/expressions/splat/expression/bool.wgsl.expected.msl create mode 100644 test/expressions/splat/expression/bool.wgsl.expected.spvasm create mode 100644 test/expressions/splat/expression/bool.wgsl.expected.wgsl create mode 100644 test/expressions/splat/expression/f32.wgsl create mode 100644 test/expressions/splat/expression/f32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/expression/f32.wgsl.expected.msl create mode 100644 test/expressions/splat/expression/f32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/expression/f32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/expression/i32.wgsl create mode 100644 test/expressions/splat/expression/i32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/expression/i32.wgsl.expected.msl create mode 100644 test/expressions/splat/expression/i32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/expression/i32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/expression/u32.wgsl create mode 100644 test/expressions/splat/expression/u32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/expression/u32.wgsl.expected.msl create mode 100644 test/expressions/splat/expression/u32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/expression/u32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/immediate/bool.wgsl create mode 100644 test/expressions/splat/immediate/bool.wgsl.expected.hlsl create mode 100644 test/expressions/splat/immediate/bool.wgsl.expected.msl create mode 100644 test/expressions/splat/immediate/bool.wgsl.expected.spvasm create mode 100644 test/expressions/splat/immediate/bool.wgsl.expected.wgsl create mode 100644 test/expressions/splat/immediate/f32.wgsl create mode 100644 test/expressions/splat/immediate/f32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/immediate/f32.wgsl.expected.msl create mode 100644 test/expressions/splat/immediate/f32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/immediate/f32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/immediate/i32.wgsl create mode 100644 test/expressions/splat/immediate/i32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/immediate/i32.wgsl.expected.msl create mode 100644 test/expressions/splat/immediate/i32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/immediate/i32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/immediate/u32.wgsl create mode 100644 test/expressions/splat/immediate/u32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/immediate/u32.wgsl.expected.msl create mode 100644 test/expressions/splat/immediate/u32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/immediate/u32.wgsl.expected.wgsl create mode 100644 test/expressions/splat/with_swizzle/f32.wgsl create mode 100644 test/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl create mode 100644 test/expressions/splat/with_swizzle/f32.wgsl.expected.msl create mode 100644 test/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm create mode 100644 test/expressions/splat/with_swizzle/f32.wgsl.expected.wgsl delete mode 100644 test/var/splat.wgsl delete mode 100644 test/var/splat.wgsl.expected.hlsl delete mode 100644 test/var/splat.wgsl.expected.msl delete mode 100644 test/var/splat.wgsl.expected.spvasm delete mode 100644 test/var/splat.wgsl.expected.wgsl diff --git a/test/expressions/splat/call/bool.wgsl b/test/expressions/splat/call/bool.wgsl new file mode 100644 index 0000000000..2b2e3d9f0e --- /dev/null +++ b/test/expressions/splat/call/bool.wgsl @@ -0,0 +1,7 @@ +fn get_bool() -> bool { return true; } + +fn f() { + var v2 : vec2 = vec2(get_bool()); + var v3 : vec3 = vec3(get_bool()); + var v4 : vec4 = vec4(get_bool()); +} diff --git a/test/expressions/splat/call/bool.wgsl.expected.hlsl b/test/expressions/splat/call/bool.wgsl.expected.hlsl new file mode 100644 index 0000000000..5291698e35 --- /dev/null +++ b/test/expressions/splat/call/bool.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +bool get_bool() { + return true; +} + +void f() { + bool2 v2 = bool2((get_bool()).xx); + bool3 v3 = bool3((get_bool()).xxx); + bool4 v4 = bool4((get_bool()).xxxx); +} diff --git a/test/expressions/splat/call/bool.wgsl.expected.msl b/test/expressions/splat/call/bool.wgsl.expected.msl new file mode 100644 index 0000000000..5ce5b992de --- /dev/null +++ b/test/expressions/splat/call/bool.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +bool get_bool() { + return true; +} + +void f() { + bool2 v2 = bool2(get_bool()); + bool3 v3 = bool3(get_bool()); + bool4 v4 = bool4(get_bool()); +} + diff --git a/test/expressions/splat/call/bool.wgsl.expected.spvasm b/test/expressions/splat/call/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..daa1a6e0dc --- /dev/null +++ b/test/expressions/splat/call/bool.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %get_bool "get_bool" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %5 = OpTypeFunction %bool + %true = OpConstantTrue %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %17 = OpConstantNull %v2bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %23 = OpConstantNull %v3bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %29 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %get_bool = OpFunction %bool None %5 + %8 = OpLabel + OpReturnValue %true + OpFunctionEnd + %f = OpFunction %void None %1 + %11 = OpLabel + %v2 = OpVariable %_ptr_Function_v2bool Function %17 + %v3 = OpVariable %_ptr_Function_v3bool Function %23 + %v4 = OpVariable %_ptr_Function_v4bool Function %29 + %13 = OpFunctionCall %bool %get_bool + %14 = OpCompositeConstruct %v2bool %13 %13 + OpStore %v2 %14 + %19 = OpFunctionCall %bool %get_bool + %20 = OpCompositeConstruct %v3bool %19 %19 %19 + OpStore %v3 %20 + %25 = OpFunctionCall %bool %get_bool + %26 = OpCompositeConstruct %v4bool %25 %25 %25 %25 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/call/bool.wgsl.expected.wgsl b/test/expressions/splat/call/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f54d12a3e --- /dev/null +++ b/test/expressions/splat/call/bool.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn get_bool() -> bool { + return true; +} + +fn f() { + var v2 : vec2 = vec2(get_bool()); + var v3 : vec3 = vec3(get_bool()); + var v4 : vec4 = vec4(get_bool()); +} diff --git a/test/expressions/splat/call/f32.wgsl b/test/expressions/splat/call/f32.wgsl new file mode 100644 index 0000000000..08990a9f47 --- /dev/null +++ b/test/expressions/splat/call/f32.wgsl @@ -0,0 +1,7 @@ +fn get_f32() -> f32 { return 1.0; } + +fn f() { + var v2 : vec2 = vec2(get_f32()); + var v3 : vec3 = vec3(get_f32()); + var v4 : vec4 = vec4(get_f32()); +} diff --git a/test/expressions/splat/call/f32.wgsl.expected.hlsl b/test/expressions/splat/call/f32.wgsl.expected.hlsl new file mode 100644 index 0000000000..63840f246a --- /dev/null +++ b/test/expressions/splat/call/f32.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float get_f32() { + return 1.0f; +} + +void f() { + float2 v2 = float2((get_f32()).xx); + float3 v3 = float3((get_f32()).xxx); + float4 v4 = float4((get_f32()).xxxx); +} diff --git a/test/expressions/splat/call/f32.wgsl.expected.msl b/test/expressions/splat/call/f32.wgsl.expected.msl new file mode 100644 index 0000000000..1de17d99c7 --- /dev/null +++ b/test/expressions/splat/call/f32.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +float get_f32() { + return 1.0f; +} + +void f() { + float2 v2 = float2(get_f32()); + float3 v3 = float3(get_f32()); + float4 v4 = float4(get_f32()); +} + diff --git a/test/expressions/splat/call/f32.wgsl.expected.spvasm b/test/expressions/splat/call/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..57e9ac346d --- /dev/null +++ b/test/expressions/splat/call/f32.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %get_f32 "get_f32" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %5 = OpTypeFunction %float + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %17 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpConstantNull %v3float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %29 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %get_f32 = OpFunction %float None %5 + %8 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %f = OpFunction %void None %1 + %11 = OpLabel + %v2 = OpVariable %_ptr_Function_v2float Function %17 + %v3 = OpVariable %_ptr_Function_v3float Function %23 + %v4 = OpVariable %_ptr_Function_v4float Function %29 + %13 = OpFunctionCall %float %get_f32 + %14 = OpCompositeConstruct %v2float %13 %13 + OpStore %v2 %14 + %19 = OpFunctionCall %float %get_f32 + %20 = OpCompositeConstruct %v3float %19 %19 %19 + OpStore %v3 %20 + %25 = OpFunctionCall %float %get_f32 + %26 = OpCompositeConstruct %v4float %25 %25 %25 %25 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/call/f32.wgsl.expected.wgsl b/test/expressions/splat/call/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..441dd4a92b --- /dev/null +++ b/test/expressions/splat/call/f32.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn get_f32() -> f32 { + return 1.0; +} + +fn f() { + var v2 : vec2 = vec2(get_f32()); + var v3 : vec3 = vec3(get_f32()); + var v4 : vec4 = vec4(get_f32()); +} diff --git a/test/expressions/splat/call/i32.wgsl b/test/expressions/splat/call/i32.wgsl new file mode 100644 index 0000000000..1c52a5fb90 --- /dev/null +++ b/test/expressions/splat/call/i32.wgsl @@ -0,0 +1,7 @@ +fn get_i32() -> i32 { return 1; } + +fn f() { + var v2 : vec2 = vec2(get_i32()); + var v3 : vec3 = vec3(get_i32()); + var v4 : vec4 = vec4(get_i32()); +} diff --git a/test/expressions/splat/call/i32.wgsl.expected.hlsl b/test/expressions/splat/call/i32.wgsl.expected.hlsl new file mode 100644 index 0000000000..89f22e94ac --- /dev/null +++ b/test/expressions/splat/call/i32.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int get_i32() { + return 1; +} + +void f() { + int2 v2 = int2((get_i32()).xx); + int3 v3 = int3((get_i32()).xxx); + int4 v4 = int4((get_i32()).xxxx); +} diff --git a/test/expressions/splat/call/i32.wgsl.expected.msl b/test/expressions/splat/call/i32.wgsl.expected.msl new file mode 100644 index 0000000000..46579d29a7 --- /dev/null +++ b/test/expressions/splat/call/i32.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +int get_i32() { + return 1; +} + +void f() { + int2 v2 = int2(get_i32()); + int3 v3 = int3(get_i32()); + int4 v4 = int4(get_i32()); +} + diff --git a/test/expressions/splat/call/i32.wgsl.expected.spvasm b/test/expressions/splat/call/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3491493a14 --- /dev/null +++ b/test/expressions/splat/call/i32.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %get_i32 "get_i32" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %5 = OpTypeFunction %int + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %17 = OpConstantNull %v2int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %get_i32 = OpFunction %int None %5 + %8 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %f = OpFunction %void None %1 + %11 = OpLabel + %v2 = OpVariable %_ptr_Function_v2int Function %17 + %v3 = OpVariable %_ptr_Function_v3int Function %23 + %v4 = OpVariable %_ptr_Function_v4int Function %29 + %13 = OpFunctionCall %int %get_i32 + %14 = OpCompositeConstruct %v2int %13 %13 + OpStore %v2 %14 + %19 = OpFunctionCall %int %get_i32 + %20 = OpCompositeConstruct %v3int %19 %19 %19 + OpStore %v3 %20 + %25 = OpFunctionCall %int %get_i32 + %26 = OpCompositeConstruct %v4int %25 %25 %25 %25 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/call/i32.wgsl.expected.wgsl b/test/expressions/splat/call/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bba83cec7b --- /dev/null +++ b/test/expressions/splat/call/i32.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn get_i32() -> i32 { + return 1; +} + +fn f() { + var v2 : vec2 = vec2(get_i32()); + var v3 : vec3 = vec3(get_i32()); + var v4 : vec4 = vec4(get_i32()); +} diff --git a/test/expressions/splat/call/u32.wgsl b/test/expressions/splat/call/u32.wgsl new file mode 100644 index 0000000000..327c585b13 --- /dev/null +++ b/test/expressions/splat/call/u32.wgsl @@ -0,0 +1,7 @@ +fn get_u32() -> u32 { return 1u; } + +fn f() { + var v2 : vec2 = vec2(get_u32()); + var v3 : vec3 = vec3(get_u32()); + var v4 : vec4 = vec4(get_u32()); +} diff --git a/test/expressions/splat/call/u32.wgsl.expected.hlsl b/test/expressions/splat/call/u32.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ec0173c1f --- /dev/null +++ b/test/expressions/splat/call/u32.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +uint get_u32() { + return 1u; +} + +void f() { + uint2 v2 = uint2((get_u32()).xx); + uint3 v3 = uint3((get_u32()).xxx); + uint4 v4 = uint4((get_u32()).xxxx); +} diff --git a/test/expressions/splat/call/u32.wgsl.expected.msl b/test/expressions/splat/call/u32.wgsl.expected.msl new file mode 100644 index 0000000000..2d3050efdc --- /dev/null +++ b/test/expressions/splat/call/u32.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +uint get_u32() { + return 1u; +} + +void f() { + uint2 v2 = uint2(get_u32()); + uint3 v3 = uint3(get_u32()); + uint4 v4 = uint4(get_u32()); +} + diff --git a/test/expressions/splat/call/u32.wgsl.expected.spvasm b/test/expressions/splat/call/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d133c4e078 --- /dev/null +++ b/test/expressions/splat/call/u32.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %get_u32 "get_u32" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %5 = OpTypeFunction %uint + %uint_1 = OpConstant %uint 1 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %17 = OpConstantNull %v2uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %23 = OpConstantNull %v3uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %29 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %get_u32 = OpFunction %uint None %5 + %8 = OpLabel + OpReturnValue %uint_1 + OpFunctionEnd + %f = OpFunction %void None %1 + %11 = OpLabel + %v2 = OpVariable %_ptr_Function_v2uint Function %17 + %v3 = OpVariable %_ptr_Function_v3uint Function %23 + %v4 = OpVariable %_ptr_Function_v4uint Function %29 + %13 = OpFunctionCall %uint %get_u32 + %14 = OpCompositeConstruct %v2uint %13 %13 + OpStore %v2 %14 + %19 = OpFunctionCall %uint %get_u32 + %20 = OpCompositeConstruct %v3uint %19 %19 %19 + OpStore %v3 %20 + %25 = OpFunctionCall %uint %get_u32 + %26 = OpCompositeConstruct %v4uint %25 %25 %25 %25 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/call/u32.wgsl.expected.wgsl b/test/expressions/splat/call/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c6d2010c2 --- /dev/null +++ b/test/expressions/splat/call/u32.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn get_u32() -> u32 { + return 1u; +} + +fn f() { + var v2 : vec2 = vec2(get_u32()); + var v3 : vec3 = vec3(get_u32()); + var v4 : vec4 = vec4(get_u32()); +} diff --git a/test/expressions/splat/expression/bool.wgsl b/test/expressions/splat/expression/bool.wgsl new file mode 100644 index 0000000000..672cb871a4 --- /dev/null +++ b/test/expressions/splat/expression/bool.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(true || false); + var v3 : vec3 = vec3(true || false); + var v4 : vec4 = vec4(true || false); +} diff --git a/test/expressions/splat/expression/bool.wgsl.expected.hlsl b/test/expressions/splat/expression/bool.wgsl.expected.hlsl new file mode 100644 index 0000000000..544f39d0ef --- /dev/null +++ b/test/expressions/splat/expression/bool.wgsl.expected.hlsl @@ -0,0 +1,22 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool tint_tmp = true; + if (!tint_tmp) { + tint_tmp = false; + } + bool2 v2 = bool2(((tint_tmp)).xx); + bool tint_tmp_1 = true; + if (!tint_tmp_1) { + tint_tmp_1 = false; + } + bool3 v3 = bool3(((tint_tmp_1)).xxx); + bool tint_tmp_2 = true; + if (!tint_tmp_2) { + tint_tmp_2 = false; + } + bool4 v4 = bool4(((tint_tmp_2)).xxxx); +} diff --git a/test/expressions/splat/expression/bool.wgsl.expected.msl b/test/expressions/splat/expression/bool.wgsl.expected.msl new file mode 100644 index 0000000000..354bab195d --- /dev/null +++ b/test/expressions/splat/expression/bool.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + bool2 v2 = bool2((true || false)); + bool3 v3 = bool3((true || false)); + bool4 v4 = bool4((true || false)); +} + diff --git a/test/expressions/splat/expression/bool.wgsl.expected.spvasm b/test/expressions/splat/expression/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a6eb60e97 --- /dev/null +++ b/test/expressions/splat/expression/bool.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %17 = OpConstantNull %v2bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %33 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2bool Function %17 + %v3 = OpVariable %_ptr_Function_v3bool Function %25 + %v4 = OpVariable %_ptr_Function_v4bool Function %33 + OpSelectionMerge %10 None + OpBranchConditional %true %10 %11 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel + %13 = OpPhi %bool %true %6 %false %11 + %14 = OpCompositeConstruct %v2bool %13 %13 + OpStore %v2 %14 + OpSelectionMerge %19 None + OpBranchConditional %true %19 %20 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + %21 = OpPhi %bool %true %10 %false %20 + %22 = OpCompositeConstruct %v3bool %21 %21 %21 + OpStore %v3 %22 + OpSelectionMerge %27 None + OpBranchConditional %true %27 %28 + %28 = OpLabel + OpBranch %27 + %27 = OpLabel + %29 = OpPhi %bool %true %19 %false %28 + %30 = OpCompositeConstruct %v4bool %29 %29 %29 %29 + OpStore %v4 %30 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/expression/bool.wgsl.expected.wgsl b/test/expressions/splat/expression/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..868c155af4 --- /dev/null +++ b/test/expressions/splat/expression/bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2((true || false)); + var v3 : vec3 = vec3((true || false)); + var v4 : vec4 = vec4((true || false)); +} diff --git a/test/expressions/splat/expression/f32.wgsl b/test/expressions/splat/expression/f32.wgsl new file mode 100644 index 0000000000..73794a0b65 --- /dev/null +++ b/test/expressions/splat/expression/f32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1.0 + 2.0); + var v3 : vec3 = vec3(1.0 + 2.0); + var v4 : vec4 = vec4(1.0 + 2.0); +} diff --git a/test/expressions/splat/expression/f32.wgsl.expected.hlsl b/test/expressions/splat/expression/f32.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ed6e5ab17 --- /dev/null +++ b/test/expressions/splat/expression/f32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = float2(((1.0f + 2.0f)).xx); + float3 v3 = float3(((1.0f + 2.0f)).xxx); + float4 v4 = float4(((1.0f + 2.0f)).xxxx); +} diff --git a/test/expressions/splat/expression/f32.wgsl.expected.msl b/test/expressions/splat/expression/f32.wgsl.expected.msl new file mode 100644 index 0000000000..9dd8768fb6 --- /dev/null +++ b/test/expressions/splat/expression/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + float2 v2 = float2((1.0f + 2.0f)); + float3 v3 = float3((1.0f + 2.0f)); + float4 v4 = float4((1.0f + 2.0f)); +} + diff --git a/test/expressions/splat/expression/f32.wgsl.expected.spvasm b/test/expressions/splat/expression/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..286c6bace5 --- /dev/null +++ b/test/expressions/splat/expression/f32.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpConstantNull %v3float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2float Function %15 + %v3 = OpVariable %_ptr_Function_v3float Function %21 + %v4 = OpVariable %_ptr_Function_v4float Function %27 + %11 = OpFAdd %float %float_1 %float_2 + %12 = OpCompositeConstruct %v2float %11 %11 + OpStore %v2 %12 + %17 = OpFAdd %float %float_1 %float_2 + %18 = OpCompositeConstruct %v3float %17 %17 %17 + OpStore %v3 %18 + %23 = OpFAdd %float %float_1 %float_2 + %24 = OpCompositeConstruct %v4float %23 %23 %23 %23 + OpStore %v4 %24 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/expression/f32.wgsl.expected.wgsl b/test/expressions/splat/expression/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e00bbc0a3 --- /dev/null +++ b/test/expressions/splat/expression/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2((1.0 + 2.0)); + var v3 : vec3 = vec3((1.0 + 2.0)); + var v4 : vec4 = vec4((1.0 + 2.0)); +} diff --git a/test/expressions/splat/expression/i32.wgsl b/test/expressions/splat/expression/i32.wgsl new file mode 100644 index 0000000000..cffe95c014 --- /dev/null +++ b/test/expressions/splat/expression/i32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1 + 2); + var v3 : vec3 = vec3(1 + 2); + var v4 : vec4 = vec4(1 + 2); +} diff --git a/test/expressions/splat/expression/i32.wgsl.expected.hlsl b/test/expressions/splat/expression/i32.wgsl.expected.hlsl new file mode 100644 index 0000000000..1a1fa76f6a --- /dev/null +++ b/test/expressions/splat/expression/i32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = int2(((1 + 2)).xx); + int3 v3 = int3(((1 + 2)).xxx); + int4 v4 = int4(((1 + 2)).xxxx); +} diff --git a/test/expressions/splat/expression/i32.wgsl.expected.msl b/test/expressions/splat/expression/i32.wgsl.expected.msl new file mode 100644 index 0000000000..ad7738ca83 --- /dev/null +++ b/test/expressions/splat/expression/i32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + int2 v2 = int2((1 + 2)); + int3 v3 = int3((1 + 2)); + int4 v4 = int4((1 + 2)); +} + diff --git a/test/expressions/splat/expression/i32.wgsl.expected.spvasm b/test/expressions/splat/expression/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..83c14c2da8 --- /dev/null +++ b/test/expressions/splat/expression/i32.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %15 = OpConstantNull %v2int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %v3int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %27 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2int Function %15 + %v3 = OpVariable %_ptr_Function_v3int Function %21 + %v4 = OpVariable %_ptr_Function_v4int Function %27 + %11 = OpIAdd %int %int_1 %int_2 + %12 = OpCompositeConstruct %v2int %11 %11 + OpStore %v2 %12 + %17 = OpIAdd %int %int_1 %int_2 + %18 = OpCompositeConstruct %v3int %17 %17 %17 + OpStore %v3 %18 + %23 = OpIAdd %int %int_1 %int_2 + %24 = OpCompositeConstruct %v4int %23 %23 %23 %23 + OpStore %v4 %24 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/expression/i32.wgsl.expected.wgsl b/test/expressions/splat/expression/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9d0247e9e --- /dev/null +++ b/test/expressions/splat/expression/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2((1 + 2)); + var v3 : vec3 = vec3((1 + 2)); + var v4 : vec4 = vec4((1 + 2)); +} diff --git a/test/expressions/splat/expression/u32.wgsl b/test/expressions/splat/expression/u32.wgsl new file mode 100644 index 0000000000..96d76b935e --- /dev/null +++ b/test/expressions/splat/expression/u32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1u + 2u); + var v3 : vec3 = vec3(1u + 2u); + var v4 : vec4 = vec4(1u + 2u); +} diff --git a/test/expressions/splat/expression/u32.wgsl.expected.hlsl b/test/expressions/splat/expression/u32.wgsl.expected.hlsl new file mode 100644 index 0000000000..afbc8e2e88 --- /dev/null +++ b/test/expressions/splat/expression/u32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = uint2(((1u + 2u)).xx); + uint3 v3 = uint3(((1u + 2u)).xxx); + uint4 v4 = uint4(((1u + 2u)).xxxx); +} diff --git a/test/expressions/splat/expression/u32.wgsl.expected.msl b/test/expressions/splat/expression/u32.wgsl.expected.msl new file mode 100644 index 0000000000..0bec34dd33 --- /dev/null +++ b/test/expressions/splat/expression/u32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + uint2 v2 = uint2((1u + 2u)); + uint3 v3 = uint3((1u + 2u)); + uint4 v4 = uint4((1u + 2u)); +} + diff --git a/test/expressions/splat/expression/u32.wgsl.expected.spvasm b/test/expressions/splat/expression/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..209c60ed3e --- /dev/null +++ b/test/expressions/splat/expression/u32.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %15 = OpConstantNull %v2uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpConstantNull %v3uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %27 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2uint Function %15 + %v3 = OpVariable %_ptr_Function_v3uint Function %21 + %v4 = OpVariable %_ptr_Function_v4uint Function %27 + %11 = OpIAdd %uint %uint_1 %uint_2 + %12 = OpCompositeConstruct %v2uint %11 %11 + OpStore %v2 %12 + %17 = OpIAdd %uint %uint_1 %uint_2 + %18 = OpCompositeConstruct %v3uint %17 %17 %17 + OpStore %v3 %18 + %23 = OpIAdd %uint %uint_1 %uint_2 + %24 = OpCompositeConstruct %v4uint %23 %23 %23 %23 + OpStore %v4 %24 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/expression/u32.wgsl.expected.wgsl b/test/expressions/splat/expression/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..92f8f6899b --- /dev/null +++ b/test/expressions/splat/expression/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2((1u + 2u)); + var v3 : vec3 = vec3((1u + 2u)); + var v4 : vec4 = vec4((1u + 2u)); +} diff --git a/test/expressions/splat/immediate/bool.wgsl b/test/expressions/splat/immediate/bool.wgsl new file mode 100644 index 0000000000..2c4233b521 --- /dev/null +++ b/test/expressions/splat/immediate/bool.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(true); + var v3 : vec3 = vec3(true); + var v4 : vec4 = vec4(true); +} diff --git a/test/expressions/splat/immediate/bool.wgsl.expected.hlsl b/test/expressions/splat/immediate/bool.wgsl.expected.hlsl new file mode 100644 index 0000000000..c00d526492 --- /dev/null +++ b/test/expressions/splat/immediate/bool.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool2 v2 = bool2((true).xx); + bool3 v3 = bool3((true).xxx); + bool4 v4 = bool4((true).xxxx); +} diff --git a/test/expressions/splat/immediate/bool.wgsl.expected.msl b/test/expressions/splat/immediate/bool.wgsl.expected.msl new file mode 100644 index 0000000000..f4cb400eca --- /dev/null +++ b/test/expressions/splat/immediate/bool.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + bool2 v2 = bool2(true); + bool3 v3 = bool3(true); + bool4 v4 = bool4(true); +} + diff --git a/test/expressions/splat/immediate/bool.wgsl.expected.spvasm b/test/expressions/splat/immediate/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..703affae22 --- /dev/null +++ b/test/expressions/splat/immediate/bool.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %10 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %13 = OpConstantNull %v2bool + %v3bool = OpTypeVector %bool 3 + %15 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %18 = OpConstantNull %v3bool + %v4bool = OpTypeVector %bool 4 + %20 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %23 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2bool Function %13 + %v3 = OpVariable %_ptr_Function_v3bool Function %18 + %v4 = OpVariable %_ptr_Function_v4bool Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/immediate/bool.wgsl.expected.wgsl b/test/expressions/splat/immediate/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..844afc665f --- /dev/null +++ b/test/expressions/splat/immediate/bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(true); + var v3 : vec3 = vec3(true); + var v4 : vec4 = vec4(true); +} diff --git a/test/expressions/splat/immediate/f32.wgsl b/test/expressions/splat/immediate/f32.wgsl new file mode 100644 index 0000000000..4cf8f23b5c --- /dev/null +++ b/test/expressions/splat/immediate/f32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1.0); + var v3 : vec3 = vec3(1.0); + var v4 : vec4 = vec4(1.0); +} diff --git a/test/expressions/splat/immediate/f32.wgsl.expected.hlsl b/test/expressions/splat/immediate/f32.wgsl.expected.hlsl new file mode 100644 index 0000000000..c757ba2ce3 --- /dev/null +++ b/test/expressions/splat/immediate/f32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = float2((1.0f).xx); + float3 v3 = float3((1.0f).xxx); + float4 v4 = float4((1.0f).xxxx); +} diff --git a/test/expressions/splat/immediate/f32.wgsl.expected.msl b/test/expressions/splat/immediate/f32.wgsl.expected.msl new file mode 100644 index 0000000000..fed4ad42cd --- /dev/null +++ b/test/expressions/splat/immediate/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + float2 v2 = float2(1.0f); + float3 v3 = float3(1.0f); + float4 v4 = float4(1.0f); +} + diff --git a/test/expressions/splat/immediate/f32.wgsl.expected.spvasm b/test/expressions/splat/immediate/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..98a2d6217f --- /dev/null +++ b/test/expressions/splat/immediate/f32.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %10 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %13 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %v4float = OpTypeVector %float 4 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2float Function %13 + %v3 = OpVariable %_ptr_Function_v3float Function %18 + %v4 = OpVariable %_ptr_Function_v4float Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/immediate/f32.wgsl.expected.wgsl b/test/expressions/splat/immediate/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0dda448888 --- /dev/null +++ b/test/expressions/splat/immediate/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1.0); + var v3 : vec3 = vec3(1.0); + var v4 : vec4 = vec4(1.0); +} diff --git a/test/expressions/splat/immediate/i32.wgsl b/test/expressions/splat/immediate/i32.wgsl new file mode 100644 index 0000000000..adab1b584b --- /dev/null +++ b/test/expressions/splat/immediate/i32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1); + var v3 : vec3 = vec3(1); + var v4 : vec4 = vec4(1); +} diff --git a/test/expressions/splat/immediate/i32.wgsl.expected.hlsl b/test/expressions/splat/immediate/i32.wgsl.expected.hlsl new file mode 100644 index 0000000000..7598cd0283 --- /dev/null +++ b/test/expressions/splat/immediate/i32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = int2((1).xx); + int3 v3 = int3((1).xxx); + int4 v4 = int4((1).xxxx); +} diff --git a/test/expressions/splat/immediate/i32.wgsl.expected.msl b/test/expressions/splat/immediate/i32.wgsl.expected.msl new file mode 100644 index 0000000000..2916f0a3e6 --- /dev/null +++ b/test/expressions/splat/immediate/i32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + int2 v2 = int2(1); + int3 v3 = int3(1); + int4 v4 = int4(1); +} + diff --git a/test/expressions/splat/immediate/i32.wgsl.expected.spvasm b/test/expressions/splat/immediate/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd2497f732 --- /dev/null +++ b/test/expressions/splat/immediate/i32.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %10 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %13 = OpConstantNull %v2int + %v3int = OpTypeVector %int 3 + %15 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %18 = OpConstantNull %v3int + %v4int = OpTypeVector %int 4 + %20 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %23 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2int Function %13 + %v3 = OpVariable %_ptr_Function_v3int Function %18 + %v4 = OpVariable %_ptr_Function_v4int Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/immediate/i32.wgsl.expected.wgsl b/test/expressions/splat/immediate/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6b54d3c3cf --- /dev/null +++ b/test/expressions/splat/immediate/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1); + var v3 : vec3 = vec3(1); + var v4 : vec4 = vec4(1); +} diff --git a/test/expressions/splat/immediate/u32.wgsl b/test/expressions/splat/immediate/u32.wgsl new file mode 100644 index 0000000000..1cf3437342 --- /dev/null +++ b/test/expressions/splat/immediate/u32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1u); + var v3 : vec3 = vec3(1u); + var v4 : vec4 = vec4(1u); +} diff --git a/test/expressions/splat/immediate/u32.wgsl.expected.hlsl b/test/expressions/splat/immediate/u32.wgsl.expected.hlsl new file mode 100644 index 0000000000..3bb8b1fa9a --- /dev/null +++ b/test/expressions/splat/immediate/u32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = uint2((1u).xx); + uint3 v3 = uint3((1u).xxx); + uint4 v4 = uint4((1u).xxxx); +} diff --git a/test/expressions/splat/immediate/u32.wgsl.expected.msl b/test/expressions/splat/immediate/u32.wgsl.expected.msl new file mode 100644 index 0000000000..85728d9384 --- /dev/null +++ b/test/expressions/splat/immediate/u32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + uint2 v2 = uint2(1u); + uint3 v3 = uint3(1u); + uint4 v4 = uint4(1u); +} + diff --git a/test/expressions/splat/immediate/u32.wgsl.expected.spvasm b/test/expressions/splat/immediate/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fbabae1369 --- /dev/null +++ b/test/expressions/splat/immediate/u32.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %10 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %13 = OpConstantNull %v2uint + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %v4uint = OpTypeVector %uint 4 + %20 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %23 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2uint Function %13 + %v3 = OpVariable %_ptr_Function_v3uint Function %18 + %v4 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/immediate/u32.wgsl.expected.wgsl b/test/expressions/splat/immediate/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..65f96fa035 --- /dev/null +++ b/test/expressions/splat/immediate/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var v2 : vec2 = vec2(1u); + var v3 : vec3 = vec3(1u); + var v4 : vec4 = vec4(1u); +} diff --git a/test/expressions/splat/with_swizzle/f32.wgsl b/test/expressions/splat/with_swizzle/f32.wgsl new file mode 100644 index 0000000000..d9b9eff3df --- /dev/null +++ b/test/expressions/splat/with_swizzle/f32.wgsl @@ -0,0 +1,5 @@ +fn f() { + var a = vec2(1.0).y; + var b = vec3(1.0).z; + var c = vec4(1.0).w; +} diff --git a/test/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl b/test/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl new file mode 100644 index 0000000000..0ee0a3771a --- /dev/null +++ b/test/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float a = float2((1.0f).xx).y; + float b = float3((1.0f).xxx).z; + float c = float4((1.0f).xxxx).w; +} diff --git a/test/expressions/splat/with_swizzle/f32.wgsl.expected.msl b/test/expressions/splat/with_swizzle/f32.wgsl.expected.msl new file mode 100644 index 0000000000..64e4f8c447 --- /dev/null +++ b/test/expressions/splat/with_swizzle/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + float a = float2(1.0f).y; + float b = float3(1.0f).z; + float c = float4(1.0f).w; +} + diff --git a/test/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm b/test/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe1995c1aa --- /dev/null +++ b/test/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %c "c" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %10 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %v3float = OpTypeVector %float 3 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v4float = OpTypeVector %float 4 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %a = OpVariable %_ptr_Function_float Function %14 + %b = OpVariable %_ptr_Function_float Function %14 + %c = OpVariable %_ptr_Function_float Function %14 + %11 = OpCompositeExtract %float %10 1 + OpStore %a %11 + %17 = OpCompositeExtract %float %16 2 + OpStore %b %17 + %21 = OpCompositeExtract %float %20 3 + OpStore %c %21 + OpReturn + OpFunctionEnd diff --git a/test/expressions/splat/with_swizzle/f32.wgsl.expected.wgsl b/test/expressions/splat/with_swizzle/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..66e437b538 --- /dev/null +++ b/test/expressions/splat/with_swizzle/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +fn f() { + var a = vec2(1.0).y; + var b = vec3(1.0).z; + var c = vec4(1.0).w; +} diff --git a/test/var/splat.wgsl b/test/var/splat.wgsl deleted file mode 100644 index 1ede944927..0000000000 --- a/test/var/splat.wgsl +++ /dev/null @@ -1,91 +0,0 @@ -var g_v2 : vec2 = vec2(1.0); -var g_v3 : vec3 = vec3(1.0); -var g_v4 : vec4 = vec4(1.0); - -fn from_immediate_bool() { - var v2 : vec2 = vec2(true); - var v3 : vec3 = vec3(true); - var v4 : vec4 = vec4(true); -} - -fn from_immediate_f32() { - var v2 : vec2 = vec2(1.0); - var v3 : vec3 = vec3(1.0); - var v4 : vec4 = vec4(1.0); -} - -fn from_immediate_i32() { - var v2 : vec2 = vec2(1); - var v3 : vec3 = vec3(1); - var v4 : vec4 = vec4(1); -} - -fn from_immediate_u32() { - var v2 : vec2 = vec2(1u); - var v3 : vec3 = vec3(1u); - var v4 : vec4 = vec4(1u); -} - -fn from_expression_bool() { - var v2 : vec2 = vec2(true); - var v3 : vec3 = vec3(true); - var v4 : vec4 = vec4(true); -} - -fn from_expression_f32() { - var v2 : vec2 = vec2(1.0 + 2.0); - var v3 : vec3 = vec3(1.0 + 2.0); - var v4 : vec4 = vec4(1.0 + 2.0); -} - -fn from_expression_i32() { - var v2 : vec2 = vec2(1 + 2); - var v3 : vec3 = vec3(1 + 2); - var v4 : vec4 = vec4(1 + 2); -} - -fn from_expression_u32() { - var v2 : vec2 = vec2(1u + 2u); - var v3 : vec3 = vec3(1u + 2u); - var v4 : vec4 = vec4(1u + 2u); -} - -fn get_bool() -> bool { return true; } -fn get_f32() -> f32 { return 1.0; } -fn get_i32() -> i32 { return 1; } -fn get_u32() -> u32 { return 1u; } - -fn from_call_bool() { - var v2 : vec2 = vec2(get_bool()); - var v3 : vec3 = vec3(get_bool()); - var v4 : vec4 = vec4(get_bool()); -} - -fn from_call_f32() { - var v2 : vec2 = vec2(get_f32()); - var v3 : vec3 = vec3(get_f32()); - var v4 : vec4 = vec4(get_f32()); -} - -fn from_call_i32() { - var v2 : vec2 = vec2(get_i32()); - var v3 : vec3 = vec3(get_i32()); - var v4 : vec4 = vec4(get_i32()); -} - -fn from_call_u32() { - var v2 : vec2 = vec2(get_u32()); - var v3 : vec3 = vec3(get_u32()); - var v4 : vec4 = vec4(get_u32()); -} - -fn with_swizzle() { - var a = vec2(1.0).y; - var b = vec3(1.0).z; - var c = vec4(1.0).w; -} - -[[stage(fragment)]] -fn main() -> [[location(0)]] vec4 { - return vec4(0.0,0.0,0.0,0.0); -} diff --git a/test/var/splat.wgsl.expected.hlsl b/test/var/splat.wgsl.expected.hlsl deleted file mode 100644 index d0e88b8e16..0000000000 --- a/test/var/splat.wgsl.expected.hlsl +++ /dev/null @@ -1,106 +0,0 @@ -static float2 g_v2 = float2((1.0f).xx); -static float3 g_v3 = float3((1.0f).xxx); -static float4 g_v4 = float4((1.0f).xxxx); - -void from_immediate_bool() { - bool2 v2 = bool2((true).xx); - bool3 v3 = bool3((true).xxx); - bool4 v4 = bool4((true).xxxx); -} - -void from_immediate_f32() { - float2 v2 = float2((1.0f).xx); - float3 v3 = float3((1.0f).xxx); - float4 v4 = float4((1.0f).xxxx); -} - -void from_immediate_i32() { - int2 v2 = int2((1).xx); - int3 v3 = int3((1).xxx); - int4 v4 = int4((1).xxxx); -} - -void from_immediate_u32() { - uint2 v2 = uint2((1u).xx); - uint3 v3 = uint3((1u).xxx); - uint4 v4 = uint4((1u).xxxx); -} - -void from_expression_bool() { - bool2 v2 = bool2((true).xx); - bool3 v3 = bool3((true).xxx); - bool4 v4 = bool4((true).xxxx); -} - -void from_expression_f32() { - float2 v2 = float2(((1.0f + 2.0f)).xx); - float3 v3 = float3(((1.0f + 2.0f)).xxx); - float4 v4 = float4(((1.0f + 2.0f)).xxxx); -} - -void from_expression_i32() { - int2 v2 = int2(((1 + 2)).xx); - int3 v3 = int3(((1 + 2)).xxx); - int4 v4 = int4(((1 + 2)).xxxx); -} - -void from_expression_u32() { - uint2 v2 = uint2(((1u + 2u)).xx); - uint3 v3 = uint3(((1u + 2u)).xxx); - uint4 v4 = uint4(((1u + 2u)).xxxx); -} - -bool get_bool() { - return true; -} - -float get_f32() { - return 1.0f; -} - -int get_i32() { - return 1; -} - -uint get_u32() { - return 1u; -} - -void from_call_bool() { - bool2 v2 = bool2((get_bool()).xx); - bool3 v3 = bool3((get_bool()).xxx); - bool4 v4 = bool4((get_bool()).xxxx); -} - -void from_call_f32() { - float2 v2 = float2((get_f32()).xx); - float3 v3 = float3((get_f32()).xxx); - float4 v4 = float4((get_f32()).xxxx); -} - -void from_call_i32() { - int2 v2 = int2((get_i32()).xx); - int3 v3 = int3((get_i32()).xxx); - int4 v4 = int4((get_i32()).xxxx); -} - -void from_call_u32() { - uint2 v2 = uint2((get_u32()).xx); - uint3 v3 = uint3((get_u32()).xxx); - uint4 v4 = uint4((get_u32()).xxxx); -} - -void with_swizzle() { - float a = float2((1.0f).xx).y; - float b = float3((1.0f).xxx).z; - float c = float4((1.0f).xxxx).w; -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -tint_symbol main() { - const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; - return tint_symbol_1; -} diff --git a/test/var/splat.wgsl.expected.msl b/test/var/splat.wgsl.expected.msl deleted file mode 100644 index bd8803e7a6..0000000000 --- a/test/var/splat.wgsl.expected.msl +++ /dev/null @@ -1,106 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - float4 value [[color(0)]]; -}; - -void from_immediate_bool() { - bool2 v2 = bool2(true); - bool3 v3 = bool3(true); - bool4 v4 = bool4(true); -} - -void from_immediate_f32() { - float2 v2 = float2(1.0f); - float3 v3 = float3(1.0f); - float4 v4 = float4(1.0f); -} - -void from_immediate_i32() { - int2 v2 = int2(1); - int3 v3 = int3(1); - int4 v4 = int4(1); -} - -void from_immediate_u32() { - uint2 v2 = uint2(1u); - uint3 v3 = uint3(1u); - uint4 v4 = uint4(1u); -} - -void from_expression_bool() { - bool2 v2 = bool2(true); - bool3 v3 = bool3(true); - bool4 v4 = bool4(true); -} - -void from_expression_f32() { - float2 v2 = float2((1.0f + 2.0f)); - float3 v3 = float3((1.0f + 2.0f)); - float4 v4 = float4((1.0f + 2.0f)); -} - -void from_expression_i32() { - int2 v2 = int2((1 + 2)); - int3 v3 = int3((1 + 2)); - int4 v4 = int4((1 + 2)); -} - -void from_expression_u32() { - uint2 v2 = uint2((1u + 2u)); - uint3 v3 = uint3((1u + 2u)); - uint4 v4 = uint4((1u + 2u)); -} - -bool get_bool() { - return true; -} - -float get_f32() { - return 1.0f; -} - -int get_i32() { - return 1; -} - -uint get_u32() { - return 1u; -} - -void from_call_bool() { - bool2 v2 = bool2(get_bool()); - bool3 v3 = bool3(get_bool()); - bool4 v4 = bool4(get_bool()); -} - -void from_call_f32() { - float2 v2 = float2(get_f32()); - float3 v3 = float3(get_f32()); - float4 v4 = float4(get_f32()); -} - -void from_call_i32() { - int2 v2 = int2(get_i32()); - int3 v3 = int3(get_i32()); - int4 v4 = int4(get_i32()); -} - -void from_call_u32() { - uint2 v2 = uint2(get_u32()); - uint3 v3 = uint3(get_u32()); - uint4 v4 = uint4(get_u32()); -} - -void with_swizzle() { - float a = float2(1.0f).y; - float b = float3(1.0f).z; - float c = float4(1.0f).w; -} - -fragment tint_symbol_1 tint_symbol() { - tint_symbol_1 const tint_symbol_2 = {.value=float4(0.0f, 0.0f, 0.0f, 0.0f)}; - return tint_symbol_2; -} - diff --git a/test/var/splat.wgsl.expected.spvasm b/test/var/splat.wgsl.expected.spvasm deleted file mode 100644 index 5ac13ce36a..0000000000 --- a/test/var/splat.wgsl.expected.spvasm +++ /dev/null @@ -1,353 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 203 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %tint_symbol_1 - OpExecutionMode %main OriginUpperLeft - OpName %g_v2 "g_v2" - OpName %g_v3 "g_v3" - OpName %g_v4 "g_v4" - OpName %tint_symbol_1 "tint_symbol_1" - OpName %from_immediate_bool "from_immediate_bool" - OpName %v2 "v2" - OpName %v3 "v3" - OpName %v4 "v4" - OpName %from_immediate_f32 "from_immediate_f32" - OpName %v2_0 "v2" - OpName %v3_0 "v3" - OpName %v4_0 "v4" - OpName %from_immediate_i32 "from_immediate_i32" - OpName %v2_1 "v2" - OpName %v3_1 "v3" - OpName %v4_1 "v4" - OpName %from_immediate_u32 "from_immediate_u32" - OpName %v2_2 "v2" - OpName %v3_2 "v3" - OpName %v4_2 "v4" - OpName %from_expression_bool "from_expression_bool" - OpName %v2_3 "v2" - OpName %v3_3 "v3" - OpName %v4_3 "v4" - OpName %from_expression_f32 "from_expression_f32" - OpName %v2_4 "v2" - OpName %v3_4 "v3" - OpName %v4_4 "v4" - OpName %from_expression_i32 "from_expression_i32" - OpName %v2_5 "v2" - OpName %v3_5 "v3" - OpName %v4_5 "v4" - OpName %from_expression_u32 "from_expression_u32" - OpName %v2_6 "v2" - OpName %v3_6 "v3" - OpName %v4_6 "v4" - OpName %get_bool "get_bool" - OpName %get_f32 "get_f32" - OpName %get_i32 "get_i32" - OpName %get_u32 "get_u32" - OpName %from_call_bool "from_call_bool" - OpName %v2_7 "v2" - OpName %v3_7 "v3" - OpName %v4_7 "v4" - OpName %from_call_f32 "from_call_f32" - OpName %v2_8 "v2" - OpName %v3_8 "v3" - OpName %v4_8 "v4" - OpName %from_call_i32 "from_call_i32" - OpName %v2_9 "v2" - OpName %v3_9 "v3" - OpName %v4_9 "v4" - OpName %from_call_u32 "from_call_u32" - OpName %v2_10 "v2" - OpName %v3_10 "v3" - OpName %v4_10 "v4" - OpName %with_swizzle "with_swizzle" - OpName %a "a" - OpName %b "b" - OpName %c "c" - OpName %tint_symbol_2 "tint_symbol_2" - OpName %tint_symbol "tint_symbol" - OpName %main "main" - OpDecorate %tint_symbol_1 Location 0 - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %4 = OpConstantComposite %v2float %float_1 %float_1 -%_ptr_Private_v2float = OpTypePointer Private %v2float - %g_v2 = OpVariable %_ptr_Private_v2float Private %4 - %v3float = OpTypeVector %float 3 - %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 -%_ptr_Private_v3float = OpTypePointer Private %v3float - %g_v3 = OpVariable %_ptr_Private_v3float Private %8 - %v4float = OpTypeVector %float 4 - %12 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 -%_ptr_Private_v4float = OpTypePointer Private %v4float - %g_v4 = OpVariable %_ptr_Private_v4float Private %12 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %17 = OpConstantNull %v4float -%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 - %void = OpTypeVoid - %18 = OpTypeFunction %void - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %true = OpConstantTrue %bool - %25 = OpConstantComposite %v2bool %true %true -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %28 = OpConstantNull %v2bool - %v3bool = OpTypeVector %bool 3 - %30 = OpConstantComposite %v3bool %true %true %true -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %33 = OpConstantNull %v3bool - %v4bool = OpTypeVector %bool 4 - %35 = OpConstantComposite %v4bool %true %true %true %true -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %38 = OpConstantNull %v4bool -%_ptr_Function_v2float = OpTypePointer Function %v2float - %43 = OpConstantNull %v2float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %46 = OpConstantNull %v3float -%_ptr_Function_v4float = OpTypePointer Function %v4float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_1 = OpConstant %int 1 - %54 = OpConstantComposite %v2int %int_1 %int_1 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %57 = OpConstantNull %v2int - %v3int = OpTypeVector %int 3 - %59 = OpConstantComposite %v3int %int_1 %int_1 %int_1 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %62 = OpConstantNull %v3int - %v4int = OpTypeVector %int 4 - %64 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %67 = OpConstantNull %v4int - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %uint_1 = OpConstant %uint 1 - %73 = OpConstantComposite %v2uint %uint_1 %uint_1 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %76 = OpConstantNull %v2uint - %v3uint = OpTypeVector %uint 3 - %78 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %81 = OpConstantNull %v3uint - %v4uint = OpTypeVector %uint 4 - %83 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %86 = OpConstantNull %v4uint - %float_2 = OpConstant %float 2 - %int_2 = OpConstant %int 2 - %uint_2 = OpConstant %uint 2 - %128 = OpTypeFunction %bool - %131 = OpTypeFunction %float - %134 = OpTypeFunction %int - %137 = OpTypeFunction %uint -%_ptr_Function_float = OpTypePointer Function %float - %189 = OpConstantNull %float - %194 = OpTypeFunction %void %v4float - %float_0 = OpConstant %float 0 - %202 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 -%from_immediate_bool = OpFunction %void None %18 - %21 = OpLabel - %v2 = OpVariable %_ptr_Function_v2bool Function %28 - %v3 = OpVariable %_ptr_Function_v3bool Function %33 - %v4 = OpVariable %_ptr_Function_v4bool Function %38 - OpStore %v2 %25 - OpStore %v3 %30 - OpStore %v4 %35 - OpReturn - OpFunctionEnd -%from_immediate_f32 = OpFunction %void None %18 - %40 = OpLabel - %v2_0 = OpVariable %_ptr_Function_v2float Function %43 - %v3_0 = OpVariable %_ptr_Function_v3float Function %46 - %v4_0 = OpVariable %_ptr_Function_v4float Function %17 - OpStore %v2_0 %4 - OpStore %v3_0 %8 - OpStore %v4_0 %12 - OpReturn - OpFunctionEnd -%from_immediate_i32 = OpFunction %void None %18 - %50 = OpLabel - %v2_1 = OpVariable %_ptr_Function_v2int Function %57 - %v3_1 = OpVariable %_ptr_Function_v3int Function %62 - %v4_1 = OpVariable %_ptr_Function_v4int Function %67 - OpStore %v2_1 %54 - OpStore %v3_1 %59 - OpStore %v4_1 %64 - OpReturn - OpFunctionEnd -%from_immediate_u32 = OpFunction %void None %18 - %69 = OpLabel - %v2_2 = OpVariable %_ptr_Function_v2uint Function %76 - %v3_2 = OpVariable %_ptr_Function_v3uint Function %81 - %v4_2 = OpVariable %_ptr_Function_v4uint Function %86 - OpStore %v2_2 %73 - OpStore %v3_2 %78 - OpStore %v4_2 %83 - OpReturn - OpFunctionEnd -%from_expression_bool = OpFunction %void None %18 - %88 = OpLabel - %v2_3 = OpVariable %_ptr_Function_v2bool Function %28 - %v3_3 = OpVariable %_ptr_Function_v3bool Function %33 - %v4_3 = OpVariable %_ptr_Function_v4bool Function %38 - OpStore %v2_3 %25 - OpStore %v3_3 %30 - OpStore %v4_3 %35 - OpReturn - OpFunctionEnd -%from_expression_f32 = OpFunction %void None %18 - %93 = OpLabel - %v2_4 = OpVariable %_ptr_Function_v2float Function %43 - %v3_4 = OpVariable %_ptr_Function_v3float Function %46 - %v4_4 = OpVariable %_ptr_Function_v4float Function %17 - %95 = OpFAdd %float %float_1 %float_2 - %96 = OpCompositeConstruct %v2float %95 %95 - OpStore %v2_4 %96 - %98 = OpFAdd %float %float_1 %float_2 - %99 = OpCompositeConstruct %v3float %98 %98 %98 - OpStore %v3_4 %99 - %101 = OpFAdd %float %float_1 %float_2 - %102 = OpCompositeConstruct %v4float %101 %101 %101 %101 - OpStore %v4_4 %102 - OpReturn - OpFunctionEnd -%from_expression_i32 = OpFunction %void None %18 - %105 = OpLabel - %v2_5 = OpVariable %_ptr_Function_v2int Function %57 - %v3_5 = OpVariable %_ptr_Function_v3int Function %62 - %v4_5 = OpVariable %_ptr_Function_v4int Function %67 - %107 = OpIAdd %int %int_1 %int_2 - %108 = OpCompositeConstruct %v2int %107 %107 - OpStore %v2_5 %108 - %110 = OpIAdd %int %int_1 %int_2 - %111 = OpCompositeConstruct %v3int %110 %110 %110 - OpStore %v3_5 %111 - %113 = OpIAdd %int %int_1 %int_2 - %114 = OpCompositeConstruct %v4int %113 %113 %113 %113 - OpStore %v4_5 %114 - OpReturn - OpFunctionEnd -%from_expression_u32 = OpFunction %void None %18 - %117 = OpLabel - %v2_6 = OpVariable %_ptr_Function_v2uint Function %76 - %v3_6 = OpVariable %_ptr_Function_v3uint Function %81 - %v4_6 = OpVariable %_ptr_Function_v4uint Function %86 - %119 = OpIAdd %uint %uint_1 %uint_2 - %120 = OpCompositeConstruct %v2uint %119 %119 - OpStore %v2_6 %120 - %122 = OpIAdd %uint %uint_1 %uint_2 - %123 = OpCompositeConstruct %v3uint %122 %122 %122 - OpStore %v3_6 %123 - %125 = OpIAdd %uint %uint_1 %uint_2 - %126 = OpCompositeConstruct %v4uint %125 %125 %125 %125 - OpStore %v4_6 %126 - OpReturn - OpFunctionEnd - %get_bool = OpFunction %bool None %128 - %130 = OpLabel - OpReturnValue %true - OpFunctionEnd - %get_f32 = OpFunction %float None %131 - %133 = OpLabel - OpReturnValue %float_1 - OpFunctionEnd - %get_i32 = OpFunction %int None %134 - %136 = OpLabel - OpReturnValue %int_1 - OpFunctionEnd - %get_u32 = OpFunction %uint None %137 - %139 = OpLabel - OpReturnValue %uint_1 - OpFunctionEnd -%from_call_bool = OpFunction %void None %18 - %141 = OpLabel - %v2_7 = OpVariable %_ptr_Function_v2bool Function %28 - %v3_7 = OpVariable %_ptr_Function_v3bool Function %33 - %v4_7 = OpVariable %_ptr_Function_v4bool Function %38 - %142 = OpFunctionCall %bool %get_bool - %143 = OpCompositeConstruct %v2bool %142 %142 - OpStore %v2_7 %143 - %145 = OpFunctionCall %bool %get_bool - %146 = OpCompositeConstruct %v3bool %145 %145 %145 - OpStore %v3_7 %146 - %148 = OpFunctionCall %bool %get_bool - %149 = OpCompositeConstruct %v4bool %148 %148 %148 %148 - OpStore %v4_7 %149 - OpReturn - OpFunctionEnd -%from_call_f32 = OpFunction %void None %18 - %152 = OpLabel - %v2_8 = OpVariable %_ptr_Function_v2float Function %43 - %v3_8 = OpVariable %_ptr_Function_v3float Function %46 - %v4_8 = OpVariable %_ptr_Function_v4float Function %17 - %153 = OpFunctionCall %float %get_f32 - %154 = OpCompositeConstruct %v2float %153 %153 - OpStore %v2_8 %154 - %156 = OpFunctionCall %float %get_f32 - %157 = OpCompositeConstruct %v3float %156 %156 %156 - OpStore %v3_8 %157 - %159 = OpFunctionCall %float %get_f32 - %160 = OpCompositeConstruct %v4float %159 %159 %159 %159 - OpStore %v4_8 %160 - OpReturn - OpFunctionEnd -%from_call_i32 = OpFunction %void None %18 - %163 = OpLabel - %v2_9 = OpVariable %_ptr_Function_v2int Function %57 - %v3_9 = OpVariable %_ptr_Function_v3int Function %62 - %v4_9 = OpVariable %_ptr_Function_v4int Function %67 - %164 = OpFunctionCall %int %get_i32 - %165 = OpCompositeConstruct %v2int %164 %164 - OpStore %v2_9 %165 - %167 = OpFunctionCall %int %get_i32 - %168 = OpCompositeConstruct %v3int %167 %167 %167 - OpStore %v3_9 %168 - %170 = OpFunctionCall %int %get_i32 - %171 = OpCompositeConstruct %v4int %170 %170 %170 %170 - OpStore %v4_9 %171 - OpReturn - OpFunctionEnd -%from_call_u32 = OpFunction %void None %18 - %174 = OpLabel - %v2_10 = OpVariable %_ptr_Function_v2uint Function %76 - %v3_10 = OpVariable %_ptr_Function_v3uint Function %81 - %v4_10 = OpVariable %_ptr_Function_v4uint Function %86 - %175 = OpFunctionCall %uint %get_u32 - %176 = OpCompositeConstruct %v2uint %175 %175 - OpStore %v2_10 %176 - %178 = OpFunctionCall %uint %get_u32 - %179 = OpCompositeConstruct %v3uint %178 %178 %178 - OpStore %v3_10 %179 - %181 = OpFunctionCall %uint %get_u32 - %182 = OpCompositeConstruct %v4uint %181 %181 %181 %181 - OpStore %v4_10 %182 - OpReturn - OpFunctionEnd -%with_swizzle = OpFunction %void None %18 - %185 = OpLabel - %a = OpVariable %_ptr_Function_float Function %189 - %b = OpVariable %_ptr_Function_float Function %189 - %c = OpVariable %_ptr_Function_float Function %189 - %186 = OpCompositeExtract %float %4 1 - OpStore %a %186 - %190 = OpCompositeExtract %float %8 2 - OpStore %b %190 - %192 = OpCompositeExtract %float %12 3 - OpStore %c %192 - OpReturn - OpFunctionEnd -%tint_symbol_2 = OpFunction %void None %194 -%tint_symbol = OpFunctionParameter %v4float - %197 = OpLabel - OpStore %tint_symbol_1 %tint_symbol - OpReturn - OpFunctionEnd - %main = OpFunction %void None %18 - %199 = OpLabel - %200 = OpFunctionCall %void %tint_symbol_2 %202 - OpReturn - OpFunctionEnd diff --git a/test/var/splat.wgsl.expected.wgsl b/test/var/splat.wgsl.expected.wgsl deleted file mode 100644 index 9adddf96e6..0000000000 --- a/test/var/splat.wgsl.expected.wgsl +++ /dev/null @@ -1,104 +0,0 @@ -var g_v2 : vec2 = vec2(1.0); - -var g_v3 : vec3 = vec3(1.0); - -var g_v4 : vec4 = vec4(1.0); - -fn from_immediate_bool() { - var v2 : vec2 = vec2(true); - var v3 : vec3 = vec3(true); - var v4 : vec4 = vec4(true); -} - -fn from_immediate_f32() { - var v2 : vec2 = vec2(1.0); - var v3 : vec3 = vec3(1.0); - var v4 : vec4 = vec4(1.0); -} - -fn from_immediate_i32() { - var v2 : vec2 = vec2(1); - var v3 : vec3 = vec3(1); - var v4 : vec4 = vec4(1); -} - -fn from_immediate_u32() { - var v2 : vec2 = vec2(1u); - var v3 : vec3 = vec3(1u); - var v4 : vec4 = vec4(1u); -} - -fn from_expression_bool() { - var v2 : vec2 = vec2(true); - var v3 : vec3 = vec3(true); - var v4 : vec4 = vec4(true); -} - -fn from_expression_f32() { - var v2 : vec2 = vec2((1.0 + 2.0)); - var v3 : vec3 = vec3((1.0 + 2.0)); - var v4 : vec4 = vec4((1.0 + 2.0)); -} - -fn from_expression_i32() { - var v2 : vec2 = vec2((1 + 2)); - var v3 : vec3 = vec3((1 + 2)); - var v4 : vec4 = vec4((1 + 2)); -} - -fn from_expression_u32() { - var v2 : vec2 = vec2((1u + 2u)); - var v3 : vec3 = vec3((1u + 2u)); - var v4 : vec4 = vec4((1u + 2u)); -} - -fn get_bool() -> bool { - return true; -} - -fn get_f32() -> f32 { - return 1.0; -} - -fn get_i32() -> i32 { - return 1; -} - -fn get_u32() -> u32 { - return 1u; -} - -fn from_call_bool() { - var v2 : vec2 = vec2(get_bool()); - var v3 : vec3 = vec3(get_bool()); - var v4 : vec4 = vec4(get_bool()); -} - -fn from_call_f32() { - var v2 : vec2 = vec2(get_f32()); - var v3 : vec3 = vec3(get_f32()); - var v4 : vec4 = vec4(get_f32()); -} - -fn from_call_i32() { - var v2 : vec2 = vec2(get_i32()); - var v3 : vec3 = vec3(get_i32()); - var v4 : vec4 = vec4(get_i32()); -} - -fn from_call_u32() { - var v2 : vec2 = vec2(get_u32()); - var v3 : vec3 = vec3(get_u32()); - var v4 : vec4 = vec4(get_u32()); -} - -fn with_swizzle() { - var a = vec2(1.0).y; - var b = vec3(1.0).z; - var c = vec4(1.0).w; -} - -[[stage(fragment)]] -fn main() -> [[location(0)]] vec4 { - return vec4(0.0, 0.0, 0.0, 0.0); -}