nouveau: codegen: LOAD: Do not call fetchSrc(1) if the address is immediate
authorHans de Goede <hdegoede@redhat.com>
Thu, 21 Apr 2016 11:51:14 +0000 (13:51 +0200)
committerHans de Goede <hdegoede@redhat.com>
Wed, 27 Apr 2016 14:11:48 +0000 (16:11 +0200)
"off" later gets set to NULL when the address is immediate, so move the
fetchSrc(1) call to the non-immediate branch of the if-else. This brings
handleLOAD's offset handling inline with how it is done in handleSTORE.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp

index cdf9d9413e6cbf0471973cbe8167558f04933da8..9b9f257b28006c5ad80a4a38f75f7563674b932d 100644 (file)
@@ -2383,14 +2383,15 @@ Converter::handleLOAD(Value *dst0[4])
          if (!dst0[c])
             continue;
 
-         // yzw are ignored for buffers
-         Value *off = fetchSrc(1, 0);
+         Value *off;
          Symbol *sym;
          if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {
             off = NULL;
             sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
                           tgsi.getSrc(1).getValueU32(0, info) + 4 * c);
          } else {
+            // yzw are ignored for buffers
+            off = fetchSrc(1, 0);
             sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);
          }