test: Add matrix constructor tests that take a vector

Bug: tint:1334
Change-Id: I7e625da4bd270b6d0bfdb43fbd8dbe41682180f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72141
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..b2ceabf
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl
@@ -0,0 +1,2 @@
+let m = mat2x2<f32>(vec2<f32>(0.0, 1.0),
+                    vec2<f32>(2.0, 3.0));
diff --git a/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..c2e0d31
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
diff --git a/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..e33850f
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
diff --git a/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..16c6345
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+          %6 = OpConstantComposite %v2float %float_0 %float_1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %9 = OpConstantComposite %v2float %float_2 %float_3
+          %m = OpConstantComposite %mat2v2float %6 %9
+       %void = OpTypeVoid
+         %11 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %11
+         %14 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..5da680b
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat2x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0));
diff --git a/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..ffa6470
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl
@@ -0,0 +1,2 @@
+let m = mat2x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
+                    vec3<f32>(3.0, 4.0, 5.0));
diff --git a/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..fb12d01
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
diff --git a/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..86b17e2
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
diff --git a/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..d99921c
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+          %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2
+    %float_3 = OpConstant %float 3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+         %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+          %m = OpConstantComposite %mat2v3float %7 %11
+       %void = OpTypeVoid
+         %13 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %13
+         %16 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..2e36381
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat2x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0));
diff --git a/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..0a9b59a
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl
@@ -0,0 +1,2 @@
+let m = mat2x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
+                    vec4<f32>(4.0, 5.0, 6.0, 7.0));
diff --git a/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..5ed2b1b
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..684918a
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..57110c5
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+         %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+          %m = OpConstantComposite %mat2v4float %8 %13
+       %void = OpTypeVoid
+         %15 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %15
+         %18 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..a3a8fd3
--- /dev/null
+++ b/test/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat2x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0));
diff --git a/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..2afe85b
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl
@@ -0,0 +1,3 @@
+let m = mat3x2<f32>(vec2<f32>(0.0, 1.0),
+                    vec2<f32>(2.0, 3.0),
+                    vec2<f32>(4.0, 5.0));
diff --git a/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..27568ed
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
diff --git a/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..04aad8e
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
diff --git a/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..ffaa504
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+          %6 = OpConstantComposite %v2float %float_0 %float_1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %9 = OpConstantComposite %v2float %float_2 %float_3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+         %12 = OpConstantComposite %v2float %float_4 %float_5
+          %m = OpConstantComposite %mat3v2float %6 %9 %12
+       %void = OpTypeVoid
+         %14 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %14
+         %17 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..23a270e
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat3x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0), vec2<f32>(4.0, 5.0));
diff --git a/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..fd4d236
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl
@@ -0,0 +1,3 @@
+let m = mat3x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
+                    vec3<f32>(3.0, 4.0, 5.0),
+                    vec3<f32>(6.0, 7.0, 8.0));
diff --git a/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..c35ca2a
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
diff --git a/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..c8c096a
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
diff --git a/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..8ec1da4
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+          %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2
+    %float_3 = OpConstant %float 3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+         %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+    %float_8 = OpConstant %float 8
+         %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+          %m = OpConstantComposite %mat3v3float %7 %11 %15
+       %void = OpTypeVoid
+         %17 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %17
+         %20 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..9a9a20f
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat3x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0), vec3<f32>(6.0, 7.0, 8.0));
diff --git a/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..0551705
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl
@@ -0,0 +1,3 @@
+let m = mat3x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
+                    vec4<f32>(4.0, 5.0, 6.0, 7.0),
+                    vec4<f32>(8.0, 9.0, 10.0, 11.0));
diff --git a/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..fae68df
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..114cb09
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..b6ff57d
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,36 @@
+; 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 %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+         %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+    %float_8 = OpConstant %float 8
+    %float_9 = OpConstant %float 9
+   %float_10 = OpConstant %float 10
+   %float_11 = OpConstant %float 11
+         %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+          %m = OpConstantComposite %mat3v4float %8 %13 %18
+       %void = OpTypeVoid
+         %20 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %20
+         %23 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c51aa6
--- /dev/null
+++ b/test/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat3x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0), vec4<f32>(8.0, 9.0, 10.0, 11.0));
diff --git a/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..a1a32f8
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl
@@ -0,0 +1,4 @@
+let m = mat4x2<f32>(vec2<f32>(0.0, 1.0),
+                    vec2<f32>(2.0, 3.0),
+                    vec2<f32>(4.0, 5.0),
+                    vec2<f32>(6.0, 7.0));
diff --git a/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..2acab36
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
diff --git a/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..0df65ff
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
diff --git a/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..c6a6c63
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v2float = OpTypeVector %float 2
+%mat4v2float = OpTypeMatrix %v2float 4
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+          %6 = OpConstantComposite %v2float %float_0 %float_1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %9 = OpConstantComposite %v2float %float_2 %float_3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+         %12 = OpConstantComposite %v2float %float_4 %float_5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+         %15 = OpConstantComposite %v2float %float_6 %float_7
+          %m = OpConstantComposite %mat4v2float %6 %9 %12 %15
+       %void = OpTypeVoid
+         %17 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %17
+         %20 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..dea4919
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat4x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0), vec2<f32>(4.0, 5.0), vec2<f32>(6.0, 7.0));
diff --git a/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..7f218e1
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl
@@ -0,0 +1,4 @@
+let m = mat4x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
+                    vec3<f32>(3.0, 4.0, 5.0),
+                    vec3<f32>(6.0, 7.0, 8.0),
+                    vec3<f32>(9.0, 10.0, 11.0));
diff --git a/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..254cc40
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
diff --git a/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..2a7c078
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
diff --git a/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..d99b492
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v3float = OpTypeVector %float 3
+%mat4v3float = OpTypeMatrix %v3float 4
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+          %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2
+    %float_3 = OpConstant %float 3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+         %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+    %float_8 = OpConstant %float 8
+         %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+    %float_9 = OpConstant %float 9
+   %float_10 = OpConstant %float 10
+   %float_11 = OpConstant %float 11
+         %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11
+          %m = OpConstantComposite %mat4v3float %7 %11 %15 %19
+       %void = OpTypeVoid
+         %21 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %21
+         %24 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..ae27122
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat4x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0), vec3<f32>(6.0, 7.0, 8.0), vec3<f32>(9.0, 10.0, 11.0));
diff --git a/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl
new file mode 100644
index 0000000..02b4118
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl
@@ -0,0 +1,4 @@
+let m = mat4x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
+                    vec4<f32>(4.0, 5.0, 6.0, 7.0),
+                    vec4<f32>(8.0, 9.0, 10.0, 11.0),
+                    vec4<f32>(12.0, 13.0, 14.0, 15.0));
diff --git a/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl
new file mode 100644
index 0000000..2707999
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl
@@ -0,0 +1,6 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+static const float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl
new file mode 100644
index 0000000..6fb51a2
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl
@@ -0,0 +1,4 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm
new file mode 100644
index 0000000..84a8f89
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
+               OpExecutionMode %unused_entry_point LocalSize 1 1 1
+               OpName %m "m"
+               OpName %unused_entry_point "unused_entry_point"
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%mat4v4float = OpTypeMatrix %v4float 4
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+          %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3
+    %float_4 = OpConstant %float 4
+    %float_5 = OpConstant %float 5
+    %float_6 = OpConstant %float 6
+    %float_7 = OpConstant %float 7
+         %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+    %float_8 = OpConstant %float 8
+    %float_9 = OpConstant %float 9
+   %float_10 = OpConstant %float 10
+   %float_11 = OpConstant %float 11
+         %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+   %float_12 = OpConstant %float 12
+   %float_13 = OpConstant %float 13
+   %float_14 = OpConstant %float 14
+   %float_15 = OpConstant %float 15
+         %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15
+          %m = OpConstantComposite %mat4v4float %8 %13 %18 %23
+       %void = OpTypeVoid
+         %25 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %25
+         %28 = OpLabel
+               OpReturn
+               OpFunctionEnd
diff --git a/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl
new file mode 100644
index 0000000..6bdb257
--- /dev/null
+++ b/test/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -0,0 +1 @@
+let m = mat4x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0), vec4<f32>(8.0, 9.0, 10.0, 11.0), vec4<f32>(12.0, 13.0, 14.0, 15.0));