diff options
author | Rhys Perry <[email protected]> | 2019-09-24 15:46:37 +0100 |
---|---|---|
committer | Rhys Perry <[email protected]> | 2019-09-25 15:28:44 +0000 |
commit | db2ca45102753f9af62d4fe339599a357239b781 (patch) | |
tree | 7551ae326eac0d9c34e4f8443dc63053ffd30b33 /src/amd/compiler/aco_opcodes.py | |
parent | 101f47fdd7f9111d176f90a5d0ec033baa0015e9 (diff) |
aco: check for duplicate opcode numbers
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/compiler/aco_opcodes.py')
-rw-r--r-- | src/amd/compiler/aco_opcodes.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_opcodes.py b/src/amd/compiler/aco_opcodes.py index 1b9c3c7a155..a5b4eb9a54e 100644 --- a/src/amd/compiler/aco_opcodes.py +++ b/src/amd/compiler/aco_opcodes.py @@ -27,6 +27,7 @@ # Class that represents all the information we have about the opcode # NOTE: this must be kept in sync with aco_op_info +import sys from enum import Enum class Format(Enum): @@ -1550,3 +1551,27 @@ SCRATCH = { } for (gfx8, gfx10, name) in SCRATCH: opcode(name, gfx8, gfx10, Format.SCRATCH) + +# check for duplicate opcode numbers +for ver in ['gfx9', 'gfx10']: + op_to_name = {} + for op in opcodes.values(): + if op.format in [Format.PSEUDO, Format.PSEUDO_BRANCH, Format.PSEUDO_BARRIER, Format.PSEUDO_REDUCTION]: + continue + + num = getattr(op, 'opcode_' + ver) + if num == -1: + continue + + key = (op.format, num) + + if key in op_to_name: + # exceptions + names = set([op_to_name[key], op.name]) + if ver in ['gfx8', 'gfx9'] and names == set(['v_mul_lo_i32', 'v_mul_lo_u32']): + continue + + print('%s and %s share the same opcode number (%s)' % (op_to_name[key], op.name, ver)) + sys.exit(1) + else: + op_to_name[key] = op.name |