mesa: Remove Mesa IR opcodes that existed only for NV_vertex_program.
authorEric Anholt <eric@anholt.net>
Tue, 9 Oct 2012 22:31:42 +0000 (15:31 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 15 Oct 2012 18:53:23 +0000 (11:53 -0700)
v2: Remove dead positive() function, caught by Matt.

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
src/mesa/drivers/dri/i915/i915_fragprog.c
src/mesa/program/prog_execute.c
src/mesa/program/prog_instruction.c
src/mesa/program/prog_instruction.h
src/mesa/program/prog_optimize.c
src/mesa/program/prog_print.c

index 7a6e0673678746cf3308f0090ab544476766c021..3038d84f3ed2cf3d7b6ec62bb7ce9a9acca6202d 100644 (file)
@@ -1088,7 +1088,6 @@ upload_program(struct i915_fragment_program *p)
 
       case OPCODE_BGNLOOP:
       case OPCODE_BGNSUB:
-      case OPCODE_BRA:
       case OPCODE_BRK:
       case OPCODE_CAL:
       case OPCODE_CONT:
index dd1706e1444d63ecb1d2d07394c2db6f56d0a2c0..f57027c0756185c1d54d94a02834fa3e77308662 100644 (file)
 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.
@@ -728,13 +711,6 @@ _mesa_execute_program(struct gl_context * 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
                 == OPCODE_ENDLOOP);
@@ -1367,43 +1343,6 @@ _mesa_execute_program(struct gl_context * ctx,
             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;
-            store_vector4(inst, machine, result);
-         }
-         break;
 
       case OPCODE_RCP:
          {
index d69d7b2d46570c35993169398e2bc90598d3bc9b..0bd45b09bab1aeb3537c8f5171e1ea42469d0732 100644 (file)
@@ -154,13 +154,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
    { OPCODE_ABS,    "ABS",     1, 1 },
    { OPCODE_ADD,    "ADD",     2, 1 },
    { OPCODE_AND,    "AND",     2, 1 },
-   { OPCODE_ARA,    "ARA",     1, 1 },
    { OPCODE_ARL,    "ARL",     1, 1 },
-   { OPCODE_ARL_NV, "ARL_NV",  1, 1 },
-   { OPCODE_ARR,    "ARL",     1, 1 },
    { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
    { OPCODE_BGNSUB, "BGNSUB",  0, 0 },
-   { OPCODE_BRA,    "BRA",     0, 0 },
    { OPCODE_BRK,    "BRK",     0, 0 },
    { OPCODE_CAL,    "CAL",     0, 0 },
    { OPCODE_CMP,    "CMP",     3, 1 },
@@ -210,10 +206,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
    { OPCODE_PK4B,   "PK4B",    1, 1 },
    { OPCODE_PK4UB,  "PK4UB",   1, 1 },
    { OPCODE_POW,    "POW",     2, 1 },
-   { OPCODE_POPA,   "POPA",    0, 0 },
    { OPCODE_PRINT,  "PRINT",   1, 0 },
-   { OPCODE_PUSHA,  "PUSHA",   0, 0 },
-   { OPCODE_RCC,    "RCC",     1, 1 },
    { OPCODE_RCP,    "RCP",     1, 1 },
    { OPCODE_RET,    "RET",     0, 0 },
    { OPCODE_RFL,    "RFL",     1, 1 },
index 656556dd4ee3cbf91e3013fb280db53be6d290f5..7c09cdabf0feddc2fec8d3290a6c3d3904b8e818 100644 (file)
@@ -148,13 +148,9 @@ typedef enum prog_opcode {
    OPCODE_ABS,       /*   X        X       1.1               X   */
    OPCODE_ADD,       /*   X        X       X       X         X   */
    OPCODE_AND,       /*                                          */
-   OPCODE_ARA,       /*                    2                     */
    OPCODE_ARL,       /*   X                X                 X   */
-   OPCODE_ARL_NV,    /*                    2                     */
-   OPCODE_ARR,       /*                    2                     */
    OPCODE_BGNLOOP,   /*                                     opt  */
    OPCODE_BGNSUB,    /*                                     opt  */
-   OPCODE_BRA,       /*                    2                     */
    OPCODE_BRK,       /*                    2                opt  */
    OPCODE_CAL,       /*                    2       2        opt  */
    OPCODE_CMP,       /*            X                         X   */
@@ -204,10 +200,7 @@ typedef enum prog_opcode {
    OPCODE_PK4B,      /*                            X             */
    OPCODE_PK4UB,     /*                            X             */
    OPCODE_POW,       /*   X        X               X         X   */
-   OPCODE_POPA,      /*                    3                     */
    OPCODE_PRINT,     /*                    X       X             */
-   OPCODE_PUSHA,     /*                    3                     */
-   OPCODE_RCC,       /*                    1.1                   */
    OPCODE_RCP,       /*   X        X       X       X         X   */
    OPCODE_RET,       /*                    2       2        opt  */
    OPCODE_RFL,       /*                            X             */
index e89e8d6a45c67537f523f8275539fabab1806a73..78d09f1cbe1f1d64269a5659111711fb75619124 100644 (file)
@@ -392,7 +392,6 @@ find_next_use(const struct gl_program *prog,
       switch (inst->Opcode) {
       case OPCODE_BGNLOOP:
       case OPCODE_BGNSUB:
-      case OPCODE_BRA:
       case OPCODE_CAL:
       case OPCODE_CONT:
       case OPCODE_IF:
@@ -439,7 +438,6 @@ _mesa_is_flow_control_opcode(enum prog_opcode opcode)
    switch (opcode) {
    case OPCODE_BGNLOOP:
    case OPCODE_BGNSUB:
-   case OPCODE_BRA:
    case OPCODE_CAL:
    case OPCODE_CONT:
    case OPCODE_IF:
index bc5dc5803672660ec0b1f79f026f904686db6013..a560b53537f4f1b96ed0ff56d29ec9ef9ed05b5e 100644 (file)
@@ -748,13 +748,6 @@ _mesa_fprint_instruction_opt(FILE *f,
       fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
       fprint_comment(f, inst);
       break;
-   case OPCODE_BRA:
-      fprintf(f, "BRA %d (%s%s)",
-             inst->BranchTarget,
-             _mesa_condcode_string(inst->DstReg.CondMask),
-             _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
-      fprint_comment(f, inst);
-      break;
    case OPCODE_IF:
       if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
          /* Use ordinary register */