instr->operands.pop_back();
assert(instr->operands[1].isConstant());
/* in case it's an inline constant, make it a literal */
- instr->operands[1].setFixed(PhysReg(255));
+ instr->operands[1] = Operand::literal32(instr->operands[1].constantValue());
}
uint32_t opcode = ctx.opcode[(int)instr->opcode];
instr.reset(bld.sop1(aco_opcode::s_getpc_b64, branch->definitions[0]).instr);
emit_instruction(ctx, out, instr.get());
- instr.reset(bld.sop2(aco_opcode::s_addc_u32, def_tmp_lo, op_tmp_lo, Operand::zero()).instr);
- instr->operands[1].setFixed(PhysReg{255}); /* this operand has to be a literal */
+ instr.reset(
+ bld.sop2(aco_opcode::s_addc_u32, def_tmp_lo, op_tmp_lo, Operand::literal32(0)).instr);
emit_instruction(ctx, out, instr.get());
branch->pass_flags = out.size();
return op;
}
+ static Operand literal32(uint32_t v) noexcept
+ {
+ Operand op;
+ op.control_ = 0;
+ op.data_.i = v;
+ op.isConstant_ = true;
+ op.constSize = 2;
+ op.setFixed(PhysReg{255});
+ return op;
+ }
+
explicit Operand(RegClass type) noexcept
{
isUndef_ = true;
bld.sopp(aco_opcode::s_denorm_mode, -1, new_mode.denorm);
} else if (set_round || set_denorm) {
/* "((size - 1) << 11) | register" (MODE is encoded as register 1) */
- Instruction* instr =
- bld.sopk(aco_opcode::s_setreg_imm32_b32, Operand::c8(new_mode.val), (7 << 11) | 1).instr;
- /* has to be a literal */
- instr->operands[0].setFixed(PhysReg{255});
+ bld.sopk(aco_opcode::s_setreg_imm32_b32, Operand::literal32(new_mode.val), (7 << 11) | 1);
}
}
Operand op = instr->operands[i];
unsigned bits = get_operand_size(instr, i);
if (op.isTemp() && ctx.info[op.tempId()].is_literal(bits) && ctx.uses[op.tempId()] == 0) {
- Operand literal = Operand::c32(ctx.info[op.tempId()].val);
+ Operand literal = Operand::literal32(ctx.info[op.tempId()].val);
instr->format = withoutDPP(instr->format);
if (instr->isVALU() && i > 0 && instr->format != Format::VOP3P)
to_VOP3(ctx, instr);