1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**************************************************************************
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved.
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish,
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions:
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software.
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **************************************************************************/
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_debug.h"
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_memory.h"
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "tgsi_info.h"
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NONE TGSI_OUTPUT_NONE
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define COMP TGSI_OUTPUT_COMPONENTWISE
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define REPL TGSI_OUTPUT_REPLICATE
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define CHAN TGSI_OUTPUT_CHAN_DEPENDENT
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define OTHR TGSI_OUTPUT_OTHER
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ARL", TGSI_OPCODE_ARL },
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "MOV", TGSI_OPCODE_MOV },
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, CHAN, "LIT", TGSI_OPCODE_LIT },
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "RCP", TGSI_OPCODE_RCP },
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "RSQ", TGSI_OPCODE_RSQ },
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, CHAN, "EXP", TGSI_OPCODE_EXP },
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, CHAN, "LOG", TGSI_OPCODE_LOG },
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "MUL", TGSI_OPCODE_MUL },
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "ADD", TGSI_OPCODE_ADD },
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "DP3", TGSI_OPCODE_DP3 },
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "DP4", TGSI_OPCODE_DP4 },
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, CHAN, "DST", TGSI_OPCODE_DST },
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "MIN", TGSI_OPCODE_MIN },
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "MAX", TGSI_OPCODE_MAX },
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SLT", TGSI_OPCODE_SLT },
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SGE", TGSI_OPCODE_SGE },
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "MAD", TGSI_OPCODE_MAD },
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SUB", TGSI_OPCODE_SUB },
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "LRP", TGSI_OPCODE_LRP },
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "CND", TGSI_OPCODE_CND },
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 20 },      /* removed */
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, REPL, "DP2A", TGSI_OPCODE_DP2A },
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 22 },      /* removed */
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 23 },      /* removed */
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "FRC", TGSI_OPCODE_FRC },
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "CLAMP", TGSI_OPCODE_CLAMP },
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "FLR", TGSI_OPCODE_FLR },
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ROUND", TGSI_OPCODE_ROUND },
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "EX2", TGSI_OPCODE_EX2 },
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "LG2", TGSI_OPCODE_LG2 },
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "POW", TGSI_OPCODE_POW },
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "XPD", TGSI_OPCODE_XPD },
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 32 },      /* removed */
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ABS", TGSI_OPCODE_ABS },
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "RCC", TGSI_OPCODE_RCC },
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "DPH", TGSI_OPCODE_DPH },
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "COS", TGSI_OPCODE_COS },
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "DDX", TGSI_OPCODE_DDX },
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "DDY", TGSI_OPCODE_DDY },
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "KILP", TGSI_OPCODE_KILP },
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "PK2H", TGSI_OPCODE_PK2H },
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "PK2US", TGSI_OPCODE_PK2US },
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "PK4B", TGSI_OPCODE_PK4B },
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "PK4UB", TGSI_OPCODE_PK4UB },
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "RFL", TGSI_OPCODE_RFL },
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SEQ", TGSI_OPCODE_SEQ },
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "SFL", TGSI_OPCODE_SFL },
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SGT", TGSI_OPCODE_SGT },
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "SIN", TGSI_OPCODE_SIN },
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SLE", TGSI_OPCODE_SLE },
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SNE", TGSI_OPCODE_SNE },
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "STR", TGSI_OPCODE_STR },
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TEX", TGSI_OPCODE_TEX },
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 4, 1, 0, 0, 0, OTHR, "TXD", TGSI_OPCODE_TXD },
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TXP", TGSI_OPCODE_TXP },
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "UP2H", TGSI_OPCODE_UP2H },
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "UP2US", TGSI_OPCODE_UP2US },
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "UP4B", TGSI_OPCODE_UP4B },
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "UP4UB", TGSI_OPCODE_UP4UB },
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "X2D", TGSI_OPCODE_X2D },
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ARA", TGSI_OPCODE_ARA },
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ARR", TGSI_OPCODE_ARR },
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "BRA", TGSI_OPCODE_BRA },
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 1, 0, 0, NONE, "CAL", TGSI_OPCODE_CAL },
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "RET", TGSI_OPCODE_RET },
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "SSG", TGSI_OPCODE_SSG },
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "CMP", TGSI_OPCODE_CMP },
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, CHAN, "SCS", TGSI_OPCODE_SCS },
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TXB", TGSI_OPCODE_TXB },
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "NRM", TGSI_OPCODE_NRM },
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "DIV", TGSI_OPCODE_DIV },
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, REPL, "DP2", TGSI_OPCODE_DP2 },
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TXL", TGSI_OPCODE_TXL },
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "BRK", TGSI_OPCODE_BRK },
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 1, 0, 1, NONE, "IF", TGSI_OPCODE_IF },
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 1, NONE, "", 75 },      /* removed */
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 1, NONE, "", 76 },      /* removed */
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 1, 1, 1, NONE, "ELSE", TGSI_OPCODE_ELSE },
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 1, 0, NONE, "ENDIF", TGSI_OPCODE_ENDIF },
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 0, 0, 0, 1, 0, NONE, "", 79 },      /* removed */
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 1, 0, NONE, "", 80 },      /* removed */
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "PUSHA", TGSI_OPCODE_PUSHA },
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 0, 0, 0, 0, 0, NONE, "POPA", TGSI_OPCODE_POPA },
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "CEIL", TGSI_OPCODE_CEIL },
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "I2F", TGSI_OPCODE_I2F },
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "NOT", TGSI_OPCODE_NOT },
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "TRUNC", TGSI_OPCODE_TRUNC },
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "SHL", TGSI_OPCODE_SHL },
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 88 },      /* removed */
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "AND", TGSI_OPCODE_AND },
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "OR", TGSI_OPCODE_OR },
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "MOD", TGSI_OPCODE_MOD },
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "XOR", TGSI_OPCODE_XOR },
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "SAD", TGSI_OPCODE_SAD },
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TXF", TGSI_OPCODE_TXF },
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 1, 0, 0, 0, OTHR, "TXQ", TGSI_OPCODE_TXQ },
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "CONT", TGSI_OPCODE_CONT },
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "EMIT", TGSI_OPCODE_EMIT },
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "ENDPRIM", TGSI_OPCODE_ENDPRIM },
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 1, 0, 1, NONE, "BGNLOOP", TGSI_OPCODE_BGNLOOP },
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 1, NONE, "BGNSUB", TGSI_OPCODE_BGNSUB },
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 1, 1, 0, NONE, "ENDLOOP", TGSI_OPCODE_ENDLOOP },
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 1, 0, NONE, "ENDSUB", TGSI_OPCODE_ENDSUB },
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 1, 0, 0, 0, OTHR, "TXQ_LZ", TGSI_OPCODE_TXQ_LZ },
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 104 },     /* removed */
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 105 },     /* removed */
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 106 },     /* removed */
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "NOP", TGSI_OPCODE_NOP },
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 108 },     /* removed */
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 109 },     /* removed */
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 110 },     /* removed */
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 111 },     /* removed */
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, REPL, "NRM4", TGSI_OPCODE_NRM4 },
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "CALLNZ", TGSI_OPCODE_CALLNZ },
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "IFC", TGSI_OPCODE_IFC },
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "BREAKC", TGSI_OPCODE_BREAKC },
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "KIL", TGSI_OPCODE_KIL },
157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "END", TGSI_OPCODE_END },
158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "", 118 },     /* removed */
159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "F2I", TGSI_OPCODE_F2I },
160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "IDIV", TGSI_OPCODE_IDIV },
161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "IMAX", TGSI_OPCODE_IMAX },
162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "IMIN", TGSI_OPCODE_IMIN },
163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "INEG", TGSI_OPCODE_INEG },
164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "ISGE", TGSI_OPCODE_ISGE },
165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "ISHR", TGSI_OPCODE_ISHR },
166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "ISLT", TGSI_OPCODE_ISLT },
167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "F2U", TGSI_OPCODE_F2U },
168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "U2F", TGSI_OPCODE_U2F },
169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UADD", TGSI_OPCODE_UADD },
170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UDIV", TGSI_OPCODE_UDIV },
171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "UMAD", TGSI_OPCODE_UMAD },
172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UMAX", TGSI_OPCODE_UMAX },
173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UMIN", TGSI_OPCODE_UMIN },
174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UMOD", TGSI_OPCODE_UMOD },
175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "UMUL", TGSI_OPCODE_UMUL },
176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "USEQ", TGSI_OPCODE_USEQ },
177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "USGE", TGSI_OPCODE_USGE },
178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "USHR", TGSI_OPCODE_USHR },
179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "USLT", TGSI_OPCODE_USLT },
180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, COMP, "USNE", TGSI_OPCODE_USNE },
181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "SWITCH", TGSI_OPCODE_SWITCH },
182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 1, 0, 0, 0, 0, NONE, "CASE", TGSI_OPCODE_CASE },
183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "DEFAULT", TGSI_OPCODE_DEFAULT },
184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, NONE, "ENDSWITCH", TGSI_OPCODE_ENDSWITCH },
185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE",      TGSI_OPCODE_SAMPLE },
187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_I",    TGSI_OPCODE_SAMPLE_I },
188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_I_MS", TGSI_OPCODE_SAMPLE_I_MS },
189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_B",    TGSI_OPCODE_SAMPLE_B },
190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C",    TGSI_OPCODE_SAMPLE_C },
191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C_LZ", TGSI_OPCODE_SAMPLE_C_LZ },
192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 5, 0, 0, 0, 0, OTHR, "SAMPLE_D",    TGSI_OPCODE_SAMPLE_D },
193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE_L",    TGSI_OPCODE_SAMPLE_L },
194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "GATHER4",     TGSI_OPCODE_GATHER4 },
195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "SVIEWINFO",   TGSI_OPCODE_SVIEWINFO },
196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_POS",  TGSI_OPCODE_SAMPLE_POS },
197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO },
198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "UARL", TGSI_OPCODE_UARL },
199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, COMP, "UCMP", TGSI_OPCODE_UCMP },
200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS },
201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG },
202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD },
203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 2, 0, 0, 0, 0, OTHR, "STORE", TGSI_OPCODE_STORE },
204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 0, 0, 0, 0, 0, OTHR, "MFENCE", TGSI_OPCODE_MFENCE },
205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 0, 0, 0, 0, 0, OTHR, "LFENCE", TGSI_OPCODE_LFENCE },
206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 0, 0, 0, 0, 0, OTHR, "SFENCE", TGSI_OPCODE_SFENCE },
207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 0, 0, 0, 0, 0, 0, OTHR, "BARRIER", TGSI_OPCODE_BARRIER },
208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUADD", TGSI_OPCODE_ATOMUADD },
210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMXCHG", TGSI_OPCODE_ATOMXCHG },
211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 4, 0, 0, 0, 0, OTHR, "ATOMCAS", TGSI_OPCODE_ATOMCAS },
212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMAND", TGSI_OPCODE_ATOMAND },
213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMOR", TGSI_OPCODE_ATOMOR },
214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMXOR", TGSI_OPCODE_ATOMXOR },
215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMIN", TGSI_OPCODE_ATOMUMIN },
216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMAX", TGSI_OPCODE_ATOMUMAX },
217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMIN", TGSI_OPCODE_ATOMIMIN },
218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMAX", TGSI_OPCODE_ATOMIMAX }
219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconst struct tgsi_opcode_info *
222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtgsi_get_opcode_info( uint opcode )
223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   static boolean firsttime = 1;
225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (firsttime) {
227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unsigned i;
228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      firsttime = 0;
229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for (i = 0; i < Elements(opcode_info); i++)
230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         assert(opcode_info[i].opcode == i);
231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (opcode < TGSI_OPCODE_LAST)
234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return &opcode_info[opcode];
235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   assert( 0 );
237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return NULL;
238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconst char *
242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtgsi_get_opcode_name( uint opcode )
243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct tgsi_opcode_info *info = tgsi_get_opcode_info(opcode);
245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return info->mnemonic;
246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconst char *
250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtgsi_get_processor_name( uint processor )
251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   switch (processor) {
253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_PROCESSOR_VERTEX:
254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return "vertex shader";
255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_PROCESSOR_FRAGMENT:
256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return "fragment shader";
257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_PROCESSOR_GEOMETRY:
258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return "geometry shader";
259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   default:
260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return "unknown shader type!";
261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * infer the source type of a TGSI opcode.
266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MOV is special so return VOID
267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgenum tgsi_opcode_type
269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtgsi_opcode_infer_src_type( uint opcode )
270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   switch (opcode) {
272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_MOV:
273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_UNTYPED;
274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_AND:
275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_OR:
276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_XOR:
277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_SAD:
278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_U2F:
279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UADD:
280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UDIV:
281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMOD:
282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMAD:
283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMUL:
284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMAX:
285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMIN:
286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USEQ:
287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USGE:
288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USLT:
289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USNE:
290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USHR:
291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_SHL:
292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_TXQ:
293f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_UNSIGNED;
294f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_MOD:
295f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_I2F:
296f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IDIV:
297f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IMAX:
298f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IMIN:
299f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_INEG:
300f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISGE:
301f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISHR:
302f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISLT:
303f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IABS:
304f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISSG:
305f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UARL:
306f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_SIGNED;
307f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   default:
308f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_FLOAT;
309f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
310f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
311f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
312f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
313f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * infer the destination type of a TGSI opcode.
314f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MOV is special so return VOID
315f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
316f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgenum tgsi_opcode_type
317f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtgsi_opcode_infer_dst_type( uint opcode )
318f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
319f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   switch (opcode) {
320f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_MOV:
321f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_UNTYPED;
322f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_F2U:
323f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_AND:
324f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_OR:
325f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_XOR:
326f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_SAD:
327f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UADD:
328f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UDIV:
329f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMOD:
330f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMAD:
331f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMUL:
332f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMAX:
333f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UMIN:
334f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USEQ:
335f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USGE:
336f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USLT:
337f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USNE:
338f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_USHR:
339f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_SHL:
340f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_TXQ:
341f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_TXQ_LZ:
342f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_UNSIGNED;
343f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_F2I:
344f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IDIV:
345f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IMAX:
346f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IMIN:
347f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_INEG:
348f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISGE:
349f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISHR:
350f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISLT:
351f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_MOD:
352f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_UARL:
353f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ARL:
354f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ARR:
355f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_IABS:
356f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case TGSI_OPCODE_ISSG:
357f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_SIGNED;
358f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   default:
359f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return TGSI_TYPE_FLOAT;
360f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
361f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
362