Mesa (gallium-double-opcodes): tgsi: Implement DABS and DNEG, remove DMOV.

Michał Król michal at kemper.freedesktop.org
Tue Jan 19 13:14:07 UTC 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Tue Jan 19 14:02:29 2010 +0100

tgsi: Implement DABS and DNEG, remove DMOV.

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c |   38 +++++++++++++++++++++----------
 src/gallium/auxiliary/tgsi/tgsi_info.c |    3 +-
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 2438ce6..f8a4468 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -140,6 +140,16 @@ micro_d2f(union tgsi_exec_channel *dst,
 }
 
 static void
+micro_dabs(union tgsi_double_channel *dst,
+           const union tgsi_double_channel *src)
+{
+   dst->d[0] = src->d[0] >= 0.0 ? src->d[0] : -src->d[0];
+   dst->d[1] = src->d[1] >= 0.0 ? src->d[1] : -src->d[1];
+   dst->d[2] = src->d[2] >= 0.0 ? src->d[2] : -src->d[2];
+   dst->d[3] = src->d[3] >= 0.0 ? src->d[3] : -src->d[3];
+}
+
+static void
 micro_dadd(union tgsi_double_channel *dst,
           const union tgsi_double_channel *src)
 {
@@ -170,16 +180,6 @@ micro_ddy(union tgsi_exec_channel *dst,
 }
 
 static void
-micro_dmov(union tgsi_double_channel *dst,
-          const union tgsi_double_channel *src)
-{
-   dst->d[0] = src->d[0];
-   dst->d[1] = src->d[1];
-   dst->d[2] = src->d[2];
-   dst->d[3] = src->d[3];
-}
-
-static void
 micro_ddiv(union tgsi_double_channel *dst,
            const union tgsi_double_channel *src)
 {
@@ -220,6 +220,16 @@ micro_dmin(union tgsi_double_channel *dst,
 }
 
 static void
+micro_dneg(union tgsi_double_channel *dst,
+           const union tgsi_double_channel *src)
+{
+   dst->d[0] = -src->d[0];
+   dst->d[1] = -src->d[1];
+   dst->d[2] = -src->d[2];
+   dst->d[3] = -src->d[3];
+}
+
+static void
 micro_dslt(union tgsi_double_channel *dst,
            const union tgsi_double_channel *src)
 {
@@ -3845,8 +3855,12 @@ exec_instruction(
       exec_d2f(mach, inst);
       break;
 
-   case TGSI_OPCODE_DMOV:
-      exec_double_unary(mach, inst, micro_dmov);
+   case TGSI_OPCODE_DABS:
+      exec_double_unary(mach, inst, micro_dabs);
+      break;
+
+   case TGSI_OPCODE_DNEG:
+      exec_double_unary(mach, inst, micro_dneg);
       break;
 
    case TGSI_OPCODE_DADD:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 6403e61..b2339e7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -178,7 +178,8 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 0, 0, 0, 0, 0, 0, "ENDSWITCH", TGSI_OPCODE_ENDSWITCH },
    { 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, 1, 0, 0, 0, 0, "DABS", TGSI_OPCODE_DABS },
+   { 1, 1, 0, 0, 0, 0, "DNEG", TGSI_OPCODE_DNEG },
    { 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 },




More information about the mesa-commit mailing list