Skip to content

nir: Add lowering of round for r300, fix repeated integer-ization in gallium nine -> NIR -> TGSI

Emma Anholt requested to merge anholt/mesa:r300-lower-round into main

The chain of gallium nine -> ttn -> ntt turned an innocent DX9 array indexing using a floored array index into this mess:

  0: MUL TEMP[0].x, CONST[0][224].xxxx, IN[0].zzzz
  1: FLR TEMP[0].x, TEMP[0].xxxx
  2: ROUND TEMP[0].x, TEMP[0].xxxx
  3: TRUNC TEMP[0].x, TEMP[0].xxxx
  4: ARL ADDR[0].x, TEMP[0].xxxx

This series should, I hope, turn it into just:

  0: MUL TEMP[0].x, CONST[0][224].xxxx, IN[0].zzzz
  1: FLR TEMP[0].x, TEMP[0].xxxx
  2: ARL ADDR[0].x, TEMP[0].xxxx

plus lowering of round if necessary in case the optimization fails. Ideally we'd also drop the FLR, since ARL also floors, but I couldn't quite be bothered right now (it makes me want to rework address reg loading, again, and ughhhhh).

Note: regression tested on some other drivers, but I don't actually have gallium nine set up on r300.

Edited by Emma Anholt

Merge request reports