From: Roland Scheidegger <srol...@vmware.com> Need to take the type into account. Also, if we want to allow mov's with modifiers we need to pick a type (assume float). --- src/gallium/auxiliary/gallivm/lp_bld_tgsi.c | 54 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c index 53c81bd..00a493a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c @@ -310,11 +310,61 @@ lp_build_emit_fetch( } if (reg->Register.Absolute) { - res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res); + switch (stype) { + case TGSI_TYPE_FLOAT: + case TGSI_TYPE_DOUBLE: + case TGSI_TYPE_UNTYPED: + /* + * modifiers on movs assume data is float + */ + res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res); + break; + case TGSI_TYPE_UNSIGNED: + case TGSI_TYPE_SIGNED: + /* + * XXX note we cannot effectively distinguish between signed and unsigned, + * since some opcodes (like uadd) are used for both signed and unsigned + * source operands. Hence this always assumes signed numbers. + * (May revisit this by using signed type for such opcodes?) + */ + res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_IABS, res); + break; + case TGSI_TYPE_VOID: + default: + /* dunno how that should work if legal just ignore? */ + assert(0); + break; + } } if (reg->Register.Negate) { - res = lp_build_negate( &bld_base->base, res ); + switch (stype) { + case TGSI_TYPE_FLOAT: + case TGSI_TYPE_UNTYPED: + /* + * modifiers on movs assume data is float + */ + res = lp_build_negate( &bld_base->base, res ); + break; + case TGSI_TYPE_DOUBLE: + /* no double build context */ + assert(0); + break; + case TGSI_TYPE_UNSIGNED: + case TGSI_TYPE_SIGNED: + /* + * like above, cannot distinguish signed and unsigned. + * However, in any case it looks like we probably should return + * two's complement in any case. + */ + res = lp_build_negate( &bld_base->int_bld, res ); + break; + case TGSI_TYPE_VOID: + default: + /* dunno how that should work if legal just ignore? */ + assert(0); + break; + } } /* -- 1.7.9.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev