From ee47ce6ac3c74b547c060751f82624205c24ec77 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 27 Feb 2020 09:35:50 -0500 Subject: [PATCH] pan/midgard: Add LDST_ADDRESS property Many load/store ops (used for globals, SSBOs, shared memory, etc) have the ability to compute addresses directly. Mark off which ones behave like this. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/helpers.h | 3 +++ src/panfrost/midgard/midgard_ops.c | 22 +++++++++++----------- src/panfrost/midgard/midgard_ops.h | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h index 9acc5dd6664..7aa2e776008 100644 --- a/src/panfrost/midgard/helpers.h +++ b/src/panfrost/midgard/helpers.h @@ -230,6 +230,9 @@ struct mir_tag_props { * its mask is 0 */ #define LDST_SIDE_FX (1 << 4) +/* Computes an address according to indirects/zext/shift/etc */ +#define LDST_ADDRESS (1 << 5) + /* This file is common, so don't define the tables themselves. #include * midgard_op.h if you need that, or edit midgard_ops.c directly */ diff --git a/src/panfrost/midgard/midgard_ops.c b/src/panfrost/midgard/midgard_ops.c index cb0e50dfbff..ec00e2af475 100644 --- a/src/panfrost/midgard/midgard_ops.c +++ b/src/panfrost/midgard/midgard_ops.c @@ -207,12 +207,12 @@ struct mir_ldst_op_props load_store_opcode_props[256] = { [midgard_op_atomic_umax64] = {"atomic_umax64", M64 | LDST_SIDE_FX}, [midgard_op_atomic_xchg64] = {"atomic_xchg64", M64 | LDST_SIDE_FX}, - [midgard_op_ld_char] = {"ld_char", M32}, - [midgard_op_ld_char2] = {"ld_char2", M16}, - [midgard_op_ld_short] = {"ld_short", M32}, - [midgard_op_ld_char4] = {"ld_char4", M32}, - [midgard_op_ld_short4] = {"ld_short4", M32}, - [midgard_op_ld_int4] = {"ld_int4", M32}, + [midgard_op_ld_char] = {"ld_char", M32 | LDST_ADDRESS}, + [midgard_op_ld_char2] = {"ld_char2", M16 | LDST_ADDRESS}, + [midgard_op_ld_short] = {"ld_short", M32 | LDST_ADDRESS}, + [midgard_op_ld_char4] = {"ld_char4", M32 | LDST_ADDRESS}, + [midgard_op_ld_short4] = {"ld_short4", M32 | LDST_ADDRESS}, + [midgard_op_ld_int4] = {"ld_int4", M32 | LDST_ADDRESS}, [midgard_op_ld_attr_32] = {"ld_attr_32", M32}, [midgard_op_ld_attr_32i] = {"ld_attr_32i", M32}, @@ -234,11 +234,11 @@ struct mir_ldst_op_props load_store_opcode_props[256] = { [midgard_op_ld_ubo_short4] = {"ld_ubo_short4", M32}, [midgard_op_ld_ubo_int4] = {"ld_ubo_int4", M32}, - [midgard_op_st_char] = {"st_char", M32 | LDST_STORE}, - [midgard_op_st_char2] = {"st_char2", M16 | LDST_STORE}, - [midgard_op_st_char4] = {"st_char4", M32 | LDST_STORE}, - [midgard_op_st_short4] = {"st_short4", M32 | LDST_STORE}, - [midgard_op_st_int4] = {"st_int4", M32 | LDST_STORE}, + [midgard_op_st_char] = {"st_char", M32 | LDST_STORE | LDST_ADDRESS}, + [midgard_op_st_char2] = {"st_char2", M16 | LDST_STORE | LDST_ADDRESS}, + [midgard_op_st_char4] = {"st_char4", M32 | LDST_STORE | LDST_ADDRESS}, + [midgard_op_st_short4] = {"st_short4", M32 | LDST_STORE | LDST_ADDRESS}, + [midgard_op_st_int4] = {"st_int4", M32 | LDST_STORE | LDST_ADDRESS}, [midgard_op_st_vary_32] = {"st_vary_32", M32 | LDST_STORE}, [midgard_op_st_vary_32i] = {"st_vary_32i", M32 | LDST_STORE}, diff --git a/src/panfrost/midgard/midgard_ops.h b/src/panfrost/midgard/midgard_ops.h index f0cfc5db424..6919c3155b6 100644 --- a/src/panfrost/midgard/midgard_ops.h +++ b/src/panfrost/midgard/midgard_ops.h @@ -31,6 +31,7 @@ extern struct mir_ldst_op_props load_store_opcode_props[256]; extern struct mir_tag_props midgard_tag_props[16]; #define OP_IS_STORE(op) (load_store_opcode_props[op].props & LDST_STORE) +#define OP_HAS_ADDRESS(op) (load_store_opcode_props[op].props & LDST_ADDRESS) /* Is this opcode that of an integer (regardless of signedness)? Instruction * names authoritatively determine types */ -- 2.30.2