gallium: Add UMOD TGSI opcode.

Either that or have UDIV have two destination operands.
This commit is contained in:
Michal Krol
2010-01-02 11:00:40 +01:00
parent 062aab96e0
commit c34f6faf35
4 changed files with 28 additions and 11 deletions

View File

@@ -2089,6 +2089,16 @@ micro_umin(union tgsi_exec_channel *dst,
dst->u[3] = src[0].u[3] < src[1].u[3] ? src[0].u[3] : src[1].u[3]; dst->u[3] = src[0].u[3] < src[1].u[3] ? src[0].u[3] : src[1].u[3];
} }
static void
micro_umod(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
dst->u[0] = src[0].u[0] % src[1].u[0];
dst->u[1] = src[0].u[1] % src[1].u[1];
dst->u[2] = src[0].u[2] % src[1].u[2];
dst->u[3] = src[0].u[3] % src[1].u[3];
}
static void static void
micro_umul(union tgsi_exec_channel *dst, micro_umul(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src) const union tgsi_exec_channel *src)
@@ -3491,6 +3501,10 @@ exec_instruction(
exec_vector_binary(mach, inst, micro_umin); exec_vector_binary(mach, inst, micro_umin);
break; break;
case TGSI_OPCODE_UMOD:
exec_vector_binary(mach, inst, micro_umod);
break;
case TGSI_OPCODE_UMUL: case TGSI_OPCODE_UMUL:
exec_vector_binary(mach, inst, micro_umul); exec_vector_binary(mach, inst, micro_umul);
break; break;

View File

@@ -165,6 +165,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 3, 0, 0, 0, 0, "UMAD", TGSI_OPCODE_UMAD }, { 1, 3, 0, 0, 0, 0, "UMAD", TGSI_OPCODE_UMAD },
{ 1, 2, 0, 0, 0, 0, "UMAX", TGSI_OPCODE_UMAX }, { 1, 2, 0, 0, 0, 0, "UMAX", TGSI_OPCODE_UMAX },
{ 1, 2, 0, 0, 0, 0, "UMIN", TGSI_OPCODE_UMIN }, { 1, 2, 0, 0, 0, 0, "UMIN", TGSI_OPCODE_UMIN },
{ 1, 2, 0, 0, 0, 0, "UMOD", TGSI_OPCODE_UMOD },
{ 1, 2, 0, 0, 0, 0, "UMUL", TGSI_OPCODE_UMUL }, { 1, 2, 0, 0, 0, 0, "UMUL", TGSI_OPCODE_UMUL },
{ 1, 2, 0, 0, 0, 0, "USEQ", TGSI_OPCODE_USEQ }, { 1, 2, 0, 0, 0, 0, "USEQ", TGSI_OPCODE_USEQ },
{ 1, 2, 0, 0, 0, 0, "USGE", TGSI_OPCODE_USGE }, { 1, 2, 0, 0, 0, 0, "USGE", TGSI_OPCODE_USGE },

View File

@@ -160,6 +160,7 @@ OP12(UDIV)
OP13(UMAD) OP13(UMAD)
OP12(UMAX) OP12(UMAX)
OP12(UMIN) OP12(UMIN)
OP12(UMOD)
OP12(UMUL) OP12(UMUL)
OP12(USEQ) OP12(USEQ)
OP12(USGE) OP12(USGE)

View File

@@ -308,17 +308,18 @@ struct tgsi_property_data {
#define TGSI_OPCODE_UMAD 131 #define TGSI_OPCODE_UMAD 131
#define TGSI_OPCODE_UMAX 132 #define TGSI_OPCODE_UMAX 132
#define TGSI_OPCODE_UMIN 133 #define TGSI_OPCODE_UMIN 133
#define TGSI_OPCODE_UMUL 134 #define TGSI_OPCODE_UMOD 134
#define TGSI_OPCODE_USEQ 135 #define TGSI_OPCODE_UMUL 135
#define TGSI_OPCODE_USGE 136 #define TGSI_OPCODE_USEQ 136
#define TGSI_OPCODE_USHR 137 #define TGSI_OPCODE_USGE 137
#define TGSI_OPCODE_USLT 138 #define TGSI_OPCODE_USHR 138
#define TGSI_OPCODE_USNE 139 #define TGSI_OPCODE_USLT 139
#define TGSI_OPCODE_SWITCH 140 #define TGSI_OPCODE_USNE 140
#define TGSI_OPCODE_CASE 141 #define TGSI_OPCODE_SWITCH 141
#define TGSI_OPCODE_DEFAULT 142 #define TGSI_OPCODE_CASE 142
#define TGSI_OPCODE_ENDSWITCH 143 #define TGSI_OPCODE_DEFAULT 143
#define TGSI_OPCODE_LAST 144 #define TGSI_OPCODE_ENDSWITCH 144
#define TGSI_OPCODE_LAST 145
#define TGSI_SAT_NONE 0 /* do not saturate */ #define TGSI_SAT_NONE 0 /* do not saturate */
#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */ #define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */