panvk: use cs_move_reg32 and lower to cs_add32 if needed
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Trivial but still better than cs_add32 workaround on platforms
supporting MOVE_REG32.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37951>
This commit is contained in:
Yiwei Zhang 2025-10-19 21:27:20 -07:00 committed by Marge Bot
parent 81692b8168
commit cc1d942727
2 changed files with 15 additions and 11 deletions

View file

@ -1686,6 +1686,19 @@ cs_umin32(struct cs_builder *b, struct cs_index dest, struct cs_index src1,
}
}
static inline void
cs_move_reg32(struct cs_builder *b, struct cs_index dest, struct cs_index src)
{
#if PAN_ARCH >= 11
cs_emit(b, MOVE_REG32, I) {
I.destination = cs_dst32(b, dest);
I.source = cs_src32(b, src);
}
#else
cs_add32(b, dest, src, 0);
#endif
}
#if PAN_ARCH >= 11
static inline void
cs_and32(struct cs_builder *b, struct cs_index dest, struct cs_index src1,
@ -1751,15 +1764,6 @@ cs_bit_clear32(struct cs_builder *b, struct cs_index dest, struct cs_index src1,
}
}
static inline void
cs_move_reg32(struct cs_builder *b, struct cs_index dest, struct cs_index src)
{
cs_emit(b, MOVE_REG32, I) {
I.destination = cs_dst32(b, dest);
I.source = cs_src32(b, src);
}
}
static inline void
cs_set_state(struct cs_builder *b, enum mali_cs_set_state_type state,
struct cs_index src)

View file

@ -2630,8 +2630,8 @@ panvk_cmd_draw_indirect(struct panvk_cmd_buffer *cmdbuf,
/* Emulated immediate multiply: we walk the bits in
* base_instance, and accumulate (stride << bit_pos) if the bit
* is present. This is sub-optimal, but it's simple :-). */
cs_add32(b, multiplicand,
cs_sr_reg32(b, IDVS, INSTANCE_OFFSET), 0);
cs_move_reg32(b, multiplicand,
cs_sr_reg32(b, IDVS, INSTANCE_OFFSET));
/* Flush the loads here so that we don't get automatic flushes
* over and over again due to the divergent nature of the if/else