Mesa (gallium-double-opcodes): tgsi: implement DFRAC and DLDEXP opcodes

Michał Król michal at kemper.freedesktop.org
Wed Jan 20 12:24:08 UTC 2010


Module: Mesa
Branch: gallium-double-opcodes
Commit: 991b1d0ce000908cef3403c954a0a4c34adced09
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=991b1d0ce000908cef3403c954a0a4c34adced09

Author: Igor Oliveira <igor.oliveira at openbossa.org>
Date:   Tue Jan 19 17:02:34 2010 -0400

tgsi: implement DFRAC and DLDEXP opcodes

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c |   28 ++++++++++++++++++++++++++++
 src/gallium/auxiliary/tgsi/tgsi_info.c |    4 +++-
 2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index f8a4468..efb9ea1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -290,6 +290,26 @@ micro_dmad(union tgsi_double_channel *dst,
 }
 
 static void
+micro_dfrac(union tgsi_double_channel *dst,
+            const union tgsi_double_channel *src)
+{
+   dst->d[0] = src->d[0] - floor(src->d[0]);
+   dst->d[1] = src->d[1] - floor(src->d[1]);
+   dst->d[2] = src->d[2] - floor(src->d[2]);
+   dst->d[3] = src->d[3] - floor(src->d[3]);
+}
+
+static void
+micro_dldexp(union tgsi_double_channel *dst,
+             const union tgsi_double_channel *src)
+{
+   dst->d[0] = ldexp(src[0].d[0], src[1].d[0]);
+   dst->d[1] = ldexp(src[0].d[1], src[1].d[1]);
+   dst->d[2] = ldexp(src[0].d[2], src[1].d[2]);
+   dst->d[3] = ldexp(src[0].d[3], src[1].d[3]);
+}
+
+static void
 micro_exp2(union tgsi_exec_channel *dst,
            const union tgsi_exec_channel *src)
 {
@@ -3907,6 +3927,14 @@ exec_instruction(
       exec_double_trinary(mach, inst, micro_dmad);
       break;
 
+   case TGSI_OPCODE_DFRAC:
+      exec_double_unary(mach, inst, micro_dfrac);
+      break;
+
+   case TGSI_OPCODE_DLDEXP:
+      exec_double_binary(mach, inst, micro_dldexp);
+      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 269ef73..8340b07 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -190,7 +190,9 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 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 },
-   { 1, 3, 0, 0 ,0, 0, "DMAD", TGSI_OPCODE_DMAD }
+   { 1, 3, 0, 0 ,0, 0, "DMAD", TGSI_OPCODE_DMAD },
+   { 1, 1, 0, 0, 0, 0, "DFRAC", TGSI_OPCODE_DFRAC},
+   { 1, 2, 0, 0, 0, 0, "DLDEXP", TGSI_OPCODE_DLDEXP}
 };
 
 const struct tgsi_opcode_info *




More information about the mesa-commit mailing list