jay/lower_post_ra: remove SWAP macro

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41064>
This commit is contained in:
Alyssa Rosenzweig 2026-04-20 10:19:40 -04:00 committed by Marge Bot
parent 4c5ad7a832
commit 915af8e121
5 changed files with 9 additions and 41 deletions

View file

@ -107,18 +107,6 @@ lower(jay_builder *b, jay_inst *I)
return false;
}
case JAY_OPCODE_SWAP: {
jay_def x = I->src[0], y = I->src[1];
/* TODO: Need stride-aware lowering here too like MOV. Same ideas. */
if (jay_def_stride(b->shader, x) != jay_def_stride(b->shader, y))
UNREACHABLE("todo");
jay_XOR(b, JAY_TYPE_U32, x, y, x);
jay_XOR(b, JAY_TYPE_U32, y, x, y);
jay_XOR(b, JAY_TYPE_U32, x, y, x);
return true;
}
case JAY_OPCODE_ZERO_FLAG: {
jay_MOV(b, jay_bare_reg(FLAG, jay_zero_flag_reg(I)), 0)->type =
JAY_TYPE_U32;

View file

@ -170,9 +170,6 @@ op('expand_quad', 2, 'u32')
op('offset_packed_pixel_coords', 1, 'u32')
op('extract_layer', 2, 'u32')
# Generated by RA and lowered after. Valid only for GPR/UGPR.
op('swap', 2, 'u32', Props.NO_DEST)
# Phi function representations
#
# Unlike in NIR, we represent Phi functions as a pair of opcodes, purely

View file

@ -569,19 +569,15 @@ jay_emit_parallel_copies(jay_builder *b,
assert(dst.file == src.file);
enum jay_file file = dst.file;
jay_reg tmp = (file == GPR || file == MEM) ? temps.gpr : temps.ugpr;
if (tmp != NO_REG) {
struct jay_temp_regs t = { .gpr = temps.gpr2, .ugpr = temps.ugpr2 };
jay_def temp = push_temp(b, tmp, file == MEM /* stride4 */);
{
mov(b, temp, dst, t);
mov(b, dst, src, t);
mov(b, src, temp, t);
}
pop_temp(b, temps, temp);
} else {
jay_SWAP(b, dst, src);
assert(tmp != NO_REG);
struct jay_temp_regs t = { .gpr = temps.gpr2, .ugpr = temps.ugpr2 };
jay_def temp = push_temp(b, tmp, file == MEM /* stride4 */);
{
mov(b, temp, dst, t);
mov(b, dst, src, t);
mov(b, src, temp, t);
}
pop_temp(b, temps, temp);
for (unsigned j = 0; j < num_copies; j++) {
if (pcopies[j].src == copy->dst)

View file

@ -248,15 +248,8 @@ validate_inst(struct validate_state *validate, jay_inst *I)
CHECK(!I->src[s].negate || jay_has_src_mods(I, s));
}
switch (I->op) {
case JAY_OPCODE_SEL:
if (I->op == JAY_OPCODE_SEL) {
CHECK(jay_is_flag(I->src[2]) && "SEL src[2] (selector) must be a flag");
break;
case JAY_OPCODE_SWAP:
CHECK(I->src[0].file == I->src[1].file && "SWAP files must match");
break;
default:
break;
}
}

View file

@ -171,12 +171,6 @@ validate_block(jay_function *func, jay_block *block, struct regfile *blocks)
jay_foreach_comp(I->dst, c) {
*def_reg(rf, I->dst, c) = *def_reg(rf, I->src[0], c);
}
} else if (I->op == JAY_OPCODE_SWAP) {
assert(jay_num_values(I->src[0]) == jay_num_values(I->src[1]));
jay_foreach_comp(I->src[0], c) {
SWAP(*def_reg(rf, I->src[0], c), *def_reg(rf, I->src[1], c));
}
}
}