Import Tint changes from Dawn
Changes:
- 01956b668a7f2e259fc9913ac93014dba4057991 [tint] Add missing headers by Ben Clayton <bclayton@google.com>
- f72919f3004c56b537c30cab162bfb1942a0fb0b Add subgroupBroadcast to intrinsics.def by David Neto <dneto@google.com>
- 11bc1b0cfde39f1f05a36e4417706ab38d7fb72b [ir][spirv-writer] Fix OpPhi incoming blocks by James Price <jrprice@google.com>
GitOrigin-RevId: 01956b668a7f2e259fc9913ac93014dba4057991
Change-Id: I732c6208a85869001a4c87b7a489a5a82f231849
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/151533
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/core.def b/src/tint/lang/core/core.def
index de0c81e..639eba7 100644
--- a/src/tint/lang/core/core.def
+++ b/src/tint/lang/core/core.def
@@ -17,6 +17,10 @@
// //
// This file is used to generate parts of the Tint BuiltinTable, various //
// enum definition files, as well as test .wgsl files. //
+// //
+// After modifying this file, run: //
+// tools/run gen //
+// from the Dawn source directory. //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -910,6 +914,7 @@
@stage("fragment", "compute") fn atomicCompareExchangeWeak<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T, T) -> __atomic_compare_exchange_result<T>
@must_use @stage("compute") fn subgroupBallot() -> vec4<u32>
+@must_use @stage("compute") fn subgroupBroadcast<T: fiu32, L: iu32>(value: T, @const sourceLaneIndex: L) -> T
////////////////////////////////////////////////////////////////////////////////
// Value constructors //
diff --git a/src/tint/lang/core/function.cc b/src/tint/lang/core/function.cc
index 1e636b3..afa1150 100644
--- a/src/tint/lang/core/function.cc
+++ b/src/tint/lang/core/function.cc
@@ -371,6 +371,9 @@
if (name == "subgroupBallot") {
return Function::kSubgroupBallot;
}
+ if (name == "subgroupBroadcast") {
+ return Function::kSubgroupBroadcast;
+ }
if (name == "_tint_materialize") {
return Function::kTintMaterialize;
}
@@ -611,6 +614,8 @@
return "atomicCompareExchangeWeak";
case Function::kSubgroupBallot:
return "subgroupBallot";
+ case Function::kSubgroupBroadcast:
+ return "subgroupBroadcast";
case Function::kTintMaterialize:
return "_tint_materialize";
}
@@ -679,7 +684,7 @@
}
bool IsSubgroupBuiltin(Function f) {
- return f == Function::kSubgroupBallot;
+ return f == Function::kSubgroupBallot || f == Function::kSubgroupBroadcast;
}
bool HasSideEffects(Function f) {
diff --git a/src/tint/lang/core/function.cc.tmpl b/src/tint/lang/core/function.cc.tmpl
index 32ed851..e594eb6 100644
--- a/src/tint/lang/core/function.cc.tmpl
+++ b/src/tint/lang/core/function.cc.tmpl
@@ -105,7 +105,7 @@
}
bool IsSubgroupBuiltin(Function f) {
- return f == Function::kSubgroupBallot;
+ return f == Function::kSubgroupBallot || f == Function::kSubgroupBroadcast;
}
bool HasSideEffects(Function f) {
diff --git a/src/tint/lang/core/function.h b/src/tint/lang/core/function.h
index 4347af9..e9b52fa 100644
--- a/src/tint/lang/core/function.h
+++ b/src/tint/lang/core/function.h
@@ -149,6 +149,7 @@
kAtomicExchange,
kAtomicCompareExchangeWeak,
kSubgroupBallot,
+ kSubgroupBroadcast,
kTintMaterialize,
kNone,
};
@@ -287,6 +288,7 @@
Function::kAtomicExchange,
Function::kAtomicCompareExchangeWeak,
Function::kSubgroupBallot,
+ Function::kSubgroupBroadcast,
Function::kTintMaterialize,
};
@@ -407,6 +409,7 @@
"atomicExchange",
"atomicCompareExchangeWeak",
"subgroupBallot",
+ "subgroupBroadcast",
"_tint_materialize",
};
diff --git a/src/tint/lang/core/intrinsic/data/data.cc b/src/tint/lang/core/intrinsic/data/data.cc
index d423120..5f92989 100644
--- a/src/tint/lang/core/intrinsic/data/data.cc
+++ b/src/tint/lang/core/intrinsic/data/data.cc
@@ -4141,39 +4141,39 @@
},
{
/* [348] */
- /* usage */ core::ParameterUsage::kNone,
+ /* usage */ core::ParameterUsage::kValue,
/* type_matcher_indices */ TypeMatcherIndicesIndex(2),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
/* [349] */
+ /* usage */ core::ParameterUsage::kSourceLaneIndex,
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(21),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
+ },
+ {
+ /* [350] */
+ /* usage */ core::ParameterUsage::kNone,
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(2),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
+ },
+ {
+ /* [351] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* number_matcher_indices */ NumberMatcherIndicesIndex(1),
},
{
- /* [350] */
+ /* [352] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(82),
/* number_matcher_indices */ NumberMatcherIndicesIndex(1),
},
{
- /* [351] */
- /* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(2),
- },
- {
- /* [352] */
- /* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(2),
- },
- {
/* [353] */
/* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(2),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
/* [354] */
@@ -4184,323 +4184,335 @@
{
/* [355] */
/* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(6),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(1),
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(2),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
/* [356] */
/* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(6),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(3),
- },
- {
- /* [357] */
- /* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
+ /* [357] */
+ /* usage */ core::ParameterUsage::kNone,
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(6),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(1),
+ },
+ {
/* [358] */
/* usage */ core::ParameterUsage::kNone,
- /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(22),
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(6),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(3),
},
{
/* [359] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(12),
- /* number_matcher_indices */ NumberMatcherIndicesIndex(3),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
/* [360] */
+ /* usage */ core::ParameterUsage::kNone,
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(22),
+ },
+ {
+ /* [361] */
+ /* usage */ core::ParameterUsage::kNone,
+ /* type_matcher_indices */ TypeMatcherIndicesIndex(12),
+ /* number_matcher_indices */ NumberMatcherIndicesIndex(3),
+ },
+ {
+ /* [362] */
/* usage */ core::ParameterUsage::kXy,
/* type_matcher_indices */ TypeMatcherIndicesIndex(70),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [361] */
+ /* [363] */
/* usage */ core::ParameterUsage::kZw,
/* type_matcher_indices */ TypeMatcherIndicesIndex(70),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [362] */
+ /* [364] */
/* usage */ core::ParameterUsage::kXyz,
/* type_matcher_indices */ TypeMatcherIndicesIndex(10),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [363] */
+ /* [365] */
/* usage */ core::ParameterUsage::kW,
/* type_matcher_indices */ TypeMatcherIndicesIndex(2),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [364] */
+ /* [366] */
/* usage */ core::ParameterUsage::kX,
/* type_matcher_indices */ TypeMatcherIndicesIndex(2),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [365] */
+ /* [367] */
/* usage */ core::ParameterUsage::kZyw,
/* type_matcher_indices */ TypeMatcherIndicesIndex(10),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [366] */
+ /* [368] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(0),
/* number_matcher_indices */ NumberMatcherIndicesIndex(0),
},
{
- /* [367] */
+ /* [369] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* number_matcher_indices */ NumberMatcherIndicesIndex(1),
},
{
- /* [368] */
+ /* [370] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(15),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [369] */
+ /* [371] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(14),
/* number_matcher_indices */ NumberMatcherIndicesIndex(1),
},
{
- /* [370] */
+ /* [372] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(26),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [371] */
+ /* [373] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(28),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [372] */
+ /* [374] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(30),
/* number_matcher_indices */ NumberMatcherIndicesIndex(6),
},
{
- /* [373] */
+ /* [375] */
/* usage */ core::ParameterUsage::kTexture,
/* type_matcher_indices */ TypeMatcherIndicesIndex(165),
/* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
- /* [374] */
+ /* [376] */
/* usage */ core::ParameterUsage::kTexture,
/* type_matcher_indices */ TypeMatcherIndicesIndex(166),
/* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
- /* [375] */
+ /* [377] */
/* usage */ core::ParameterUsage::kTexture,
/* type_matcher_indices */ TypeMatcherIndicesIndex(167),
/* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
- /* [376] */
+ /* [378] */
/* usage */ core::ParameterUsage::kTexture,
/* type_matcher_indices */ TypeMatcherIndicesIndex(168),
/* number_matcher_indices */ NumberMatcherIndicesIndex(2),
},
{
- /* [377] */
+ /* [379] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(53),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [378] */
+ /* [380] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(87),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [379] */
+ /* [381] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(76),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [380] */
+ /* [382] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(78),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [381] */
+ /* [383] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(98),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [382] */
+ /* [384] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(104),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [383] */
+ /* [385] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(108),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [384] */
+ /* [386] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(106),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [385] */
+ /* [387] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(110),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [386] */
+ /* [388] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(114),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [387] */
+ /* [389] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(112),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [388] */
+ /* [390] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(116),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [389] */
+ /* [391] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(120),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [390] */
+ /* [392] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(118),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [391] */
+ /* [393] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(122),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [392] */
+ /* [394] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(126),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [393] */
+ /* [395] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(124),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [394] */
+ /* [396] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(128),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [395] */
+ /* [397] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(132),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [396] */
+ /* [398] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(130),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [397] */
+ /* [399] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(134),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [398] */
+ /* [400] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(138),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [399] */
+ /* [401] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(136),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [400] */
+ /* [402] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(140),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [401] */
+ /* [403] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(144),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [402] */
+ /* [404] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(142),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [403] */
+ /* [405] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(146),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [404] */
+ /* [406] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(150),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [405] */
+ /* [407] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(148),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [406] */
+ /* [408] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(152),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [407] */
+ /* [409] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(156),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
},
{
- /* [408] */
+ /* [410] */
/* usage */ core::ParameterUsage::kNone,
/* type_matcher_indices */ TypeMatcherIndicesIndex(154),
/* number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
@@ -5158,7 +5170,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(6),
- /* parameters */ ParameterIndex(373),
+ /* parameters */ ParameterIndex(375),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -5171,7 +5183,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(6),
- /* parameters */ ParameterIndex(374),
+ /* parameters */ ParameterIndex(376),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(34),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -5184,7 +5196,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(6),
- /* parameters */ ParameterIndex(375),
+ /* parameters */ ParameterIndex(377),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(34),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -5197,7 +5209,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(6),
- /* parameters */ ParameterIndex(376),
+ /* parameters */ ParameterIndex(378),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(40),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -5600,7 +5612,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(27),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(360),
+ /* parameters */ ParameterIndex(362),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(50),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(102),
@@ -5613,7 +5625,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(27),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(362),
+ /* parameters */ ParameterIndex(364),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(50),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(102),
@@ -5626,7 +5638,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(27),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(364),
+ /* parameters */ ParameterIndex(366),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(50),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(102),
@@ -5639,7 +5651,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(381),
+ /* parameters */ ParameterIndex(383),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(28),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -5652,7 +5664,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(381),
+ /* parameters */ ParameterIndex(383),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(100),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -5665,7 +5677,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(18),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(381),
+ /* parameters */ ParameterIndex(383),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(72),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -5678,7 +5690,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(20),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(381),
+ /* parameters */ ParameterIndex(383),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(74),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -5691,7 +5703,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(22),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(381),
+ /* parameters */ ParameterIndex(383),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(102),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6484,7 +6496,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(380),
+ /* parameters */ ParameterIndex(382),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(54),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6497,7 +6509,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(380),
+ /* parameters */ ParameterIndex(382),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(92),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6510,7 +6522,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(18),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(380),
+ /* parameters */ ParameterIndex(382),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(64),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6523,7 +6535,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(20),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(380),
+ /* parameters */ ParameterIndex(382),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(40),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6536,7 +6548,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(22),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(380),
+ /* parameters */ ParameterIndex(382),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(94),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6744,7 +6756,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(379),
+ /* parameters */ ParameterIndex(381),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(26),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6757,7 +6769,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(379),
+ /* parameters */ ParameterIndex(381),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(86),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6770,7 +6782,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(18),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(379),
+ /* parameters */ ParameterIndex(381),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(52),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6783,7 +6795,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(20),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(379),
+ /* parameters */ ParameterIndex(381),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(34),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6796,7 +6808,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(22),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(379),
+ /* parameters */ ParameterIndex(381),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(88),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -6848,7 +6860,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(24),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(348),
+ /* parameters */ ParameterIndex(350),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(79),
@@ -6861,7 +6873,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(353),
+ /* parameters */ ParameterIndex(355),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(2),
/* const_eval_fn */ ConstEvalFunctionIndex(79),
@@ -6874,7 +6886,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(352),
+ /* parameters */ ParameterIndex(354),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(2),
/* const_eval_fn */ ConstEvalFunctionIndex(79),
@@ -6887,7 +6899,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(1),
- /* parameters */ ParameterIndex(354),
+ /* parameters */ ParameterIndex(356),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(3),
/* const_eval_fn */ ConstEvalFunctionIndex(80),
@@ -6900,7 +6912,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(1),
- /* parameters */ ParameterIndex(356),
+ /* parameters */ ParameterIndex(358),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(81),
@@ -6913,7 +6925,7 @@
/* num_template_numbers */ 3,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(0),
- /* parameters */ ParameterIndex(358),
+ /* parameters */ ParameterIndex(360),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(20),
/* const_eval_fn */ ConstEvalFunctionIndex(82),
@@ -7381,7 +7393,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(382),
+ /* parameters */ ParameterIndex(384),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(104),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7420,7 +7432,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(383),
+ /* parameters */ ParameterIndex(385),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(106),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7433,7 +7445,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(384),
+ /* parameters */ ParameterIndex(386),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(108),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7459,7 +7471,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(385),
+ /* parameters */ ParameterIndex(387),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(110),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7498,7 +7510,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(386),
+ /* parameters */ ParameterIndex(388),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(112),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7511,7 +7523,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(387),
+ /* parameters */ ParameterIndex(389),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(114),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7537,7 +7549,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(388),
+ /* parameters */ ParameterIndex(390),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(116),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7576,7 +7588,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(389),
+ /* parameters */ ParameterIndex(391),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(118),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7589,7 +7601,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(390),
+ /* parameters */ ParameterIndex(392),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(120),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7615,7 +7627,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(391),
+ /* parameters */ ParameterIndex(393),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(122),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7654,7 +7666,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(392),
+ /* parameters */ ParameterIndex(394),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(124),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7667,7 +7679,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(393),
+ /* parameters */ ParameterIndex(395),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(126),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7693,7 +7705,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(394),
+ /* parameters */ ParameterIndex(396),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(128),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7732,7 +7744,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(395),
+ /* parameters */ ParameterIndex(397),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(130),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7745,7 +7757,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(396),
+ /* parameters */ ParameterIndex(398),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(132),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7771,7 +7783,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(397),
+ /* parameters */ ParameterIndex(399),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(134),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7810,7 +7822,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(398),
+ /* parameters */ ParameterIndex(400),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(136),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7823,7 +7835,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(399),
+ /* parameters */ ParameterIndex(401),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(138),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7849,7 +7861,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(400),
+ /* parameters */ ParameterIndex(402),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(140),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7888,7 +7900,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(401),
+ /* parameters */ ParameterIndex(403),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(142),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7901,7 +7913,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(402),
+ /* parameters */ ParameterIndex(404),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(144),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7927,7 +7939,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(403),
+ /* parameters */ ParameterIndex(405),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(146),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -7966,7 +7978,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(404),
+ /* parameters */ ParameterIndex(406),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(148),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -7979,7 +7991,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(405),
+ /* parameters */ ParameterIndex(407),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(150),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -8005,7 +8017,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(36),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(406),
+ /* parameters */ ParameterIndex(408),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(152),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -8044,7 +8056,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(16),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(407),
+ /* parameters */ ParameterIndex(409),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(154),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -8057,7 +8069,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(14),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(408),
+ /* parameters */ ParameterIndex(410),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(156),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(99),
@@ -8122,7 +8134,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(6),
- /* parameters */ ParameterIndex(375),
+ /* parameters */ ParameterIndex(377),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -8174,7 +8186,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(24),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(348),
+ /* parameters */ ParameterIndex(350),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(77),
@@ -8187,7 +8199,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(351),
+ /* parameters */ ParameterIndex(353),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(2),
/* const_eval_fn */ ConstEvalFunctionIndex(77),
@@ -8239,7 +8251,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(24),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(348),
+ /* parameters */ ParameterIndex(350),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(78),
@@ -8252,7 +8264,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(351),
+ /* parameters */ ParameterIndex(353),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(2),
/* const_eval_fn */ ConstEvalFunctionIndex(78),
@@ -8304,7 +8316,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(24),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(348),
+ /* parameters */ ParameterIndex(350),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(83),
@@ -8356,7 +8368,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(24),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(348),
+ /* parameters */ ParameterIndex(350),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(84),
@@ -8564,7 +8576,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(377),
+ /* parameters */ ParameterIndex(379),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(53),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -8642,7 +8654,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(368),
+ /* parameters */ ParameterIndex(370),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(15),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -8681,7 +8693,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(378),
+ /* parameters */ ParameterIndex(380),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(87),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(73),
@@ -9240,7 +9252,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(368),
+ /* parameters */ ParameterIndex(370),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(15),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -9253,7 +9265,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(369),
+ /* parameters */ ParameterIndex(371),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(14),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -9760,7 +9772,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(368),
+ /* parameters */ ParameterIndex(370),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(15),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(49),
@@ -9773,7 +9785,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(369),
+ /* parameters */ ParameterIndex(371),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(14),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(49),
@@ -10449,7 +10461,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(29),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(349),
+ /* parameters */ ParameterIndex(351),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(96),
@@ -10475,7 +10487,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(29),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(349),
+ /* parameters */ ParameterIndex(351),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(6),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(97),
@@ -10488,7 +10500,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(25),
/* template_numbers */ TemplateNumberIndex(7),
- /* parameters */ ParameterIndex(366),
+ /* parameters */ ParameterIndex(368),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -10514,7 +10526,7 @@
/* num_template_numbers */ 1,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(4),
- /* parameters */ ParameterIndex(367),
+ /* parameters */ ParameterIndex(369),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(2),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(19),
@@ -10592,7 +10604,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(370),
+ /* parameters */ ParameterIndex(372),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(43),
@@ -10605,7 +10617,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(370),
+ /* parameters */ ParameterIndex(372),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(44),
@@ -10618,7 +10630,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(370),
+ /* parameters */ ParameterIndex(372),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(45),
@@ -10631,7 +10643,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(371),
+ /* parameters */ ParameterIndex(373),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(46),
@@ -10644,7 +10656,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(/* invalid */),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(371),
+ /* parameters */ ParameterIndex(373),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(35),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(47),
@@ -10696,7 +10708,7 @@
/* num_template_numbers */ 2,
/* template_types */ TemplateTypeIndex(10),
/* template_numbers */ TemplateNumberIndex(3),
- /* parameters */ ParameterIndex(351),
+ /* parameters */ ParameterIndex(353),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(12),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(3),
/* const_eval_fn */ ConstEvalFunctionIndex(66),
@@ -10774,7 +10786,7 @@
/* num_template_numbers */ 0,
/* template_types */ TemplateTypeIndex(25),
/* template_numbers */ TemplateNumberIndex(/* invalid */),
- /* parameters */ ParameterIndex(372),
+ /* parameters */ ParameterIndex(374),
/* return_type_matcher_indices */ TypeMatcherIndicesIndex(2),
/* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -10846,6 +10858,19 @@
},
{
/* [460] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* num_parameters */ 2,
+ /* num_template_types */ 2,
+ /* num_template_numbers */ 0,
+ /* template_types */ TemplateTypeIndex(12),
+ /* template_numbers */ TemplateNumberIndex(/* invalid */),
+ /* parameters */ ParameterIndex(348),
+ /* return_type_matcher_indices */ TypeMatcherIndicesIndex(2),
+ /* return_number_matcher_indices */ NumberMatcherIndicesIndex(/* invalid */),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+ },
+ {
+ /* [461] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* num_parameters */ 1,
/* num_template_types */ 1,
@@ -10858,7 +10883,7 @@
/* const_eval_fn */ ConstEvalFunctionIndex(73),
},
{
- /* [461] */
+ /* [462] */
/* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* num_parameters */ 2,
/* num_template_types */ 0,
@@ -10871,7 +10896,7 @@
/* const_eval_fn */ ConstEvalFunctionIndex(88),
},
{
- /* [462] */
+ /* [463] */
/* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* num_parameters */ 2,
/* num_template_types */ 0,
@@ -10884,7 +10909,7 @@
/* const_eval_fn */ ConstEvalFunctionIndex(89),
},
{
- /* [463] */
+ /* [464] */
/* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* num_parameters */ 1,
/* num_template_types */ 1,
@@ -11798,10 +11823,16 @@
},
{
/* [115] */
- /* fn _tint_materialize<T>(T) -> T */
+ /* fn subgroupBroadcast<T : fiu32, L : iu32>(value: T, @const sourceLaneIndex: L) -> T */
/* num overloads */ 1,
/* overloads */ OverloadIndex(460),
},
+ {
+ /* [116] */
+ /* fn _tint_materialize<T>(T) -> T */
+ /* num overloads */ 1,
+ /* overloads */ OverloadIndex(461),
+ },
};
constexpr IntrinsicInfo kUnaryOperators[] = {
@@ -11913,13 +11944,13 @@
/* [8] */
/* op &&(bool, bool) -> bool */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(461),
+ /* overloads */ OverloadIndex(462),
},
{
/* [9] */
/* op ||(bool, bool) -> bool */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(462),
+ /* overloads */ OverloadIndex(463),
},
{
/* [10] */
@@ -12194,7 +12225,7 @@
/* [17] */
/* conv packedVec3<T : concrete_scalar>(vec3<T>) -> packedVec3<T> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(463),
+ /* overloads */ OverloadIndex(464),
},
};
diff --git a/src/tint/lang/core/parameter_usage.cc b/src/tint/lang/core/parameter_usage.cc
index 2a42c49..c5ddc1c 100644
--- a/src/tint/lang/core/parameter_usage.cc
+++ b/src/tint/lang/core/parameter_usage.cc
@@ -51,6 +51,8 @@
return "sample_index";
case ParameterUsage::kSampler:
return "sampler";
+ case ParameterUsage::kSourceLaneIndex:
+ return "sourceLaneIndex";
case ParameterUsage::kTexture:
return "texture";
case ParameterUsage::kValue:
diff --git a/src/tint/lang/core/parameter_usage.h b/src/tint/lang/core/parameter_usage.h
index 39e0207..fdf355c 100644
--- a/src/tint/lang/core/parameter_usage.h
+++ b/src/tint/lang/core/parameter_usage.h
@@ -45,6 +45,7 @@
kOffset,
kSampleIndex,
kSampler,
+ kSourceLaneIndex,
kTexture,
kValue,
kW,
diff --git a/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.h b/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.h
index 2b2800b..80421af 100644
--- a/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.h
+++ b/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.h
@@ -15,6 +15,7 @@
#ifndef SRC_TINT_LANG_SPIRV_READER_AST_PARSER_SPIRV_TOOLS_HELPERS_TEST_H_
#define SRC_TINT_LANG_SPIRV_READER_AST_PARSER_SPIRV_TOOLS_HELPERS_TEST_H_
+#include <cstdint>
#include <string>
#include <vector>
diff --git a/src/tint/lang/spirv/writer/if_test.cc b/src/tint/lang/spirv/writer/if_test.cc
index 152e583..50cf1e5 100644
--- a/src/tint/lang/spirv/writer/if_test.cc
+++ b/src/tint/lang/spirv/writer/if_test.cc
@@ -288,5 +288,49 @@
)");
}
+TEST_F(SpirvWriterTest, If_Phi_Nested) {
+ auto* func = b.Function("foo", ty.i32());
+ b.Append(func->Block(), [&] {
+ auto* outer = b.If(true);
+ outer->SetResults(b.InstructionResult(ty.i32()));
+ b.Append(outer->True(), [&] { //
+ auto* inner = b.If(true);
+ inner->SetResults(b.InstructionResult(ty.i32()));
+ b.Append(inner->True(), [&] { //
+ b.ExitIf(inner, 10_i);
+ });
+ b.Append(inner->False(), [&] { //
+ b.ExitIf(inner, 20_i);
+ });
+ b.ExitIf(outer, inner->Result());
+ });
+ b.Append(outer->False(), [&] { //
+ b.ExitIf(outer, 30_i);
+ });
+ b.Return(func, outer);
+ });
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+ OpSelectionMerge %5 None
+ OpBranchConditional %true %6 %7
+ %6 = OpLabel
+ OpSelectionMerge %10 None
+ OpBranchConditional %true %11 %12
+ %11 = OpLabel
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ %13 = OpPhi %int %int_10 %11 %int_20 %12
+ OpBranch %5
+ %7 = OpLabel
+ OpBranch %5
+ %5 = OpLabel
+ %16 = OpPhi %int %int_30 %7 %13 %10
+ OpReturnValue %16
+)");
+}
+
} // namespace
} // namespace tint::spirv::writer
diff --git a/src/tint/lang/spirv/writer/loop_test.cc b/src/tint/lang/spirv/writer/loop_test.cc
index 1a44fdd..61760b5 100644
--- a/src/tint/lang/spirv/writer/loop_test.cc
+++ b/src/tint/lang/spirv/writer/loop_test.cc
@@ -330,7 +330,7 @@
auto* loop = b.Loop();
b.Append(loop->Initializer(), [&] { //
- b.NextIteration(loop, 1_i, false);
+ b.NextIteration(loop, 1_i);
});
auto* loop_param = b.BlockParam(ty.i32());
@@ -427,5 +427,137 @@
)");
}
+TEST_F(SpirvWriterTest, Loop_Phi_NestedIf) {
+ auto* func = b.Function("foo", ty.void_());
+
+ b.Append(func->Block(), [&] {
+ auto* loop = b.Loop();
+ b.Append(loop->Initializer(), [&] { //
+ b.NextIteration(loop, 1_i);
+ });
+
+ auto* loop_param = b.BlockParam(ty.i32());
+ loop->Body()->SetParams({loop_param});
+ b.Append(loop->Body(), [&] {
+ auto* inner = b.If(true);
+ inner->SetResults(b.InstructionResult(ty.i32()));
+ b.Append(inner->True(), [&] { //
+ b.ExitIf(inner, 10_i);
+ });
+ b.Append(inner->False(), [&] { //
+ b.ExitIf(inner, 20_i);
+ });
+ b.Continue(loop, inner->Result());
+ });
+
+ auto* cont_param = b.BlockParam(ty.i32());
+ loop->Continuing()->SetParams({cont_param});
+ b.Append(loop->Continuing(), [&] {
+ auto* cmp = b.GreaterThan(ty.bool_(), cont_param, 5_i);
+ b.BreakIf(loop, cmp, cont_param);
+ });
+
+ b.Return(func);
+ });
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+ %4 = OpLabel
+ OpBranch %5
+ %5 = OpLabel
+ OpBranch %8
+ %8 = OpLabel
+ %11 = OpPhi %int %int_1 %5 %13 %7
+ OpLoopMerge %9 %7 None
+ OpBranch %6
+ %6 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %16
+ %15 = OpLabel
+ OpBranch %14
+ %16 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ %19 = OpPhi %int %int_10 %15 %int_20 %16
+ OpBranch %7
+ %7 = OpLabel
+ %13 = OpPhi %int %19 %14
+ %22 = OpSGreaterThan %bool %13 %int_5
+ OpBranchConditional %22 %9 %8
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+)");
+}
+
+TEST_F(SpirvWriterTest, Loop_Phi_NestedLoop) {
+ auto* func = b.Function("foo", ty.void_());
+
+ b.Append(func->Block(), [&] {
+ auto* outer = b.Loop();
+ b.Append(outer->Initializer(), [&] { //
+ b.NextIteration(outer, 1_i);
+ });
+
+ auto* outer_param = b.BlockParam(ty.i32());
+ outer->Body()->SetParams({outer_param});
+ b.Append(outer->Body(), [&] {
+ auto* inner = b.Loop();
+ b.Append(inner->Initializer(), [&] { //
+ b.NextIteration(inner);
+ });
+ b.Append(inner->Body(), [&] { //
+ b.Continue(inner);
+ });
+ b.Append(inner->Continuing(), [&] { //
+ b.BreakIf(inner, true);
+ });
+
+ b.Continue(outer, outer_param);
+ });
+
+ auto* cont_param = b.BlockParam(ty.i32());
+ outer->Continuing()->SetParams({cont_param});
+ b.Append(outer->Continuing(), [&] {
+ auto* cmp = b.GreaterThan(ty.bool_(), cont_param, 5_i);
+ b.BreakIf(outer, cmp, cont_param);
+ });
+
+ b.Return(func);
+ });
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+ %4 = OpLabel
+ OpBranch %5
+ %5 = OpLabel
+ OpBranch %8
+ %8 = OpLabel
+ %11 = OpPhi %int %int_1 %5 %13 %7
+ OpLoopMerge %9 %7 None
+ OpBranch %6
+ %6 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %17
+ %17 = OpLabel
+ OpLoopMerge %18 %16 None
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpBranch %7
+ %7 = OpLabel
+ %13 = OpPhi %int %11 %18
+ %21 = OpSGreaterThan %bool %13 %int_5
+ OpBranchConditional %21 %9 %8
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+)");
+}
+
} // namespace
} // namespace tint::spirv::writer
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index eba5239..b098a86 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -748,7 +748,7 @@
for (auto* incoming : block->InboundSiblingBranches()) {
auto* arg = incoming->Args()[param_idx];
ops.push_back(Value(arg));
- ops.push_back(Label(incoming->Block()));
+ ops.push_back(GetTerminatorBlockLabel(incoming));
}
current_function_.push_inst(spv::Op::OpPhi, std::move(ops));
@@ -848,7 +848,7 @@
// 2. branches somewhere instead of exiting the loop (e.g. return or break), or
// 3. the if returns a value
// Otherwise we skip them and branch straight to the merge block.
- uint32_t merge_label = module_.NextId();
+ uint32_t merge_label = GetMergeLabel(i);
TINT_SCOPED_ASSIGNMENT(if_merge_label_, merge_label);
uint32_t true_label = merge_label;
@@ -1697,7 +1697,7 @@
auto header_label = module_.NextId();
TINT_SCOPED_ASSIGNMENT(loop_header_label_, header_label);
- auto merge_label = module_.NextId();
+ auto merge_label = GetMergeLabel(loop);
TINT_SCOPED_ASSIGNMENT(loop_merge_label_, merge_label);
if (init_label != 0) {
@@ -1762,7 +1762,7 @@
}
}
- uint32_t merge_label = module_.NextId();
+ uint32_t merge_label = GetMergeLabel(swtch);
TINT_SCOPED_ASSIGNMENT(switch_merge_label_, merge_label);
// Emit the OpSelectionMerge and OpSwitch instructions.
@@ -1935,7 +1935,7 @@
Vector<Branch, 8> branches;
branches.Reserve(inst->Exits().Count());
for (auto& exit : inst->Exits()) {
- branches.Push(Branch{Label(exit->Block()), exit->Args()[index]});
+ branches.Push(Branch{GetTerminatorBlockLabel(exit), exit->Args()[index]});
}
branches.Sort(); // Sort the branches by label to ensure deterministic output
@@ -1952,6 +1952,26 @@
}
}
+uint32_t Printer::GetMergeLabel(core::ir::ControlInstruction* ci) {
+ return merge_block_labels_.GetOrCreate(ci, [&] { return module_.NextId(); });
+}
+
+uint32_t Printer::GetTerminatorBlockLabel(core::ir::Terminator* t) {
+ // Walk backwards from `t` until we find a control instruction.
+ auto* inst = t->prev;
+ while (inst) {
+ auto* prev = inst->prev;
+ if (auto* ci = inst->As<core::ir::ControlInstruction>()) {
+ // This is the last control instruction before `t`, so use its merge block label.
+ return GetMergeLabel(ci);
+ }
+ inst = prev;
+ }
+
+ // There were no control instructions before `t`, so use the label of the parent block.
+ return Label(t->Block());
+}
+
uint32_t Printer::TexelFormat(const core::TexelFormat format) {
switch (format) {
case core::TexelFormat::kBgra8Unorm:
diff --git a/src/tint/lang/spirv/writer/printer/printer.h b/src/tint/lang/spirv/writer/printer/printer.h
index f991bfe..2f0d53a 100644
--- a/src/tint/lang/spirv/writer/printer/printer.h
+++ b/src/tint/lang/spirv/writer/printer/printer.h
@@ -272,6 +272,16 @@
/// @param inst the flow control instruction
void EmitExitPhis(core::ir::ControlInstruction* inst);
+ /// Get the ID of the label of the merge block for a control instruction.
+ /// @param ci the control instruction to get the merge label for
+ /// @returns the label ID
+ uint32_t GetMergeLabel(core::ir::ControlInstruction* ci);
+
+ /// Get the ID of the label of the block that will contain a terminator instruction.
+ /// @param t the terminator instruction to get the block label for
+ /// @returns the label ID
+ uint32_t GetTerminatorBlockLabel(core::ir::Terminator* t);
+
core::ir::Module* ir_;
core::ir::Builder b_;
writer::Module module_;
@@ -323,6 +333,9 @@
/// The map of blocks to the IDs of their label instructions.
Hashmap<core::ir::Block*, uint32_t, 8> block_labels_;
+ /// The map of control instructions to the IDs of the label of their SPIR-V merge blocks.
+ Hashmap<core::ir::ControlInstruction*, uint32_t, 8> merge_block_labels_;
+
/// The map of extended instruction set names to their result IDs.
Hashmap<std::string_view, uint32_t, 2> imports_;
diff --git a/src/tint/lang/spirv/writer/switch_test.cc b/src/tint/lang/spirv/writer/switch_test.cc
index bfcefca..ef94384 100644
--- a/src/tint/lang/spirv/writer/switch_test.cc
+++ b/src/tint/lang/spirv/writer/switch_test.cc
@@ -369,5 +369,104 @@
)");
}
+TEST_F(SpirvWriterTest, Switch_Phi_NestedIf) {
+ auto* func = b.Function("foo", ty.i32());
+ b.Append(func->Block(), [&] {
+ auto* s = b.Switch(42_i);
+ s->SetResults(b.InstructionResult(ty.i32()));
+ auto* case_a = b.Case(s, Vector{core::ir::Switch::CaseSelector{b.Constant(1_i)},
+ core::ir::Switch::CaseSelector{nullptr}});
+ b.Append(case_a, [&] { //
+ auto* inner = b.If(true);
+ inner->SetResults(b.InstructionResult(ty.i32()));
+ b.Append(inner->True(), [&] { //
+ b.ExitIf(inner, 10_i);
+ });
+ b.Append(inner->False(), [&] { //
+ b.ExitIf(inner, 20_i);
+ });
+
+ b.ExitSwitch(s, inner->Result());
+ });
+
+ auto* case_b = b.Case(s, Vector{core::ir::Switch::CaseSelector{b.Constant(2_i)}});
+ b.Append(case_b, [&] { //
+ b.ExitSwitch(s, 20_i);
+ });
+
+ b.Return(func, s);
+ });
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+ %4 = OpLabel
+ OpSelectionMerge %8 None
+ OpSwitch %int_42 %5 1 %5 2 %7
+ %5 = OpLabel
+ OpSelectionMerge %9 None
+ OpBranchConditional %true %10 %11
+ %10 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ %14 = OpPhi %int %int_10 %10 %int_20 %11
+ OpBranch %8
+ %7 = OpLabel
+ OpBranch %8
+ %8 = OpLabel
+ %17 = OpPhi %int %int_20 %7 %14 %9
+ OpReturnValue %17
+ OpFunctionEnd
+)");
+}
+
+TEST_F(SpirvWriterTest, Switch_Phi_NestedSwitch) {
+ auto* func = b.Function("foo", ty.i32());
+ b.Append(func->Block(), [&] {
+ auto* outer = b.Switch(42_i);
+ outer->SetResults(b.InstructionResult(ty.i32()));
+ auto* case_a = b.Case(outer, Vector{core::ir::Switch::CaseSelector{b.Constant(1_i)},
+ core::ir::Switch::CaseSelector{nullptr}});
+ b.Append(case_a, [&] { //
+ auto* inner = b.Switch(42_i);
+ auto* case_inner = b.Case(inner, Vector{core::ir::Switch::CaseSelector{b.Constant(2_i)},
+ core::ir::Switch::CaseSelector{nullptr}});
+ b.Append(case_inner, [&] { //
+ b.ExitSwitch(inner);
+ });
+
+ b.ExitSwitch(outer, 10_i);
+ });
+
+ auto* case_b = b.Case(outer, Vector{core::ir::Switch::CaseSelector{b.Constant(2_i)}});
+ b.Append(case_b, [&] { //
+ b.ExitSwitch(outer, 20_i);
+ });
+
+ b.Return(func, outer);
+ });
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+ %4 = OpLabel
+ OpSelectionMerge %8 None
+ OpSwitch %int_42 %5 1 %5 2 %7
+ %5 = OpLabel
+ OpSelectionMerge %10 None
+ OpSwitch %int_42 %9 2 %9
+ %9 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpBranch %8
+ %7 = OpLabel
+ OpBranch %8
+ %8 = OpLabel
+ %11 = OpPhi %int %int_20 %7 %int_10 %10
+ OpReturnValue %11
+ OpFunctionEnd
+)");
+}
+
} // namespace
} // namespace tint::spirv::writer
diff --git a/src/tint/utils/socket/socket.cc b/src/tint/utils/socket/socket.cc
index d11624c..5ebf9ea 100644
--- a/src/tint/utils/socket/socket.cc
+++ b/src/tint/utils/socket/socket.cc
@@ -28,6 +28,7 @@
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
+#include <cstdio>
#endif
#if defined(_WIN32)