• Caio Marcelo de Oliveira Filho's avatar
    nir: Fix nir_opt_idiv_const when negatives are involved · 8a995f2b
    Caio Marcelo de Oliveira Filho authored
    First, allow the case for negative powers of two.  Then ensure that we
    use the absolute value of the non-constant value to calculate the
    quotient -- this was hinted in the code by the name 'uq'.
    
    This fixes an issue when 'd' is positive and 'n' is negative.  The
    ishr will propagate the negative sign and we'll use nir_ineg() again,
    incorrectly.
    
    v2: First version used only ishr, but that isn't sufficient, since it
        never can produce a zero as a result.  (Jason)
        Allow negative powers of two.  (Caio)
    
    Fixes: 74492eba "nir: Add a pass for lowering integer division by constants"
    Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
    8a995f2b
Name
Last commit
Last update
.gitlab-ci Loading commit data...
bin Loading commit data...
build-support Loading commit data...
docs Loading commit data...
doxygen Loading commit data...
include Loading commit data...
scons Loading commit data...
scripts Loading commit data...
src Loading commit data...
.dir-locals.el Loading commit data...
.editorconfig Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
Android.common.mk Loading commit data...
Android.mk Loading commit data...
CleanSpec.mk Loading commit data...
README.rst Loading commit data...
REVIEWERS Loading commit data...
SConstruct Loading commit data...
VERSION Loading commit data...
appveyor.yml Loading commit data...
common.py Loading commit data...
meson.build Loading commit data...
meson_options.txt Loading commit data...