summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schürmann <daniel@schuermann.dev>2024-01-30 15:51:48 +0100
committerEric Engestrom <eric@engestrom.ch>2024-01-31 22:21:24 +0000
commit74a0eb9cfa82662459dc06fce7f6924beae539f1 (patch)
tree97413e8d5bf8400687cd5eb74e28e65f7dfef388
parentec84f5a1e2fa380def18f96062fb0ca6d808e6dc (diff)
aco/insert_exec_mask: Fix unconditional demote at top-level control flow.
Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27362> (cherry picked from commit c309d2017230e657fd042b9b9dd7acd1c621d2c5)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/compiler/aco_insert_exec_mask.cpp19
2 files changed, 10 insertions, 11 deletions
diff --git a/.pick_status.json b/.pick_status.json
index e4f51a6a3b3..57f469beb12 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -134,7 +134,7 @@
"description": "aco/insert_exec_mask: Fix unconditional demote at top-level control flow.",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp
index 4f4fb7eba5e..f5f89d5603b 100644
--- a/src/amd/compiler/aco_insert_exec_mask.cpp
+++ b/src/amd/compiler/aco_insert_exec_mask.cpp
@@ -556,33 +556,32 @@ process_instructions(exec_ctx& ctx, Block* block, std::vector<aco_ptr<Instructio
(ctx.info[block->index].exec[0].second & mask_type_global));
int num;
- Temp cond, exit_cond;
- if (instr->operands[0].isConstant()) {
+ Operand src;
+ Temp exit_cond;
+ if (instr->operands[0].isConstant() && !(block->kind & block_kind_top_level)) {
assert(instr->operands[0].constantValue() == -1u);
/* transition to exact and set exec to zero */
exit_cond = bld.tmp(s1);
- cond =
- bld.sop1(Builder::s_and_saveexec, bld.def(bld.lm), bld.scc(Definition(exit_cond)),
- Definition(exec, bld.lm), Operand::zero(), Operand(exec, bld.lm));
+ src = bld.sop1(Builder::s_and_saveexec, bld.def(bld.lm), bld.scc(Definition(exit_cond)),
+ Definition(exec, bld.lm), Operand::zero(), Operand(exec, bld.lm));
num = ctx.info[block->index].exec.size() - 2;
if (!(ctx.info[block->index].exec.back().second & mask_type_exact)) {
- ctx.info[block->index].exec.back().first = Operand(cond);
+ ctx.info[block->index].exec.back().first = src;
ctx.info[block->index].exec.emplace_back(Operand(bld.lm), mask_type_exact);
}
} else {
/* demote_if: transition to exact */
if (block->kind & block_kind_top_level && ctx.info[block->index].exec.size() == 2 &&
ctx.info[block->index].exec.back().second & mask_type_global) {
- /* We don't need to actually copy anything into exact, since the s_andn2
+ /* We don't need to actually copy anything into exec, since the s_andn2
* instructions later will do that.
*/
ctx.info[block->index].exec.pop_back();
} else {
transition_to_Exact(ctx, bld, block->index);
}
- assert(instr->operands[0].isTemp());
- cond = instr->operands[0].getTemp();
+ src = instr->operands[0];
num = ctx.info[block->index].exec.size() - 1;
}
@@ -590,7 +589,7 @@ process_instructions(exec_ctx& ctx, Block* block, std::vector<aco_ptr<Instructio
if (ctx.info[block->index].exec[i].second & mask_type_exact) {
Instruction* andn2 =
bld.sop2(Builder::s_andn2, bld.def(bld.lm), bld.def(s1, scc),
- get_exec_op(ctx.info[block->index].exec[i].first), cond);
+ get_exec_op(ctx.info[block->index].exec[i].first), src);
if (i == (int)ctx.info[block->index].exec.size() - 1)
andn2->definitions[0] = Definition(exec, bld.lm);