From 497fcd26b51e7be7ddcd30a6450e1fa273af6206 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 2 Mar 2023 13:09:35 +0100 Subject: [PATCH] ir3: Add builder support for shared immediates In addition to replacing existing no-longer-needed usage of the readfirst macro, we will use this for other NIR ALU instructions that need to materialize constants when they use the shared ALU. Part-of: --- src/freedreno/ir3/ir3.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 0e2ec78560d..b295f57f02e 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -2155,7 +2155,7 @@ type_flags(type_t type) } static inline struct ir3_instruction * -create_immed_typed(struct ir3_block *block, uint32_t val, type_t type) +create_immed_typed_shared(struct ir3_block *block, uint32_t val, type_t type, bool shared) { struct ir3_instruction *mov; ir3_register_flags flags = type_flags(type); @@ -2163,16 +2163,28 @@ create_immed_typed(struct ir3_block *block, uint32_t val, type_t type) mov = ir3_instr_create(block, OPC_MOV, 1, 1); mov->cat1.src_type = type; mov->cat1.dst_type = type; - __ssa_dst(mov)->flags |= flags; + __ssa_dst(mov)->flags |= flags | (shared ? IR3_REG_SHARED : 0); ir3_src_create(mov, 0, IR3_REG_IMMED | flags)->uim_val = val; return mov; } +static inline struct ir3_instruction * +create_immed_typed(struct ir3_block *block, uint32_t val, type_t type) +{ + return create_immed_typed_shared(block, val, type, false); +} + +static inline struct ir3_instruction * +create_immed_shared(struct ir3_block *block, uint32_t val, bool shared) +{ + return create_immed_typed_shared(block, val, TYPE_U32, shared); +} + static inline struct ir3_instruction * create_immed(struct ir3_block *block, uint32_t val) { - return create_immed_typed(block, val, TYPE_U32); + return create_immed_shared(block, val, false); } static inline struct ir3_instruction *