gallium: Add UMOD TGSI opcode.
authorMichal Krol <michal@vmware.com>
Sat, 2 Jan 2010 10:00:40 +0000 (11:00 +0100)
committerMichal Krol <michal@vmware.com>
Tue, 5 Jan 2010 08:28:27 +0000 (09:28 +0100)
Either that or have UDIV have two destination operands.

src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
src/gallium/include/pipe/p_shader_tokens.h

index 0a27648..4d56cac 100644 (file)
@@ -2090,6 +2090,16 @@ micro_umin(union tgsi_exec_channel *dst,
 }
 
 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
 micro_umul(union tgsi_exec_channel *dst,
            const union tgsi_exec_channel *src)
 {
@@ -3491,6 +3501,10 @@ exec_instruction(
       exec_vector_binary(mach, inst, micro_umin);
       break;
 
+   case TGSI_OPCODE_UMOD:
+      exec_vector_binary(mach, inst, micro_umod);
+      break;
+
    case TGSI_OPCODE_UMUL:
       exec_vector_binary(mach, inst, micro_umul);
       break;
index 8e06356..de0e09c 100644 (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, 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, "UMOD", TGSI_OPCODE_UMOD },
    { 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, "USGE", TGSI_OPCODE_USGE },
index a35186c..e4af15c 100644 (file)
@@ -160,6 +160,7 @@ OP12(UDIV)
 OP13(UMAD)
 OP12(UMAX)
 OP12(UMIN)
+OP12(UMOD)
 OP12(UMUL)
 OP12(USEQ)
 OP12(USGE)
index f8d4a45..550e2ab 100644 (file)
@@ -308,17 +308,18 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_UMAD                131
 #define TGSI_OPCODE_UMAX                132
 #define TGSI_OPCODE_UMIN                133
-#define TGSI_OPCODE_UMUL                134
-#define TGSI_OPCODE_USEQ                135
-#define TGSI_OPCODE_USGE                136
-#define TGSI_OPCODE_USHR                137
-#define TGSI_OPCODE_USLT                138
-#define TGSI_OPCODE_USNE                139
-#define TGSI_OPCODE_SWITCH              140
-#define TGSI_OPCODE_CASE                141
-#define TGSI_OPCODE_DEFAULT             142
-#define TGSI_OPCODE_ENDSWITCH           143
-#define TGSI_OPCODE_LAST                144
+#define TGSI_OPCODE_UMOD                134
+#define TGSI_OPCODE_UMUL                135
+#define TGSI_OPCODE_USEQ                136
+#define TGSI_OPCODE_USGE                137
+#define TGSI_OPCODE_USHR                138
+#define TGSI_OPCODE_USLT                139
+#define TGSI_OPCODE_USNE                140
+#define TGSI_OPCODE_SWITCH              141
+#define TGSI_OPCODE_CASE                142
+#define TGSI_OPCODE_DEFAULT             143
+#define TGSI_OPCODE_ENDSWITCH           144
+#define TGSI_OPCODE_LAST                145
 
 #define TGSI_SAT_NONE            0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */