From fde66f0aa8943d7d1e230e333b43a63d7cccce80 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 11 Apr 2021 15:08:44 -0400 Subject: [PATCH] agx: Implement load_const as mov Signed-off-by: Alyssa Rosenzweig Acked-by: Jason Ekstrand Acked-by: Bas Nieuwenhuizen Part-of: --- src/asahi/compiler/agx_compile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 680881d6442..577acab359e 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -51,7 +51,15 @@ int agx_debug = 0; static void agx_emit_load_const(agx_builder *b, nir_load_const_instr *instr) { - unreachable("stub"); + /* Ensure we've been scalarized and bit size lowered */ + unsigned bit_size = instr->def.bit_size; + assert(instr->def.num_components == 1); + assert(bit_size == 16 || bit_size == 32); + + /* Emit move, later passes can inline/push if useful */ + agx_mov_imm_to(b, + agx_get_index(instr->def.index, agx_size_for_bits(bit_size)), + nir_const_value_as_uint(instr->value[0], bit_size)); } static void