pan/bi: Move typesize to common code

Useful for the 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-06-10 20:07:50 -04:00
committed by Marge Bot
parent 7db6d8d748
commit 91a2804d8f
2 changed files with 15 additions and 14 deletions
+1 -14
View File
@@ -58,19 +58,6 @@ def nirtypes(opcode):
else:
return None
def typesize(opcode):
if opcode[-3:] == '128':
return 128
if opcode[-2:] == '48':
return 48
elif opcode[-1] == '8':
return 8
else:
try:
return int(opcode[-2:])
except:
return None
def condition(opcode, typecheck, sizecheck):
cond = ''
if typecheck == True:
@@ -211,4 +198,4 @@ def arguments(op, temp_dest = True):
modifier_signature(op) +
op["immediates"])
print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, modifiers = modifier_lists, signature = signature, arguments = arguments, src_count = src_count, SKIP = SKIP))
print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, modifiers = modifier_lists, signature = signature, arguments = arguments, src_count = src_count, typesize = typesize, SKIP = SKIP))
+14
View File
@@ -334,3 +334,17 @@ def order_modifiers(ir_instructions):
def src_count(op):
staging = 1 if (op["staging"] in ["r", "rw"]) else 0
return op["srcs"] + staging
# Parses out the size part of an opocde name
def typesize(opcode):
if opcode[-3:] == '128':
return 128
if opcode[-2:] == '48':
return 48
elif opcode[-1] == '8':
return 8
else:
try:
return int(opcode[-2:])
except:
return 32