gallivm: Fix indirect immediate registers.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Jul 2013 19:54:19 +0000 (20:54 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 2 Jul 2013 05:30:06 +0000 (06:30 +0100)
If reg->Register.Indirect is true then the immediate is not truly a
constant LLVM expression.

There is no performance regression in using LLVMBuildBitCast, as it will
fallback to LLVMConstBitCast internally when the argument is a constant.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c

index 0bbc408bd467bc9f3f63103caa2116e2696179d7..f64185910369c0de500341dd84ae6d4a22ed0482 100644 (file)
@@ -1026,9 +1026,9 @@ emit_fetch_immediate(
    }
 
    if (stype == TGSI_TYPE_UNSIGNED) {
-      res = LLVMConstBitCast(res, bld_base->uint_bld.vec_type);
+      res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
    } else if (stype == TGSI_TYPE_SIGNED) {
-      res = LLVMConstBitCast(res, bld_base->int_bld.vec_type);
+      res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
    }
    return res;
 }