program: Remove condition-code and precision support.
[mesa.git] / src / mesa / program / prog_execute.c
index 2ae5bc572af3ec08f402601408160f92b7ff9e12..d336c51ca20b3573b1214d814980e4a05c25c628 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.3
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /**
@@ -35,8 +35,8 @@
  */
 
 
+#include "c99_math.h"
 #include "main/glheader.h"
-#include "main/colormac.h"
 #include "main/macros.h"
 #include "prog_execute.h"
 #include "prog_instruction.h"
@@ -52,7 +52,6 @@
 /**
  * Set x to positive or negative infinity.
  */
-#if defined(USE_IEEE) || defined(_WIN32)
 #define SET_POS_INFINITY(x)                  \
    do {                                      \
          fi_type fi;                         \
          fi.i = 0xFF800000;                  \
          x = fi.f;                           \
    } while (0)
-#elif defined(VMS)
-#define SET_POS_INFINITY(x)  x = __MAXFLOAT
-#define SET_NEG_INFINITY(x)  x = -__MAXFLOAT
-#else
-#define SET_POS_INFINITY(x)  x = (GLfloat) HUGE_VAL
-#define SET_NEG_INFINITY(x)  x = (GLfloat) -HUGE_VAL
-#endif
 
 #define SET_FLOAT_BITS(x, bits) ((fi_type *) (void *) &(x))->i = bits
 
 static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
 
 
-
-/**
- * Return TRUE for +0 and other positive values, FALSE otherwise.
- * Used for RCC opcode.
- */
-static INLINE GLboolean
-positive(float x)
-{
-   fi_type fi;
-   fi.f = x;
-   if (fi.i & 0x80000000)
-      return GL_FALSE;
-   return GL_TRUE;
-}
-
-
-
 /**
  * Return a pointer to the 4-element float vector specified by the given
  * source register.
  */
-static INLINE const GLfloat *
+static inline const GLfloat *
 get_src_register_pointer(const struct prog_src_register *source,
                          const struct gl_program_machine *machine)
 {
@@ -128,7 +103,7 @@ get_src_register_pointer(const struct prog_src_register *source,
          return machine->VertAttribs[reg];
       }
       else {
-         if (reg >= FRAG_ATTRIB_MAX)
+         if (reg >= VARYING_SLOT_MAX)
             return ZeroVec;
          return machine->Attribs[reg][machine->CurElement];
       }
@@ -138,32 +113,24 @@ get_src_register_pointer(const struct prog_src_register *source,
          return ZeroVec;
       return machine->Outputs[reg];
 
-   case PROGRAM_LOCAL_PARAM:
-      if (reg >= MAX_PROGRAM_LOCAL_PARAMS)
-         return ZeroVec;
-      return machine->CurProgram->LocalParams[reg];
-
-   case PROGRAM_ENV_PARAM:
-      if (reg >= MAX_PROGRAM_ENV_PARAMS)
-         return ZeroVec;
-      return machine->EnvParams[reg];
-
    case PROGRAM_STATE_VAR:
       /* Fallthrough */
    case PROGRAM_CONSTANT:
       /* Fallthrough */
    case PROGRAM_UNIFORM:
-      /* Fallthrough */
-   case PROGRAM_NAMED_PARAM:
       if (reg >= (GLint) prog->Parameters->NumParameters)
          return ZeroVec;
-      return prog->Parameters->ParameterValues[reg];
+      return (GLfloat *) prog->Parameters->ParameterValues[reg];
+
+   case PROGRAM_SYSTEM_VALUE:
+      assert(reg < (GLint) ARRAY_SIZE(machine->SystemValues));
+      return machine->SystemValues[reg];
 
    default:
       _mesa_problem(NULL,
          "Invalid src register file %d in get_src_register_pointer()",
          source->File);
-      return NULL;
+      return ZeroVec;
    }
 }
 
@@ -172,7 +139,7 @@ get_src_register_pointer(const struct prog_src_register *source,
  * Return a pointer to the 4-element float vector specified by the given
  * destination register.
  */
-static INLINE GLfloat *
+static inline GLfloat *
 get_dst_register_pointer(const struct prog_dst_register *dest,
                          struct gl_program_machine *machine)
 {
@@ -198,14 +165,11 @@ get_dst_register_pointer(const struct prog_dst_register *dest,
          return dummyReg;
       return machine->Outputs[reg];
 
-   case PROGRAM_WRITE_ONLY:
-      return dummyReg;
-
    default:
       _mesa_problem(NULL,
          "Invalid dest register file %d in get_dst_register_pointer()",
          dest->File);
-      return NULL;
+      return dummyReg;
    }
 }
 
@@ -220,17 +184,16 @@ fetch_vector4(const struct prog_src_register *source,
               const struct gl_program_machine *machine, GLfloat result[4])
 {
    const GLfloat *src = get_src_register_pointer(source, machine);
-   ASSERT(src);
 
    if (source->Swizzle == SWIZZLE_NOOP) {
       /* no swizzling */
       COPY_4V(result, src);
    }
    else {
-      ASSERT(GET_SWZ(source->Swizzle, 0) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 1) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 2) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 3) <= 3);
+      assert(GET_SWZ(source->Swizzle, 0) <= 3);
+      assert(GET_SWZ(source->Swizzle, 1) <= 3);
+      assert(GET_SWZ(source->Swizzle, 2) <= 3);
+      assert(GET_SWZ(source->Swizzle, 3) <= 3);
       result[0] = src[GET_SWZ(source->Swizzle, 0)];
       result[1] = src[GET_SWZ(source->Swizzle, 1)];
       result[2] = src[GET_SWZ(source->Swizzle, 2)];
@@ -238,13 +201,13 @@ fetch_vector4(const struct prog_src_register *source,
    }
 
    if (source->Abs) {
-      result[0] = FABSF(result[0]);
-      result[1] = FABSF(result[1]);
-      result[2] = FABSF(result[2]);
-      result[3] = FABSF(result[3]);
+      result[0] = fabsf(result[0]);
+      result[1] = fabsf(result[1]);
+      result[2] = fabsf(result[2]);
+      result[3] = fabsf(result[3]);
    }
    if (source->Negate) {
-      ASSERT(source->Negate == NEGATE_XYZW);
+      assert(source->Negate == NEGATE_XYZW);
       result[0] = -result[0];
       result[1] = -result[1];
       result[2] = -result[2];
@@ -260,43 +223,12 @@ fetch_vector4(const struct prog_src_register *source,
 }
 
 
-/**
- * Fetch a 4-element uint vector from the given source register.
- * Apply swizzling but not negation/abs.
- */
-static void
-fetch_vector4ui(const struct prog_src_register *source,
-                const struct gl_program_machine *machine, GLuint result[4])
-{
-   const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
-   ASSERT(src);
-
-   if (source->Swizzle == SWIZZLE_NOOP) {
-      /* no swizzling */
-      COPY_4V(result, src);
-   }
-   else {
-      ASSERT(GET_SWZ(source->Swizzle, 0) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 1) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 2) <= 3);
-      ASSERT(GET_SWZ(source->Swizzle, 3) <= 3);
-      result[0] = src[GET_SWZ(source->Swizzle, 0)];
-      result[1] = src[GET_SWZ(source->Swizzle, 1)];
-      result[2] = src[GET_SWZ(source->Swizzle, 2)];
-      result[3] = src[GET_SWZ(source->Swizzle, 3)];
-   }
-
-   /* Note: no Negate or Abs here */
-}
-
-
-
 /**
  * Fetch the derivative with respect to X or Y for the given register.
  * XXX this currently only works for fragment program input attribs.
  */
 static void
-fetch_vector4_deriv(GLcontext * ctx,
+fetch_vector4_deriv(struct gl_context * ctx,
                     const struct prog_src_register *source,
                     const struct gl_program_machine *machine,
                     char xOrY, GLfloat result[4])
@@ -304,7 +236,7 @@ fetch_vector4_deriv(GLcontext * ctx,
    if (source->File == PROGRAM_INPUT &&
        source->Index < (GLint) machine->NumDeriv) {
       const GLint col = machine->CurElement;
-      const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3];
+      const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3];
       const GLfloat invQ = 1.0f / w;
       GLfloat deriv[4];
 
@@ -327,13 +259,13 @@ fetch_vector4_deriv(GLcontext * ctx,
       result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
       
       if (source->Abs) {
-         result[0] = FABSF(result[0]);
-         result[1] = FABSF(result[1]);
-         result[2] = FABSF(result[2]);
-         result[3] = FABSF(result[3]);
+         result[0] = fabsf(result[0]);
+         result[1] = fabsf(result[1]);
+         result[2] = fabsf(result[2]);
+         result[3] = fabsf(result[3]);
       }
       if (source->Negate) {
-         ASSERT(source->Negate == NEGATE_XYZW);
+         assert(source->Negate == NEGATE_XYZW);
          result[0] = -result[0];
          result[1] = -result[1];
          result[2] = -result[2];
@@ -354,12 +286,11 @@ fetch_vector1(const struct prog_src_register *source,
               const struct gl_program_machine *machine, GLfloat result[4])
 {
    const GLfloat *src = get_src_register_pointer(source, machine);
-   ASSERT(src);
 
    result[0] = src[GET_SWZ(source->Swizzle, 0)];
 
    if (source->Abs) {
-      result[0] = FABSF(result[0]);
+      result[0] = fabsf(result[0]);
    }
    if (source->Negate) {
       result[0] = -result[0];
@@ -367,20 +298,11 @@ fetch_vector1(const struct prog_src_register *source,
 }
 
 
-static GLuint
-fetch_vector1ui(const struct prog_src_register *source,
-                const struct gl_program_machine *machine)
-{
-   const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
-   return src[GET_SWZ(source->Swizzle, 0)];
-}
-
-
 /**
  * Fetch texel from texture.  Use partial derivatives when possible.
  */
-static INLINE void
-fetch_texel(GLcontext *ctx,
+static inline void
+fetch_texel(struct gl_context *ctx,
             const struct gl_program_machine *machine,
             const struct prog_instruction *inst,
             const GLfloat texcoord[4], GLfloat lodBias,
@@ -392,7 +314,7 @@ fetch_texel(GLcontext *ctx,
     */
    if (machine->NumDeriv > 0 &&
        inst->SrcReg[0].File == PROGRAM_INPUT &&
-       inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) {
+       inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) {
       /* simple texture fetch for which we should have derivatives */
       GLuint attr = inst->SrcReg[0].Index;
       machine->FetchTexelDeriv(ctx, texcoord,
@@ -406,66 +328,6 @@ fetch_texel(GLcontext *ctx,
 }
 
 
-/**
- * Test value against zero and return GT, LT, EQ or UN if NaN.
- */
-static INLINE GLuint
-generate_cc(float value)
-{
-   if (value != value)
-      return COND_UN;           /* NaN */
-   if (value > 0.0F)
-      return COND_GT;
-   if (value < 0.0F)
-      return COND_LT;
-   return COND_EQ;
-}
-
-
-/**
- * Test if the ccMaskRule is satisfied by the given condition code.
- * Used to mask destination writes according to the current condition code.
- */
-static INLINE GLboolean
-test_cc(GLuint condCode, GLuint ccMaskRule)
-{
-   switch (ccMaskRule) {
-   case COND_EQ: return (condCode == COND_EQ);
-   case COND_NE: return (condCode != COND_EQ);
-   case COND_LT: return (condCode == COND_LT);
-   case COND_GE: return (condCode == COND_GT || condCode == COND_EQ);
-   case COND_LE: return (condCode == COND_LT || condCode == COND_EQ);
-   case COND_GT: return (condCode == COND_GT);
-   case COND_TR: return GL_TRUE;
-   case COND_FL: return GL_FALSE;
-   default:      return GL_TRUE;
-   }
-}
-
-
-/**
- * Evaluate the 4 condition codes against a predicate and return GL_TRUE
- * or GL_FALSE to indicate result.
- */
-static INLINE GLboolean
-eval_condition(const struct gl_program_machine *machine,
-               const struct prog_instruction *inst)
-{
-   const GLuint swizzle = inst->DstReg.CondSwizzle;
-   const GLuint condMask = inst->DstReg.CondMask;
-   if (test_cc(machine->CondCodes[GET_SWZ(swizzle, 0)], condMask) ||
-       test_cc(machine->CondCodes[GET_SWZ(swizzle, 1)], condMask) ||
-       test_cc(machine->CondCodes[GET_SWZ(swizzle, 2)], condMask) ||
-       test_cc(machine->CondCodes[GET_SWZ(swizzle, 3)], condMask)) {
-      return GL_TRUE;
-   }
-   else {
-      return GL_FALSE;
-   }
-}
-
-
-
 /**
  * Store 4 floats into a register.  Observe the instructions saturate and
  * set-condition-code flags.
@@ -475,7 +337,7 @@ store_vector4(const struct prog_instruction *inst,
               struct gl_program_machine *machine, const GLfloat value[4])
 {
    const struct prog_dst_register *dstReg = &(inst->DstReg);
-   const GLboolean clamp = inst->SaturateMode == SATURATE_ZERO_ONE;
+   const GLboolean clamp = inst->Saturate;
    GLuint writeMask = dstReg->WriteMask;
    GLfloat clampedValue[4];
    GLfloat *dst = get_dst_register_pointer(dstReg, machine);
@@ -496,30 +358,6 @@ store_vector4(const struct prog_instruction *inst,
       value = clampedValue;
    }
 
-   if (dstReg->CondMask != COND_TR) {
-      /* condition codes may turn off some writes */
-      if (writeMask & WRITEMASK_X) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_X;
-      }
-      if (writeMask & WRITEMASK_Y) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_Y;
-      }
-      if (writeMask & WRITEMASK_Z) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_Z;
-      }
-      if (writeMask & WRITEMASK_W) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_W;
-      }
-   }
-
 #ifdef NAN_CHECK
    assert(!IS_INF_OR_NAN(value[0]));
    assert(!IS_INF_OR_NAN(value[0]));
@@ -535,92 +373,9 @@ store_vector4(const struct prog_instruction *inst,
       dst[2] = value[2];
    if (writeMask & WRITEMASK_W)
       dst[3] = value[3];
-
-   if (inst->CondUpdate) {
-      if (writeMask & WRITEMASK_X)
-         machine->CondCodes[0] = generate_cc(value[0]);
-      if (writeMask & WRITEMASK_Y)
-         machine->CondCodes[1] = generate_cc(value[1]);
-      if (writeMask & WRITEMASK_Z)
-         machine->CondCodes[2] = generate_cc(value[2]);
-      if (writeMask & WRITEMASK_W)
-         machine->CondCodes[3] = generate_cc(value[3]);
-#if DEBUG_PROG
-      printf("CondCodes=(%s,%s,%s,%s) for:\n",
-             _mesa_condcode_string(machine->CondCodes[0]),
-             _mesa_condcode_string(machine->CondCodes[1]),
-             _mesa_condcode_string(machine->CondCodes[2]),
-             _mesa_condcode_string(machine->CondCodes[3]));
-#endif
-   }
 }
 
 
-/**
- * Store 4 uints into a register.  Observe the set-condition-code flags.
- */
-static void
-store_vector4ui(const struct prog_instruction *inst,
-                struct gl_program_machine *machine, const GLuint value[4])
-{
-   const struct prog_dst_register *dstReg = &(inst->DstReg);
-   GLuint writeMask = dstReg->WriteMask;
-   GLuint *dst = (GLuint *) get_dst_register_pointer(dstReg, machine);
-
-   if (dstReg->CondMask != COND_TR) {
-      /* condition codes may turn off some writes */
-      if (writeMask & WRITEMASK_X) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_X;
-      }
-      if (writeMask & WRITEMASK_Y) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_Y;
-      }
-      if (writeMask & WRITEMASK_Z) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_Z;
-      }
-      if (writeMask & WRITEMASK_W) {
-         if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)],
-                      dstReg->CondMask))
-            writeMask &= ~WRITEMASK_W;
-      }
-   }
-
-   if (writeMask & WRITEMASK_X)
-      dst[0] = value[0];
-   if (writeMask & WRITEMASK_Y)
-      dst[1] = value[1];
-   if (writeMask & WRITEMASK_Z)
-      dst[2] = value[2];
-   if (writeMask & WRITEMASK_W)
-      dst[3] = value[3];
-
-   if (inst->CondUpdate) {
-      if (writeMask & WRITEMASK_X)
-         machine->CondCodes[0] = generate_cc((float)value[0]);
-      if (writeMask & WRITEMASK_Y)
-         machine->CondCodes[1] = generate_cc((float)value[1]);
-      if (writeMask & WRITEMASK_Z)
-         machine->CondCodes[2] = generate_cc((float)value[2]);
-      if (writeMask & WRITEMASK_W)
-         machine->CondCodes[3] = generate_cc((float)value[3]);
-#if DEBUG_PROG
-      printf("CondCodes=(%s,%s,%s,%s) for:\n",
-             _mesa_condcode_string(machine->CondCodes[0]),
-             _mesa_condcode_string(machine->CondCodes[1]),
-             _mesa_condcode_string(machine->CondCodes[2]),
-             _mesa_condcode_string(machine->CondCodes[3]));
-#endif
-   }
-}
-
-
-
 /**
  * Execute the given vertex/fragment program.
  *
@@ -630,12 +385,12 @@ store_vector4ui(const struct prog_instruction *inst,
  * \return GL_TRUE if program completed or GL_FALSE if program executed KIL.
  */
 GLboolean
