Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | nir: Fix nir_opt_idiv_const when negatives are involved | Caio Marcelo de Oliveira Filho | 2019-05-16 | 1 | -3/+5 |
| | | | | | | | | | | | | | | | | | 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: 74492ebad94 "nir: Add a pass for lowering integer division by constants" Reviewed-by: Jason Ekstrand <[email protected]> | ||||
* | nir: make nir_const_value scalar | Karol Herbst | 2019-04-14 | 1 | -4/+4 |
| | | | | | | | | | v2: remove & operator in a couple of memsets add some memsets v3: fixup lima Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (v2) | ||||
* | nir: Add a pass for lowering integer division by constants | Jason Ekstrand | 2018-12-13 | 1 | -0/+215 |
It's a reasonably well-known fact in the world of compilers that integer divisions by constants can be replaced by a multiply, an add, and some shifts. This commit adds such an optimization to NIR for easiest case of udiv. Other division operations will be added in following commits. In order to provide some additional driver control, the pass takes a minimum bit size to optimize. Reviewed-by: Ian Romanick [email protected] |