mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-04 17:10:26 +01:00
nir/algebraic: fix imod by negative power-of-two
If "a" is a multiple of "b", then the result would have been "b" instead of 0. No fossil-db changes. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Fixes:0ef5f3552f("nir: add strength reduction pattern for imod/irem with pow2 divisor.") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12039> (cherry picked from commitec4b425f59)
This commit is contained in:
parent
c63674ee71
commit
8446f10145
2 changed files with 4 additions and 4 deletions
|
|
@ -355,7 +355,7 @@
|
|||
"description": "nir/algebraic: fix imod by negative power-of-two",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "0ef5f3552f68076747211ec81f687b37a5540d8e"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue