pvr: Support loading immediate values

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by Frank Binns <frank.binns@imgtec.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21331>
This commit is contained in:
Simon Perretta 2023-02-07 10:53:13 +00:00 committed by Marge Bot
parent e0e58e9659
commit 3355749105
2 changed files with 17 additions and 4 deletions

View file

@ -33,8 +33,6 @@
*/
/* Converts immediate values to constant register values. */
/* TODO: For values that aren't in constant registers, either insert a bitwise
* mov, or ask driver to put it into shared regs. */
PUBLIC
bool rogue_constreg(rogue_shader *shader)
{
@ -45,8 +43,10 @@ bool rogue_constreg(rogue_shader *shader)
rogue_foreach_imm_use_safe (imm_use, shader) {
unsigned index = rogue_constreg_lookup(*imm_use->imm);
/* Skip values that aren't in the special constant registers; they'll be
* replaced with immediate movs. */
if (index == ROGUE_NO_CONST_REG)
unreachable("Immediate value not in constant registers.");
continue;
rogue_reg *reg = rogue_const_reg(shader, index);

View file

@ -74,7 +74,20 @@ static inline bool rogue_lower_MOV(rogue_builder *b, rogue_alu_instr *mov)
mov->dst[0].ref.reg->class == ROGUE_REG_CLASS_VTXOUT) {
instr = &rogue_UVSW_WRITE(b, mov->dst[0].ref, mov->src[0].ref)->instr;
} else {
instr = &rogue_MBYP(b, mov->dst[0].ref, mov->src[0].ref)->instr;
/* If we're moving an immediate value not in special constants,
* we need to do a bitwise bypass.
*/
if (rogue_ref_is_imm(&mov->src[0].ref)) {
instr = &rogue_BYP0(b,
rogue_ref_io(ROGUE_IO_FT0),
mov->dst[0].ref,
rogue_ref_io(ROGUE_IO_S0),
rogue_ref_val(
rogue_ref_get_imm(&mov->src[0].ref)->imm.u32))
->instr;
} else {
instr = &rogue_MBYP(b, mov->dst[0].ref, mov->src[0].ref)->instr;
}
}
rogue_merge_instr_comment(instr, &mov->instr, "mov");