Commit e9c26c2c authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

EMIT_ALU_CASE to macro

parent 4ba093da
......@@ -243,15 +243,25 @@ emit_load_const(compiler_context *ctx, nir_load_const_instr *instr)
/* TODO: Respect src modifiers; Midgard can handle it anyway */
#define EMIT_ALU_CASE_2(op_nir, op_midgard) \
case nir_op_fadd: \
ins = m_fadd(resolve_source_register(instr->src[0].src), \
n2m_alu_modifiers(&instr->src[0]), \
resolve_source_register(instr->src[1].src), \
n2m_alu_modifiers(&instr->src[1]), \
resolve_destination_register(instr->dest.dest)); \
util_dynarray_append(&ctx->current_block, midgard_instruction, ins); \
break;
static void
emit_alu(compiler_context *ctx, nir_alu_instr *instr)
{
midgard_instruction ins;
switch(instr->op) {
case nir_op_fadd:
ins = m_fadd(resolve_source_register(instr->src[0].src), n2m_alu_modifiers(&instr->src[0]), resolve_source_register(instr->src[1].src), n2m_alu_modifiers(&instr->src[1]), resolve_destination_register(instr->dest.dest));
util_dynarray_append(&ctx->current_block, midgard_instruction, ins);
EMIT_ALU_CASE_2(fadd, fadd);
default:
printf("Unhandled ALU op\n");
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment