diff --git a/src/panfrost/bifrost/bifrost_isa.py b/src/panfrost/bifrost/bifrost_isa.py index 89e5d6f008f..ba5e62aba48 100644 --- a/src/panfrost/bifrost/bifrost_isa.py +++ b/src/panfrost/bifrost/bifrost_isa.py @@ -247,6 +247,12 @@ def simplify_to_ir(ins): 'immediates': [m[0] for m in ins['immediates']] } +# Converstions to integers default to rounding-to-zero +# All other opcodes default to rounding to nearest even +def default_round_to_zero(name): + # 8-bit int to float is exact + subs = ['_TO_U', '_TO_S', '_TO_V2U', '_TO_V2S', '_TO_V4U', '_TO_V4S'] + return any([x in name for x in subs]) def combine_ir_variants(instructions, key): seen = [op for op in instructions.keys() if op[1:] == key] @@ -278,7 +284,8 @@ def combine_ir_variants(instructions, key): 'immediates': sorted(variants[0]['immediates']), 'modifiers': modifiers, 'v': len(variants), - 'ir': variants + 'ir': variants, + 'rtz': default_round_to_zero(key) } # Partition instructions to mnemonics, considering units and variants