bifrost: Add support for nir_op_iabs

Signed-off-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6098>
This commit is contained in:
Chris Forbes
2020-07-27 11:51:31 -07:00
committed by Marge Bot
parent 1cdd161a30
commit 1882b1e5a7
5 changed files with 10 additions and 0 deletions

View File

@@ -1434,6 +1434,9 @@ bi_pack_add_special(bi_instruction *ins, bi_registers *regs)
} else if (ins->op.special == BI_SPECIAL_EXP2_LOW) {
assert(!fp16);
op = BIFROST_ADD_OP_FEXP2_FAST;
} else if (ins->op.special == BI_SPECIAL_IABS) {
assert(ins->src_types[0] == nir_type_int32);
op = BIFROST_ADD_OP_IABS_32;
} else {
unreachable("Unknown special op");
}

View File

@@ -164,6 +164,7 @@ struct bifrost_fma_mscale {
#define BIFROST_ADD_OP_FRSQ_FAST_F16_Y (0x0ce70)
#define BIFROST_ADD_OP_LOG2_HELP (0x0cc68)
#define BIFROST_ADD_OP_FEXP2_FAST (0x0cd58)
#define BIFROST_ADD_OP_IABS_32 (0x07bd4)
struct bifrost_add_inst {
unsigned src0 : 3;

View File

@@ -600,6 +600,7 @@ bi_class_for_nir_alu(nir_op op)
case nir_op_frcp:
case nir_op_frsq:
case nir_op_iabs:
return BI_SPECIAL;
default:
@@ -808,6 +809,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
case nir_op_isub:
alu.op.imath = BI_IMATH_SUB;
break;
case nir_op_iabs:
alu.op.special = BI_SPECIAL_IABS;
break;
case nir_op_inot:
/* no dedicated bitwise not, but we can invert sources. convert to ~a | 0 */
alu.op.bitwise = BI_BITWISE_OR;

View File

@@ -204,6 +204,7 @@ enum bi_special_op {
* exp2() in GL. In the first argument, it takes f2i_rte(x * 2^24). In
* the second, it takes x itself. */
BI_SPECIAL_EXP2_LOW,
BI_SPECIAL_IABS,
};
enum bi_tex_op {

View File

@@ -1013,6 +1013,7 @@ static const struct add_op_info add_op_infos[] = {
{ 0x07ba5, "FSQRT_FREXPE", ADD_ONE_SRC },
{ 0x07bad, "FRSQ_FREXPE", ADD_ONE_SRC },
{ 0x07bc5, "FLOG_FREXPE", ADD_ONE_SRC },
{ 0x07bd4, "IABS.i32", ADD_ONE_SRC },
{ 0x07d42, "CEIL.v2f16", ADD_ONE_SRC },
{ 0x07d45, "CEIL.f32", ADD_ONE_SRC },
{ 0x07d82, "FLOOR.v2f16", ADD_ONE_SRC },