pan/bi: Include modifier info in opcode table

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
This commit is contained in:
Alyssa Rosenzweig 2021-03-05 23:10:39 +00:00 committed by Marge Bot
parent 70c9726e06
commit 7ad9e1e5a5
2 changed files with 18 additions and 1 deletions

View File

@ -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
};"""

View File

@ -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 */