From: Maxence Le Doré <Maxence Le Doré> --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index aa1b140..10bce5e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -350,6 +350,42 @@ micro_mov(union tgsi_exec_channel *dst, } static void +micro_imsb(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src) +{ + int i = 0, j = 0; + + for(i = 0; i < 4; i++) { + int x = src->i[i]; + int mask; + int res = -1; + if (x < 0) + x = ~x; + for(j = 0; j < 32; j++) { + mask = 0x80000000 >> j; + if (x & mask) { + res = 31 - j; + break; + } + } + dst->i[i] = res; + } +} + +static void +micro_umsb(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src) +{ + int i = 0; + for(i = 0 ; i < 4 ; i++) { + if(src->u[i] == 0) + dst->i[i] = -1; + else + dst->i[i] = util_last_bit(src->u[i]) - 1; /* see u_math.h */ + } +} + +static void micro_popcnt(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { @@ -4322,6 +4358,10 @@ exec_instruction( exec_vector_binary(mach, inst, micro_imin, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT); break; + case TGSI_OPCODE_IMSB: + exec_vector_unary(mach, inst, micro_imsb, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT); + break; + case TGSI_OPCODE_INEG: exec_vector_unary(mach, inst, micro_ineg, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT); break; @@ -4386,6 +4426,10 @@ exec_instruction( exec_vector_binary(mach, inst, micro_umul_hi, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT); break; + case TGSI_OPCODE_UMSB: + exec_vector_unary(mach, inst, micro_umsb, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_UINT); + break; + case TGSI_OPCODE_USEQ: exec_vector_binary(mach, inst, micro_useq, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT); break; -- 1.8.5.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev