Mesa (main): pan/bi: Mark some opcodes as default round-to-zero
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 18:25:32 UTC 2022
Module: Mesa
Branch: main
Commit: de37f755544868275d9210868c2eaef2af700ff4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=de37f755544868275d9210868c2eaef2af700ff4
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Sun Feb 27 15:46:03 2022 -0500
pan/bi: Mark some opcodes as default round-to-zero
Conversions to integer have different rounding rules.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15187>
---
src/panfrost/bifrost/bifrost_isa.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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
More information about the mesa-commit
mailing list