summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Olivera <igor.oliveira@openbossa.org>2010-01-18 13:56:58 -0400
committerIgor Oliveira <igor.oliveira@openbossa.org>2010-09-29 23:07:25 -0400
commit8f94e5f9d7e67aff0cd8eb0085359ae480a80d5b (patch)
treea825b3624eae5ef7938248dd6b7b8038794a0691
parent6386f88499cae2435a4f753c960869f3301011b6 (diff)
tgsi: implement double opcodes
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c127
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c11
2 files changed, 137 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 18ee6e43e4..55e0a90266 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -216,6 +216,96 @@ micro_dmov(union tgsi_double_channel *dst,
}
static void
+micro_ddiv(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] / src[1].d[0];
+ dst->d[1] = src[0].d[1] / src[1].d[1];
+ dst->d[2] = src[0].d[2] / src[1].d[2];
+ dst->d[3] = src[0].d[3] / src[1].d[3];
+}
+
+static void
+micro_dmul(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] * src[1].d[0];
+ dst->d[1] = src[0].d[1] * src[1].d[1];
+ dst->d[2] = src[0].d[2] * src[1].d[2];
+ dst->d[3] = src[0].d[3] * src[1].d[3];
+}
+
+static void
+micro_dmax(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] > src[1].d[0] ? src[0].d[0] : src[1].d[0];
+ dst->d[1] = src[0].d[1] > src[1].d[1] ? src[0].d[1] : src[1].d[1];
+ dst->d[2] = src[0].d[2] > src[1].d[2] ? src[0].d[2] : src[1].d[2];
+ dst->d[3] = src[0].d[3] > src[1].d[3] ? src[0].d[3] : src[1].d[3];
+}
+
+static void
+micro_dmin(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] < src[1].d[0] ? src[0].d[0] : src[1].d[0];
+ dst->d[1] = src[0].d[1] < src[1].d[1] ? src[0].d[1] : src[1].d[1];
+ dst->d[2] = src[0].d[2] < src[1].d[2] ? src[0].d[2] : src[1].d[2];
+ dst->d[3] = src[0].d[3] < src[1].d[3] ? src[0].d[3] : src[1].d[3];
+}
+
+static void
+micro_dslt(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] < src[1].d[0] ? 1.0 : 0.0;
+ dst->d[1] = src[0].d[1] < src[1].d[1] ? 1.0 : 0.0;
+ dst->d[2] = src[0].d[2] < src[1].d[2] ? 1.0 : 0.0;
+ dst->d[3] = src[0].d[3] < src[1].d[3] ? 1.0 : 0.0;
+}
+
+static void
+micro_dsge(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] >= src[1].d[0] ? 1.0 : 0.0;
+ dst->d[1] = src[0].d[1] >= src[1].d[1] ? 1.0 : 0.0;
+ dst->d[2] = src[0].d[2] >= src[1].d[2] ? 1.0 : 0.0;
+ dst->d[3] = src[0].d[3] >= src[1].d[3] ? 1.0 : 0.0;
+}
+
+static void
+micro_dseq(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = src[0].d[0] == src[1].d[0] ? 1.0 : 0.0;
+ dst->d[1] = src[0].d[1] == src[1].d[1] ? 1.0 : 0.0;
+ dst->d[2] = src[0].d[2] == src[1].d[2] ? 1.0 : 0.0;
+ dst->d[3] = src[0].d[3] == src[1].d[3] ? 1.0 : 0.0;
+}
+
+static void
+micro_drcp(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = 1.0 / src->d[0];
+ dst->d[1] = 1.0 / src->d[1];
+ dst->d[2] = 1.0 / src->d[2];
+ dst->d[3] = 1.0 / src->d[3];
+}
+
+static void
+micro_dsqrt(union tgsi_double_channel *dst,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = sqrt(src->d[0]);
+ dst->d[1] = sqrt(src->d[1]);
+ dst->d[2] = sqrt(src->d[2]);
+ dst->d[3] = sqrt(src->d[3]);
+}
+
+static void
micro_exp2(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
@@ -3834,7 +3924,44 @@ exec_instruction(
exec_double_binary(mach, inst, micro_dadd);
break;
+ case TGSI_OPCODE_DDIV:
+ exec_double_binary(mach, inst, micro_ddiv);
+ break;
+
+ case TGSI_OPCODE_DMUL:
+ exec_double_binary(mach, inst, micro_dmul);
+ break;
+
+ case TGSI_OPCODE_DMAX:
+ exec_double_binary(mach, inst, micro_dmax);
+ break;
+
+ case TGSI_OPCODE_DMIN:
+ exec_double_binary(mach, inst, micro_dmin);
+ break;
+
+ case TGSI_OPCODE_DSLT:
+ exec_double_binary(mach, inst, micro_dslt);
+ break;
+
+ case TGSI_OPCODE_DSGE:
+ exec_double_binary(mach, inst, micro_dsge);
+ break;
+
+ case TGSI_OPCODE_DSEQ:
+ exec_double_binary(mach, inst, micro_dseq);
+ break;
+
+ case TGSI_OPCODE_DRCP:
+ exec_double_unary(mach, inst, micro_drcp);
+ break;
+
+ case TGSI_OPCODE_DSQRT:
+ exec_double_unary(mach, inst, micro_dsqrt);
+ break;
+
default:
+ printf("%d", inst->Instruction.Opcode);
assert( 0 );
}
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 8c2ef955a4..e4a7ea323f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -179,7 +179,16 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, 0, 0, "F2D", TGSI_OPCODE_F2D },
{ 1, 1, 0, 0, 0, 0, "D2F", TGSI_OPCODE_D2F },
{ 1, 1, 0, 0, 0, 0, "DMOV", TGSI_OPCODE_DMOV },
- { 1, 2, 0, 0, 0, 0, "DADD", TGSI_OPCODE_DADD }
+ { 1, 2, 0, 0, 0, 0, "DADD", TGSI_OPCODE_DADD },
+ { 1, 2, 0, 0, 0, 0, "DDIV", TGSI_OPCODE_DDIV },
+ { 1, 2, 0, 0, 0, 0, "DMUL", TGSI_OPCODE_DMUL },
+ { 1, 2, 0, 0, 0, 0, "DMAX", TGSI_OPCODE_DMAX },
+ { 1, 2, 0, 0, 0, 0, "DMIN", TGSI_OPCODE_DMIN },
+ { 1, 2, 0, 0, 0, 0, "DSLT", TGSI_OPCODE_DSLT },
+ { 1, 2, 0, 0, 0, 0, "DSGE", TGSI_OPCODE_DSGE },
+ { 1, 2, 0, 0, 0, 0, "DSEQ", TGSI_OPCODE_DSEQ },
+ { 1, 1, 0, 0, 0, 0, "DRCP", TGSI_OPCODE_DRCP },
+ { 1, 1, 0, 0 ,0, 0, "DSQRT", TGSI_OPCODE_DSQRT }
};
const struct tgsi_opcode_info *