From 7ad9e1e5a5825c25190f052c24107b6580002a5c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 5 Mar 2021 23:10:39 +0000 Subject: [PATCH] pan/bi: Include modifier info in opcode table Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_opcodes.c.py | 12 +++++++++++- src/panfrost/bifrost/bi_opcodes.h.py | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bi_opcodes.c.py b/src/panfrost/bifrost/bi_opcodes.c.py index 7ef88da8f0a..d0cda112dcd 100644 --- a/src/panfrost/bifrost/bi_opcodes.c.py +++ b/src/panfrost/bifrost/bi_opcodes.c.py @@ -21,7 +21,10 @@ # IN THE SOFTWARE. TEMPLATE = """#include "bi_opcodes.h" - +<% +def hasmod(mods, name): + return 1 if name in mods else 0 +%> struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = { % for opcode in sorted(mnemonics): <% @@ -35,10 +38,17 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = { branch = int(opcode.startswith('BRANCH')) has_fma = int("*" + opcode in instructions) has_add = int("+" + opcode in instructions) + mods = ops[opcode]['modifiers'] + clamp = hasmod(mods, 'clamp') + not_result = hasmod(mods, 'not_result') + abs = hasmod(mods, 'abs0') | (hasmod(mods, 'abs1') << 1) | (hasmod(mods, 'abs2') << 2) + neg = hasmod(mods, 'neg0') | (hasmod(mods, 'neg1') << 1) | (hasmod(mods, 'neg2') << 2) + m_not = hasmod(mods, 'not1') %> [BI_OPCODE_${opcode.replace('.', '_').upper()}] = { "${opcode}", BIFROST_MESSAGE_${message}, BI_SR_COUNT_${sr_count}, ${sr_read}, ${sr_write}, ${last}, ${branch}, ${table}, ${has_fma}, ${has_add}, + ${clamp}, ${not_result}, ${abs}, ${neg}, ${m_not}, }, % endfor };""" diff --git a/src/panfrost/bifrost/bi_opcodes.h.py b/src/panfrost/bifrost/bi_opcodes.h.py index b807513e196..9459eda894c 100644 --- a/src/panfrost/bifrost/bi_opcodes.h.py +++ b/src/panfrost/bifrost/bi_opcodes.h.py @@ -77,6 +77,13 @@ struct bi_op_props { bool table : 1; bool fma : 1; bool add : 1; + + /* Supported propagable modifiers */ + bool clamp : 1; + bool not_result : 1; + unsigned abs : 3; + unsigned neg : 3; + bool not : 1; }; /* Generated in bi_opcodes.c.py */