pan/bi: Implement store_vary with the builder

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
This commit is contained in:
Alyssa Rosenzweig 2020-12-09 09:00:04 -05:00 committed by Marge Bot
parent 49f38aa9e7
commit 341e312cf4
1 changed files with 34 additions and 0 deletions

View File

@ -699,6 +699,40 @@ bi_load_with_r61(enum bi_class T, nir_intrinsic_instr *instr)
return ld;
}
static void
bi_emit_store_vary(bi_builder *b, nir_intrinsic_instr *instr)
{
nir_alu_type T = nir_intrinsic_src_type(instr);
enum bi_register_format regfmt = bi_reg_fmt_for_nir(T);
nir_src *offset = nir_get_io_offset_src(instr);
unsigned imm_index = 0;
bool immediate = bi_is_intr_immediate(instr, &imm_index);
bi_index address = immediate ?
bi_lea_attr_imm(b,
bi_register(61), /* TODO RA */
bi_register(62), /* TODO RA */
regfmt, imm_index) :
bi_lea_attr(b,
bi_register(61), /* TODO RA */
bi_register(62), /* TODO RA */
bi_src_index(offset), regfmt);
/* Only look at the total components needed. In effect, we fill in all
* the intermediate "holes" in the write mask, since we can't mask off
* stores. Since nir_lower_io_to_temporaries ensures each varying is
* written at most once, anything that's masked out is undefined, so it
* doesn't matter what we write there. So we may as well do the
* simplest thing possible. */
unsigned nr = util_last_bit(nir_intrinsic_write_mask(instr));
assert(nr > 0 && nr <= nir_intrinsic_src_components(instr, 0));
bi_st_cvt_to(b, bi_null(), bi_src_index(&instr->src[0]),
address, bi_word(address, 1), bi_word(address, 2),
regfmt, nr - 1);
}
static void
bi_emit_st_vary(bi_context *ctx, nir_intrinsic_instr *instr)
{