[ir][msl] Emit swizzle, load/store vector element instructions

Add support for the ir sizzle, load/store vector element instructions.

Bug: tint:1967
Change-Id: I734fc6be226d62f95ee3221cbd6d3075dbeb8963
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/162267
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/msl/writer/printer/printer.cc b/src/tint/lang/msl/writer/printer/printer.cc
index 4809a31..d4cfaf9 100644
--- a/src/tint/lang/msl/writer/printer/printer.cc
+++ b/src/tint/lang/msl/writer/printer/printer.cc
@@ -49,12 +49,15 @@
 #include "src/tint/lang/core/ir/if.h"
 #include "src/tint/lang/core/ir/let.h"
 #include "src/tint/lang/core/ir/load.h"
+#include "src/tint/lang/core/ir/load_vector_element.h"
 #include "src/tint/lang/core/ir/module.h"
 #include "src/tint/lang/core/ir/multi_in_block.h"
 #include "src/tint/lang/core/ir/next_iteration.h"
 #include "src/tint/lang/core/ir/return.h"
 #include "src/tint/lang/core/ir/store.h"
+#include "src/tint/lang/core/ir/store_vector_element.h"
 #include "src/tint/lang/core/ir/switch.h"
+#include "src/tint/lang/core/ir/swizzle.h"
 #include "src/tint/lang/core/ir/unreachable.h"
 #include "src/tint/lang/core/ir/user_call.h"
 #include "src/tint/lang/core/ir/validator.h"
