agx: Define p_extract for type converts

Useful for grabbing the high 32-bit word of a 64-bit value.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12053>
This commit is contained in:
Alyssa Rosenzweig
2021-07-24 17:25:40 -04:00
parent 3417ecb4d7
commit 96c98e0d25

View File

@@ -200,8 +200,8 @@ agx_ra(agx_context *ctx)
agx_remove_instruction(ins);
continue;
} else if (ins->op == AGX_OPCODE_P_EXTRACT) {
/* Uses the destination size */
assert(ins->dest[0].type == AGX_INDEX_NORMAL);
assert(ins->dest[0].size == ins->src[0].size);
unsigned base = ins->src[0].value;
if (ins->src[0].type != AGX_INDEX_REGISTER) {
@@ -209,7 +209,7 @@ agx_ra(agx_context *ctx)
base = alloc[base];
}
unsigned size = ins->dest[0].size == AGX_SIZE_32 ? 2 : 1;
unsigned size = ins->dest[0].size == AGX_SIZE_64 ? 4 : ins->dest[0].size == AGX_SIZE_32 ? 2 : 1;
unsigned left = ssa_to_reg[ins->dest[0].value];
unsigned right = ssa_to_reg[ins->src[0].value] + (size * ins->imm);