Revert "Vectorize scalars in SPIR-V using ConstructorSplat."
This reverts commit 5d61cc2f87a9f988e68497be850a20926e473d04.
Reason for revert: break Vk bots
Original change's description:
> Vectorize scalars in SPIR-V using ConstructorSplat.
>
> This avoids redundant code, and has a small side benefit of
> deduplicating constant vectors which appear more than once in the code,
> since `writeConstructorSplat` already supports this.
>
> Change-Id: I2972ee922ac92adeb40bc765da3b490a59b957b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408360
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I9fc0b896c0cfccc348d510a02df47d5ad74a0e90
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408644
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
index 238c685..e14e4eb 100644
--- a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
@@ -855,13 +855,18 @@
result.reserve(args.size());
for (const auto& arg : args) {
const Type& argType = arg->type();
+ SpvId raw = this->writeExpression(*arg, out);
if (vectorSize && argType.isScalar()) {
- ConstructorSplat splat{/*offset=*/-1,
- argType.toCompound(fContext, vectorSize, /*rows=*/1),
- arg->clone()};
- result.push_back(this->writeConstructorSplat(splat, out));
+ SpvId vector = this->nextId(&arg->type());
+ this->writeOpCode(SpvOpCompositeConstruct, 3 + vectorSize, out);
+ this->writeWord(this->getType(argType.toCompound(fContext, vectorSize, 1)), out);
+ this->writeWord(vector, out);
+ for (int i = 0; i < vectorSize; i++) {
+ this->writeWord(raw, out);
+ }
+ result.push_back(vector);
} else {
- result.push_back(this->writeExpression(*arg, out));
+ result.push_back(raw);
}
}
return result;
diff --git a/tests/sksl/blend/BlendEnum.asm.frag b/tests/sksl/blend/BlendEnum.asm.frag
index 633f1ad..867cb59 100644
--- a/tests/sksl/blend/BlendEnum.asm.frag
+++ b/tests/sksl/blend/BlendEnum.asm.frag
@@ -1033,7 +1033,6 @@
%_ptr_Function_int = OpTypePointer Function %int
%657 = OpTypeFunction %v4float %_ptr_Function_int %_ptr_Function_v4float %_ptr_Function_v4float
%695 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
-%765 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%void = OpTypeVoid
%1215 = OpTypeFunction %void
%int_13 = OpConstant %int 13
@@ -1927,6 +1926,7 @@
%762 = OpLoad %v4float %660
%763 = OpLoad %v4float %661
%764 = OpFAdd %v4float %762 %763
+%765 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%761 = OpExtInst %v4float %1 FMin %764 %765
OpReturnValue %761
%678 = OpLabel
diff --git a/tests/sksl/blend/BlendPlus.asm.frag b/tests/sksl/blend/BlendPlus.asm.frag
index f260d4c..8f7e6ce 100644
--- a/tests/sksl/blend/BlendPlus.asm.frag
+++ b/tests/sksl/blend/BlendPlus.asm.frag
@@ -41,7 +41,6 @@
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%float_1 = OpConstant %float 1
-%27 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %14
%15 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
@@ -49,6 +48,7 @@
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%24 = OpLoad %v4float %22
%25 = OpFAdd %v4float %21 %24
+%27 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%16 = OpExtInst %v4float %1 FMin %25 %27
OpStore %sk_FragColor %16
OpReturn
diff --git a/tests/sksl/intrinsics/ClampFloat.asm.frag b/tests/sksl/intrinsics/ClampFloat.asm.frag
index e9181db..327ebf0 100644
--- a/tests/sksl/intrinsics/ClampFloat.asm.frag
+++ b/tests/sksl/intrinsics/ClampFloat.asm.frag
@@ -121,15 +121,9 @@
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
-%60 = OpConstantComposite %v2float %float_n1 %float_n1
-%61 = OpConstantComposite %v2float %float_1 %float_1
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
-%75 = OpConstantComposite %v3float %float_n1 %float_n1 %float_n1
-%76 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%v3bool = OpTypeVector %bool 3
-%88 = OpConstantComposite %v4float %float_n1 %float_n1 %float_n1 %float_n1
-%89 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%v4bool = OpTypeVector %bool 4
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
@@ -166,6 +160,8 @@
%57 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%58 = OpLoad %v4float %57
%59 = OpVectorShuffle %v2float %58 %58 0 1
+%60 = OpCompositeConstruct %v2float %float_n1 %float_n1
+%61 = OpCompositeConstruct %v2float %float_1 %float_1
%56 = OpExtInst %v2float %1 FClamp %59 %60 %61
%62 = OpLoad %v4float %expectedA
%63 = OpVectorShuffle %v2float %62 %62 0 1
@@ -180,6 +176,8 @@
%71 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%72 = OpLoad %v4float %71
%73 = OpVectorShuffle %v3float %72 %72 0 1 2
+%75 = OpCompositeConstruct %v3float %float_n1 %float_n1 %float_n1
+%76 = OpCompositeConstruct %v3float %float_1 %float_1 %float_1
%70 = OpExtInst %v3float %1 FClamp %73 %75 %76
%77 = OpLoad %v4float %expectedA
%78 = OpVectorShuffle %v3float %77 %77 0 1 2
@@ -193,6 +191,8 @@
%83 = OpLabel
%86 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%87 = OpLoad %v4float %86
+%88 = OpCompositeConstruct %v4float %float_n1 %float_n1 %float_n1 %float_n1
+%89 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%85 = OpExtInst %v4float %1 FClamp %87 %88 %89
%90 = OpLoad %v4float %expectedA
%91 = OpFOrdEqual %v4bool %85 %90
diff --git a/tests/sksl/intrinsics/ClampInt.asm.frag b/tests/sksl/intrinsics/ClampInt.asm.frag
index 781232d..6933548 100644
--- a/tests/sksl/intrinsics/ClampInt.asm.frag
+++ b/tests/sksl/intrinsics/ClampInt.asm.frag
@@ -75,15 +75,9 @@
%60 = OpConstantComposite %v4int %int_100 %int_200 %int_50 %int_300
%false = OpConstantFalse %bool
%v2int = OpTypeVector %int 2
-%74 = OpConstantComposite %v2int %int_n100 %int_n100
-%75 = OpConstantComposite %v2int %int_100 %int_100
%v2bool = OpTypeVector %bool 2
%v3int = OpTypeVector %int 3
-%88 = OpConstantComposite %v3int %int_n100 %int_n100 %int_n100
-%89 = OpConstantComposite %v3int %int_100 %int_100 %int_100
%v3bool = OpTypeVector %bool 3
-%100 = OpConstantComposite %v4int %int_n100 %int_n100 %int_n100 %int_n100
-%101 = OpConstantComposite %v4int %int_100 %int_100 %int_100 %int_100
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
@@ -133,6 +127,8 @@
%68 = OpLabel
%71 = OpLoad %v4int %intValues
%72 = OpVectorShuffle %v2int %71 %71 0 1
+%74 = OpCompositeConstruct %v2int %int_n100 %int_n100
+%75 = OpCompositeConstruct %v2int %int_100 %int_100
%70 = OpExtInst %v2int %1 SClamp %72 %74 %75
%76 = OpLoad %v4int %expectedA
%77 = OpVectorShuffle %v2int %76 %76 0 1
@@ -146,6 +142,8 @@
%82 = OpLabel
%85 = OpLoad %v4int %intValues
%86 = OpVectorShuffle %v3int %85 %85 0 1 2
+%88 = OpCompositeConstruct %v3int %int_n100 %int_n100 %int_n100
+%89 = OpCompositeConstruct %v3int %int_100 %int_100 %int_100
%84 = OpExtInst %v3int %1 SClamp %86 %88 %89
%90 = OpLoad %v4int %expectedA
%91 = OpVectorShuffle %v3int %90 %90 0 1 2
@@ -158,6 +156,8 @@
OpBranchConditional %95 %96 %97
%96 = OpLabel
%99 = OpLoad %v4int %intValues
+%100 = OpCompositeConstruct %v4int %int_n100 %int_n100 %int_n100 %int_n100
+%101 = OpCompositeConstruct %v4int %int_100 %int_100 %int_100 %int_100
%98 = OpExtInst %v4int %1 SClamp %99 %100 %101
%102 = OpLoad %v4int %expectedA
%103 = OpIEqual %v4bool %98 %102
diff --git a/tests/sksl/intrinsics/MaxFloat.asm.frag b/tests/sksl/intrinsics/MaxFloat.asm.frag
index ae71fe50..26afe29 100644
--- a/tests/sksl/intrinsics/MaxFloat.asm.frag
+++ b/tests/sksl/intrinsics/MaxFloat.asm.frag
@@ -99,12 +99,9 @@
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
-%52 = OpConstantComposite %v2float %float_0_5 %float_0_5
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
-%66 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
%v3bool = OpTypeVector %bool 3
-%78 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%v4bool = OpTypeVector %bool 4
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
@@ -137,6 +134,7 @@
%49 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%50 = OpLoad %v4float %49
%51 = OpVectorShuffle %v2float %50 %50 0 1
+%52 = OpCompositeConstruct %v2float %float_0_5 %float_0_5
%48 = OpExtInst %v2float %1 FMax %51 %52
%53 = OpLoad %v4float %expectedA
%54 = OpVectorShuffle %v2float %53 %53 0 1
@@ -151,6 +149,7 @@
%62 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%63 = OpLoad %v4float %62
%64 = OpVectorShuffle %v3float %63 %63 0 1 2
+%66 = OpCompositeConstruct %v3float %float_0_5 %float_0_5 %float_0_5
%61 = OpExtInst %v3float %1 FMax %64 %66
%67 = OpLoad %v4float %expectedA
%68 = OpVectorShuffle %v3float %67 %67 0 1 2
@@ -164,6 +163,7 @@
%73 = OpLabel
%76 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%77 = OpLoad %v4float %76
+%78 = OpCompositeConstruct %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%75 = OpExtInst %v4float %1 FMax %77 %78
%79 = OpLoad %v4float %expectedA
%80 = OpFOrdEqual %v4bool %75 %79
diff --git a/tests/sksl/intrinsics/MaxInt.asm.frag b/tests/sksl/intrinsics/MaxInt.asm.frag
index 8856302..3465b3a 100644
--- a/tests/sksl/intrinsics/MaxInt.asm.frag
+++ b/tests/sksl/intrinsics/MaxInt.asm.frag
@@ -75,12 +75,9 @@
%66 = OpConstantComposite %v4int %int_0 %int_100 %int_75 %int_225
%false = OpConstantFalse %bool
%v2int = OpTypeVector %int 2
-%80 = OpConstantComposite %v2int %int_50 %int_50
%v2bool = OpTypeVector %bool 2
%v3int = OpTypeVector %int 3
-%93 = OpConstantComposite %v3int %int_50 %int_50 %int_50
%v3bool = OpTypeVector %bool 3
-%104 = OpConstantComposite %v4int %int_50 %int_50 %int_50 %int_50
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_2 = OpConstant %int 2
@@ -139,6 +136,7 @@
%74 = OpLabel
%77 = OpLoad %v4int %intValues
%78 = OpVectorShuffle %v2int %77 %77 0 1
+%80 = OpCompositeConstruct %v2int %int_50 %int_50
%76 = OpExtInst %v2int %1 SMax %78 %80
%81 = OpLoad %v4int %expectedA
%82 = OpVectorShuffle %v2int %81 %81 0 1
@@ -152,6 +150,7 @@
%87 = OpLabel
%90 = OpLoad %v4int %intValues
%91 = OpVectorShuffle %v3int %90 %90 0 1 2
+%93 = OpCompositeConstruct %v3int %int_50 %int_50 %int_50
%89 = OpExtInst %v3int %1 SMax %91 %93
%94 = OpLoad %v4int %expectedA
%95 = OpVectorShuffle %v3int %94 %94 0 1 2
@@ -164,6 +163,7 @@
OpBranchConditional %99 %100 %101
%100 = OpLabel
%103 = OpLoad %v4int %intValues
+%104 = OpCompositeConstruct %v4int %int_50 %int_50 %int_50 %int_50
%102 = OpExtInst %v4int %1 SMax %103 %104
%105 = OpLoad %v4int %expectedA
%106 = OpIEqual %v4bool %102 %105
diff --git a/tests/sksl/intrinsics/MinFloat.asm.frag b/tests/sksl/intrinsics/MinFloat.asm.frag
index 85d6be5..bb2b8fc 100644
--- a/tests/sksl/intrinsics/MinFloat.asm.frag
+++ b/tests/sksl/intrinsics/MinFloat.asm.frag
@@ -98,12 +98,9 @@
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
-%51 = OpConstantComposite %v2float %float_0_5 %float_0_5
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
-%65 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
%v3bool = OpTypeVector %bool 3
-%77 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%v4bool = OpTypeVector %bool 4
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
@@ -136,6 +133,7 @@
%48 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%49 = OpLoad %v4float %48
%50 = OpVectorShuffle %v2float %49 %49 0 1
+%51 = OpCompositeConstruct %v2float %float_0_5 %float_0_5
%47 = OpExtInst %v2float %1 FMin %50 %51
%52 = OpLoad %v4float %expectedA
%53 = OpVectorShuffle %v2float %52 %52 0 1
@@ -150,6 +148,7 @@
%61 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%62 = OpLoad %v4float %61
%63 = OpVectorShuffle %v3float %62 %62 0 1 2
+%65 = OpCompositeConstruct %v3float %float_0_5 %float_0_5 %float_0_5
%60 = OpExtInst %v3float %1 FMin %63 %65
%66 = OpLoad %v4float %expectedA
%67 = OpVectorShuffle %v3float %66 %66 0 1 2
@@ -163,6 +162,7 @@
%72 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%76 = OpLoad %v4float %75
+%77 = OpCompositeConstruct %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%74 = OpExtInst %v4float %1 FMin %76 %77
%78 = OpLoad %v4float %expectedA
%79 = OpFOrdEqual %v4bool %74 %78
diff --git a/tests/sksl/intrinsics/MinInt.asm.frag b/tests/sksl/intrinsics/MinInt.asm.frag
index 8c64118..0029bf9 100644
--- a/tests/sksl/intrinsics/MinInt.asm.frag
+++ b/tests/sksl/intrinsics/MinInt.asm.frag
@@ -74,12 +74,9 @@
%65 = OpConstantComposite %v4int %int_n125 %int_0 %int_0 %int_100
%false = OpConstantFalse %bool
%v2int = OpTypeVector %int 2
-%79 = OpConstantComposite %v2int %int_50 %int_50
%v2bool = OpTypeVector %bool 2
%v3int = OpTypeVector %int 3
-%92 = OpConstantComposite %v3int %int_50 %int_50 %int_50
%v3bool = OpTypeVector %bool 3
-%103 = OpConstantComposite %v4int %int_50 %int_50 %int_50 %int_50
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_2 = OpConstant %int 2
@@ -138,6 +135,7 @@
%73 = OpLabel
%76 = OpLoad %v4int %intValues
%77 = OpVectorShuffle %v2int %76 %76 0 1
+%79 = OpCompositeConstruct %v2int %int_50 %int_50
%75 = OpExtInst %v2int %1 SMin %77 %79
%80 = OpLoad %v4int %expectedA
%81 = OpVectorShuffle %v2int %80 %80 0 1
@@ -151,6 +149,7 @@
%86 = OpLabel
%89 = OpLoad %v4int %intValues
%90 = OpVectorShuffle %v3int %89 %89 0 1 2
+%92 = OpCompositeConstruct %v3int %int_50 %int_50 %int_50
%88 = OpExtInst %v3int %1 SMin %90 %92
%93 = OpLoad %v4int %expectedA
%94 = OpVectorShuffle %v3int %93 %93 0 1 2
@@ -163,6 +162,7 @@
OpBranchConditional %98 %99 %100
%99 = OpLabel
%102 = OpLoad %v4int %intValues
+%103 = OpCompositeConstruct %v4int %int_50 %int_50 %int_50 %int_50
%101 = OpExtInst %v4int %1 SMin %102 %103
%104 = OpLoad %v4int %expectedA
%105 = OpIEqual %v4bool %101 %104
diff --git a/tests/sksl/intrinsics/MixFloat.asm.frag b/tests/sksl/intrinsics/MixFloat.asm.frag
index 8fba186..086ff48 100644
--- a/tests/sksl/intrinsics/MixFloat.asm.frag
+++ b/tests/sksl/intrinsics/MixFloat.asm.frag
@@ -131,25 +131,18 @@
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
-%44 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%v4bool = OpTypeVector %bool 4
%float_0_25 = OpConstant %float 0.25
-%57 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25
%float_0_75 = OpConstant %float 0.75
%59 = OpConstantComposite %v4float %float_0_25 %float_0_75 %float_0 %float_1
-%70 = OpConstantComposite %v4float %float_0_75 %float_0_75 %float_0_75 %float_0_75
%71 = OpConstantComposite %v4float %float_0_75 %float_0_25 %float_0 %float_1
-%82 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%83 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
-%111 = OpConstantComposite %v2float %float_0_5 %float_0_5
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
-%128 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
%v3bool = OpTypeVector %bool 3
-%142 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%int_4 = OpConstant %int 4
%170 = OpConstantComposite %v2float %float_0 %float_0_5
%185 = OpConstantComposite %v3float %float_0 %float_0_5 %float_0
@@ -174,6 +167,7 @@
%40 = OpLoad %v4float %36
%41 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%43 = OpLoad %v4float %41
+%44 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %float_0
%35 = OpExtInst %v4float %1 FMix %40 %43 %44
%46 = OpFOrdEqual %v4bool %35 %45
%48 = OpAll %bool %46
@@ -184,6 +178,7 @@
%53 = OpLoad %v4float %52
%54 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%55 = OpLoad %v4float %54
+%57 = OpCompositeConstruct %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25
%51 = OpExtInst %v4float %1 FMix %53 %55 %57
%60 = OpFOrdEqual %v4bool %51 %59
%61 = OpAll %bool %60
@@ -197,6 +192,7 @@
%67 = OpLoad %v4float %66
%68 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%69 = OpLoad %v4float %68
+%70 = OpCompositeConstruct %v4float %float_0_75 %float_0_75 %float_0_75 %float_0_75
%65 = OpExtInst %v4float %1 FMix %67 %69 %70
%72 = OpFOrdEqual %v4bool %65 %71
%73 = OpAll %bool %72
@@ -210,6 +206,7 @@
%79 = OpLoad %v4float %78
%80 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%81 = OpLoad %v4float %80
+%82 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%77 = OpExtInst %v4float %1 FMix %79 %81 %82
%84 = OpFOrdEqual %v4bool %77 %83
%85 = OpAll %bool %84
@@ -241,6 +238,7 @@
%108 = OpAccessChain %_ptr_Uniform_v4float %10 %int_3
%109 = OpLoad %v4float %108
%110 = OpVectorShuffle %v2float %109 %109 0 1
+%111 = OpCompositeConstruct %v2float %float_0_5 %float_0_5
%104 = OpExtInst %v2float %1 FMix %107 %110 %111
%112 = OpLoad %v4float %expectedBW
%113 = OpVectorShuffle %v2float %112 %112 0 1
@@ -258,6 +256,7 @@
%125 = OpAccessChain %_ptr_Uniform_v4float %10 %int_3
%126 = OpLoad %v4float %125
%127 = OpVectorShuffle %v3float %126 %126 0 1 2
+%128 = OpCompositeConstruct %v3float %float_0_5 %float_0_5 %float_0_5
%120 = OpExtInst %v3float %1 FMix %123 %127 %128
%129 = OpLoad %v4float %expectedBW
%130 = OpVectorShuffle %v3float %129 %129 0 1 2
@@ -273,6 +272,7 @@
%139 = OpLoad %v4float %138
%140 = OpAccessChain %_ptr_Uniform_v4float %10 %int_3
%141 = OpLoad %v4float %140
+%142 = OpCompositeConstruct %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%137 = OpExtInst %v4float %1 FMix %139 %141 %142
%143 = OpLoad %v4float %expectedBW
%144 = OpFOrdEqual %v4bool %137 %143
diff --git a/tests/sksl/intrinsics/Saturate.asm.frag b/tests/sksl/intrinsics/Saturate.asm.frag
index 42a8322..afc166a 100644
--- a/tests/sksl/intrinsics/Saturate.asm.frag
+++ b/tests/sksl/intrinsics/Saturate.asm.frag
@@ -33,25 +33,25 @@
OpDecorate %40 RelaxedPrecision
OpDecorate %46 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
-OpDecorate %49 RelaxedPrecision
OpDecorate %50 RelaxedPrecision
-OpDecorate %59 RelaxedPrecision
+OpDecorate %51 RelaxedPrecision
OpDecorate %60 RelaxedPrecision
-OpDecorate %64 RelaxedPrecision
+OpDecorate %61 RelaxedPrecision
OpDecorate %65 RelaxedPrecision
-OpDecorate %74 RelaxedPrecision
-OpDecorate %77 RelaxedPrecision
-OpDecorate %84 RelaxedPrecision
+OpDecorate %66 RelaxedPrecision
+OpDecorate %75 RelaxedPrecision
+OpDecorate %78 RelaxedPrecision
OpDecorate %85 RelaxedPrecision
-OpDecorate %90 RelaxedPrecision
+OpDecorate %86 RelaxedPrecision
OpDecorate %91 RelaxedPrecision
-OpDecorate %97 RelaxedPrecision
+OpDecorate %92 RelaxedPrecision
OpDecorate %98 RelaxedPrecision
OpDecorate %99 RelaxedPrecision
-OpDecorate %105 RelaxedPrecision
-OpDecorate %115 RelaxedPrecision
-OpDecorate %118 RelaxedPrecision
+OpDecorate %100 RelaxedPrecision
+OpDecorate %106 RelaxedPrecision
+OpDecorate %116 RelaxedPrecision
OpDecorate %119 RelaxedPrecision
+OpDecorate %120 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
@@ -77,16 +77,11 @@
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
-%48 = OpConstantComposite %v2float %float_1 %float_1
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
-%62 = OpConstantComposite %v3float %float_0 %float_0 %float_0
-%63 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%v3bool = OpTypeVector %bool 3
-%75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
-%76 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%v4bool = OpTypeVector %bool 4
-%97 = OpConstantComposite %v3float %float_0 %float_0 %float_0_75
+%98 = OpConstantComposite %v3float %float_0 %float_0 %float_0_75
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_entrypoint_v = OpFunction %void None %15
@@ -101,7 +96,7 @@
%24 = OpFunctionParameter %_ptr_Function_v2float
%25 = OpLabel
%expected = OpVariable %_ptr_Function_v4float Function
-%109 = OpVariable %_ptr_Function_v4float Function
+%110 = OpVariable %_ptr_Function_v4float Function
OpStore %expected %30
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%37 = OpLoad %v4float %33
@@ -116,91 +111,97 @@
%45 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%46 = OpLoad %v4float %45
%47 = OpVectorShuffle %v2float %46 %46 0 1
-%44 = OpExtInst %v2float %1 FClamp %47 %19 %48
-%49 = OpLoad %v4float %expected
-%50 = OpVectorShuffle %v2float %49 %49 0 1
-%51 = OpFOrdEqual %v2bool %44 %50
-%53 = OpAll %bool %51
+%48 = OpCompositeConstruct %v2float %float_0 %float_0
+%49 = OpCompositeConstruct %v2float %float_1 %float_1
+%44 = OpExtInst %v2float %1 FClamp %47 %48 %49
+%50 = OpLoad %v4float %expected
+%51 = OpVectorShuffle %v2float %50 %50 0 1
+%52 = OpFOrdEqual %v2bool %44 %51
+%54 = OpAll %bool %52
OpBranch %43
%43 = OpLabel
-%54 = OpPhi %bool %false %25 %53 %42
-OpSelectionMerge %56 None
-OpBranchConditional %54 %55 %56
-%55 = OpLabel
-%58 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
-%59 = OpLoad %v4float %58
-%60 = OpVectorShuffle %v3float %59 %59 0 1 2
-%57 = OpExtInst %v3float %1 FClamp %60 %62 %63
-%64 = OpLoad %v4float %expected
-%65 = OpVectorShuffle %v3float %64 %64 0 1 2
-%66 = OpFOrdEqual %v3bool %57 %65
-%68 = OpAll %bool %66
-OpBranch %56
+%55 = OpPhi %bool %false %25 %54 %42
+OpSelectionMerge %57 None
+OpBranchConditional %55 %56 %57
%56 = OpLabel
-%69 = OpPhi %bool %false %43 %68 %55
-OpSelectionMerge %71 None
-OpBranchConditional %69 %70 %71
-%70 = OpLabel
-%73 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
-%74 = OpLoad %v4float %73
-%72 = OpExtInst %v4float %1 FClamp %74 %75 %76
-%77 = OpLoad %v4float %expected
-%78 = OpFOrdEqual %v4bool %72 %77
-%80 = OpAll %bool %78
-OpBranch %71
+%59 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
+%60 = OpLoad %v4float %59
+%61 = OpVectorShuffle %v3float %60 %60 0 1 2
+%63 = OpCompositeConstruct %v3float %float_0 %float_0 %float_0
+%64 = OpCompositeConstruct %v3float %float_1 %float_1 %float_1
+%58 = OpExtInst %v3float %1 FClamp %61 %63 %64
+%65 = OpLoad %v4float %expected
+%66 = OpVectorShuffle %v3float %65 %65 0 1 2
+%67 = OpFOrdEqual %v3bool %58 %66
+%69 = OpAll %bool %67
+OpBranch %57
+%57 = OpLabel
+%70 = OpPhi %bool %false %43 %69 %56
+OpSelectionMerge %72 None
+OpBranchConditional %70 %71 %72
%71 = OpLabel
-%81 = OpPhi %bool %false %56 %80 %70
-OpSelectionMerge %83 None
-OpBranchConditional %81 %82 %83
-%82 = OpLabel
-%84 = OpLoad %v4float %expected
-%85 = OpCompositeExtract %float %84 0
-%86 = OpFOrdEqual %bool %float_0 %85
-OpBranch %83
+%74 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
+%75 = OpLoad %v4float %74
+%76 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %float_0
+%77 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
+%73 = OpExtInst %v4float %1 FClamp %75 %76 %77
+%78 = OpLoad %v4float %expected
+%79 = OpFOrdEqual %v4bool %73 %78
+%81 = OpAll %bool %79
+OpBranch %72
+%72 = OpLabel
+%82 = OpPhi %bool %false %57 %81 %71
+OpSelectionMerge %84 None
+OpBranchConditional %82 %83 %84
%83 = OpLabel
-%87 = OpPhi %bool %false %71 %86 %82
-OpSelectionMerge %89 None
-OpBranchConditional %87 %88 %89
-%88 = OpLabel
-%90 = OpLoad %v4float %expected
-%91 = OpVectorShuffle %v2float %90 %90 0 1
-%92 = OpFOrdEqual %v2bool %19 %91
-%93 = OpAll %bool %92
-OpBranch %89
+%85 = OpLoad %v4float %expected
+%86 = OpCompositeExtract %float %85 0
+%87 = OpFOrdEqual %bool %float_0 %86
+OpBranch %84
+%84 = OpLabel
+%88 = OpPhi %bool %false %72 %87 %83
+OpSelectionMerge %90 None
+OpBranchConditional %88 %89 %90
%89 = OpLabel
-%94 = OpPhi %bool %false %83 %93 %88
-OpSelectionMerge %96 None
-OpBranchConditional %94 %95 %96
-%95 = OpLabel
-%98 = OpLoad %v4float %expected
-%99 = OpVectorShuffle %v3float %98 %98 0 1 2
-%100 = OpFOrdEqual %v3bool %97 %99
-%101 = OpAll %bool %100
-OpBranch %96
+%91 = OpLoad %v4float %expected
+%92 = OpVectorShuffle %v2float %91 %91 0 1
+%93 = OpFOrdEqual %v2bool %19 %92
+%94 = OpAll %bool %93
+OpBranch %90
+%90 = OpLabel
+%95 = OpPhi %bool %false %84 %94 %89
+OpSelectionMerge %97 None
+OpBranchConditional %95 %96 %97
%96 = OpLabel
-%102 = OpPhi %bool %false %89 %101 %95
-OpSelectionMerge %104 None
-OpBranchConditional %102 %103 %104
-%103 = OpLabel
-%105 = OpLoad %v4float %expected
-%106 = OpFOrdEqual %v4bool %30 %105
-%107 = OpAll %bool %106
-OpBranch %104
+%99 = OpLoad %v4float %expected
+%100 = OpVectorShuffle %v3float %99 %99 0 1 2
+%101 = OpFOrdEqual %v3bool %98 %100
+%102 = OpAll %bool %101
+OpBranch %97
+%97 = OpLabel
+%103 = OpPhi %bool %false %90 %102 %96
+OpSelectionMerge %105 None
+OpBranchConditional %103 %104 %105
%104 = OpLabel
-%108 = OpPhi %bool %false %96 %107 %103
-OpSelectionMerge %112 None
-OpBranchConditional %108 %110 %111
-%110 = OpLabel
-%113 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
-%115 = OpLoad %v4float %113
-OpStore %109 %115
-OpBranch %112
+%106 = OpLoad %v4float %expected
+%107 = OpFOrdEqual %v4bool %30 %106
+%108 = OpAll %bool %107
+OpBranch %105
+%105 = OpLabel
+%109 = OpPhi %bool %false %97 %108 %104
+OpSelectionMerge %113 None
+OpBranchConditional %109 %111 %112
%111 = OpLabel
-%116 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
-%118 = OpLoad %v4float %116
-OpStore %109 %118
-OpBranch %112
+%114 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
+%116 = OpLoad %v4float %114
+OpStore %110 %116
+OpBranch %113
%112 = OpLabel
-%119 = OpLoad %v4float %109
-OpReturnValue %119
+%117 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
+%119 = OpLoad %v4float %117
+OpStore %110 %119
+OpBranch %113
+%113 = OpLabel
+%120 = OpLoad %v4float %110
+OpReturnValue %120
OpFunctionEnd
diff --git a/tests/sksl/shared/ComplexDelete.asm.frag b/tests/sksl/shared/ComplexDelete.asm.frag
index c9317d7..30578f4 100644
--- a/tests/sksl/shared/ComplexDelete.asm.frag
+++ b/tests/sksl/shared/ComplexDelete.asm.frag
@@ -52,7 +52,6 @@
%float_0 = OpConstant %float 0
%v4bool = OpTypeVector %bool 4
%v3float = OpTypeVector %float 3
-%75 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%main = OpFunction %void None %19
%20 = OpLabel
%tmpColor = OpVariable %_ptr_Function_v4float Function
@@ -99,6 +98,7 @@
%72 = OpCompositeConstruct %v4float %69 %70 %71 %float_1
%73 = OpMatrixTimesVector %v4float %65 %72
%74 = OpVectorShuffle %v3float %73 %73 0 1 2
+%75 = OpCompositeConstruct %v3float %float_0 %float_0 %float_0
%76 = OpLoad %v4float %tmpColor
%77 = OpCompositeExtract %float %76 3
%78 = OpCompositeConstruct %v3float %77 %77 %77