[spirv-reader] Detect constant vector splats

When all operands to an OpConstantComposite for a vector type are the
same, use a vector splat.

Change-Id: I53680e1c8a1589ab0b2047fb6cfdaaae2ba5b654
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/137882
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/test/tint/bug/tint/1520.spvasm.expected.wgsl b/test/tint/bug/tint/1520.spvasm.expected.wgsl
index 1cbb3f3..30d5150 100644
--- a/test/tint/bug/tint/1520.spvasm.expected.wgsl
+++ b/test/tint/bug/tint/1520.spvasm.expected.wgsl
@@ -19,9 +19,9 @@
 
 var<private> vcolor_S0 : vec4f;
 
-const x_46 = vec4i(1i, 1i, 1i, 1i);
+const x_46 = vec4i(1i);
 
-const x_57 = vec4i(2i, 2i, 2i, 2i);
+const x_57 = vec4i(2i);
 
 fn test_int_S1_c0_b() -> bool {
   var unknown : i32;
@@ -76,9 +76,9 @@
   return x_66;
 }
 
-const x_91 = vec4f(1.0f, 1.0f, 1.0f, 1.0f);
+const x_91 = vec4f(1.0f);
 
-const x_102 = vec4f(2.0f, 2.0f, 2.0f, 2.0f);
+const x_102 = vec4f(2.0f);
 
 fn main_1() {
   var outputColor_S0 : vec4f;
diff --git a/test/tint/bug/tint/1932.spvasm.expected.wgsl b/test/tint/bug/tint/1932.spvasm.expected.wgsl
index 5216558..172c292 100644
--- a/test/tint/bug/tint/1932.spvasm.expected.wgsl
+++ b/test/tint/bug/tint/1932.spvasm.expected.wgsl
@@ -1,4 +1,4 @@
-const x_22 = vec2f(2.0f, 2.0f);
+const x_22 = vec2f(2.0f);
 
 fn main_1() {
   let distance_1 = x_22;
diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl
index c5a058a..e80cd30 100644
--- a/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl
+++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl
@@ -1,7 +1,7 @@
 fn main_1() {
   var m = mat3x3f();
   m = mat3x3f(vec3f(1.0f, 2.0f, 3.0f), vec3f(4.0f, 5.0f, 6.0f), vec3f(7.0f, 8.0f, 9.0f));
-  m[1i] = vec3f(5.0f, 5.0f, 5.0f);
+  m[1i] = vec3f(5.0f);
   return;
 }