-_mesa_execute_program(GLcontext * ctx,
+_mesa_execute_program(struct gl_context * ctx,
                       const struct gl_program *program,
                       struct gl_program_machine *machine)
 {
    const GLuint numInst = program->NumInstructions;
-   const GLuint maxExec = 10000;
+   const GLuint maxExec = 65536;
    GLuint pc, numExec = 0;
 
    machine->CurProgram = program;
@@ -663,10 +418,10 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector4(&inst->SrcReg[0], machine, a);
-            result[0] = FABSF(a[0]);
-            result[1] = FABSF(a[1]);
-            result[2] = FABSF(a[2]);
-            result[3] = FABSF(a[3]);
+            result[0] = fabsf(a[0]);
+            result[1] = fabsf(a[1]);
+            result[2] = fabsf(a[2]);
+            result[3] = fabsf(a[3]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -687,18 +442,6 @@ _mesa_execute_program(GLcontext * ctx,
             }
          }
          break;
-      case OPCODE_AND:     /* bitwise AND */
-         {
-            GLuint a[4], b[4], result[4];
-            fetch_vector4ui(&inst->SrcReg[0], machine, a);
-            fetch_vector4ui(&inst->SrcReg[1], machine, b);
-            result[0] = a[0] & b[0];
-            result[1] = a[1] & b[1];
-            result[2] = a[2] & b[2];
-            result[3] = a[3] & b[3];
-            store_vector4ui(inst, machine, result);
-         }
-         break;
       case OPCODE_ARL:
          {
             GLfloat t[4];
@@ -711,12 +454,12 @@ _mesa_execute_program(GLcontext * ctx,
          break;
       case OPCODE_BGNLOOP:
          /* no-op */
-         ASSERT(program->Instructions[inst->BranchTarget].Opcode
+         assert(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_ENDLOOP);
          break;
       case OPCODE_ENDLOOP:
          /* subtract 1 here since pc is incremented by for(pc) loop */
-         ASSERT(program->Instructions[inst->BranchTarget].Opcode
+         assert(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_BGNLOOP);
          pc = inst->BranchTarget - 1;   /* go to matching BNGLOOP */
          break;
@@ -724,41 +467,28 @@ _mesa_execute_program(GLcontext * ctx,
          break;
       case OPCODE_ENDSUB:      /* end subroutine */
          break;
-      case OPCODE_BRA:         /* branch (conditional) */
-         if (eval_condition(machine, inst)) {
-            /* take branch */
-            /* Subtract 1 here since we'll do pc++ below */
-            pc = inst->BranchTarget - 1;
-         }
-         break;
       case OPCODE_BRK:         /* break out of loop (conditional) */
-         ASSERT(program->Instructions[inst->BranchTarget].Opcode
+         assert(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_ENDLOOP);
-         if (eval_condition(machine, inst)) {
-            /* break out of loop */
-            /* pc++ at end of for-loop will put us after the ENDLOOP inst */
-            pc = inst->BranchTarget;
-         }
+         /* break out of loop */
+         /* pc++ at end of for-loop will put us after the ENDLOOP inst */
+         pc = inst->BranchTarget;
          break;
       case OPCODE_CONT:        /* continue loop (conditional) */
-         ASSERT(program->Instructions[inst->BranchTarget].Opcode
+         assert(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_ENDLOOP);
-         if (eval_condition(machine, inst)) {
-            /* continue at ENDLOOP */
-            /* Subtract 1 here since we'll do pc++ at end of for-loop */
-            pc = inst->BranchTarget - 1;
-         }
+         /* continue at ENDLOOP */
+         /* Subtract 1 here since we'll do pc++ at end of for-loop */
+         pc = inst->BranchTarget - 1;
          break;
       case OPCODE_CAL:         /* Call subroutine (conditional) */
-         if (eval_condition(machine, inst)) {
-            /* call the subroutine */
-            if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) {
-               return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
-            }
-            machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */
-            /* Subtract 1 here since we'll do pc++ at end of for-loop */
-            pc = inst->BranchTarget - 1;
+         /* call the subroutine */
+         if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) {
+            return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
          }
+         machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */
+         /* Subtract 1 here since we'll do pc++ at end of for-loop */
+         pc = inst->BranchTarget - 1;
          break;
       case OPCODE_CMP:
          {
@@ -785,7 +515,7 @@ _mesa_execute_program(GLcontext * ctx,
             GLfloat a[4], result[4];
             fetch_vector1(&inst->SrcReg[0], machine, a);
             result[0] = result[1] = result[2] = result[3]
-               = (GLfloat) cos(a[0]);
+               = cosf(a[0]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -818,20 +548,6 @@ _mesa_execute_program(GLcontext * ctx,
             }
          }
          break;
-      case OPCODE_DP2A:
-         {
-            GLfloat a[4], b[4], c, result[4];
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            fetch_vector4(&inst->SrcReg[1], machine, b);
-            fetch_vector1(&inst->SrcReg[1], machine, &c);
-            result[0] = result[1] = result[2] = result[3] = DOT2(a, b) + c;
-            store_vector4(inst, machine, result);
-            if (DEBUG_PROG) {
-               printf("DP2A %g = (%g %g) . (%g %g) + %g\n",
-                      result[0], a[0], a[1], b[0], b[1], c);
-            }
-         }
-         break;
       case OPCODE_DP3:
          {
             GLfloat a[4], b[4], result[4];
@@ -884,7 +600,7 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat t[4], q[4], floor_t0;
             fetch_vector1(&inst->SrcReg[0], machine, t);
-            floor_t0 = FLOORF(t[0]);
+            floor_t0 = floorf(t[0]);
             if (floor_t0 > FLT_MAX_EXP) {
                SET_POS_INFINITY(q[0]);
                SET_POS_INFINITY(q[2]);
@@ -894,12 +610,12 @@ _mesa_execute_program(GLcontext * ctx,
                q[2] = 0.0F;
             }
             else {
-               q[0] = LDEXPF(1.0, (int) floor_t0);
+               q[0] = ldexpf(1.0, (int) floor_t0);
                /* Note: GL_NV_vertex_program expects 
                 * result.z = result.x * APPX(result.y)
                 * We do what the ARB extension says.
                 */
-               q[2] = (GLfloat) pow(2.0, t[0]);
+               q[2] = exp2f(t[0]);
             }
             q[1] = t[0] - floor_t0;
             q[3] = 1.0F;
@@ -910,7 +626,7 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4], val;
             fetch_vector1(&inst->SrcReg[0], machine, a);
-            val = (GLfloat) pow(2.0, a[0]);
+            val = exp2f(a[0]);
             /*
             if (IS_INF_OR_NAN(val))
                val = 1.0e10;
@@ -923,10 +639,10 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector4(&inst->SrcReg[0], machine, a);
-            result[0] = FLOORF(a[0]);
-            result[1] = FLOORF(a[1]);
-            result[2] = FLOORF(a[2]);
-            result[3] = FLOORF(a[3]);
+            result[0] = floorf(a[0]);
+            result[1] = floorf(a[1]);
+            result[2] = floorf(a[2]);
+            result[3] = floorf(a[3]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -934,17 +650,17 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector4(&inst->SrcReg[0], machine, a);
-            result[0] = a[0] - FLOORF(a[0]);
-            result[1] = a[1] - FLOORF(a[1]);
-            result[2] = a[2] - FLOORF(a[2]);
-            result[3] = a[3] - FLOORF(a[3]);
+            result[0] = a[0] - floorf(a[0]);
+            result[1] = a[1] - floorf(a[1]);
+            result[2] = a[2] - floorf(a[2]);
+            result[3] = a[3] - floorf(a[3]);
             store_vector4(inst, machine, result);
          }
          break;
       case OPCODE_IF:
          {
             GLboolean cond;
-            ASSERT(program->Instructions[inst->BranchTarget].Opcode
+            assert(program->Instructions[inst->BranchTarget].Opcode
                    == OPCODE_ELSE ||
                    program->Instructions[inst->BranchTarget].Opcode
                    == OPCODE_ENDIF);
@@ -952,10 +668,7 @@ _mesa_execute_program(GLcontext * ctx,
             if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
                GLfloat a[4];
                fetch_vector1(&inst->SrcReg[0], machine, a);
-               cond = (a[0] != 0.0);
-            }
-            else {
-               cond = eval_condition(machine, inst);
+               cond = (a[0] != 0.0F);
             }
             if (DEBUG_PROG) {
                printf("IF: %d\n", cond);
@@ -973,7 +686,7 @@ _mesa_execute_program(GLcontext * ctx,
          break;
       case OPCODE_ELSE:
          /* goto ENDIF */
-         ASSERT(program->Instructions[inst->BranchTarget].Opcode
+         assert(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_ENDIF);
          assert(inst->BranchTarget >= 0);
          pc = inst->BranchTarget;
@@ -981,11 +694,6 @@ _mesa_execute_program(GLcontext * ctx,
       case OPCODE_ENDIF:
          /* nothing */
          break;
-      case OPCODE_KIL_NV:      /* NV_f_p only (conditional) */
-         if (eval_condition(machine, inst)) {
-            return GL_FALSE;
-         }
-         break;
       case OPCODE_KIL:         /* ARB_f_p only */
          {
             GLfloat a[4];
@@ -1010,7 +718,7 @@ _mesa_execute_program(GLcontext * ctx,
                val = -FLT_MAX;
             }
             else {
-               val = (float)(log(a[0]) * 1.442695F);
+               val = logf(a[0]) * 1.442695F;
             }
             result[0] = result[1] = result[2] = result[3] = val;
             store_vector4(inst, machine, result);
@@ -1029,10 +737,10 @@ _mesa_execute_program(GLcontext * ctx,
             result[1] = a[0];
             /* XXX we could probably just use pow() here */
             if (a[0] > 0.0F) {
-               if (a[1] == 0.0 && a[3] == 0.0)
+               if (a[1] == 0.0F && a[3] == 0.0F)
                   result[2] = 1.0F;
                else
-                  result[2] = (GLfloat) pow(a[1], a[3]);
+                  result[2] = powf(a[1], a[3]);
             }
             else {
                result[2] = 0.0F;
@@ -1050,17 +758,9 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat t[4], q[4], abs_t0;
             fetch_vector1(&inst->SrcReg[0], machine, t);
-            abs_t0 = FABSF(t[0]);
+            abs_t0 = fabsf(t[0]);
             if (abs_t0 != 0.0F) {
-               /* Since we really can't handle infinite values on VMS
-                * like other OSes we'll use __MAXFLOAT to represent
-                * infinity.  This may need some tweaking.
-                */
-#ifdef VMS
-               if (abs_t0 == __MAXFLOAT)
-#else
                if (IS_INF_OR_NAN(abs_t0))
-#endif
                {
                   SET_POS_INFINITY(q[0]);
                   q[1] = 1.0F;
@@ -1068,14 +768,14 @@ _mesa_execute_program(GLcontext * ctx,
                }
                else {
                   int exponent;
-                  GLfloat mantissa = FREXPF(t[0], &exponent);
+                  GLfloat mantissa = frexpf(t[0], &exponent);
                   q[0] = (GLfloat) (exponent - 1);
-                  q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */
+                  q[1] = 2.0F * mantissa; /* map [.5, 1) -> [1, 2) */
 
                  /* The fast LOG2 macro doesn't meet the precision
                   * requirements.
                   */
-                  q[2] = (float)(log(t[0]) * 1.442695F);
+                  q[2] = logf(t[0]) * 1.442695F;
                }
             }
             else {
@@ -1229,174 +929,13 @@ _mesa_execute_program(GLcontext * ctx,
          break;
       case OPCODE_NOP:
          break;
-      case OPCODE_NOT:         /* bitwise NOT */
-         {
-            GLuint a[4], result[4];
-            fetch_vector4ui(&inst->SrcReg[0], machine, a);
-            result[0] = ~a[0];
-            result[1] = ~a[1];
-            result[2] = ~a[2];
-            result[3] = ~a[3];
-            store_vector4ui(inst, machine, result);
-         }
-         break;
-      case OPCODE_NRM3:        /* 3-component normalization */
-         {
-            GLfloat a[4], result[4];
-            GLfloat tmp;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
-            if (tmp != 0.0F)
-               tmp = INV_SQRTF(tmp);
-            result[0] = tmp * a[0];
-            result[1] = tmp * a[1];
-            result[2] = tmp * a[2];
-            result[3] = 0.0;  /* undefined, but prevent valgrind warnings */
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_NRM4:        /* 4-component normalization */
-         {
-            GLfloat a[4], result[4];
-            GLfloat tmp;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
-            if (tmp != 0.0F)
-               tmp = INV_SQRTF(tmp);
-            result[0] = tmp * a[0];
-            result[1] = tmp * a[1];
-            result[2] = tmp * a[2];
-            result[3] = tmp * a[3];
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_OR:          /* bitwise OR */
-         {
-            GLuint a[4], b[4], result[4];
-            fetch_vector4ui(&inst->SrcReg[0], machine, a);
-            fetch_vector4ui(&inst->SrcReg[1], machine, b);
-            result[0] = a[0] | b[0];
-            result[1] = a[1] | b[1];
-            result[2] = a[2] | b[2];
-            result[3] = a[3] | b[3];
-            store_vector4ui(inst, machine, result);
-         }
-         break;
-      case OPCODE_PK2H:        /* pack two 16-bit floats in one 32-bit float */
-         {
-            GLfloat a[4];
-            GLuint result[4];
-            GLhalfNV hx, hy;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            hx = _mesa_float_to_half(a[0]);
-            hy = _mesa_float_to_half(a[1]);
-            result[0] =
-            result[1] =
-            result[2] =
-            result[3] = hx | (hy << 16);
-            store_vector4ui(inst, machine, result);
-         }
-         break;
-      case OPCODE_PK2US:       /* pack two GLushorts into one 32-bit float */
-         {
-            GLfloat a[4];
-            GLuint result[4], usx, usy;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            a[0] = CLAMP(a[0], 0.0F, 1.0F);
-            a[1] = CLAMP(a[1], 0.0F, 1.0F);
-            usx = IROUND(a[0] * 65535.0F);
-            usy = IROUND(a[1] * 65535.0F);
-            result[0] =
-            result[1] =
-            result[2] =
-            result[3] = usx | (usy << 16);
-            store_vector4ui(inst, machine, result);
-         }
-         break;
-      case OPCODE_PK4B:        /* pack four GLbytes into one 32-bit float */
-         {
-            GLfloat a[4];
-            GLuint result[4], ubx, uby, ubz, ubw;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F);
-            a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F);
-            a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F);
-            a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F);
-            ubx = IROUND(127.0F * a[0] + 128.0F);
-            uby = IROUND(127.0F * a[1] + 128.0F);
-            ubz = IROUND(127.0F * a[2] + 128.0F);
-            ubw = IROUND(127.0F * a[3] + 128.0F);
-            result[0] =
-            result[1] =
-            result[2] =
-            result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
-            store_vector4ui(inst, machine, result);
-         }
-         break;
-      case OPCODE_PK4UB:       /* pack four GLubytes into one 32-bit float */
-         {
-            GLfloat a[4];
-            GLuint result[4], ubx, uby, ubz, ubw;
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            a[0] = CLAMP(a[0], 0.0F, 1.0F);
-            a[1] = CLAMP(a[1], 0.0F, 1.0F);
-            a[2] = CLAMP(a[2], 0.0F, 1.0F);
-            a[3] = CLAMP(a[3], 0.0F, 1.0F);
-            ubx = IROUND(255.0F * a[0]);
-            uby = IROUND(255.0F * a[1]);
-            ubz = IROUND(255.0F * a[2]);
-            ubw = IROUND(255.0F * a[3]);
-            result[0] =
-            result[1] =
-            result[2] =
-            result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
-            store_vector4ui(inst, machine, result);
-         }
-         break;
       case OPCODE_POW:
          {
             GLfloat a[4], b[4], result[4];
             fetch_vector1(&inst->SrcReg[0], machine, a);
             fetch_vector1(&inst->SrcReg[1], machine, b);
             result[0] = result[1] = result[2] = result[3]
-               = (GLfloat) pow(a[0], b[0]);
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_RCC:  /* clamped riciprocal */
-         {
-            const float largest = 1.884467e+19, smallest = 5.42101e-20;
-            GLfloat a[4], r, result[4];
-            fetch_vector1(&inst->SrcReg[0], machine, a);
-            if (DEBUG_PROG) {
-               if (a[0] == 0)
-                  printf("RCC(0)\n");
-               else if (IS_INF_OR_NAN(a[0]))
-                  printf("RCC(inf)\n");
-            }
-            if (a[0] == 1.0F) {
-               r = 1.0F;
-            }
-            else {
-               r = 1.0F / a[0];
-            }
-            if (positive(r)) {
-               if (r > largest) {
-                  r = largest;
-               }
-               else if (r < smallest) {
-                  r = smallest;
-               }
-            }
-            else {
-               if (r < -largest) {
-                  r = -largest;
-               }
-               else if (r > -smallest) {
-                  r = -smallest;
-               }
-            }
-            result[0] = result[1] = result[2] = result[3] = r;
+               = powf(a[0], b[0]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -1416,34 +955,18 @@ _mesa_execute_program(GLcontext * ctx,
          }
          break;
       case OPCODE_RET:         /* return from subroutine (conditional) */
-         if (eval_condition(machine, inst)) {
-            if (machine->StackDepth == 0) {
-               return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
-            }
-            /* subtract one because of pc++ in the for loop */
-            pc = machine->CallStack[--machine->StackDepth] - 1;
-         }
-         break;
-      case OPCODE_RFL:         /* reflection vector */
-         {
-            GLfloat axis[4], dir[4], result[4], tmpX, tmpW;
-            fetch_vector4(&inst->SrcReg[0], machine, axis);
-            fetch_vector4(&inst->SrcReg[1], machine, dir);
-            tmpW = DOT3(axis, axis);
-            tmpX = (2.0F * DOT3(axis, dir)) / tmpW;
-            result[0] = tmpX * axis[0] - dir[0];
-            result[1] = tmpX * axis[1] - dir[1];
-            result[2] = tmpX * axis[2] - dir[2];
-            /* result[3] is never written! XXX enforce in parser! */
-            store_vector4(inst, machine, result);
+         if (machine->StackDepth == 0) {
+            return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
          }
+         /* subtract one because of pc++ in the for loop */
+         pc = machine->CallStack[--machine->StackDepth] - 1;
          break;
       case OPCODE_RSQ:         /* 1 / sqrt() */
          {
             GLfloat a[4], result[4];
             fetch_vector1(&inst->SrcReg[0], machine, a);
-            a[0] = FABSF(a[0]);
-            result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
+            a[0] = fabsf(a[0]);
+            result[0] = result[1] = result[2] = result[3] = 1.0f / sqrtf(a[0]);
             store_vector4(inst, machine, result);
             if (DEBUG_PROG) {
                printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]);
@@ -1454,10 +977,10 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector1(&inst->SrcReg[0], machine, a);
-            result[0] = (GLfloat) cos(a[0]);
-            result[1] = (GLfloat) sin(a[0]);
-            result[2] = 0.0;    /* undefined! */
-            result[3] = 0.0;    /* undefined! */
+            result[0] = cosf(a[0]);
+            result[1] = sinf(a[0]);
+            result[2] = 0.0F;    /* undefined! */
+            result[3] = 0.0F;    /* undefined! */
             store_vector4(inst, machine, result);
          }
          break;
@@ -1479,12 +1002,6 @@ _mesa_execute_program(GLcontext * ctx,
             }
          }
          break;
-      case OPCODE_SFL:         /* set false, operands ignored */
-         {
-            static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
-            store_vector4(inst, machine, result);
-         }
-         break;
       case OPCODE_SGE:         /* set on greater or equal */
          {
             GLfloat a[4], b[4], result[4];
@@ -1526,7 +1043,7 @@ _mesa_execute_program(GLcontext * ctx,
             GLfloat a[4], result[4];
             fetch_vector1(&inst->SrcReg[0], machine, a);
             result[0] = result[1] = result[2] = result[3]
-               = (GLfloat) sin(a[0]);
+               = sinf(a[0]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -1595,12 +1112,6 @@ _mesa_execute_program(GLcontext * ctx,
             store_vector4(inst, machine, result);
          }
          break;
-      case OPCODE_STR:         /* set true, operands ignored */
-         {
-            static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F };
-            store_vector4(inst, machine, result);
-         }
-         break;
       case OPCODE_SUB:
          {
             GLfloat a[4], b[4], result[4];
@@ -1631,8 +1142,7 @@ _mesa_execute_program(GLcontext * ctx,
                else if (swz == SWIZZLE_ONE)
                   result[i] = 1.0;
                else {
-                  ASSERT(swz >= 0);
-                  ASSERT(swz <= 3);
+                  assert(swz <= 3);
                   result[i] = src[swz];
                }
                if (source->Negate & (1 << i))
@@ -1647,6 +1157,14 @@ _mesa_execute_program(GLcontext * ctx,
             GLfloat texcoord[4], color[4];
             fetch_vector4(&inst->SrcReg[0], machine, texcoord);
 
+            /* For TEX, texcoord.Q should not be used and its value should not
+             * matter (at most, we pass coord.xyz to texture3D() in GLSL).
+             * Set Q=1 so that FetchTexelDeriv() doesn't get a garbage value
+             * which is effectively what happens when the texcoord swizzle
+             * is .xyzz
+             */
+            texcoord[3] = 1.0f;
+
             fetch_texel(ctx, machine, inst, texcoord, 0.0, color);
 
             if (DEBUG_PROG) {
@@ -1670,6 +1188,18 @@ _mesa_execute_program(GLcontext * ctx,
 
             fetch_texel(ctx, machine, inst, texcoord, lodBias, color);
 
+            if (DEBUG_PROG) {
+               printf("TXB (%g, %g, %g, %g) = texture[%d][%g %g %g %g]"
+                      "  bias %g\n",
+                      color[0], color[1], color[2], color[3],
+                      inst->TexSrcUnit,
+                      texcoord[0],
+                      texcoord[1],
+                      texcoord[2],
+                      texcoord[3],
+                      lodBias);
+            }
+
             store_vector4(inst, machine, color);
          }
          break;
@@ -1709,10 +1239,10 @@ _mesa_execute_program(GLcontext * ctx,
 
             fetch_vector4(&inst->SrcReg[0], machine, texcoord);
             /* Not so sure about this test - if texcoord[3] is
-             * zero, we'd probably be fine except for an ASSERT in
+             * zero, we'd probably be fine except for an assert in
              * IROUND_POS() which gets triggered by the inf values created.
              */
-            if (texcoord[3] != 0.0) {
+            if (texcoord[3] != 0.0F) {
                texcoord[0] /= texcoord[3];
                texcoord[1] /= texcoord[3];
                texcoord[2] /= texcoord[3];
@@ -1732,7 +1262,7 @@ _mesa_execute_program(GLcontext * ctx,
 
             fetch_vector4(&inst->SrcReg[0], machine, texcoord);
             if (inst->TexSrcTarget != TEXTURE_CUBE_INDEX &&
-                texcoord[3] != 0.0) {
+                texcoord[3] != 0.0F) {
                texcoord[0] /= texcoord[3];
                texcoord[1] /= texcoord[3];
                texcoord[2] /= texcoord[3];
@@ -1754,64 +1284,6 @@ _mesa_execute_program(GLcontext * ctx,
             store_vector4(inst, machine, result);
          }
          break;
-      case OPCODE_UP2H:        /* unpack two 16-bit floats */
-         {
-            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
-            GLfloat result[4];
-            GLushort hx, hy;
-            hx = raw & 0xffff;
-            hy = raw >> 16;
-            result[0] = result[2] = _mesa_half_to_float(hx);
-            result[1] = result[3] = _mesa_half_to_float(hy);
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_UP2US:       /* unpack two GLushorts */
-         {
-            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
-            GLfloat result[4];
-            GLushort usx, usy;
-            usx = raw & 0xffff;
-            usy = raw >> 16;
-            result[0] = result[2] = usx * (1.0f / 65535.0f);
-            result[1] = result[3] = usy * (1.0f / 65535.0f);
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_UP4B:        /* unpack four GLbytes */
-         {
-            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
-            GLfloat result[4];
-            result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F;
-            result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F;
-            result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F;
-            result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F;
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_UP4UB:       /* unpack four GLubytes */
-         {
-            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
-            GLfloat result[4];
-            result[0] = ((raw >> 0) & 0xff) / 255.0F;
-            result[1] = ((raw >> 8) & 0xff) / 255.0F;
-            result[2] = ((raw >> 16) & 0xff) / 255.0F;
-            result[3] = ((raw >> 24) & 0xff) / 255.0F;
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_XOR:         /* bitwise XOR */
-         {
-            GLuint a[4], b[4], result[4];
-            fetch_vector4ui(&inst->SrcReg[0], machine, a);
-            fetch_vector4ui(&inst->SrcReg[1], machine, b);
-            result[0] = a[0] ^ b[0];
-            result[1] = a[1] ^ b[1];
-            result[2] = a[2] ^ b[2];
-            result[3] = a[3] ^ b[3];
-            store_vector4ui(inst, machine, result);
-         }
-         break;
       case OPCODE_XPD:         /* cross product */
          {
             GLfloat a[4], b[4], result[4];
@@ -1829,32 +1301,6 @@ _mesa_execute_program(GLcontext * ctx,
             }
          }
          break;
-      case OPCODE_X2D:         /* 2-D matrix transform */
-         {
-            GLfloat a[4], b[4], c[4], result[4];
-            fetch_vector4(&inst->SrcReg[0], machine, a);
-            fetch_vector4(&inst->SrcReg[1], machine, b);
-            fetch_vector4(&inst->SrcReg[2], machine, c);
-            result[0] = a[0] + b[0] * c[0] + b[1] * c[1];
-            result[1] = a[1] + b[0] * c[2] + b[1] * c[3];
-            result[2] = a[2] + b[0] * c[0] + b[1] * c[1];
-            result[3] = a[3] + b[0] * c[2] + b[1] * c[3];
-            store_vector4(inst, machine, result);
-         }
-         break;
-      case OPCODE_PRINT:
-         {
-            if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
-               GLfloat a[4];
-               fetch_vector4(&inst->SrcReg[0], machine, a);
-               printf("%s%g, %g, %g, %g\n", (const char *) inst->Data,
-                            a[0], a[1], a[2], a[3]);
-            }
-            else {
-               printf("%s\n", (const char *) inst->Data);
-            }
-         }
-         break;
       case OPCODE_END:
          return GL_TRUE;
       default: