pan/bi: Pack ADD ICMP 16
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4883>
This commit is contained in:
parent
5bd4172280
commit
5cbdf29b7e
|
@ -1527,19 +1527,21 @@ bi_pack_add_discard(bi_instruction *ins, struct bi_registers *regs)
|
|||
}
|
||||
|
||||
static enum bifrost_icmp_cond
|
||||
bi_cond_to_icmp(enum bi_cond cond, bool *flip, bool is_unsigned)
|
||||
bi_cond_to_icmp(enum bi_cond cond, bool *flip, bool is_unsigned, bool is_16)
|
||||
{
|
||||
switch (cond){
|
||||
case BI_COND_LT:
|
||||
*flip = true;
|
||||
/* fallthrough */
|
||||
case BI_COND_GT:
|
||||
return is_unsigned ? BIFROST_ICMP_UGT : BIFROST_ICMP_IGT;
|
||||
return is_unsigned ? (is_16 ? BIFROST_ICMP_IGE : BIFROST_ICMP_UGT)
|
||||
: BIFROST_ICMP_IGT;
|
||||
case BI_COND_LE:
|
||||
*flip = true;
|
||||
/* fallthrough */
|
||||
case BI_COND_GE:
|
||||
return is_unsigned ? BIFROST_ICMP_UGE : BIFROST_ICMP_IGE;
|
||||
return is_unsigned ? BIFROST_ICMP_UGE :
|
||||
(is_16 ? BIFROST_ICMP_UGT : BIFROST_ICMP_IGE);
|
||||
case BI_COND_NE:
|
||||
return BIFROST_ICMP_NEQ;
|
||||
case BI_COND_EQ:
|
||||
|
@ -1565,6 +1567,23 @@ bi_pack_add_icmp32(bi_instruction *ins, struct bi_registers *regs, bool flip,
|
|||
RETURN_PACKED(pack);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add_icmp16(bi_instruction *ins, struct bi_registers *regs, bool flip,
|
||||
enum bifrost_icmp_cond cond)
|
||||
{
|
||||
struct bifrost_add_icmp16 pack = {
|
||||
.src0 = bi_get_src(ins, regs, flip ? 1 : 0, false),
|
||||
.src1 = bi_get_src(ins, regs, flip ? 0 : 1, false),
|
||||
.src0_swizzle = bi_swiz16(ins, flip ? 1 : 0),
|
||||
.src1_swizzle = bi_swiz16(ins, flip ? 0 : 1),
|
||||
.cond = cond,
|
||||
.d3d = false,
|
||||
.op = BIFROST_ADD_OP_ICMP_16
|
||||
};
|
||||
|
||||
RETURN_PACKED(pack);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add_cmp(bi_instruction *ins, struct bi_registers *regs)
|
||||
{
|
||||
|
@ -1578,11 +1597,14 @@ bi_pack_add_cmp(bi_instruction *ins, struct bi_registers *regs)
|
|||
|
||||
bool flip = false;
|
||||
|
||||
enum bifrost_icmp_cond cond =
|
||||
bi_cond_to_icmp(ins->cond, &flip, Bl == nir_type_uint);
|
||||
enum bifrost_icmp_cond cond = bi_cond_to_icmp(
|
||||
sz == 16 ? /*bi_invert_cond*/(ins->cond) : ins->cond,
|
||||
&flip, Bl == nir_type_uint, sz == 16);
|
||||
|
||||
if (sz == 32)
|
||||
return bi_pack_add_icmp32(ins, regs, flip, cond);
|
||||
else if (sz == 16)
|
||||
return bi_pack_add_icmp16(ins, regs, flip, cond);
|
||||
else
|
||||
unreachable("TODO");
|
||||
} else {
|
||||
|
|
|
@ -497,8 +497,8 @@ struct bifrost_add_fcmp16 {
|
|||
|
||||
enum bifrost_icmp_cond {
|
||||
BIFROST_ICMP_IGT = 0,
|
||||
BIFROST_ICMP_IGE = 1,
|
||||
BIFROST_ICMP_UGT = 2,
|
||||
BIFROST_ICMP_IGE = 1, /* swapped for 16-bit */
|
||||
BIFROST_ICMP_UGT = 2, /* swapped for 16-bit */
|
||||
BIFROST_ICMP_UGE = 3,
|
||||
BIFROST_ICMP_EQ = 4,
|
||||
BIFROST_ICMP_NEQ = 5,
|
||||
|
|
Loading…
Reference in New Issue