mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 00:30:13 +01:00
nir/algebraic: mark float optimizations returning one parameter as inexact
With the arrival of VK_KHR_shader_float_controls algebraic
optimizations for float types of the form (('fop', a, b), a) become
inexact depending on the execution mode.
For example, if we have activated SHADER_DENORM_FLUSH_TO_ZERO, in case
of a denorm value for the "a" parameter, we cannot return it still as
a denorm, it needs to be flushed to zero. Therefore, we mark now all
those operations as inexact.
Suggested-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
parent
5e22f3e29a
commit
3f782cdd25
1 changed files with 8 additions and 8 deletions
|
|
@ -100,7 +100,7 @@ optimizations = [
|
|||
(('idiv', a, '#b@32(is_neg_power_of_two)'), ('ineg', ('imul', ('isign', a), ('ushr', ('iabs', a), ('find_lsb', ('iabs', b))))), 'options->lower_idiv'),
|
||||
(('umod', a, '#b(is_pos_power_of_two)'), ('iand', a, ('isub', b, 1))),
|
||||
|
||||
(('fneg', ('fneg', a)), a),
|
||||
(('~fneg', ('fneg', a)), a),
|
||||
(('ineg', ('ineg', a)), a),
|
||||
(('fabs', ('fabs', a)), ('fabs', a)),
|
||||
(('fabs', ('fneg', a)), ('fabs', a)),
|
||||
|
|
@ -126,7 +126,7 @@ optimizations = [
|
|||
(('imul', a, 0), 0),
|
||||
(('umul_unorm_4x8', a, 0), 0),
|
||||
(('umul_unorm_4x8', a, ~0), a),
|
||||
(('fmul', a, 1.0), a),
|
||||
(('~fmul', a, 1.0), a),
|
||||
(('imul', a, 1), a),
|
||||
(('fmul', a, -1.0), ('fneg', a)),
|
||||
(('imul', a, -1), ('ineg', a)),
|
||||
|
|
@ -383,7 +383,7 @@ optimizations.extend([
|
|||
(('feq', ('fmin', ('fneg', ('b2f', 'a@1')), 'b@1'), 0.0), ('iand', ('inot', a), ('fge', b, 0.0))),
|
||||
|
||||
(('feq', ('b2f', 'a@1'), 0.0), ('inot', a)),
|
||||
(('fne', ('b2f', 'a@1'), 0.0), a),
|
||||
(('~fne', ('b2f', 'a@1'), 0.0), a),
|
||||
(('ieq', ('b2i', 'a@1'), 0), ('inot', a)),
|
||||
(('ine', ('b2i', 'a@1'), 0), a),
|
||||
|
||||
|
|
@ -462,8 +462,8 @@ optimizations.extend([
|
|||
(('bcsel', a, a, b), ('ior', a, b)),
|
||||
(('bcsel', a, b, False), ('iand', a, b)),
|
||||
(('bcsel', a, b, a), ('iand', a, b)),
|
||||
(('fmin', a, a), a),
|
||||
(('fmax', a, a), a),
|
||||
(('~fmin', a, a), a),
|
||||
(('~fmax', a, a), a),
|
||||
(('imin', a, a), a),
|
||||
(('imax', a, a), a),
|
||||
(('umin', a, a), a),
|
||||
|
|
@ -480,9 +480,9 @@ optimizations.extend([
|
|||
(('imin', a, ('ineg', a)), ('ineg', ('iabs', a))),
|
||||
(('fmin', a, ('fneg', ('fabs', a))), ('fneg', ('fabs', a))),
|
||||
(('imin', a, ('ineg', ('iabs', a))), ('ineg', ('iabs', a))),
|
||||
(('fmin', a, ('fabs', a)), a),
|
||||
(('~fmin', a, ('fabs', a)), a),
|
||||
(('imin', a, ('iabs', a)), a),
|
||||
(('fmax', a, ('fneg', ('fabs', a))), a),
|
||||
(('~fmax', a, ('fneg', ('fabs', a))), a),
|
||||
(('imax', a, ('ineg', ('iabs', a))), a),
|
||||
(('fmax', a, ('fabs', a)), ('fabs', a)),
|
||||
(('imax', a, ('iabs', a)), ('iabs', a)),
|
||||
|
|
@ -768,7 +768,7 @@ optimizations.extend([
|
|||
(('bcsel', a, ('b2f(is_used_once)', 'b@32'), ('b2f', 'c@32')), ('b2f', ('bcsel', a, b, c))),
|
||||
|
||||
(('bcsel', a, b, b), b),
|
||||
(('fcsel', a, b, b), b),
|
||||
(('~fcsel', a, b, b), b),
|
||||
|
||||
# D3D Boolean emulation
|
||||
(('bcsel', a, -1, 0), ('ineg', ('b2i', 'a@1'))),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue