Mesa (master): r600g: fix the representation of control-flow instructions

Marek Olšák mareko at kemper.freedesktop.org
Tue Nov 15 00:18:33 UTC 2011


Module: Mesa
Branch: master
Commit: 4f7c21899ad449be2bc1157ce1d2d99296a34499
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f7c21899ad449be2bc1157ce1d2d99296a34499

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon Nov 14 16:53:54 2011 +0100

r600g: fix the representation of control-flow instructions

We need something that looks like a compiler and not like some hacker
put some functions together. /rant

This is a band-aid for these two problems:
- The R600 and EG control-flow instructions appear in switch statements
  next to each other, causing conflicts when adding new instructions.
- The ALU control-flow instructions are bitshifted by 3 (from CF_INST 26:29
  to CF_INST 23:29, as is defined by r600 ISA) even for EG, where CF_INST
  is 22:29.

To fix this mess, the 'inst' field is bitshifted to the left either by 22, 23,
or 26 (directly in the definitions), such that it can be just or'd when making
bytecode without any shifting. All switch statements have been divided into
two, one for R600 and the other for EG.

Of course, there is a better way to do this, but that is left for future
work.

Tested on RV730 and REDWOOD with no regressions.

v2: minor cleanup as per Alex's comment.

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

---

 src/gallium/drivers/r600/eg_asm.c       |   18 +-
 src/gallium/drivers/r600/eg_sq.h        |    8 -
 src/gallium/drivers/r600/r600_asm.c     |  577 ++++++++++++++++++++-----------
 src/gallium/drivers/r600/r600_asm.h     |    6 +
 src/gallium/drivers/r600/r600_opcodes.h |  264 ++++++++-------
 src/gallium/drivers/r600/r600_shader.c  |   12 +-
 src/gallium/drivers/r600/r600d.h        |   34 --
 src/gallium/drivers/r600/r700_asm.c     |    2 +-
 src/gallium/drivers/r600/r700_sq.h      |   41 ---
 9 files changed, 536 insertions(+), 426 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=4f7c21899ad449be2bc1157ce1d2d99296a34499



More information about the mesa-commit mailing list