Mesa (master): nir/algebraic: Remove unnecessary iand of [iu]bfe and bfm sources
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 17:12:23 UTC 2019
Module: Mesa
Branch: master
Commit: 4eeb49ea71e47899f5d9a51b8f3e1fd9762fa7ad
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4eeb49ea71e47899f5d9a51b8f3e1fd9762fa7ad
Author: Daniel Schürmann <daniel.schuermann at campus.tu-berlin.de>
Date: Fri Jan 25 13:56:49 2019 +0100
nir/algebraic: Remove unnecessary iand of [iu]bfe and bfm sources
The [iu]bfe and bfm instructions are defined to only use the five
least significant bits.
This optimizes a common pattern from D3D -> SPIR-V translation.
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/compiler/nir/nir_opt_algebraic.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index c7e69c0310c..6e660dfdc02 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -809,6 +809,14 @@ optimizations.extend([
('ubfe', 'value', 'offset', 'bits')),
'options->lower_bitfield_extract'),
+ # Note that these opcodes are defined to only use the five least significant bits of 'offset' and 'bits'
+ (('ubfe', 'value', 'offset', ('iand', 31, 'bits')), ('ubfe', 'value', 'offset', 'bits')),
+ (('ubfe', 'value', ('iand', 31, 'offset'), 'bits'), ('ubfe', 'value', 'offset', 'bits')),
+ (('ibfe', 'value', 'offset', ('iand', 31, 'bits')), ('ibfe', 'value', 'offset', 'bits')),
+ (('ibfe', 'value', ('iand', 31, 'offset'), 'bits'), ('ibfe', 'value', 'offset', 'bits')),
+ (('bfm', 'bits', ('iand', 31, 'offset')), ('bfm', 'bits', 'offset')),
+ (('bfm', ('iand', 31, 'bits'), 'offset'), ('bfm', 'bits', 'offset')),
+
(('ibitfield_extract', 'value', 'offset', 'bits'),
('bcsel', ('ieq', 0, 'bits'),
0,
More information about the mesa-commit
mailing list