summaryrefslogtreecommitdiff
path: root/lib/mesa/src/compiler/nir
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
commit884abe30143f8f6bceb6f3fc7febec2c07d51821 (patch)
tree21cfa7f0f49cdb4a078e8bfd76b4cc5a8711c444 /lib/mesa/src/compiler/nir
parent17251c8fe97e6c8f1f6e21767313ce4bfa80a547 (diff)
Merge Mesa 21.1.8
Diffstat (limited to 'lib/mesa/src/compiler/nir')
-rw-r--r--lib/mesa/src/compiler/nir/nir_algebraic.py11
-rw-r--r--lib/mesa/src/compiler/nir/nir_builder.h6
-rw-r--r--lib/mesa/src/compiler/nir/nir_opcodes.py1
-rw-r--r--lib/mesa/src/compiler/nir/nir_opt_algebraic.py6
-rw-r--r--lib/mesa/src/compiler/nir/nir_opt_gcm.c5
5 files changed, 14 insertions, 15 deletions
diff --git a/lib/mesa/src/compiler/nir/nir_algebraic.py b/lib/mesa/src/compiler/nir/nir_algebraic.py
index 37fefd87a..c5b47ff92 100644
--- a/lib/mesa/src/compiler/nir/nir_algebraic.py
+++ b/lib/mesa/src/compiler/nir/nir_algebraic.py
@@ -249,16 +249,7 @@ class Constant(Value):
if isinstance(self.value, integer_types):
return hex(self.value)
elif isinstance(self.value, float):
- i = struct.unpack('Q', struct.pack('d', self.value))[0]
- h = hex(i)
-
- # On Python 2 this 'L' suffix is automatically added, but not on Python 3
- # Adding it explicitly makes the generated file identical, regardless
- # of the Python version running this script.
- if h[-1] != 'L' and i > sys.maxsize:
- h += 'L'
-
- return h
+ return hex(struct.unpack('Q', struct.pack('d', self.value))[0])
else:
assert False
diff --git a/lib/mesa/src/compiler/nir/nir_builder.h b/lib/mesa/src/compiler/nir/nir_builder.h
index 37711abe6..f277d89c2 100644
--- a/lib/mesa/src/compiler/nir/nir_builder.h
+++ b/lib/mesa/src/compiler/nir/nir_builder.h
@@ -103,17 +103,19 @@ nir_shader_instructions_pass(nir_shader *shader,
if (!function->impl)
continue;
+ bool func_progress = false;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_foreach_block_safe(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
- progress |= pass(&b, instr, cb_data);
+ func_progress |= pass(&b, instr, cb_data);
}
}
- if (progress) {
+ if (func_progress) {
nir_metadata_preserve(function->impl, preserved);
+ progress = true;
} else {
nir_metadata_preserve(function->impl, nir_metadata_all);
}
diff --git a/lib/mesa/src/compiler/nir/nir_opcodes.py b/lib/mesa/src/compiler/nir/nir_opcodes.py
index b977e17a8..9291f6db1 100644
--- a/lib/mesa/src/compiler/nir/nir_opcodes.py
+++ b/lib/mesa/src/compiler/nir/nir_opcodes.py
@@ -537,6 +537,7 @@ dst.y = dst.y * (1.0f / ma) + 0.5f;
""")
unop_horiz("cube_face_index", 1, tfloat32, 3, tfloat32, """
+dst.x = 0.0;
float absX = fabsf(src0.x);
float absY = fabsf(src0.y);
float absZ = fabsf(src0.z);
diff --git a/lib/mesa/src/compiler/nir/nir_opt_algebraic.py b/lib/mesa/src/compiler/nir/nir_opt_algebraic.py
index fd808550e..dd1d7ce71 100644
--- a/lib/mesa/src/compiler/nir/nir_opt_algebraic.py
+++ b/lib/mesa/src/compiler/nir/nir_opt_algebraic.py
@@ -114,9 +114,9 @@ optimizations = [
(('idiv', a, '#b(is_neg_power_of_two)'), ('ineg', ('imul', ('isign', a), ('ushr', ('iabs', a), ('find_lsb', ('iabs', b))))), '!options->lower_bitops'),
(('umod', a, '#b(is_pos_power_of_two)'), ('iand', a, ('isub', b, 1))),
(('imod', a, '#b(is_pos_power_of_two)'), ('iand', a, ('isub', b, 1))),
- (('imod', a, '#b(is_neg_power_of_two)'), ('ior', a, b)),
- (('irem', a, '#b(is_pos_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('isub', b, 1)), ('ior', a, ('ineg', b)))),
- (('irem', a, '#b(is_neg_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('inot', b)), ('ior', a, b))),
+ (('imod', a, '#b(is_neg_power_of_two)'), ('bcsel', ('ieq', ('ior', a, b), b), 0, ('ior', a, b))),
+ (('irem', a, '#b(is_pos_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('isub', b, 1)), ('imod', a, ('ineg', b)))),
+ (('irem', a, '#b(is_neg_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('inot', b)), ('imod', a, b))),
(('~fneg', ('fneg', a)), a),
(('ineg', ('ineg', a)), a),
diff --git a/lib/mesa/src/compiler/nir/nir_opt_gcm.c b/lib/mesa/src/compiler/nir/nir_opt_gcm.c
index 7317ded09..4fa5bdfc5 100644
--- a/lib/mesa/src/compiler/nir/nir_opt_gcm.c
+++ b/lib/mesa/src/compiler/nir/nir_opt_gcm.c
@@ -604,6 +604,11 @@ opt_gcm_impl(nir_function_impl *impl, bool value_number)
nir_metadata_require(impl, nir_metadata_block_index |
nir_metadata_dominance);
+ /* A previous pass may have left pass_flags dirty, so clear it all out. */
+ nir_foreach_block(block, impl)
+ nir_foreach_instr(instr, block)
+ instr->pass_flags = 0;
+
struct gcm_state state;
state.impl = impl;