@@ -271,30 +274,33 @@
 
         for (auto* inst : *block) {
             Switch(
-                inst,                                                //
-                [&](core::ir::ExitIf* e) { EmitExitIf(e); },         //
-                [&](core::ir::If* if_) { EmitIf(if_); },             //
-                [&](core::ir::Loop* l) { EmitLoop(l); },             //
-                [&](core::ir::Return* r) { EmitReturn(r); },         //
-                [&](core::ir::Unreachable*) { EmitUnreachable(); },  //
-                [&](core::ir::Var* v) { EmitVar(v); },               //
-                [&](core::ir::Discard*) { EmitDiscard(); },          //
-                [&](core::ir::Store* s) { EmitStore(s); },           //
-                [&](core::ir::Continue*) { EmitContinue(); },        //
-                [&](core::ir::NextIteration*) { /* do nothing */ },  //
-                [&](core::ir::BreakIf* b) { EmitBreakIf(b); },       //
-                [&](core::ir::ExitLoop*) { EmitExitLoop(); },        //
-                [&](core::ir::ExitSwitch*) { EmitExitSwitch(); },    //
-                [&](core::ir::Switch* s) { EmitSwitch(s); },         //
-
-                [&](core::ir::Bitcast*) { MaybeEmitInstruction(inst); },    //
-                [&](core::ir::Unary*) { MaybeEmitInstruction(inst); },      //
-                [&](core::ir::Binary*) { MaybeEmitInstruction(inst); },     //
-                [&](core::ir::Let* l) { EmitLet(l); },                      //
-                [&](core::ir::Load*) { MaybeEmitInstruction(inst); },       //
-                [&](core::ir::Construct*) { MaybeEmitInstruction(inst); },  //
-                [&](core::ir::Access*) { MaybeEmitInstruction(inst); },     //
-                [&](core::ir::UserCall* c) {                                //
+                inst,                                                                 //
+                [&](core::ir::ExitIf* e) { EmitExitIf(e); },                          //
+                [&](core::ir::If* if_) { EmitIf(if_); },                              //
+                [&](core::ir::Loop* l) { EmitLoop(l); },                              //
+                [&](core::ir::Return* r) { EmitReturn(r); },                          //
+                [&](core::ir::Unreachable*) { EmitUnreachable(); },                   //
+                [&](core::ir::Var* v) { EmitVar(v); },                                //
+                [&](core::ir::Discard*) { EmitDiscard(); },                           //
+                [&](core::ir::Store* s) { EmitStore(s); },                            //
+                [&](core::ir::Continue*) { EmitContinue(); },                         //
+                [&](core::ir::NextIteration*) { /* do nothing */ },                   //
+                [&](core::ir::BreakIf* b) { EmitBreakIf(b); },                        //
+                [&](core::ir::ExitLoop*) { EmitExitLoop(); },                         //
+                [&](core::ir::ExitSwitch*) { EmitExitSwitch(); },                     //
+                [&](core::ir::Switch* s) { EmitSwitch(s); },                          //
+                                                                                      //
+                [&](core::ir::LoadVectorElement* e) { MaybeEmitInstruction(e); },     //
+                [&](core::ir::StoreVectorElement* e) { EmitStoreVectorElement(e); },  //
+                [&](core::ir::Swizzle* s) { MaybeEmitInstruction(s); },               //
+                [&](core::ir::Bitcast*) { MaybeEmitInstruction(inst); },              //
+                [&](core::ir::Unary*) { MaybeEmitInstruction(inst); },                //
+                [&](core::ir::Binary*) { MaybeEmitInstruction(inst); },               //
+                [&](core::ir::Let* l) { EmitLet(l); },                                //
+                [&](core::ir::Load*) { MaybeEmitInstruction(inst); },                 //
+                [&](core::ir::Construct*) { MaybeEmitInstruction(inst); },            //
+                [&](core::ir::Access*) { MaybeEmitInstruction(inst); },               //
+                [&](core::ir::UserCall* c) {                                          //
                     if (c->Result()->Type()->Is<core::type::Void>()) {
                         auto out = Line();
                         EmitValue(out, c->Result());
@@ -343,6 +349,10 @@
                     [&](const core::ir::Bitcast* b) { EmitBitcast(out, b); },      //
                     [&](const core::ir::Access* a) { EmitAccess(out, a); },        //
                     [&](const core::ir::UserCall* c) { EmitUserCall(out, c); },    //
+                    [&](const core::ir::LoadVectorElement* e) {
+                        EmitLoadVectorElement(out, e);
+                    },                                                         //
+                    [&](const core::ir::Swizzle* s) { EmitSwizzle(out, s); },  //
                     TINT_ICE_ON_NO_MATCH);
             },                                                                     //
             [&](const core::ir::FunctionParam* p) { EmitFunctionParam(out, p); },  //
@@ -557,6 +567,47 @@
         Line() << "}";
     }
 
+    void EmitSwizzle(StringStream& out, const core::ir::Swizzle* swizzle) {
+        EmitValue(out, swizzle->Object());
+        out << ".";
+        for (const auto i : swizzle->Indices()) {
+            switch (i) {
+                case 0:
+                    out << "x";
+                    break;
+                case 1:
+                    out << "y";
+                    break;
+                case 2:
+                    out << "z";
+                    break;
+                case 3:
+                    out << "w";
+                    break;
+                default:
+                    TINT_UNREACHABLE();
+            }
+        }
+    }
+
+    void EmitStoreVectorElement(const core::ir::StoreVectorElement* l) {
+        auto out = Line();
+
+        EmitValue(out, l->To());
+        out << "[";
+        EmitValue(out, l->Index());
+        out << "] = ";
+        EmitValue(out, l->Value());
+        out << ";";
+    }
+
+    void EmitLoadVectorElement(StringStream& out, const core::ir::LoadVectorElement* l) {
+        EmitValue(out, l->From());
+        out << "[";
+        EmitValue(out, l->Index());
+        out << "]";
+    }
+
     /// Emit an if instruction
     /// @param if_ the if instruction
     void EmitIf(core::ir::If* if_) {
diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.ir.msl
index a3a0b49..2125482 100644
--- a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(8) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(8) {
   v:vec3<f16> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.ir.msl
index 5e5ddee..cedacce 100644
--- a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<f32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.ir.msl
index 13e66a5..59aa9d0 100644
--- a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<i32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.ir.msl
index 06b60c6..c744736 100644
--- a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<u32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl b/test/tint/expressions/swizzle/read/swizzle.wgsl
new file mode 100644
index 0000000..9a4a75a
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl
@@ -0,0 +1,12 @@
+struct S {
+    val: array<vec3f, 3>,
+}
+
+fn a() {
+    var a = vec4();
+    let b = a.x;
+    let c = a.zzyy;
+
+    var d = S();
+    let e = d.val[2].yzx;
+}
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a18d42a
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.dxc.hlsl
@@ -0,0 +1,16 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+struct S {
+  float3 val[3];
+};
+
+void a() {
+  int4 a_1 = (0).xxxx;
+  const int b = a_1.x;
+  const int4 c = a_1.zzyy;
+  S d = (S)0;
+  const float3 e = d.val[2].yzx;
+}
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a18d42a
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.fxc.hlsl
@@ -0,0 +1,16 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+struct S {
+  float3 val[3];
+};
+
+void a() {
+  int4 a_1 = (0).xxxx;
+  const int b = a_1.x;
+  const int4 c = a_1.zzyy;
+  S d = (S)0;
+  const float3 e = d.val[2].yzx;
+}
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.glsl
new file mode 100644
index 0000000..1ef2479
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void unused_entry_point() {
+  return;
+}
+struct S {
+  vec3 val[3];
+};
+
+void a() {
+  ivec4 a_1 = ivec4(0);
+  int b = a_1.x;
+  ivec4 c = a_1.zzyy;
+  S d = S(vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f)));
+  vec3 e = d.val[2].yzx;
+}
+
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.ir.msl
new file mode 100644
index 0000000..177f6f3
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.ir.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+using namespace metal;
+template<typename T, size_t N>
+struct tint_array {
+  const constant T& operator[](size_t i) const constant { return elements[i]; }
+  device T& operator[](size_t i) device { return elements[i]; }
+  const device T& operator[](size_t i) const device { return elements[i]; }
+  thread T& operator[](size_t i) thread { return elements[i]; }
+  const thread T& operator[](size_t i) const thread { return elements[i]; }
+  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+  T elements[N];
+};
+
+struct S {
+  tint_array<float3, 3> val;
+};
+
+void a() {
+  int4 a = int4(0);
+  int const b = a[0u];
+  int4 const c = a.zzyy;
+  S d = S{};
+  float3 const e = d.val[2].yzx;
+}
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.msl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.msl
new file mode 100644
index 0000000..e4b6121
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+    const constant T& operator[](size_t i) const constant { return elements[i]; }
+    device T& operator[](size_t i) device { return elements[i]; }
+    const device T& operator[](size_t i) const device { return elements[i]; }
+    thread T& operator[](size_t i) thread { return elements[i]; }
+    const thread T& operator[](size_t i) const thread { return elements[i]; }
+    threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+    const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+    T elements[N];
+};
+
+struct S {
+  tint_array<float3, 3> val;
+};
+
+void a() {
+  int4 a_1 = int4(0);
+  int const b = a_1[0];
+  int4 const c = a_1.zzyy;
+  S d = S{};
+  float3 const e = d.val[2].yzx;
+}
+
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.spvasm
new file mode 100644
index 0000000..9fd92da
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; 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 %a "a"
+               OpName %a_1 "a_1"
+               OpName %S "S"
+               OpMemberName %S 0 "val"
+               OpName %d "d"
+               OpMemberDecorate %S 0 Offset 0
+               OpDecorate %_arr_v3float_uint_3 ArrayStride 16
+       %void = OpTypeVoid
+          %1 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %v4int = OpTypeVector %int 4
+          %9 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Function_int = OpTypePointer Function %int
+      %float = OpTypeFloat 32
+    %v3float = OpTypeVector %float 3
+     %uint_3 = OpConstant %uint 3
+%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3
+          %S = OpTypeStruct %_arr_v3float_uint_3
+         %24 = OpConstantNull %S
+%_ptr_Function_S = OpTypePointer Function %S
+      %int_2 = OpConstant %int 2
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%unused_entry_point = OpFunction %void None %1
+          %4 = OpLabel
+               OpReturn
+               OpFunctionEnd
+          %a = OpFunction %void None %1
+          %6 = OpLabel
+        %a_1 = OpVariable %_ptr_Function_v4int Function %9
+          %d = OpVariable %_ptr_Function_S Function %24
+               OpStore %a_1 %9
+         %15 = OpAccessChain %_ptr_Function_int %a_1 %uint_0
+         %16 = OpLoad %int %15
+         %17 = OpLoad %v4int %a_1
+         %18 = OpVectorShuffle %v4int %17 %17 2 2 1 1
+               OpStore %d %24
+         %29 = OpAccessChain %_ptr_Function_v3float %d %uint_0 %int_2
+         %30 = OpLoad %v3float %29
+         %31 = OpVectorShuffle %v3float %30 %30 1 2 0
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.wgsl b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.wgsl
new file mode 100644
index 0000000..c48654d
--- /dev/null
+++ b/test/tint/expressions/swizzle/read/swizzle.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+struct S {
+  val : array<vec3f, 3>,
+}
+
+fn a() {
+  var a = vec4();
+  let b = a.x;
+  let c = a.zzyy;
+  var d = S();
+  let e = d.val[2].yzx;
+}
diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.ir.msl
index 28251dc..3b4dce1 100644
--- a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.ir.msl
@@ -1,9 +1,499 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  half3 v;
+};
+
+thread S P = {};
+void f() {
+  half3 v = P.v;
+  half x = P.v[0u];
+  half y = P.v[1u];
+  half z = P.v[2u];
+  half2 xx = P.v.xx;
+  half2 xy = P.v.xy;
+  half2 xz = P.v.xz;
+  half2 yx = P.v.yx;
+  half2 yy = P.v.yy;
+  half2 yz = P.v.yz;
+  half2 zx = P.v.zx;
+  half2 zy = P.v.zy;
+  half2 zz = P.v.zz;
+  half3 xxx = P.v.xxx;
+  half3 xxy = P.v.xxy;
+  half3 xxz = P.v.xxz;
+  half3 xyx = P.v.xyx;
+  half3 xyy = P.v.xyy;
+  half3 xyz = P.v.xyz;
+  half3 xzx = P.v.xzx;
+  half3 xzy = P.v.xzy;
+  half3 xzz = P.v.xzz;
+  half3 yxx = P.v.yxx;
+  half3 yxy = P.v.yxy;
+  half3 yxz = P.v.yxz;
+  half3 yyx = P.v.yyx;
+  half3 yyy = P.v.yyy;
+  half3 yyz = P.v.yyz;
+  half3 yzx = P.v.yzx;
+  half3 yzy = P.v.yzy;
+  half3 yzz = P.v.yzz;
+  half3 zxx = P.v.zxx;
+  half3 zxy = P.v.zxy;
+  half3 zxz = P.v.zxz;
+  half3 zyx = P.v.zyx;
+  half3 zyy = P.v.zyy;
+  half3 zyz = P.v.zyz;
+  half3 zzx = P.v.zzx;
+  half3 zzy = P.v.zzy;
+  half3 zzz = P.v.zzz;
+  half4 xxxx = P.v.xxxx;
+  half4 xxxy = P.v.xxxy;
+  half4 xxxz = P.v.xxxz;
+  half4 xxyx = P.v.xxyx;
+  half4 xxyy = P.v.xxyy;
+  half4 xxyz = P.v.xxyz;
+  half4 xxzx = P.v.xxzx;
+  half4 xxzy = P.v.xxzy;
+  half4 xxzz = P.v.xxzz;
+  half4 xyxx = P.v.xyxx;
+  half4 xyxy = P.v.xyxy;
+  half4 xyxz = P.v.xyxz;
+  half4 xyyx = P.v.xyyx;
+  half4 xyyy = P.v.xyyy;
+  half4 xyyz = P.v.xyyz;
+  half4 xyzx = P.v.xyzx;
+  half4 xyzy = P.v.xyzy;
+  half4 xyzz = P.v.xyzz;
+  half4 xzxx = P.v.xzxx;
+  half4 xzxy = P.v.xzxy;
+  half4 xzxz = P.v.xzxz;
+  half4 xzyx = P.v.xzyx;
+  half4 xzyy = P.v.xzyy;
+  half4 xzyz = P.v.xzyz;
+  half4 xzzx = P.v.xzzx;
+  half4 xzzy = P.v.xzzy;
+  half4 xzzz = P.v.xzzz;
+  half4 yxxx = P.v.yxxx;
+  half4 yxxy = P.v.yxxy;
+  half4 yxxz = P.v.yxxz;
+  half4 yxyx = P.v.yxyx;
+  half4 yxyy = P.v.yxyy;
+  half4 yxyz = P.v.yxyz;
+  half4 yxzx = P.v.yxzx;
+  half4 yxzy = P.v.yxzy;
+  half4 yxzz = P.v.yxzz;
+  half4 yyxx = P.v.yyxx;
+  half4 yyxy = P.v.yyxy;
+  half4 yyxz = P.v.yyxz;
+  half4 yyyx = P.v.yyyx;
+  half4 yyyy = P.v.yyyy;
+  half4 yyyz = P.v.yyyz;
+  half4 yyzx = P.v.yyzx;
+  half4 yyzy = P.v.yyzy;
+  half4 yyzz = P.v.yyzz;
+  half4 yzxx = P.v.yzxx;
+  half4 yzxy = P.v.yzxy;
+  half4 yzxz = P.v.yzxz;
+  half4 yzyx = P.v.yzyx;
+  half4 yzyy = P.v.yzyy;
+  half4 yzyz = P.v.yzyz;
+  half4 yzzx = P.v.yzzx;
+  half4 yzzy = P.v.yzzy;
+  half4 yzzz = P.v.yzzz;
+  half4 zxxx = P.v.zxxx;
+  half4 zxxy = P.v.zxxy;
+  half4 zxxz = P.v.zxxz;
+  half4 zxyx = P.v.zxyx;
+  half4 zxyy = P.v.zxyy;
+  half4 zxyz = P.v.zxyz;
+  half4 zxzx = P.v.zxzx;
+  half4 zxzy = P.v.zxzy;
+  half4 zxzz = P.v.zxzz;
+  half4 zyxx = P.v.zyxx;
+  half4 zyxy = P.v.zyxy;
+  half4 zyxz = P.v.zyxz;
+  half4 zyyx = P.v.zyyx;
+  half4 zyyy = P.v.zyyy;
+  half4 zyyz = P.v.zyyz;
+  half4 zyzx = P.v.zyzx;
+  half4 zyzy = P.v.zyzy;
+  half4 zyzz = P.v.zyzz;
+  half4 zzxx = P.v.zzxx;
+  half4 zzxy = P.v.zzxy;
+  half4 zzxz = P.v.zzxz;
+  half4 zzyx = P.v.zzyx;
+  half4 zzyy = P.v.zzyy;
+  half4 zzyz = P.v.zzyz;
+  half4 zzzx = P.v.zzzx;
+  half4 zzzy = P.v.zzzy;
+  half4 zzzz = P.v.zzzz;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+program_source:9:9: warning: unused variable 'v' [-Wunused-variable]
+  half3 v = P.v;
+        ^
+program_source:10:8: warning: unused variable 'x' [-Wunused-variable]
+  half x = P.v[0u];
+       ^
+program_source:11:8: warning: unused variable 'y' [-Wunused-variable]
+  half y = P.v[1u];
+       ^
+program_source:12:8: warning: unused variable 'z' [-Wunused-variable]
+  half z = P.v[2u];
+       ^
+program_source:13:9: warning: unused variable 'xx' [-Wunused-variable]
+  half2 xx = P.v.xx;
+        ^
+program_source:14:9: warning: unused variable 'xy' [-Wunused-variable]
+  half2 xy = P.v.xy;
+        ^
+program_source:15:9: warning: unused variable 'xz' [-Wunused-variable]
+  half2 xz = P.v.xz;
+        ^
+program_source:16:9: warning: unused variable 'yx' [-Wunused-variable]
+  half2 yx = P.v.yx;
+        ^
+program_source:17:9: warning: unused variable 'yy' [-Wunused-variable]
+  half2 yy = P.v.yy;
+        ^
+program_source:18:9: warning: unused variable 'yz' [-Wunused-variable]
+  half2 yz = P.v.yz;
+        ^
+program_source:19:9: warning: unused variable 'zx' [-Wunused-variable]
+  half2 zx = P.v.zx;
+        ^
+program_source:20:9: warning: unused variable 'zy' [-Wunused-variable]
+  half2 zy = P.v.zy;
+        ^
+program_source:21:9: warning: unused variable 'zz' [-Wunused-variable]
+  half2 zz = P.v.zz;
+        ^
+program_source:22:9: warning: unused variable 'xxx' [-Wunused-variable]
+  half3 xxx = P.v.xxx;
+        ^
+program_source:23:9: warning: unused variable 'xxy' [-Wunused-variable]
+  half3 xxy = P.v.xxy;
+        ^
+program_source:24:9: warning: unused variable 'xxz' [-Wunused-variable]
+  half3 xxz = P.v.xxz;
+        ^
+program_source:25:9: warning: unused variable 'xyx' [-Wunused-variable]
+  half3 xyx = P.v.xyx;
+        ^
+program_source:26:9: warning: unused variable 'xyy' [-Wunused-variable]
+  half3 xyy = P.v.xyy;
+        ^
+program_source:27:9: warning: unused variable 'xyz' [-Wunused-variable]
+  half3 xyz = P.v.xyz;
+        ^
+program_source:28:9: warning: unused variable 'xzx' [-Wunused-variable]
+  half3 xzx = P.v.xzx;
+        ^
+program_source:29:9: warning: unused variable 'xzy' [-Wunused-variable]
+  half3 xzy = P.v.xzy;
+        ^
+program_source:30:9: warning: unused variable 'xzz' [-Wunused-variable]
+  half3 xzz = P.v.xzz;
+        ^
+program_source:31:9: warning: unused variable 'yxx' [-Wunused-variable]
+  half3 yxx = P.v.yxx;
+        ^
+program_source:32:9: warning: unused variable 'yxy' [-Wunused-variable]
+  half3 yxy = P.v.yxy;
+        ^
+program_source:33:9: warning: unused variable 'yxz' [-Wunused-variable]
+  half3 yxz = P.v.yxz;
+        ^
+program_source:34:9: warning: unused variable 'yyx' [-Wunused-variable]
+  half3 yyx = P.v.yyx;
+        ^
+program_source:35:9: warning: unused variable 'yyy' [-Wunused-variable]
+  half3 yyy = P.v.yyy;
+        ^
+program_source:36:9: warning: unused variable 'yyz' [-Wunused-variable]
+  half3 yyz = P.v.yyz;
+        ^
+program_source:37:9: warning: unused variable 'yzx' [-Wunused-variable]
+  half3 yzx = P.v.yzx;
+        ^
+program_source:38:9: warning: unused variable 'yzy' [-Wunused-variable]
+  half3 yzy = P.v.yzy;
+        ^
+program_source:39:9: warning: unused variable 'yzz' [-Wunused-variable]
+  half3 yzz = P.v.yzz;
+        ^
+program_source:40:9: warning: unused variable 'zxx' [-Wunused-variable]
+  half3 zxx = P.v.zxx;
+        ^
+program_source:41:9: warning: unused variable 'zxy' [-Wunused-variable]
+  half3 zxy = P.v.zxy;
+        ^
+program_source:42:9: warning: unused variable 'zxz' [-Wunused-variable]
+  half3 zxz = P.v.zxz;
+        ^
+program_source:43:9: warning: unused variable 'zyx' [-Wunused-variable]
+  half3 zyx = P.v.zyx;
+        ^
+program_source:44:9: warning: unused variable 'zyy' [-Wunused-variable]
+  half3 zyy = P.v.zyy;
+        ^
+program_source:45:9: warning: unused variable 'zyz' [-Wunused-variable]
+  half3 zyz = P.v.zyz;
+        ^
+program_source:46:9: warning: unused variable 'zzx' [-Wunused-variable]
+  half3 zzx = P.v.zzx;
+        ^
+program_source:47:9: warning: unused variable 'zzy' [-Wunused-variable]
+  half3 zzy = P.v.zzy;
+        ^
+program_source:48:9: warning: unused variable 'zzz' [-Wunused-variable]
+  half3 zzz = P.v.zzz;
+        ^
+program_source:49:9: warning: unused variable 'xxxx' [-Wunused-variable]
+  half4 xxxx = P.v.xxxx;
+        ^
+program_source:50:9: warning: unused variable 'xxxy' [-Wunused-variable]
+  half4 xxxy = P.v.xxxy;
+        ^
+program_source:51:9: warning: unused variable 'xxxz' [-Wunused-variable]
+  half4 xxxz = P.v.xxxz;
+        ^
+program_source:52:9: warning: unused variable 'xxyx' [-Wunused-variable]
+  half4 xxyx = P.v.xxyx;
+        ^
+program_source:53:9: warning: unused variable 'xxyy' [-Wunused-variable]
+  half4 xxyy = P.v.xxyy;
+        ^
+program_source:54:9: warning: unused variable 'xxyz' [-Wunused-variable]
+  half4 xxyz = P.v.xxyz;
+        ^
+program_source:55:9: warning: unused variable 'xxzx' [-Wunused-variable]
+  half4 xxzx = P.v.xxzx;
+        ^
+program_source:56:9: warning: unused variable 'xxzy' [-Wunused-variable]
+  half4 xxzy = P.v.xxzy;
+        ^
+program_source:57:9: warning: unused variable 'xxzz' [-Wunused-variable]
+  half4 xxzz = P.v.xxzz;
+        ^
+program_source:58:9: warning: unused variable 'xyxx' [-Wunused-variable]
+  half4 xyxx = P.v.xyxx;
+        ^
+program_source:59:9: warning: unused variable 'xyxy' [-Wunused-variable]
+  half4 xyxy = P.v.xyxy;
+        ^
+program_source:60:9: warning: unused variable 'xyxz' [-Wunused-variable]
+  half4 xyxz = P.v.xyxz;
+        ^
+program_source:61:9: warning: unused variable 'xyyx' [-Wunused-variable]
+  half4 xyyx = P.v.xyyx;
+        ^
+program_source:62:9: warning: unused variable 'xyyy' [-Wunused-variable]
+  half4 xyyy = P.v.xyyy;
+        ^
+program_source:63:9: warning: unused variable 'xyyz' [-Wunused-variable]
+  half4 xyyz = P.v.xyyz;
+        ^
+program_source:64:9: warning: unused variable 'xyzx' [-Wunused-variable]
+  half4 xyzx = P.v.xyzx;
+        ^
+program_source:65:9: warning: unused variable 'xyzy' [-Wunused-variable]
+  half4 xyzy = P.v.xyzy;
+        ^
+program_source:66:9: warning: unused variable 'xyzz' [-Wunused-variable]
+  half4 xyzz = P.v.xyzz;
+        ^
+program_source:67:9: warning: unused variable 'xzxx' [-Wunused-variable]
+  half4 xzxx = P.v.xzxx;
+        ^
+program_source:68:9: warning: unused variable 'xzxy' [-Wunused-variable]
+  half4 xzxy = P.v.xzxy;
+        ^
+program_source:69:9: warning: unused variable 'xzxz' [-Wunused-variable]
+  half4 xzxz = P.v.xzxz;
+        ^
+program_source:70:9: warning: unused variable 'xzyx' [-Wunused-variable]
+  half4 xzyx = P.v.xzyx;
+        ^
+program_source:71:9: warning: unused variable 'xzyy' [-Wunused-variable]
+  half4 xzyy = P.v.xzyy;
+        ^
+program_source:72:9: warning: unused variable 'xzyz' [-Wunused-variable]
+  half4 xzyz = P.v.xzyz;
+        ^
+program_source:73:9: warning: unused variable 'xzzx' [-Wunused-variable]
+  half4 xzzx = P.v.xzzx;
+        ^
+program_source:74:9: warning: unused variable 'xzzy' [-Wunused-variable]
+  half4 xzzy = P.v.xzzy;
+        ^
+program_source:75:9: warning: unused variable 'xzzz' [-Wunused-variable]
+  half4 xzzz = P.v.xzzz;
+        ^
+program_source:76:9: warning: unused variable 'yxxx' [-Wunused-variable]
+  half4 yxxx = P.v.yxxx;
+        ^
+program_source:77:9: warning: unused variable 'yxxy' [-Wunused-variable]
+  half4 yxxy = P.v.yxxy;
+        ^
+program_source:78:9: warning: unused variable 'yxxz' [-Wunused-variable]
+  half4 yxxz = P.v.yxxz;
+        ^
+program_source:79:9: warning: unused variable 'yxyx' [-Wunused-variable]
+  half4 yxyx = P.v.yxyx;
+        ^
+program_source:80:9: warning: unused variable 'yxyy' [-Wunused-variable]
+  half4 yxyy = P.v.yxyy;
+        ^
+program_source:81:9: warning: unused variable 'yxyz' [-Wunused-variable]
+  half4 yxyz = P.v.yxyz;
+        ^
+program_source:82:9: warning: unused variable 'yxzx' [-Wunused-variable]
+  half4 yxzx = P.v.yxzx;
+        ^
+program_source:83:9: warning: unused variable 'yxzy' [-Wunused-variable]
+  half4 yxzy = P.v.yxzy;
+        ^
+program_source:84:9: warning: unused variable 'yxzz' [-Wunused-variable]
+  half4 yxzz = P.v.yxzz;
+        ^
+program_source:85:9: warning: unused variable 'yyxx' [-Wunused-variable]
+  half4 yyxx = P.v.yyxx;
+        ^
+program_source:86:9: warning: unused variable 'yyxy' [-Wunused-variable]
+  half4 yyxy = P.v.yyxy;
+        ^
+program_source:87:9: warning: unused variable 'yyxz' [-Wunused-variable]
+  half4 yyxz = P.v.yyxz;
+        ^
+program_source:88:9: warning: unused variable 'yyyx' [-Wunused-variable]
+  half4 yyyx = P.v.yyyx;
+        ^
+program_source:89:9: warning: unused variable 'yyyy' [-Wunused-variable]
+  half4 yyyy = P.v.yyyy;
+        ^
+program_source:90:9: warning: unused variable 'yyyz' [-Wunused-variable]
+  half4 yyyz = P.v.yyyz;
+        ^
+program_source:91:9: warning: unused variable 'yyzx' [-Wunused-variable]
+  half4 yyzx = P.v.yyzx;
+        ^
+program_source:92:9: warning: unused variable 'yyzy' [-Wunused-variable]
+  half4 yyzy = P.v.yyzy;
+        ^
+program_source:93:9: warning: unused variable 'yyzz' [-Wunused-variable]
+  half4 yyzz = P.v.yyzz;
+        ^
+program_source:94:9: warning: unused variable 'yzxx' [-Wunused-variable]
+  half4 yzxx = P.v.yzxx;
+        ^
+program_source:95:9: warning: unused variable 'yzxy' [-Wunused-variable]
+  half4 yzxy = P.v.yzxy;
+        ^
+program_source:96:9: warning: unused variable 'yzxz' [-Wunused-variable]
+  half4 yzxz = P.v.yzxz;
+        ^
+program_source:97:9: warning: unused variable 'yzyx' [-Wunused-variable]
+  half4 yzyx = P.v.yzyx;
+        ^
+program_source:98:9: warning: unused variable 'yzyy' [-Wunused-variable]
+  half4 yzyy = P.v.yzyy;
+        ^
+program_source:99:9: warning: unused variable 'yzyz' [-Wunused-variable]
+  half4 yzyz = P.v.yzyz;
+        ^
+program_source:100:9: warning: unused variable 'yzzx' [-Wunused-variable]
+  half4 yzzx = P.v.yzzx;
+        ^
+program_source:101:9: warning: unused variable 'yzzy' [-Wunused-variable]
+  half4 yzzy = P.v.yzzy;
+        ^
+program_source:102:9: warning: unused variable 'yzzz' [-Wunused-variable]
+  half4 yzzz = P.v.yzzz;
+        ^
+program_source:103:9: warning: unused variable 'zxxx' [-Wunused-variable]
+  half4 zxxx = P.v.zxxx;
+        ^
+program_source:104:9: warning: unused variable 'zxxy' [-Wunused-variable]
+  half4 zxxy = P.v.zxxy;
+        ^
+program_source:105:9: warning: unused variable 'zxxz' [-Wunused-variable]
+  half4 zxxz = P.v.zxxz;
+        ^
+program_source:106:9: warning: unused variable 'zxyx' [-Wunused-variable]
+  half4 zxyx = P.v.zxyx;
+        ^
+program_source:107:9: warning: unused variable 'zxyy' [-Wunused-variable]
+  half4 zxyy = P.v.zxyy;
+        ^
+program_source:108:9: warning: unused variable 'zxyz' [-Wunused-variable]
+  half4 zxyz = P.v.zxyz;
+        ^
+program_source:109:9: warning: unused variable 'zxzx' [-Wunused-variable]
+  half4 zxzx = P.v.zxzx;
+        ^
+program_source:110:9: warning: unused variable 'zxzy' [-Wunused-variable]
+  half4 zxzy = P.v.zxzy;
+        ^
+program_source:111:9: warning: unused variable 'zxzz' [-Wunused-variable]
+  half4 zxzz = P.v.zxzz;
+        ^
+program_source:112:9: warning: unused variable 'zyxx' [-Wunused-variable]
+  half4 zyxx = P.v.zyxx;
+        ^
+program_source:113:9: warning: unused variable 'zyxy' [-Wunused-variable]
+  half4 zyxy = P.v.zyxy;
+        ^
+program_source:114:9: warning: unused variable 'zyxz' [-Wunused-variable]
+  half4 zyxz = P.v.zyxz;
+        ^
+program_source:115:9: warning: unused variable 'zyyx' [-Wunused-variable]
+  half4 zyyx = P.v.zyyx;
+        ^
+program_source:116:9: warning: unused variable 'zyyy' [-Wunused-variable]
+  half4 zyyy = P.v.zyyy;
+        ^
+program_source:117:9: warning: unused variable 'zyyz' [-Wunused-variable]
+  half4 zyyz = P.v.zyyz;
+        ^
+program_source:118:9: warning: unused variable 'zyzx' [-Wunused-variable]
+  half4 zyzx = P.v.zyzx;
+        ^
+program_source:119:9: warning: unused variable 'zyzy' [-Wunused-variable]
+  half4 zyzy = P.v.zyzy;
+        ^
+program_source:120:9: warning: unused variable 'zyzz' [-Wunused-variable]
+  half4 zyzz = P.v.zyzz;
+        ^
+program_source:121:9: warning: unused variable 'zzxx' [-Wunused-variable]
+  half4 zzxx = P.v.zzxx;
+        ^
+program_source:122:9: warning: unused variable 'zzxy' [-Wunused-variable]
+  half4 zzxy = P.v.zzxy;
+        ^
+program_source:123:9: warning: unused variable 'zzxz' [-Wunused-variable]
+  half4 zzxz = P.v.zzxz;
+        ^
+program_source:124:9: warning: unused variable 'zzyx' [-Wunused-variable]
+  half4 zzyx = P.v.zzyx;
+        ^
+program_source:125:9: warning: unused variable 'zzyy' [-Wunused-variable]
+  half4 zzyy = P.v.zzyy;
+        ^
+program_source:126:9: warning: unused variable 'zzyz' [-Wunused-variable]
+  half4 zzyz = P.v.zzyz;
+        ^
+program_source:127:9: warning: unused variable 'zzzx' [-Wunused-variable]
+  half4 zzzx = P.v.zzzx;
+        ^
+program_source:128:9: warning: unused variable 'zzzy' [-Wunused-variable]
+  half4 zzzy = P.v.zzzy;
+        ^
+program_source:129:9: warning: unused variable 'zzzz' [-Wunused-variable]
+  half4 zzzz = P.v.zzzz;
+        ^
+
diff --git a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.ir.msl
index 28251dc..8bf573f 100644
--- a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.ir.msl
@@ -1,9 +1,499 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  float3 v;
+};
+
+thread S P = {};
+void f() {
+  float3 v = P.v;
+  float x = P.v[0u];
+  float y = P.v[1u];
+  float z = P.v[2u];
+  float2 xx = P.v.xx;
+  float2 xy = P.v.xy;
+  float2 xz = P.v.xz;
+  float2 yx = P.v.yx;
+  float2 yy = P.v.yy;
+  float2 yz = P.v.yz;
+  float2 zx = P.v.zx;
+  float2 zy = P.v.zy;
+  float2 zz = P.v.zz;
+  float3 xxx = P.v.xxx;
+  float3 xxy = P.v.xxy;
+  float3 xxz = P.v.xxz;
+  float3 xyx = P.v.xyx;
+  float3 xyy = P.v.xyy;
+  float3 xyz = P.v.xyz;
+  float3 xzx = P.v.xzx;
+  float3 xzy = P.v.xzy;
+  float3 xzz = P.v.xzz;
+  float3 yxx = P.v.yxx;
+  float3 yxy = P.v.yxy;
+  float3 yxz = P.v.yxz;
+  float3 yyx = P.v.yyx;
+  float3 yyy = P.v.yyy;
+  float3 yyz = P.v.yyz;
+  float3 yzx = P.v.yzx;
+  float3 yzy = P.v.yzy;
+  float3 yzz = P.v.yzz;
+  float3 zxx = P.v.zxx;
+  float3 zxy = P.v.zxy;
+  float3 zxz = P.v.zxz;
+  float3 zyx = P.v.zyx;
+  float3 zyy = P.v.zyy;
+  float3 zyz = P.v.zyz;
+  float3 zzx = P.v.zzx;
+  float3 zzy = P.v.zzy;
+  float3 zzz = P.v.zzz;
+  float4 xxxx = P.v.xxxx;
+  float4 xxxy = P.v.xxxy;
+  float4 xxxz = P.v.xxxz;
+  float4 xxyx = P.v.xxyx;
+  float4 xxyy = P.v.xxyy;
+  float4 xxyz = P.v.xxyz;
+  float4 xxzx = P.v.xxzx;
+  float4 xxzy = P.v.xxzy;
+  float4 xxzz = P.v.xxzz;
+  float4 xyxx = P.v.xyxx;
+  float4 xyxy = P.v.xyxy;
+  float4 xyxz = P.v.xyxz;
+  float4 xyyx = P.v.xyyx;
+  float4 xyyy = P.v.xyyy;
+  float4 xyyz = P.v.xyyz;
+  float4 xyzx = P.v.xyzx;
+  float4 xyzy = P.v.xyzy;
+  float4 xyzz = P.v.xyzz;
+  float4 xzxx = P.v.xzxx;
+  float4 xzxy = P.v.xzxy;
+  float4 xzxz = P.v.xzxz;
+  float4 xzyx = P.v.xzyx;
+  float4 xzyy = P.v.xzyy;
+  float4 xzyz = P.v.xzyz;
+  float4 xzzx = P.v.xzzx;
+  float4 xzzy = P.v.xzzy;
+  float4 xzzz = P.v.xzzz;
+  float4 yxxx = P.v.yxxx;
+  float4 yxxy = P.v.yxxy;
+  float4 yxxz = P.v.yxxz;
+  float4 yxyx = P.v.yxyx;
+  float4 yxyy = P.v.yxyy;
+  float4 yxyz = P.v.yxyz;
+  float4 yxzx = P.v.yxzx;
+  float4 yxzy = P.v.yxzy;
+  float4 yxzz = P.v.yxzz;
+  float4 yyxx = P.v.yyxx;
+  float4 yyxy = P.v.yyxy;
+  float4 yyxz = P.v.yyxz;
+  float4 yyyx = P.v.yyyx;
+  float4 yyyy = P.v.yyyy;
+  float4 yyyz = P.v.yyyz;
+  float4 yyzx = P.v.yyzx;
+  float4 yyzy = P.v.yyzy;
+  float4 yyzz = P.v.yyzz;
+  float4 yzxx = P.v.yzxx;
+  float4 yzxy = P.v.yzxy;
+  float4 yzxz = P.v.yzxz;
+  float4 yzyx = P.v.yzyx;
+  float4 yzyy = P.v.yzyy;
+  float4 yzyz = P.v.yzyz;
+  float4 yzzx = P.v.yzzx;
+  float4 yzzy = P.v.yzzy;
+  float4 yzzz = P.v.yzzz;
+  float4 zxxx = P.v.zxxx;
+  float4 zxxy = P.v.zxxy;
+  float4 zxxz = P.v.zxxz;
+  float4 zxyx = P.v.zxyx;
+  float4 zxyy = P.v.zxyy;
+  float4 zxyz = P.v.zxyz;
+  float4 zxzx = P.v.zxzx;
+  float4 zxzy = P.v.zxzy;
+  float4 zxzz = P.v.zxzz;
+  float4 zyxx = P.v.zyxx;
+  float4 zyxy = P.v.zyxy;
+  float4 zyxz = P.v.zyxz;
+  float4 zyyx = P.v.zyyx;
+  float4 zyyy = P.v.zyyy;
+  float4 zyyz = P.v.zyyz;
+  float4 zyzx = P.v.zyzx;
+  float4 zyzy = P.v.zyzy;
+  float4 zyzz = P.v.zyzz;
+  float4 zzxx = P.v.zzxx;
+  float4 zzxy = P.v.zzxy;
+  float4 zzxz = P.v.zzxz;
+  float4 zzyx = P.v.zzyx;
+  float4 zzyy = P.v.zzyy;
+  float4 zzyz = P.v.zzyz;
+  float4 zzzx = P.v.zzzx;
+  float4 zzzy = P.v.zzzy;
+  float4 zzzz = P.v.zzzz;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+program_source:9:10: warning: unused variable 'v' [-Wunused-variable]
+  float3 v = P.v;
+         ^
+program_source:10:9: warning: unused variable 'x' [-Wunused-variable]
+  float x = P.v[0u];
+        ^
+program_source:11:9: warning: unused variable 'y' [-Wunused-variable]
+  float y = P.v[1u];
+        ^
+program_source:12:9: warning: unused variable 'z' [-Wunused-variable]
+  float z = P.v[2u];
+        ^
+program_source:13:10: warning: unused variable 'xx' [-Wunused-variable]
+  float2 xx = P.v.xx;
+         ^
+program_source:14:10: warning: unused variable 'xy' [-Wunused-variable]
+  float2 xy = P.v.xy;
+         ^
+program_source:15:10: warning: unused variable 'xz' [-Wunused-variable]
+  float2 xz = P.v.xz;
+         ^
+program_source:16:10: warning: unused variable 'yx' [-Wunused-variable]
+  float2 yx = P.v.yx;
+         ^
+program_source:17:10: warning: unused variable 'yy' [-Wunused-variable]
+  float2 yy = P.v.yy;
+         ^
+program_source:18:10: warning: unused variable 'yz' [-Wunused-variable]
+  float2 yz = P.v.yz;
+         ^
+program_source:19:10: warning: unused variable 'zx' [-Wunused-variable]
+  float2 zx = P.v.zx;
+         ^
+program_source:20:10: warning: unused variable 'zy' [-Wunused-variable]
+  float2 zy = P.v.zy;
+         ^
+program_source:21:10: warning: unused variable 'zz' [-Wunused-variable]
+  float2 zz = P.v.zz;
+         ^
+program_source:22:10: warning: unused variable 'xxx' [-Wunused-variable]
+  float3 xxx = P.v.xxx;
+         ^
+program_source:23:10: warning: unused variable 'xxy' [-Wunused-variable]
+  float3 xxy = P.v.xxy;
+         ^
+program_source:24:10: warning: unused variable 'xxz' [-Wunused-variable]
+  float3 xxz = P.v.xxz;
+         ^
+program_source:25:10: warning: unused variable 'xyx' [-Wunused-variable]
+  float3 xyx = P.v.xyx;
+         ^
+program_source:26:10: warning: unused variable 'xyy' [-Wunused-variable]
+  float3 xyy = P.v.xyy;
+         ^
+program_source:27:10: warning: unused variable 'xyz' [-Wunused-variable]
+  float3 xyz = P.v.xyz;
+         ^
+program_source:28:10: warning: unused variable 'xzx' [-Wunused-variable]
+  float3 xzx = P.v.xzx;
+         ^
+program_source:29:10: warning: unused variable 'xzy' [-Wunused-variable]
+  float3 xzy = P.v.xzy;
+         ^
+program_source:30:10: warning: unused variable 'xzz' [-Wunused-variable]
+  float3 xzz = P.v.xzz;
+         ^
+program_source:31:10: warning: unused variable 'yxx' [-Wunused-variable]
+  float3 yxx = P.v.yxx;
+         ^
+program_source:32:10: warning: unused variable 'yxy' [-Wunused-variable]
+  float3 yxy = P.v.yxy;
+         ^
+program_source:33:10: warning: unused variable 'yxz' [-Wunused-variable]
+  float3 yxz = P.v.yxz;
+         ^
+program_source:34:10: warning: unused variable 'yyx' [-Wunused-variable]
+  float3 yyx = P.v.yyx;
+         ^
+program_source:35:10: warning: unused variable 'yyy' [-Wunused-variable]
+  float3 yyy = P.v.yyy;
+         ^
+program_source:36:10: warning: unused variable 'yyz' [-Wunused-variable]
+  float3 yyz = P.v.yyz;
+         ^
+program_source:37:10: warning: unused variable 'yzx' [-Wunused-variable]
+  float3 yzx = P.v.yzx;
+         ^
+program_source:38:10: warning: unused variable 'yzy' [-Wunused-variable]
+  float3 yzy = P.v.yzy;
+         ^
+program_source:39:10: warning: unused variable 'yzz' [-Wunused-variable]
+  float3 yzz = P.v.yzz;
+         ^
+program_source:40:10: warning: unused variable 'zxx' [-Wunused-variable]
+  float3 zxx = P.v.zxx;
+         ^
+program_source:41:10: warning: unused variable 'zxy' [-Wunused-variable]
+  float3 zxy = P.v.zxy;
+         ^
+program_source:42:10: warning: unused variable 'zxz' [-Wunused-variable]
+  float3 zxz = P.v.zxz;
+         ^
+program_source:43:10: warning: unused variable 'zyx' [-Wunused-variable]
+  float3 zyx = P.v.zyx;
+         ^
+program_source:44:10: warning: unused variable 'zyy' [-Wunused-variable]
+  float3 zyy = P.v.zyy;
+         ^
+program_source:45:10: warning: unused variable 'zyz' [-Wunused-variable]
+  float3 zyz = P.v.zyz;
+         ^
+program_source:46:10: warning: unused variable 'zzx' [-Wunused-variable]
+  float3 zzx = P.v.zzx;
+         ^
+program_source:47:10: warning: unused variable 'zzy' [-Wunused-variable]
+  float3 zzy = P.v.zzy;
+         ^
+program_source:48:10: warning: unused variable 'zzz' [-Wunused-variable]
+  float3 zzz = P.v.zzz;
+         ^
+program_source:49:10: warning: unused variable 'xxxx' [-Wunused-variable]
+  float4 xxxx = P.v.xxxx;
+         ^
+program_source:50:10: warning: unused variable 'xxxy' [-Wunused-variable]
+  float4 xxxy = P.v.xxxy;
+         ^
+program_source:51:10: warning: unused variable 'xxxz' [-Wunused-variable]
+  float4 xxxz = P.v.xxxz;
+         ^
+program_source:52:10: warning: unused variable 'xxyx' [-Wunused-variable]
+  float4 xxyx = P.v.xxyx;
+         ^
+program_source:53:10: warning: unused variable 'xxyy' [-Wunused-variable]
+  float4 xxyy = P.v.xxyy;
+         ^
+program_source:54:10: warning: unused variable 'xxyz' [-Wunused-variable]
+  float4 xxyz = P.v.xxyz;
+         ^
+program_source:55:10: warning: unused variable 'xxzx' [-Wunused-variable]
+  float4 xxzx = P.v.xxzx;
+         ^
+program_source:56:10: warning: unused variable 'xxzy' [-Wunused-variable]
+  float4 xxzy = P.v.xxzy;
+         ^
+program_source:57:10: warning: unused variable 'xxzz' [-Wunused-variable]
+  float4 xxzz = P.v.xxzz;
+         ^
+program_source:58:10: warning: unused variable 'xyxx' [-Wunused-variable]
+  float4 xyxx = P.v.xyxx;
+         ^
+program_source:59:10: warning: unused variable 'xyxy' [-Wunused-variable]
+  float4 xyxy = P.v.xyxy;
+         ^
+program_source:60:10: warning: unused variable 'xyxz' [-Wunused-variable]
+  float4 xyxz = P.v.xyxz;
+         ^
+program_source:61:10: warning: unused variable 'xyyx' [-Wunused-variable]
+  float4 xyyx = P.v.xyyx;
+         ^
+program_source:62:10: warning: unused variable 'xyyy' [-Wunused-variable]
+  float4 xyyy = P.v.xyyy;
+         ^
+program_source:63:10: warning: unused variable 'xyyz' [-Wunused-variable]
+  float4 xyyz = P.v.xyyz;
+         ^
+program_source:64:10: warning: unused variable 'xyzx' [-Wunused-variable]
+  float4 xyzx = P.v.xyzx;
+         ^
+program_source:65:10: warning: unused variable 'xyzy' [-Wunused-variable]
+  float4 xyzy = P.v.xyzy;
+         ^
+program_source:66:10: warning: unused variable 'xyzz' [-Wunused-variable]
+  float4 xyzz = P.v.xyzz;
+         ^
+program_source:67:10: warning: unused variable 'xzxx' [-Wunused-variable]
+  float4 xzxx = P.v.xzxx;
+         ^
+program_source:68:10: warning: unused variable 'xzxy' [-Wunused-variable]
+  float4 xzxy = P.v.xzxy;
+         ^
+program_source:69:10: warning: unused variable 'xzxz' [-Wunused-variable]
+  float4 xzxz = P.v.xzxz;
+         ^
+program_source:70:10: warning: unused variable 'xzyx' [-Wunused-variable]
+  float4 xzyx = P.v.xzyx;
+         ^
+program_source:71:10: warning: unused variable 'xzyy' [-Wunused-variable]
+  float4 xzyy = P.v.xzyy;
+         ^
+program_source:72:10: warning: unused variable 'xzyz' [-Wunused-variable]
+  float4 xzyz = P.v.xzyz;
+         ^
+program_source:73:10: warning: unused variable 'xzzx' [-Wunused-variable]
+  float4 xzzx = P.v.xzzx;
+         ^
+program_source:74:10: warning: unused variable 'xzzy' [-Wunused-variable]
+  float4 xzzy = P.v.xzzy;
+         ^
+program_source:75:10: warning: unused variable 'xzzz' [-Wunused-variable]
+  float4 xzzz = P.v.xzzz;
+         ^
+program_source:76:10: warning: unused variable 'yxxx' [-Wunused-variable]
+  float4 yxxx = P.v.yxxx;
+         ^
+program_source:77:10: warning: unused variable 'yxxy' [-Wunused-variable]
+  float4 yxxy = P.v.yxxy;
+         ^
+program_source:78:10: warning: unused variable 'yxxz' [-Wunused-variable]
+  float4 yxxz = P.v.yxxz;
+         ^
+program_source:79:10: warning: unused variable 'yxyx' [-Wunused-variable]
+  float4 yxyx = P.v.yxyx;
+         ^
+program_source:80:10: warning: unused variable 'yxyy' [-Wunused-variable]
+  float4 yxyy = P.v.yxyy;
+         ^
+program_source:81:10: warning: unused variable 'yxyz' [-Wunused-variable]
+  float4 yxyz = P.v.yxyz;
+         ^
+program_source:82:10: warning: unused variable 'yxzx' [-Wunused-variable]
+  float4 yxzx = P.v.yxzx;
+         ^
+program_source:83:10: warning: unused variable 'yxzy' [-Wunused-variable]
+  float4 yxzy = P.v.yxzy;
+         ^
+program_source:84:10: warning: unused variable 'yxzz' [-Wunused-variable]
+  float4 yxzz = P.v.yxzz;
+         ^
+program_source:85:10: warning: unused variable 'yyxx' [-Wunused-variable]
+  float4 yyxx = P.v.yyxx;
+         ^
+program_source:86:10: warning: unused variable 'yyxy' [-Wunused-variable]
+  float4 yyxy = P.v.yyxy;
+         ^
+program_source:87:10: warning: unused variable 'yyxz' [-Wunused-variable]
+  float4 yyxz = P.v.yyxz;
+         ^
+program_source:88:10: warning: unused variable 'yyyx' [-Wunused-variable]
+  float4 yyyx = P.v.yyyx;
+         ^
+program_source:89:10: warning: unused variable 'yyyy' [-Wunused-variable]
+  float4 yyyy = P.v.yyyy;
+         ^
+program_source:90:10: warning: unused variable 'yyyz' [-Wunused-variable]
+  float4 yyyz = P.v.yyyz;
+         ^
+program_source:91:10: warning: unused variable 'yyzx' [-Wunused-variable]
+  float4 yyzx = P.v.yyzx;
+         ^
+program_source:92:10: warning: unused variable 'yyzy' [-Wunused-variable]
+  float4 yyzy = P.v.yyzy;
+         ^
+program_source:93:10: warning: unused variable 'yyzz' [-Wunused-variable]
+  float4 yyzz = P.v.yyzz;
+         ^
+program_source:94:10: warning: unused variable 'yzxx' [-Wunused-variable]
+  float4 yzxx = P.v.yzxx;
+         ^
+program_source:95:10: warning: unused variable 'yzxy' [-Wunused-variable]
+  float4 yzxy = P.v.yzxy;
+         ^
+program_source:96:10: warning: unused variable 'yzxz' [-Wunused-variable]
+  float4 yzxz = P.v.yzxz;
+         ^
+program_source:97:10: warning: unused variable 'yzyx' [-Wunused-variable]
+  float4 yzyx = P.v.yzyx;
+         ^
+program_source:98:10: warning: unused variable 'yzyy' [-Wunused-variable]
+  float4 yzyy = P.v.yzyy;
+         ^
+program_source:99:10: warning: unused variable 'yzyz' [-Wunused-variable]
+  float4 yzyz = P.v.yzyz;
+         ^
+program_source:100:10: warning: unused variable 'yzzx' [-Wunused-variable]
+  float4 yzzx = P.v.yzzx;
+         ^
+program_source:101:10: warning: unused variable 'yzzy' [-Wunused-variable]
+  float4 yzzy = P.v.yzzy;
+         ^
+program_source:102:10: warning: unused variable 'yzzz' [-Wunused-variable]
+  float4 yzzz = P.v.yzzz;
+         ^
+program_source:103:10: warning: unused variable 'zxxx' [-Wunused-variable]
+  float4 zxxx = P.v.zxxx;
+         ^
+program_source:104:10: warning: unused variable 'zxxy' [-Wunused-variable]
+  float4 zxxy = P.v.zxxy;
+         ^
+program_source:105:10: warning: unused variable 'zxxz' [-Wunused-variable]
+  float4 zxxz = P.v.zxxz;
+         ^
+program_source:106:10: warning: unused variable 'zxyx' [-Wunused-variable]
+  float4 zxyx = P.v.zxyx;
+         ^
+program_source:107:10: warning: unused variable 'zxyy' [-Wunused-variable]
+  float4 zxyy = P.v.zxyy;
+         ^
+program_source:108:10: warning: unused variable 'zxyz' [-Wunused-variable]
+  float4 zxyz = P.v.zxyz;
+         ^
+program_source:109:10: warning: unused variable 'zxzx' [-Wunused-variable]
+  float4 zxzx = P.v.zxzx;
+         ^
+program_source:110:10: warning: unused variable 'zxzy' [-Wunused-variable]
+  float4 zxzy = P.v.zxzy;
+         ^
+program_source:111:10: warning: unused variable 'zxzz' [-Wunused-variable]
+  float4 zxzz = P.v.zxzz;
+         ^
+program_source:112:10: warning: unused variable 'zyxx' [-Wunused-variable]
+  float4 zyxx = P.v.zyxx;
+         ^
+program_source:113:10: warning: unused variable 'zyxy' [-Wunused-variable]
+  float4 zyxy = P.v.zyxy;
+         ^
+program_source:114:10: warning: unused variable 'zyxz' [-Wunused-variable]
+  float4 zyxz = P.v.zyxz;
+         ^
+program_source:115:10: warning: unused variable 'zyyx' [-Wunused-variable]
+  float4 zyyx = P.v.zyyx;
+         ^
+program_source:116:10: warning: unused variable 'zyyy' [-Wunused-variable]
+  float4 zyyy = P.v.zyyy;
+         ^
+program_source:117:10: warning: unused variable 'zyyz' [-Wunused-variable]
+  float4 zyyz = P.v.zyyz;
+         ^
+program_source:118:10: warning: unused variable 'zyzx' [-Wunused-variable]
+  float4 zyzx = P.v.zyzx;
+         ^
+program_source:119:10: warning: unused variable 'zyzy' [-Wunused-variable]
+  float4 zyzy = P.v.zyzy;
+         ^
+program_source:120:10: warning: unused variable 'zyzz' [-Wunused-variable]
+  float4 zyzz = P.v.zyzz;
+         ^
+program_source:121:10: warning: unused variable 'zzxx' [-Wunused-variable]
+  float4 zzxx = P.v.zzxx;
+         ^
+program_source:122:10: warning: unused variable 'zzxy' [-Wunused-variable]
+  float4 zzxy = P.v.zzxy;
+         ^
+program_source:123:10: warning: unused variable 'zzxz' [-Wunused-variable]
+  float4 zzxz = P.v.zzxz;
+         ^
+program_source:124:10: warning: unused variable 'zzyx' [-Wunused-variable]
+  float4 zzyx = P.v.zzyx;
+         ^
+program_source:125:10: warning: unused variable 'zzyy' [-Wunused-variable]
+  float4 zzyy = P.v.zzyy;
+         ^
+program_source:126:10: warning: unused variable 'zzyz' [-Wunused-variable]
+  float4 zzyz = P.v.zzyz;
+         ^
+program_source:127:10: warning: unused variable 'zzzx' [-Wunused-variable]
+  float4 zzzx = P.v.zzzx;
+         ^
+program_source:128:10: warning: unused variable 'zzzy' [-Wunused-variable]
+  float4 zzzy = P.v.zzzy;
+         ^
+program_source:129:10: warning: unused variable 'zzzz' [-Wunused-variable]
+  float4 zzzz = P.v.zzzz;
+         ^
+
diff --git a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.ir.msl
index 28251dc..f8f1803 100644
--- a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.ir.msl
@@ -1,9 +1,499 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  int3 v;
+};
+
+thread S P = {};
+void f() {
+  int3 v = P.v;
+  int x = P.v[0u];
+  int y = P.v[1u];
+  int z = P.v[2u];
+  int2 xx = P.v.xx;
+  int2 xy = P.v.xy;
+  int2 xz = P.v.xz;
+  int2 yx = P.v.yx;
+  int2 yy = P.v.yy;
+  int2 yz = P.v.yz;
+  int2 zx = P.v.zx;
+  int2 zy = P.v.zy;
+  int2 zz = P.v.zz;
+  int3 xxx = P.v.xxx;
+  int3 xxy = P.v.xxy;
+  int3 xxz = P.v.xxz;
+  int3 xyx = P.v.xyx;
+  int3 xyy = P.v.xyy;
+  int3 xyz = P.v.xyz;
+  int3 xzx = P.v.xzx;
+  int3 xzy = P.v.xzy;
+  int3 xzz = P.v.xzz;
+  int3 yxx = P.v.yxx;
+  int3 yxy = P.v.yxy;
+  int3 yxz = P.v.yxz;
+  int3 yyx = P.v.yyx;
+  int3 yyy = P.v.yyy;
+  int3 yyz = P.v.yyz;
+  int3 yzx = P.v.yzx;
+  int3 yzy = P.v.yzy;
+  int3 yzz = P.v.yzz;
+  int3 zxx = P.v.zxx;
+  int3 zxy = P.v.zxy;
+  int3 zxz = P.v.zxz;
+  int3 zyx = P.v.zyx;
+  int3 zyy = P.v.zyy;
+  int3 zyz = P.v.zyz;
+  int3 zzx = P.v.zzx;
+  int3 zzy = P.v.zzy;
+  int3 zzz = P.v.zzz;
+  int4 xxxx = P.v.xxxx;
+  int4 xxxy = P.v.xxxy;
+  int4 xxxz = P.v.xxxz;
+  int4 xxyx = P.v.xxyx;
+  int4 xxyy = P.v.xxyy;
+  int4 xxyz = P.v.xxyz;
+  int4 xxzx = P.v.xxzx;
+  int4 xxzy = P.v.xxzy;
+  int4 xxzz = P.v.xxzz;
+  int4 xyxx = P.v.xyxx;
+  int4 xyxy = P.v.xyxy;
+  int4 xyxz = P.v.xyxz;
+  int4 xyyx = P.v.xyyx;
+  int4 xyyy = P.v.xyyy;
+  int4 xyyz = P.v.xyyz;
+  int4 xyzx = P.v.xyzx;
+  int4 xyzy = P.v.xyzy;
+  int4 xyzz = P.v.xyzz;
+  int4 xzxx = P.v.xzxx;
+  int4 xzxy = P.v.xzxy;
+  int4 xzxz = P.v.xzxz;
+  int4 xzyx = P.v.xzyx;
+  int4 xzyy = P.v.xzyy;
+  int4 xzyz = P.v.xzyz;
+  int4 xzzx = P.v.xzzx;
+  int4 xzzy = P.v.xzzy;
+  int4 xzzz = P.v.xzzz;
+  int4 yxxx = P.v.yxxx;
+  int4 yxxy = P.v.yxxy;
+  int4 yxxz = P.v.yxxz;
+  int4 yxyx = P.v.yxyx;
+  int4 yxyy = P.v.yxyy;
+  int4 yxyz = P.v.yxyz;
+  int4 yxzx = P.v.yxzx;
+  int4 yxzy = P.v.yxzy;
+  int4 yxzz = P.v.yxzz;
+  int4 yyxx = P.v.yyxx;
+  int4 yyxy = P.v.yyxy;
+  int4 yyxz = P.v.yyxz;
+  int4 yyyx = P.v.yyyx;
+  int4 yyyy = P.v.yyyy;
+  int4 yyyz = P.v.yyyz;
+  int4 yyzx = P.v.yyzx;
+  int4 yyzy = P.v.yyzy;
+  int4 yyzz = P.v.yyzz;
+  int4 yzxx = P.v.yzxx;
+  int4 yzxy = P.v.yzxy;
+  int4 yzxz = P.v.yzxz;
+  int4 yzyx = P.v.yzyx;
+  int4 yzyy = P.v.yzyy;
+  int4 yzyz = P.v.yzyz;
+  int4 yzzx = P.v.yzzx;
+  int4 yzzy = P.v.yzzy;
+  int4 yzzz = P.v.yzzz;
+  int4 zxxx = P.v.zxxx;
+  int4 zxxy = P.v.zxxy;
+  int4 zxxz = P.v.zxxz;
+  int4 zxyx = P.v.zxyx;
+  int4 zxyy = P.v.zxyy;
+  int4 zxyz = P.v.zxyz;
+  int4 zxzx = P.v.zxzx;
+  int4 zxzy = P.v.zxzy;
+  int4 zxzz = P.v.zxzz;
+  int4 zyxx = P.v.zyxx;
+  int4 zyxy = P.v.zyxy;
+  int4 zyxz = P.v.zyxz;
+  int4 zyyx = P.v.zyyx;
+  int4 zyyy = P.v.zyyy;
+  int4 zyyz = P.v.zyyz;
+  int4 zyzx = P.v.zyzx;
+  int4 zyzy = P.v.zyzy;
+  int4 zyzz = P.v.zyzz;
+  int4 zzxx = P.v.zzxx;
+  int4 zzxy = P.v.zzxy;
+  int4 zzxz = P.v.zzxz;
+  int4 zzyx = P.v.zzyx;
+  int4 zzyy = P.v.zzyy;
+  int4 zzyz = P.v.zzyz;
+  int4 zzzx = P.v.zzzx;
+  int4 zzzy = P.v.zzzy;
+  int4 zzzz = P.v.zzzz;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+program_source:9:8: warning: unused variable 'v' [-Wunused-variable]
+  int3 v = P.v;
+       ^
+program_source:10:7: warning: unused variable 'x' [-Wunused-variable]
+  int x = P.v[0u];
+      ^
+program_source:11:7: warning: unused variable 'y' [-Wunused-variable]
+  int y = P.v[1u];
+      ^
+program_source:12:7: warning: unused variable 'z' [-Wunused-variable]
+  int z = P.v[2u];
+      ^
+program_source:13:8: warning: unused variable 'xx' [-Wunused-variable]
+  int2 xx = P.v.xx;
+       ^
+program_source:14:8: warning: unused variable 'xy' [-Wunused-variable]
+  int2 xy = P.v.xy;
+       ^
+program_source:15:8: warning: unused variable 'xz' [-Wunused-variable]
+  int2 xz = P.v.xz;
+       ^
+program_source:16:8: warning: unused variable 'yx' [-Wunused-variable]
+  int2 yx = P.v.yx;
+       ^
+program_source:17:8: warning: unused variable 'yy' [-Wunused-variable]
+  int2 yy = P.v.yy;
+       ^
+program_source:18:8: warning: unused variable 'yz' [-Wunused-variable]
+  int2 yz = P.v.yz;
+       ^
+program_source:19:8: warning: unused variable 'zx' [-Wunused-variable]
+  int2 zx = P.v.zx;
+       ^
+program_source:20:8: warning: unused variable 'zy' [-Wunused-variable]
+  int2 zy = P.v.zy;
+       ^
+program_source:21:8: warning: unused variable 'zz' [-Wunused-variable]
+  int2 zz = P.v.zz;
+       ^
+program_source:22:8: warning: unused variable 'xxx' [-Wunused-variable]
+  int3 xxx = P.v.xxx;
+       ^
+program_source:23:8: warning: unused variable 'xxy' [-Wunused-variable]
+  int3 xxy = P.v.xxy;
+       ^
+program_source:24:8: warning: unused variable 'xxz' [-Wunused-variable]
+  int3 xxz = P.v.xxz;
+       ^
+program_source:25:8: warning: unused variable 'xyx' [-Wunused-variable]
+  int3 xyx = P.v.xyx;
+       ^
+program_source:26:8: warning: unused variable 'xyy' [-Wunused-variable]
+  int3 xyy = P.v.xyy;
+       ^
+program_source:27:8: warning: unused variable 'xyz' [-Wunused-variable]
+  int3 xyz = P.v.xyz;
+       ^
+program_source:28:8: warning: unused variable 'xzx' [-Wunused-variable]
+  int3 xzx = P.v.xzx;
+       ^
+program_source:29:8: warning: unused variable 'xzy' [-Wunused-variable]
+  int3 xzy = P.v.xzy;
+       ^
+program_source:30:8: warning: unused variable 'xzz' [-Wunused-variable]
+  int3 xzz = P.v.xzz;
+       ^
+program_source:31:8: warning: unused variable 'yxx' [-Wunused-variable]
+  int3 yxx = P.v.yxx;
+       ^
+program_source:32:8: warning: unused variable 'yxy' [-Wunused-variable]
+  int3 yxy = P.v.yxy;
+       ^
+program_source:33:8: warning: unused variable 'yxz' [-Wunused-variable]
+  int3 yxz = P.v.yxz;
+       ^
+program_source:34:8: warning: unused variable 'yyx' [-Wunused-variable]
+  int3 yyx = P.v.yyx;
+       ^
+program_source:35:8: warning: unused variable 'yyy' [-Wunused-variable]
+  int3 yyy = P.v.yyy;
+       ^
+program_source:36:8: warning: unused variable 'yyz' [-Wunused-variable]
+  int3 yyz = P.v.yyz;
+       ^
+program_source:37:8: warning: unused variable 'yzx' [-Wunused-variable]
+  int3 yzx = P.v.yzx;
+       ^
+program_source:38:8: warning: unused variable 'yzy' [-Wunused-variable]
+  int3 yzy = P.v.yzy;
+       ^
+program_source:39:8: warning: unused variable 'yzz' [-Wunused-variable]
+  int3 yzz = P.v.yzz;
+       ^
+program_source:40:8: warning: unused variable 'zxx' [-Wunused-variable]
+  int3 zxx = P.v.zxx;
+       ^
+program_source:41:8: warning: unused variable 'zxy' [-Wunused-variable]
+  int3 zxy = P.v.zxy;
+       ^
+program_source:42:8: warning: unused variable 'zxz' [-Wunused-variable]
+  int3 zxz = P.v.zxz;
+       ^
+program_source:43:8: warning: unused variable 'zyx' [-Wunused-variable]
+  int3 zyx = P.v.zyx;
+       ^
+program_source:44:8: warning: unused variable 'zyy' [-Wunused-variable]
+  int3 zyy = P.v.zyy;
+       ^
+program_source:45:8: warning: unused variable 'zyz' [-Wunused-variable]
+  int3 zyz = P.v.zyz;
+       ^
+program_source:46:8: warning: unused variable 'zzx' [-Wunused-variable]
+  int3 zzx = P.v.zzx;
+       ^
+program_source:47:8: warning: unused variable 'zzy' [-Wunused-variable]
+  int3 zzy = P.v.zzy;
+       ^
+program_source:48:8: warning: unused variable 'zzz' [-Wunused-variable]
+  int3 zzz = P.v.zzz;
+       ^
+program_source:49:8: warning: unused variable 'xxxx' [-Wunused-variable]
+  int4 xxxx = P.v.xxxx;
+       ^
+program_source:50:8: warning: unused variable 'xxxy' [-Wunused-variable]
+  int4 xxxy = P.v.xxxy;
+       ^
+program_source:51:8: warning: unused variable 'xxxz' [-Wunused-variable]
+  int4 xxxz = P.v.xxxz;
+       ^
+program_source:52:8: warning: unused variable 'xxyx' [-Wunused-variable]
+  int4 xxyx = P.v.xxyx;
+       ^
+program_source:53:8: warning: unused variable 'xxyy' [-Wunused-variable]
+  int4 xxyy = P.v.xxyy;
+       ^
+program_source:54:8: warning: unused variable 'xxyz' [-Wunused-variable]
+  int4 xxyz = P.v.xxyz;
+       ^
+program_source:55:8: warning: unused variable 'xxzx' [-Wunused-variable]
+  int4 xxzx = P.v.xxzx;
+       ^
+program_source:56:8: warning: unused variable 'xxzy' [-Wunused-variable]
+  int4 xxzy = P.v.xxzy;
+       ^
+program_source:57:8: warning: unused variable 'xxzz' [-Wunused-variable]
+  int4 xxzz = P.v.xxzz;
+       ^
+program_source:58:8: warning: unused variable 'xyxx' [-Wunused-variable]
+  int4 xyxx = P.v.xyxx;
+       ^
+program_source:59:8: warning: unused variable 'xyxy' [-Wunused-variable]
+  int4 xyxy = P.v.xyxy;
+       ^
+program_source:60:8: warning: unused variable 'xyxz' [-Wunused-variable]
+  int4 xyxz = P.v.xyxz;
+       ^
+program_source:61:8: warning: unused variable 'xyyx' [-Wunused-variable]
+  int4 xyyx = P.v.xyyx;
+       ^
+program_source:62:8: warning: unused variable 'xyyy' [-Wunused-variable]
+  int4 xyyy = P.v.xyyy;
+       ^
+program_source:63:8: warning: unused variable 'xyyz' [-Wunused-variable]
+  int4 xyyz = P.v.xyyz;
+       ^
+program_source:64:8: warning: unused variable 'xyzx' [-Wunused-variable]
+  int4 xyzx = P.v.xyzx;
+       ^
+program_source:65:8: warning: unused variable 'xyzy' [-Wunused-variable]
+  int4 xyzy = P.v.xyzy;
+       ^
+program_source:66:8: warning: unused variable 'xyzz' [-Wunused-variable]
+  int4 xyzz = P.v.xyzz;
+       ^
+program_source:67:8: warning: unused variable 'xzxx' [-Wunused-variable]
+  int4 xzxx = P.v.xzxx;
+       ^
+program_source:68:8: warning: unused variable 'xzxy' [-Wunused-variable]
+  int4 xzxy = P.v.xzxy;
+       ^
+program_source:69:8: warning: unused variable 'xzxz' [-Wunused-variable]
+  int4 xzxz = P.v.xzxz;
+       ^
+program_source:70:8: warning: unused variable 'xzyx' [-Wunused-variable]
+  int4 xzyx = P.v.xzyx;
+       ^
+program_source:71:8: warning: unused variable 'xzyy' [-Wunused-variable]
+  int4 xzyy = P.v.xzyy;
+       ^
+program_source:72:8: warning: unused variable 'xzyz' [-Wunused-variable]
+  int4 xzyz = P.v.xzyz;
+       ^
+program_source:73:8: warning: unused variable 'xzzx' [-Wunused-variable]
+  int4 xzzx = P.v.xzzx;
+       ^
+program_source:74:8: warning: unused variable 'xzzy' [-Wunused-variable]
+  int4 xzzy = P.v.xzzy;
+       ^
+program_source:75:8: warning: unused variable 'xzzz' [-Wunused-variable]
+  int4 xzzz = P.v.xzzz;
+       ^
+program_source:76:8: warning: unused variable 'yxxx' [-Wunused-variable]
+  int4 yxxx = P.v.yxxx;
+       ^
+program_source:77:8: warning: unused variable 'yxxy' [-Wunused-variable]
+  int4 yxxy = P.v.yxxy;
+       ^
+program_source:78:8: warning: unused variable 'yxxz' [-Wunused-variable]
+  int4 yxxz = P.v.yxxz;
+       ^
+program_source:79:8: warning: unused variable 'yxyx' [-Wunused-variable]
+  int4 yxyx = P.v.yxyx;
+       ^
+program_source:80:8: warning: unused variable 'yxyy' [-Wunused-variable]
+  int4 yxyy = P.v.yxyy;
+       ^
+program_source:81:8: warning: unused variable 'yxyz' [-Wunused-variable]
+  int4 yxyz = P.v.yxyz;
+       ^
+program_source:82:8: warning: unused variable 'yxzx' [-Wunused-variable]
+  int4 yxzx = P.v.yxzx;
+       ^
+program_source:83:8: warning: unused variable 'yxzy' [-Wunused-variable]
+  int4 yxzy = P.v.yxzy;
+       ^
+program_source:84:8: warning: unused variable 'yxzz' [-Wunused-variable]
+  int4 yxzz = P.v.yxzz;
+       ^
+program_source:85:8: warning: unused variable 'yyxx' [-Wunused-variable]
+  int4 yyxx = P.v.yyxx;
+       ^
+program_source:86:8: warning: unused variable 'yyxy' [-Wunused-variable]
+  int4 yyxy = P.v.yyxy;
+       ^
+program_source:87:8: warning: unused variable 'yyxz' [-Wunused-variable]
+  int4 yyxz = P.v.yyxz;
+       ^
+program_source:88:8: warning: unused variable 'yyyx' [-Wunused-variable]
+  int4 yyyx = P.v.yyyx;
+       ^
+program_source:89:8: warning: unused variable 'yyyy' [-Wunused-variable]
+  int4 yyyy = P.v.yyyy;
+       ^
+program_source:90:8: warning: unused variable 'yyyz' [-Wunused-variable]
+  int4 yyyz = P.v.yyyz;
+       ^
+program_source:91:8: warning: unused variable 'yyzx' [-Wunused-variable]
+  int4 yyzx = P.v.yyzx;
+       ^
+program_source:92:8: warning: unused variable 'yyzy' [-Wunused-variable]
+  int4 yyzy = P.v.yyzy;
+       ^
+program_source:93:8: warning: unused variable 'yyzz' [-Wunused-variable]
+  int4 yyzz = P.v.yyzz;
+       ^
+program_source:94:8: warning: unused variable 'yzxx' [-Wunused-variable]
+  int4 yzxx = P.v.yzxx;
+       ^
+program_source:95:8: warning: unused variable 'yzxy' [-Wunused-variable]
+  int4 yzxy = P.v.yzxy;
+       ^
+program_source:96:8: warning: unused variable 'yzxz' [-Wunused-variable]
+  int4 yzxz = P.v.yzxz;
+       ^
+program_source:97:8: warning: unused variable 'yzyx' [-Wunused-variable]
+  int4 yzyx = P.v.yzyx;
+       ^
+program_source:98:8: warning: unused variable 'yzyy' [-Wunused-variable]
+  int4 yzyy = P.v.yzyy;
+       ^
+program_source:99:8: warning: unused variable 'yzyz' [-Wunused-variable]
+  int4 yzyz = P.v.yzyz;
+       ^
+program_source:100:8: warning: unused variable 'yzzx' [-Wunused-variable]
+  int4 yzzx = P.v.yzzx;
+       ^
+program_source:101:8: warning: unused variable 'yzzy' [-Wunused-variable]
+  int4 yzzy = P.v.yzzy;
+       ^
+program_source:102:8: warning: unused variable 'yzzz' [-Wunused-variable]
+  int4 yzzz = P.v.yzzz;
+       ^
+program_source:103:8: warning: unused variable 'zxxx' [-Wunused-variable]
+  int4 zxxx = P.v.zxxx;
+       ^
+program_source:104:8: warning: unused variable 'zxxy' [-Wunused-variable]
+  int4 zxxy = P.v.zxxy;
+       ^
+program_source:105:8: warning: unused variable 'zxxz' [-Wunused-variable]
+  int4 zxxz = P.v.zxxz;
+       ^
+program_source:106:8: warning: unused variable 'zxyx' [-Wunused-variable]
+  int4 zxyx = P.v.zxyx;
+       ^
+program_source:107:8: warning: unused variable 'zxyy' [-Wunused-variable]
+  int4 zxyy = P.v.zxyy;
+       ^
+program_source:108:8: warning: unused variable 'zxyz' [-Wunused-variable]
+  int4 zxyz = P.v.zxyz;
+       ^
+program_source:109:8: warning: unused variable 'zxzx' [-Wunused-variable]
+  int4 zxzx = P.v.zxzx;
+       ^
+program_source:110:8: warning: unused variable 'zxzy' [-Wunused-variable]
+  int4 zxzy = P.v.zxzy;
+       ^
+program_source:111:8: warning: unused variable 'zxzz' [-Wunused-variable]
+  int4 zxzz = P.v.zxzz;
+       ^
+program_source:112:8: warning: unused variable 'zyxx' [-Wunused-variable]
+  int4 zyxx = P.v.zyxx;
+       ^
+program_source:113:8: warning: unused variable 'zyxy' [-Wunused-variable]
+  int4 zyxy = P.v.zyxy;
+       ^
+program_source:114:8: warning: unused variable 'zyxz' [-Wunused-variable]
+  int4 zyxz = P.v.zyxz;
+       ^
+program_source:115:8: warning: unused variable 'zyyx' [-Wunused-variable]
+  int4 zyyx = P.v.zyyx;
+       ^
+program_source:116:8: warning: unused variable 'zyyy' [-Wunused-variable]
+  int4 zyyy = P.v.zyyy;
+       ^
+program_source:117:8: warning: unused variable 'zyyz' [-Wunused-variable]
+  int4 zyyz = P.v.zyyz;
+       ^
+program_source:118:8: warning: unused variable 'zyzx' [-Wunused-variable]
+  int4 zyzx = P.v.zyzx;
+       ^
+program_source:119:8: warning: unused variable 'zyzy' [-Wunused-variable]
+  int4 zyzy = P.v.zyzy;
+       ^
+program_source:120:8: warning: unused variable 'zyzz' [-Wunused-variable]
+  int4 zyzz = P.v.zyzz;
+       ^
+program_source:121:8: warning: unused variable 'zzxx' [-Wunused-variable]
+  int4 zzxx = P.v.zzxx;
+       ^
+program_source:122:8: warning: unused variable 'zzxy' [-Wunused-variable]
+  int4 zzxy = P.v.zzxy;
+       ^
+program_source:123:8: warning: unused variable 'zzxz' [-Wunused-variable]
+  int4 zzxz = P.v.zzxz;
+       ^
+program_source:124:8: warning: unused variable 'zzyx' [-Wunused-variable]
+  int4 zzyx = P.v.zzyx;
+       ^
+program_source:125:8: warning: unused variable 'zzyy' [-Wunused-variable]
+  int4 zzyy = P.v.zzyy;
+       ^
+program_source:126:8: warning: unused variable 'zzyz' [-Wunused-variable]
+  int4 zzyz = P.v.zzyz;
+       ^
+program_source:127:8: warning: unused variable 'zzzx' [-Wunused-variable]
+  int4 zzzx = P.v.zzzx;
+       ^
+program_source:128:8: warning: unused variable 'zzzy' [-Wunused-variable]
+  int4 zzzy = P.v.zzzy;
+       ^
+program_source:129:8: warning: unused variable 'zzzz' [-Wunused-variable]
+  int4 zzzz = P.v.zzzz;
+       ^
+
diff --git a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.ir.msl
index 28251dc..399f5f3 100644
--- a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.ir.msl
@@ -1,9 +1,499 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  uint3 v;
+};
+
+thread S P = {};
+void f() {
+  uint3 v = P.v;
+  uint x = P.v[0u];
+  uint y = P.v[1u];
+  uint z = P.v[2u];
+  uint2 xx = P.v.xx;
+  uint2 xy = P.v.xy;
+  uint2 xz = P.v.xz;
+  uint2 yx = P.v.yx;
+  uint2 yy = P.v.yy;
+  uint2 yz = P.v.yz;
+  uint2 zx = P.v.zx;
+  uint2 zy = P.v.zy;
+  uint2 zz = P.v.zz;
+  uint3 xxx = P.v.xxx;
+  uint3 xxy = P.v.xxy;
+  uint3 xxz = P.v.xxz;
+  uint3 xyx = P.v.xyx;
+  uint3 xyy = P.v.xyy;
+  uint3 xyz = P.v.xyz;
+  uint3 xzx = P.v.xzx;
+  uint3 xzy = P.v.xzy;
+  uint3 xzz = P.v.xzz;
+  uint3 yxx = P.v.yxx;
+  uint3 yxy = P.v.yxy;
+  uint3 yxz = P.v.yxz;
+  uint3 yyx = P.v.yyx;
+  uint3 yyy = P.v.yyy;
+  uint3 yyz = P.v.yyz;
+  uint3 yzx = P.v.yzx;
+  uint3 yzy = P.v.yzy;
+  uint3 yzz = P.v.yzz;
+  uint3 zxx = P.v.zxx;
+  uint3 zxy = P.v.zxy;
+  uint3 zxz = P.v.zxz;
+  uint3 zyx = P.v.zyx;
+  uint3 zyy = P.v.zyy;
+  uint3 zyz = P.v.zyz;
+  uint3 zzx = P.v.zzx;
+  uint3 zzy = P.v.zzy;
+  uint3 zzz = P.v.zzz;
+  uint4 xxxx = P.v.xxxx;
+  uint4 xxxy = P.v.xxxy;
+  uint4 xxxz = P.v.xxxz;
+  uint4 xxyx = P.v.xxyx;
+  uint4 xxyy = P.v.xxyy;
+  uint4 xxyz = P.v.xxyz;
+  uint4 xxzx = P.v.xxzx;
+  uint4 xxzy = P.v.xxzy;
+  uint4 xxzz = P.v.xxzz;
+  uint4 xyxx = P.v.xyxx;
+  uint4 xyxy = P.v.xyxy;
+  uint4 xyxz = P.v.xyxz;
+  uint4 xyyx = P.v.xyyx;
+  uint4 xyyy = P.v.xyyy;
+  uint4 xyyz = P.v.xyyz;
+  uint4 xyzx = P.v.xyzx;
+  uint4 xyzy = P.v.xyzy;
+  uint4 xyzz = P.v.xyzz;
+  uint4 xzxx = P.v.xzxx;
+  uint4 xzxy = P.v.xzxy;
+  uint4 xzxz = P.v.xzxz;
+  uint4 xzyx = P.v.xzyx;
+  uint4 xzyy = P.v.xzyy;
+  uint4 xzyz = P.v.xzyz;
+  uint4 xzzx = P.v.xzzx;
+  uint4 xzzy = P.v.xzzy;
+  uint4 xzzz = P.v.xzzz;
+  uint4 yxxx = P.v.yxxx;
+  uint4 yxxy = P.v.yxxy;
+  uint4 yxxz = P.v.yxxz;
+  uint4 yxyx = P.v.yxyx;
+  uint4 yxyy = P.v.yxyy;
+  uint4 yxyz = P.v.yxyz;
+  uint4 yxzx = P.v.yxzx;
+  uint4 yxzy = P.v.yxzy;
+  uint4 yxzz = P.v.yxzz;
+  uint4 yyxx = P.v.yyxx;
+  uint4 yyxy = P.v.yyxy;
+  uint4 yyxz = P.v.yyxz;
+  uint4 yyyx = P.v.yyyx;
+  uint4 yyyy = P.v.yyyy;
+  uint4 yyyz = P.v.yyyz;
+  uint4 yyzx = P.v.yyzx;
+  uint4 yyzy = P.v.yyzy;
+  uint4 yyzz = P.v.yyzz;
+  uint4 yzxx = P.v.yzxx;
+  uint4 yzxy = P.v.yzxy;
+  uint4 yzxz = P.v.yzxz;
+  uint4 yzyx = P.v.yzyx;
+  uint4 yzyy = P.v.yzyy;
+  uint4 yzyz = P.v.yzyz;
+  uint4 yzzx = P.v.yzzx;
+  uint4 yzzy = P.v.yzzy;
+  uint4 yzzz = P.v.yzzz;
+  uint4 zxxx = P.v.zxxx;
+  uint4 zxxy = P.v.zxxy;
+  uint4 zxxz = P.v.zxxz;
+  uint4 zxyx = P.v.zxyx;
+  uint4 zxyy = P.v.zxyy;
+  uint4 zxyz = P.v.zxyz;
+  uint4 zxzx = P.v.zxzx;
+  uint4 zxzy = P.v.zxzy;
+  uint4 zxzz = P.v.zxzz;
+  uint4 zyxx = P.v.zyxx;
+  uint4 zyxy = P.v.zyxy;
+  uint4 zyxz = P.v.zyxz;
+  uint4 zyyx = P.v.zyyx;
+  uint4 zyyy = P.v.zyyy;
+  uint4 zyyz = P.v.zyyz;
+  uint4 zyzx = P.v.zyzx;
+  uint4 zyzy = P.v.zyzy;
+  uint4 zyzz = P.v.zyzz;
+  uint4 zzxx = P.v.zzxx;
+  uint4 zzxy = P.v.zzxy;
+  uint4 zzxz = P.v.zzxz;
+  uint4 zzyx = P.v.zzyx;
+  uint4 zzyy = P.v.zzyy;
+  uint4 zzyz = P.v.zzyz;
+  uint4 zzzx = P.v.zzzx;
+  uint4 zzzy = P.v.zzzy;
+  uint4 zzzz = P.v.zzzz;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+program_source:9:9: warning: unused variable 'v' [-Wunused-variable]
+  uint3 v = P.v;
+        ^
+program_source:10:8: warning: unused variable 'x' [-Wunused-variable]
+  uint x = P.v[0u];
+       ^
+program_source:11:8: warning: unused variable 'y' [-Wunused-variable]
+  uint y = P.v[1u];
+       ^
+program_source:12:8: warning: unused variable 'z' [-Wunused-variable]
+  uint z = P.v[2u];
+       ^
+program_source:13:9: warning: unused variable 'xx' [-Wunused-variable]
+  uint2 xx = P.v.xx;
+        ^
+program_source:14:9: warning: unused variable 'xy' [-Wunused-variable]
+  uint2 xy = P.v.xy;
+        ^
+program_source:15:9: warning: unused variable 'xz' [-Wunused-variable]
+  uint2 xz = P.v.xz;
+        ^
+program_source:16:9: warning: unused variable 'yx' [-Wunused-variable]
+  uint2 yx = P.v.yx;
+        ^
+program_source:17:9: warning: unused variable 'yy' [-Wunused-variable]
+  uint2 yy = P.v.yy;
+        ^
+program_source:18:9: warning: unused variable 'yz' [-Wunused-variable]
+  uint2 yz = P.v.yz;
+        ^
+program_source:19:9: warning: unused variable 'zx' [-Wunused-variable]
+  uint2 zx = P.v.zx;
+        ^
+program_source:20:9: warning: unused variable 'zy' [-Wunused-variable]
+  uint2 zy = P.v.zy;
+        ^
+program_source:21:9: warning: unused variable 'zz' [-Wunused-variable]
+  uint2 zz = P.v.zz;
+        ^
+program_source:22:9: warning: unused variable 'xxx' [-Wunused-variable]
+  uint3 xxx = P.v.xxx;
+        ^
+program_source:23:9: warning: unused variable 'xxy' [-Wunused-variable]
+  uint3 xxy = P.v.xxy;
+        ^
+program_source:24:9: warning: unused variable 'xxz' [-Wunused-variable]
+  uint3 xxz = P.v.xxz;
+        ^
+program_source:25:9: warning: unused variable 'xyx' [-Wunused-variable]
+  uint3 xyx = P.v.xyx;
+        ^
+program_source:26:9: warning: unused variable 'xyy' [-Wunused-variable]
+  uint3 xyy = P.v.xyy;
+        ^
+program_source:27:9: warning: unused variable 'xyz' [-Wunused-variable]
+  uint3 xyz = P.v.xyz;
+        ^
+program_source:28:9: warning: unused variable 'xzx' [-Wunused-variable]
+  uint3 xzx = P.v.xzx;
+        ^
+program_source:29:9: warning: unused variable 'xzy' [-Wunused-variable]
+  uint3 xzy = P.v.xzy;
+        ^
+program_source:30:9: warning: unused variable 'xzz' [-Wunused-variable]
+  uint3 xzz = P.v.xzz;
+        ^
+program_source:31:9: warning: unused variable 'yxx' [-Wunused-variable]
+  uint3 yxx = P.v.yxx;
+        ^
+program_source:32:9: warning: unused variable 'yxy' [-Wunused-variable]
+  uint3 yxy = P.v.yxy;
+        ^
+program_source:33:9: warning: unused variable 'yxz' [-Wunused-variable]
+  uint3 yxz = P.v.yxz;
+        ^
+program_source:34:9: warning: unused variable 'yyx' [-Wunused-variable]
+  uint3 yyx = P.v.yyx;
+        ^
+program_source:35:9: warning: unused variable 'yyy' [-Wunused-variable]
+  uint3 yyy = P.v.yyy;
+        ^
+program_source:36:9: warning: unused variable 'yyz' [-Wunused-variable]
+  uint3 yyz = P.v.yyz;
+        ^
+program_source:37:9: warning: unused variable 'yzx' [-Wunused-variable]
+  uint3 yzx = P.v.yzx;
+        ^
+program_source:38:9: warning: unused variable 'yzy' [-Wunused-variable]
+  uint3 yzy = P.v.yzy;
+        ^
+program_source:39:9: warning: unused variable 'yzz' [-Wunused-variable]
+  uint3 yzz = P.v.yzz;
+        ^
+program_source:40:9: warning: unused variable 'zxx' [-Wunused-variable]
+  uint3 zxx = P.v.zxx;
+        ^
+program_source:41:9: warning: unused variable 'zxy' [-Wunused-variable]
+  uint3 zxy = P.v.zxy;
+        ^
+program_source:42:9: warning: unused variable 'zxz' [-Wunused-variable]
+  uint3 zxz = P.v.zxz;
+        ^
+program_source:43:9: warning: unused variable 'zyx' [-Wunused-variable]
+  uint3 zyx = P.v.zyx;
+        ^
+program_source:44:9: warning: unused variable 'zyy' [-Wunused-variable]
+  uint3 zyy = P.v.zyy;
+        ^
+program_source:45:9: warning: unused variable 'zyz' [-Wunused-variable]
+  uint3 zyz = P.v.zyz;
+        ^
+program_source:46:9: warning: unused variable 'zzx' [-Wunused-variable]
+  uint3 zzx = P.v.zzx;
+        ^
+program_source:47:9: warning: unused variable 'zzy' [-Wunused-variable]
+  uint3 zzy = P.v.zzy;
+        ^
+program_source:48:9: warning: unused variable 'zzz' [-Wunused-variable]
+  uint3 zzz = P.v.zzz;
+        ^
+program_source:49:9: warning: unused variable 'xxxx' [-Wunused-variable]
+  uint4 xxxx = P.v.xxxx;
+        ^
+program_source:50:9: warning: unused variable 'xxxy' [-Wunused-variable]
+  uint4 xxxy = P.v.xxxy;
+        ^
+program_source:51:9: warning: unused variable 'xxxz' [-Wunused-variable]
+  uint4 xxxz = P.v.xxxz;
+        ^
+program_source:52:9: warning: unused variable 'xxyx' [-Wunused-variable]
+  uint4 xxyx = P.v.xxyx;
+        ^
+program_source:53:9: warning: unused variable 'xxyy' [-Wunused-variable]
+  uint4 xxyy = P.v.xxyy;
+        ^
+program_source:54:9: warning: unused variable 'xxyz' [-Wunused-variable]
+  uint4 xxyz = P.v.xxyz;
+        ^
+program_source:55:9: warning: unused variable 'xxzx' [-Wunused-variable]
+  uint4 xxzx = P.v.xxzx;
+        ^
+program_source:56:9: warning: unused variable 'xxzy' [-Wunused-variable]
+  uint4 xxzy = P.v.xxzy;
+        ^
+program_source:57:9: warning: unused variable 'xxzz' [-Wunused-variable]
+  uint4 xxzz = P.v.xxzz;
+        ^
+program_source:58:9: warning: unused variable 'xyxx' [-Wunused-variable]
+  uint4 xyxx = P.v.xyxx;
+        ^
+program_source:59:9: warning: unused variable 'xyxy' [-Wunused-variable]
+  uint4 xyxy = P.v.xyxy;
+        ^
+program_source:60:9: warning: unused variable 'xyxz' [-Wunused-variable]
+  uint4 xyxz = P.v.xyxz;
+        ^
+program_source:61:9: warning: unused variable 'xyyx' [-Wunused-variable]
+  uint4 xyyx = P.v.xyyx;
+        ^
+program_source:62:9: warning: unused variable 'xyyy' [-Wunused-variable]
+  uint4 xyyy = P.v.xyyy;
+        ^
+program_source:63:9: warning: unused variable 'xyyz' [-Wunused-variable]
+  uint4 xyyz = P.v.xyyz;
+        ^
+program_source:64:9: warning: unused variable 'xyzx' [-Wunused-variable]
+  uint4 xyzx = P.v.xyzx;
+        ^
+program_source:65:9: warning: unused variable 'xyzy' [-Wunused-variable]
+  uint4 xyzy = P.v.xyzy;
+        ^
+program_source:66:9: warning: unused variable 'xyzz' [-Wunused-variable]
+  uint4 xyzz = P.v.xyzz;
+        ^
+program_source:67:9: warning: unused variable 'xzxx' [-Wunused-variable]
+  uint4 xzxx = P.v.xzxx;
+        ^
+program_source:68:9: warning: unused variable 'xzxy' [-Wunused-variable]
+  uint4 xzxy = P.v.xzxy;
+        ^
+program_source:69:9: warning: unused variable 'xzxz' [-Wunused-variable]
+  uint4 xzxz = P.v.xzxz;
+        ^
+program_source:70:9: warning: unused variable 'xzyx' [-Wunused-variable]
+  uint4 xzyx = P.v.xzyx;
+        ^
+program_source:71:9: warning: unused variable 'xzyy' [-Wunused-variable]
+  uint4 xzyy = P.v.xzyy;
+        ^
+program_source:72:9: warning: unused variable 'xzyz' [-Wunused-variable]
+  uint4 xzyz = P.v.xzyz;
+        ^
+program_source:73:9: warning: unused variable 'xzzx' [-Wunused-variable]
+  uint4 xzzx = P.v.xzzx;
+        ^
+program_source:74:9: warning: unused variable 'xzzy' [-Wunused-variable]
+  uint4 xzzy = P.v.xzzy;
+        ^
+program_source:75:9: warning: unused variable 'xzzz' [-Wunused-variable]
+  uint4 xzzz = P.v.xzzz;
+        ^
+program_source:76:9: warning: unused variable 'yxxx' [-Wunused-variable]
+  uint4 yxxx = P.v.yxxx;
+        ^
+program_source:77:9: warning: unused variable 'yxxy' [-Wunused-variable]
+  uint4 yxxy = P.v.yxxy;
+        ^
+program_source:78:9: warning: unused variable 'yxxz' [-Wunused-variable]
+  uint4 yxxz = P.v.yxxz;
+        ^
+program_source:79:9: warning: unused variable 'yxyx' [-Wunused-variable]
+  uint4 yxyx = P.v.yxyx;
+        ^
+program_source:80:9: warning: unused variable 'yxyy' [-Wunused-variable]
+  uint4 yxyy = P.v.yxyy;
+        ^
+program_source:81:9: warning: unused variable 'yxyz' [-Wunused-variable]
+  uint4 yxyz = P.v.yxyz;
+        ^
+program_source:82:9: warning: unused variable 'yxzx' [-Wunused-variable]
+  uint4 yxzx = P.v.yxzx;
+        ^
+program_source:83:9: warning: unused variable 'yxzy' [-Wunused-variable]
+  uint4 yxzy = P.v.yxzy;
+        ^
+program_source:84:9: warning: unused variable 'yxzz' [-Wunused-variable]
+  uint4 yxzz = P.v.yxzz;
+        ^
+program_source:85:9: warning: unused variable 'yyxx' [-Wunused-variable]
+  uint4 yyxx = P.v.yyxx;
+        ^
+program_source:86:9: warning: unused variable 'yyxy' [-Wunused-variable]
+  uint4 yyxy = P.v.yyxy;
+        ^
+program_source:87:9: warning: unused variable 'yyxz' [-Wunused-variable]
+  uint4 yyxz = P.v.yyxz;
+        ^
+program_source:88:9: warning: unused variable 'yyyx' [-Wunused-variable]
+  uint4 yyyx = P.v.yyyx;
+        ^
+program_source:89:9: warning: unused variable 'yyyy' [-Wunused-variable]
+  uint4 yyyy = P.v.yyyy;
+        ^
+program_source:90:9: warning: unused variable 'yyyz' [-Wunused-variable]
+  uint4 yyyz = P.v.yyyz;
+        ^
+program_source:91:9: warning: unused variable 'yyzx' [-Wunused-variable]
+  uint4 yyzx = P.v.yyzx;
+        ^
+program_source:92:9: warning: unused variable 'yyzy' [-Wunused-variable]
+  uint4 yyzy = P.v.yyzy;
+        ^
+program_source:93:9: warning: unused variable 'yyzz' [-Wunused-variable]
+  uint4 yyzz = P.v.yyzz;
+        ^
+program_source:94:9: warning: unused variable 'yzxx' [-Wunused-variable]
+  uint4 yzxx = P.v.yzxx;
+        ^
+program_source:95:9: warning: unused variable 'yzxy' [-Wunused-variable]
+  uint4 yzxy = P.v.yzxy;
+        ^
+program_source:96:9: warning: unused variable 'yzxz' [-Wunused-variable]
+  uint4 yzxz = P.v.yzxz;
+        ^
+program_source:97:9: warning: unused variable 'yzyx' [-Wunused-variable]
+  uint4 yzyx = P.v.yzyx;
+        ^
+program_source:98:9: warning: unused variable 'yzyy' [-Wunused-variable]
+  uint4 yzyy = P.v.yzyy;
+        ^
+program_source:99:9: warning: unused variable 'yzyz' [-Wunused-variable]
+  uint4 yzyz = P.v.yzyz;
+        ^
+program_source:100:9: warning: unused variable 'yzzx' [-Wunused-variable]
+  uint4 yzzx = P.v.yzzx;
+        ^
+program_source:101:9: warning: unused variable 'yzzy' [-Wunused-variable]
+  uint4 yzzy = P.v.yzzy;
+        ^
+program_source:102:9: warning: unused variable 'yzzz' [-Wunused-variable]
+  uint4 yzzz = P.v.yzzz;
+        ^
+program_source:103:9: warning: unused variable 'zxxx' [-Wunused-variable]
+  uint4 zxxx = P.v.zxxx;
+        ^
+program_source:104:9: warning: unused variable 'zxxy' [-Wunused-variable]
+  uint4 zxxy = P.v.zxxy;
+        ^
+program_source:105:9: warning: unused variable 'zxxz' [-Wunused-variable]
+  uint4 zxxz = P.v.zxxz;
+        ^
+program_source:106:9: warning: unused variable 'zxyx' [-Wunused-variable]
+  uint4 zxyx = P.v.zxyx;
+        ^
+program_source:107:9: warning: unused variable 'zxyy' [-Wunused-variable]
+  uint4 zxyy = P.v.zxyy;
+        ^
+program_source:108:9: warning: unused variable 'zxyz' [-Wunused-variable]
+  uint4 zxyz = P.v.zxyz;
+        ^
+program_source:109:9: warning: unused variable 'zxzx' [-Wunused-variable]
+  uint4 zxzx = P.v.zxzx;
+        ^
+program_source:110:9: warning: unused variable 'zxzy' [-Wunused-variable]
+  uint4 zxzy = P.v.zxzy;
+        ^
+program_source:111:9: warning: unused variable 'zxzz' [-Wunused-variable]
+  uint4 zxzz = P.v.zxzz;
+        ^
+program_source:112:9: warning: unused variable 'zyxx' [-Wunused-variable]
+  uint4 zyxx = P.v.zyxx;
+        ^
+program_source:113:9: warning: unused variable 'zyxy' [-Wunused-variable]
+  uint4 zyxy = P.v.zyxy;
+        ^
+program_source:114:9: warning: unused variable 'zyxz' [-Wunused-variable]
+  uint4 zyxz = P.v.zyxz;
+        ^
+program_source:115:9: warning: unused variable 'zyyx' [-Wunused-variable]
+  uint4 zyyx = P.v.zyyx;
+        ^
+program_source:116:9: warning: unused variable 'zyyy' [-Wunused-variable]
+  uint4 zyyy = P.v.zyyy;
+        ^
+program_source:117:9: warning: unused variable 'zyyz' [-Wunused-variable]
+  uint4 zyyz = P.v.zyyz;
+        ^
+program_source:118:9: warning: unused variable 'zyzx' [-Wunused-variable]
+  uint4 zyzx = P.v.zyzx;
+        ^
+program_source:119:9: warning: unused variable 'zyzy' [-Wunused-variable]
+  uint4 zyzy = P.v.zyzy;
+        ^
+program_source:120:9: warning: unused variable 'zyzz' [-Wunused-variable]
+  uint4 zyzz = P.v.zyzz;
+        ^
+program_source:121:9: warning: unused variable 'zzxx' [-Wunused-variable]
+  uint4 zzxx = P.v.zzxx;
+        ^
+program_source:122:9: warning: unused variable 'zzxy' [-Wunused-variable]
+  uint4 zzxy = P.v.zzxy;
+        ^
+program_source:123:9: warning: unused variable 'zzxz' [-Wunused-variable]
+  uint4 zzxz = P.v.zzxz;
+        ^
+program_source:124:9: warning: unused variable 'zzyx' [-Wunused-variable]
+  uint4 zzyx = P.v.zzyx;
+        ^
+program_source:125:9: warning: unused variable 'zzyy' [-Wunused-variable]
+  uint4 zzyy = P.v.zzyy;
+        ^
+program_source:126:9: warning: unused variable 'zzyz' [-Wunused-variable]
+  uint4 zzyz = P.v.zzyz;
+        ^
+program_source:127:9: warning: unused variable 'zzzx' [-Wunused-variable]
+  uint4 zzzx = P.v.zzzx;
+        ^
+program_source:128:9: warning: unused variable 'zzzy' [-Wunused-variable]
+  uint4 zzzy = P.v.zzzy;
+        ^
+program_source:129:9: warning: unused variable 'zzzz' [-Wunused-variable]
+  uint4 zzzz = P.v.zzzz;
+        ^
+
diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.ir.msl
index 171a7c5..75b0647 100644
--- a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(8) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(8) {
   v:vec3<f16> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.ir.msl
index 556ac75..9409642 100644
--- a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<f32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.ir.msl
index 11eb721..b71cd03 100644
--- a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<i32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.ir.msl
index 3374c6f..0919737 100644
--- a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.ir.msl
@@ -1,6 +1,6 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:355 internal compiler error: S = struct @align(16) {
+<dawn>/src/tint/lang/msl/writer/printer/printer.cc:458 internal compiler error: S = struct @align(16) {
   v:vec3<u32> @offset(0)
 }
 
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl b/test/tint/expressions/swizzle/write/swizzle.wgsl
new file mode 100644
index 0000000..799e7bb
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl
@@ -0,0 +1,12 @@
+struct S {
+    val: array<vec3f, 3>,
+}
+
+fn a() {
+    var a = vec4();
+    a.x = 1;
+    a.z = 2;
+
+    var d = S();
+    d.val[2].y = 3;
+}
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..516eca1
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.dxc.hlsl
@@ -0,0 +1,16 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+struct S {
+  float3 val[3];
+};
+
+void a() {
+  int4 a_1 = (0).xxxx;
+  a_1.x = 1;
+  a_1.z = 2;
+  S d = (S)0;
+  d.val[2].y = 3.0f;
+}
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..516eca1
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.fxc.hlsl
@@ -0,0 +1,16 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+  return;
+}
+
+struct S {
+  float3 val[3];
+};
+
+void a() {
+  int4 a_1 = (0).xxxx;
+  a_1.x = 1;
+  a_1.z = 2;
+  S d = (S)0;
+  d.val[2].y = 3.0f;
+}
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.glsl
new file mode 100644
index 0000000..5398b94
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void unused_entry_point() {
+  return;
+}
+struct S {
+  vec3 val[3];
+};
+
+void a() {
+  ivec4 a_1 = ivec4(0);
+  a_1.x = 1;
+  a_1.z = 2;
+  S d = S(vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f)));
+  d.val[2].y = 3.0f;
+}
+
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.ir.msl
new file mode 100644
index 0000000..3765ea7
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.ir.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+using namespace metal;
+template<typename T, size_t N>
+struct tint_array {
+  const constant T& operator[](size_t i) const constant { return elements[i]; }
+  device T& operator[](size_t i) device { return elements[i]; }
+  const device T& operator[](size_t i) const device { return elements[i]; }
+  thread T& operator[](size_t i) thread { return elements[i]; }
+  const thread T& operator[](size_t i) const thread { return elements[i]; }
+  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+  T elements[N];
+};
+
+struct S {
+  tint_array<float3, 3> val;
+};
+
+void a() {
+  int4 a = int4(0);
+  a[0u] = 1;
+  a[2u] = 2;
+  S d = S{};
+  d.val[2][1u] = 3.0f;
+}
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.msl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.msl
new file mode 100644
index 0000000..1501ee7
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+    const constant T& operator[](size_t i) const constant { return elements[i]; }
+    device T& operator[](size_t i) device { return elements[i]; }
+    const device T& operator[](size_t i) const device { return elements[i]; }
+    thread T& operator[](size_t i) thread { return elements[i]; }
+    const thread T& operator[](size_t i) const thread { return elements[i]; }
+    threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+    const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+    T elements[N];
+};
+
+struct S {
+  tint_array<float3, 3> val;
+};
+
+void a() {
+  int4 a_1 = int4(0);
+  a_1[0] = 1;
+  a_1[2] = 2;
+  S d = S{};
+  d.val[2][1] = 3.0f;
+}
+
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.spvasm
new file mode 100644
index 0000000..7fe488e
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; 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 %a "a"
+               OpName %a_1 "a_1"
+               OpName %S "S"
+               OpMemberName %S 0 "val"
+               OpName %d "d"
+               OpMemberDecorate %S 0 Offset 0
+               OpDecorate %_arr_v3float_uint_3 ArrayStride 16
+       %void = OpTypeVoid
+          %1 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %v4int = OpTypeVector %int 4
+          %9 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Function_int = OpTypePointer Function %int
+      %int_1 = OpConstant %int 1
+     %uint_2 = OpConstant %uint 2
+      %int_2 = OpConstant %int 2
+      %float = OpTypeFloat 32
+    %v3float = OpTypeVector %float 3
+     %uint_3 = OpConstant %uint 3
+%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3
+          %S = OpTypeStruct %_arr_v3float_uint_3
+         %25 = OpConstantNull %S
+%_ptr_Function_S = OpTypePointer Function %S
+     %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+    %float_3 = OpConstant %float 3
+%unused_entry_point = OpFunction %void None %1
+          %4 = OpLabel
+               OpReturn
+               OpFunctionEnd
+          %a = OpFunction %void None %1
+          %6 = OpLabel
+        %a_1 = OpVariable %_ptr_Function_v4int Function %9
+          %d = OpVariable %_ptr_Function_S Function %25
+               OpStore %a_1 %9
+         %15 = OpAccessChain %_ptr_Function_int %a_1 %uint_0
+               OpStore %15 %int_1
+         %18 = OpAccessChain %_ptr_Function_int %a_1 %uint_2
+               OpStore %18 %int_2
+               OpStore %d %25
+         %30 = OpAccessChain %_ptr_Function_float %d %uint_0 %int_2 %uint_1
+               OpStore %30 %float_3
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.wgsl b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.wgsl
new file mode 100644
index 0000000..76c5408
--- /dev/null
+++ b/test/tint/expressions/swizzle/write/swizzle.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+struct S {
+  val : array<vec3f, 3>,
+}
+
+fn a() {
+  var a = vec4();
+  a.x = 1;
+  a.z = 2;
+  var d = S();
+  d.val[2].y = 3;
+}
diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.ir.msl
index 28251dc..1fa363e 100644
--- a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.ir.msl
@@ -1,9 +1,19 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  half3 v;
+};
+
+thread S P = {};
+void f() {
+  P.v = half3(1.0h, 2.0h, 3.0h);
+  P.v[0u] = 1.0h;
+  P.v[1u] = 2.0h;
+  P.v[2u] = 3.0h;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+
diff --git a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.ir.msl
index 28251dc..d883ba5 100644
--- a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.ir.msl
@@ -1,9 +1,19 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  float3 v;
+};
+
+thread S P = {};
+void f() {
+  P.v = float3(1.0f, 2.0f, 3.0f);
+  P.v[0u] = 1.0f;
+  P.v[1u] = 2.0f;
+  P.v[2u] = 3.0f;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+
diff --git a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.ir.msl
index 28251dc..882337f 100644
--- a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.ir.msl
@@ -1,9 +1,19 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  int3 v;
+};
+
+thread S P = {};
+void f() {
+  P.v = int3(1, 2, 3);
+  P.v[0u] = 1;
+  P.v[1u] = 2;
+  P.v[2u] = 3;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+
diff --git a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.ir.msl b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.ir.msl
index 28251dc..c82764c 100644
--- a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.ir.msl
+++ b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.ir.msl
@@ -1,9 +1,19 @@
 SKIP: FAILED
 
-<dawn>/src/tint/lang/msl/writer/printer/printer.cc:247 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+#include <metal_stdlib>
+using namespace metal;
+struct S {
+  uint3 v;
+};
+
+thread S P = {};
+void f() {
+  P.v = uint3(1u, 2u, 3u);
+  P.v[0u] = 1u;
+  P.v[1u] = 2u;
+  P.v[2u] = 3u;
+}
+program_source:7:10: error: program scope variable must reside in constant address space
+thread S P = {};
+         ^
+