Add support for negate and abs to source operands.

This commit is contained in:
Eric Anholt 2006-08-22 14:42:45 -07:00 committed by Damien Lespiau
parent 0d929b430b
commit dc96c56d9e
4 changed files with 214 additions and 183 deletions

View File

@ -56,6 +56,7 @@
%token LCURLY RCURLY %token LCURLY RCURLY
%token COMMA %token COMMA
%token DOT %token DOT
%token MINUS ABS
%token TYPE_UD, TYPE_D, TYPE_UW, TYPE_W, TYPE_UB, TYPE_B, %token TYPE_UD, TYPE_D, TYPE_UW, TYPE_W, TYPE_UB, TYPE_B,
%token TYPE_VF, TYPE_HF, TYPE_V, TYPE_F %token TYPE_VF, TYPE_HF, TYPE_V, TYPE_F
@ -86,7 +87,7 @@
%type <program> instrseq %type <program> instrseq
%type <integer> instoption %type <integer> instoption
%type <integer> unaryop binaryop binaryaccop %type <integer> unaryop binaryop binaryaccop
%type <integer> conditionalmodifier saturate %type <integer> conditionalmodifier saturate negate abs
%type <integer> regtype srcimmtype execsize dstregion %type <integer> regtype srcimmtype execsize dstregion
%type <integer> subregnum msgtarget %type <integer> subregnum msgtarget
%type <region> region %type <region> region
@ -324,19 +325,22 @@ directsrcaccoperand: directsrcoperand
src: directsrcoperand src: directsrcoperand
; ;
/* XXX: srcmodifier, swizzle srcaccoperandex */ /* XXX: srcaccoperandex */
directsrcoperand: directgenreg region regtype directsrcoperand:
negate abs directgenreg region regtype
{ {
/* Returns a source operand in the src0 fields of an /* Returns a source operand in the src0 fields of an
* instruction. * instruction.
*/ */
$$.bits1.da1.src0_reg_file = $1.reg_file; $$.bits1.da1.src0_reg_file = $3.reg_file;
$$.bits1.da1.src0_reg_type = $3; $$.bits1.da1.src0_reg_type = $5;
$$.bits2.da1.src0_subreg_nr = $1.subreg_nr; $$.bits2.da1.src0_subreg_nr = $3.subreg_nr;
$$.bits2.da1.src0_reg_nr = $1.reg_nr; $$.bits2.da1.src0_reg_nr = $3.reg_nr;
$$.bits2.da1.src0_vert_stride = $2.vert_stride; $$.bits2.da1.src0_vert_stride = $4.vert_stride;
$$.bits2.da1.src0_width = $2.width; $$.bits2.da1.src0_width = $4.width;
$$.bits2.da1.src0_horiz_stride = $2.horiz_stride; $$.bits2.da1.src0_horiz_stride = $4.horiz_stride;
$$.bits2.da1.src0_negate = $1;
$$.bits2.da1.src0_abs = $2;
} }
; ;
@ -447,6 +451,13 @@ imm32: INTEGER { $$ = $1; }
/* 1.4.12: Predication and modifiers */ /* 1.4.12: Predication and modifiers */
/* XXX: do the predicate */ /* XXX: do the predicate */
predicate: predicate:
;
negate: /* empty */ { $$ = 0; }
| MINUS { $$ = 1; }
abs: /* empty */ { $$ = 0; }
| ABS { $$ = 1; }
execsize: LPAREN INTEGER RPAREN execsize: LPAREN INTEGER RPAREN
{ {
@ -542,6 +553,8 @@ void set_instruction_src0(struct brw_instruction *instr,
instr->bits2.da1.src0_width = src->bits2.da1.src0_width; instr->bits2.da1.src0_width = src->bits2.da1.src0_width;
instr->bits2.da1.src0_horiz_stride = instr->bits2.da1.src0_horiz_stride =
src->bits2.da1.src0_horiz_stride; src->bits2.da1.src0_horiz_stride;
instr->bits2.da1.src0_negate = src->bits2.da1.src0_negate;
instr->bits2.da1.src0_abs = src->bits2.da1.src0_abs;
} }
} }
@ -561,6 +574,8 @@ void set_instruction_src1(struct brw_instruction *instr,
instr->bits3.da1.src1_width = src->bits2.da1.src0_width; instr->bits3.da1.src1_width = src->bits2.da1.src0_width;
instr->bits3.da1.src1_horiz_stride = instr->bits3.da1.src1_horiz_stride =
src->bits2.da1.src0_horiz_stride; src->bits2.da1.src0_horiz_stride;
instr->bits3.da1.src1_negate = src->bits2.da1.src0_negate;
instr->bits3.da1.src1_abs = src->bits2.da1.src0_abs;
} }
} }

View File

@ -293,47 +293,49 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
*yy_cp = '\0'; \ *yy_cp = '\0'; \
yy_c_buf_p = yy_cp; yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 62 #define YY_NUM_RULES 64
#define YY_END_OF_BUFFER 63 #define YY_END_OF_BUFFER 65
static yyconst short int yy_acclist[151] = static yyconst short int yy_acclist[156] =
{ 0, { 0,
58, 58, 58, 58, 63, 61, 62, 60, 61, 62, 60, 60, 60, 60, 65, 63, 64, 62, 63, 64,
60, 62, 31, 61, 62, 32, 61, 62, 37, 61, 62, 64, 31, 63, 64, 32, 63, 64, 37, 63,
62, 61, 62, 38, 61, 62, 61, 62, 58, 61, 64, 39, 63, 64, 38, 63, 64, 63, 64, 60,
62, 30, 61, 62, 33, 61, 62, 34, 61, 62, 63, 64, 30, 63, 64, 33, 63, 64, 34, 63,
51, 61, 62, 47, 61, 62, 61, 62, 52, 61, 64, 53, 63, 64, 49, 63, 64, 63, 64, 54,
62, 61, 62, 49, 61, 62, 40, 61, 62, 61, 63, 64, 63, 64, 51, 63, 64, 42, 63, 64,
62, 61, 62, 42, 61, 62, 43, 61, 62, 61, 63, 64, 63, 64, 44, 63, 64, 45, 63, 64,
62, 61, 62, 41, 61, 62, 61, 62, 43, 61, 63, 64, 63, 64, 43, 63, 64, 63, 64, 45,
62, 61, 62, 61, 62, 61, 62, 61, 62, 35, 63, 64, 63, 64, 63, 64, 63, 64, 63, 64,
61, 62, 36, 61, 62, 58, 61, 62, 4, 62, 35, 63, 64, 36, 63, 64, 39, 63, 64, 60,
5, 62, 4, 5, 62, 4, 62, 60, 2, 58, 63, 64, 4, 64, 5, 64, 4, 5, 64, 4,
50, 46, 48, 44, 45, 58, 3, 1, 1, 59, 64, 62, 2, 60, 52, 48, 50, 46, 47, 60,
57, 39, 18, 17, 16, 14, 15, 9, 7, 8, 3, 1, 1, 61, 59, 41, 18, 17, 16, 14,
19, 53, 28, 11, 10, 23, 21, 6, 26, 22, 15, 9, 7, 8, 19, 55, 28, 11, 10, 23,
12, 20, 13, 27, 54, 55, 25, 24, 56, 29 21, 6, 26, 22, 12, 20, 40, 13, 27, 56,
57, 25, 24, 58, 29
} ; } ;
static yyconst short int yy_accept[159] = static yyconst short int yy_accept[164] =
{ 0, { 0,
1, 2, 3, 4, 5, 5, 5, 6, 8, 11, 1, 2, 3, 4, 5, 5, 5, 6, 8, 11,
13, 16, 19, 22, 24, 27, 29, 32, 35, 38, 13, 16, 19, 22, 25, 28, 30, 33, 36, 39,
41, 44, 47, 49, 52, 54, 57, 60, 62, 64, 42, 45, 48, 50, 53, 55, 58, 61, 63, 65,
67, 70, 72, 74, 77, 79, 82, 84, 86, 88, 68, 71, 73, 75, 78, 80, 83, 85, 87, 89,
90, 93, 96, 99, 101, 103, 106, 108, 109, 109, 91, 94, 97, 100, 103, 105, 107, 110, 112, 113,
110, 110, 110, 111, 111, 112, 113, 114, 114, 114, 113, 113, 114, 114, 114, 115, 115, 116, 117, 118,
114, 115, 115, 115, 116, 116, 116, 116, 116, 116, 118, 118, 118, 119, 119, 119, 120, 120, 120, 120,
116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
118, 118, 119, 120, 121, 122, 123, 124, 124, 125, 120, 121, 122, 122, 122, 123, 124, 125, 126, 127,
126, 127, 128, 128, 128, 129, 129, 129, 129, 130, 128, 128, 129, 130, 131, 132, 132, 132, 133, 133,
131, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 134, 135, 136, 136, 136, 136, 136, 136,
134, 134, 134, 134, 135, 136, 136, 137, 138, 139, 137, 137, 137, 138, 138, 138, 138, 138, 139, 140,
140, 141, 142, 142, 142, 143, 143, 143, 143, 143, 140, 141, 142, 143, 144, 145, 146, 146, 146, 147,
143, 144, 144, 144, 145, 146, 146, 146, 146, 146, 147, 147, 148, 148, 148, 148, 149, 149, 149, 150,
147, 148, 148, 149, 149, 149, 149, 149, 149, 149, 151, 151, 151, 151, 151, 152, 153, 153, 154, 154,
149, 149, 149, 150, 150, 150, 151, 151 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
155, 156, 156
} ; } ;
static yyconst int yy_ec[256] = static yyconst int yy_ec[256] =
@ -378,86 +380,88 @@ static yyconst int yy_meta[54] =
1, 1, 1 1, 1, 1
} ; } ;
static yyconst short int yy_base[160] = static yyconst short int yy_base[165] =
{ 0, { 0,
0, 0, 45, 54, 69, 71, 239, 240, 53, 62, 0, 0, 45, 54, 69, 71, 243, 244, 53, 62,
240, 240, 240, 67, 240, 78, 78, 240, 240, 240, 212, 244, 244, 67, 244, 78, 78, 244, 244, 244,
240, 240, 213, 240, 75, 240, 66, 192, 192, 240, 244, 244, 216, 244, 75, 244, 66, 195, 195, 244,
205, 190, 195, 70, 59, 71, 74, 195, 186, 185, 208, 193, 198, 70, 59, 71, 74, 198, 189, 188,
240, 240, 107, 240, 240, 240, 218, 84, 115, 240, 244, 244, 244, 107, 244, 244, 244, 221, 84, 200,
111, 121, 129, 202, 240, 240, 240, 195, 193, 187, 115, 244, 111, 121, 129, 204, 244, 244, 244, 197,
240, 133, 177, 240, 181, 108, 188, 172, 180, 175, 195, 189, 244, 133, 179, 244, 183, 108, 190, 174,
178, 187, 182, 117, 173, 169, 182, 174, 159, 240, 182, 177, 180, 189, 184, 117, 175, 171, 184, 176,
113, 240, 148, 165, 240, 240, 240, 175, 240, 240, 159, 244, 167, 113, 244, 148, 165, 244, 244, 244,
240, 240, 176, 175, 171, 168, 169, 163, 240, 240, 176, 244, 244, 244, 244, 177, 176, 172, 169, 170,
240, 164, 170, 160, 139, 157, 240, 167, 165, 240, 164, 244, 244, 244, 165, 171, 161, 139, 158, 244,
151, 155, 146, 240, 240, 166, 240, 240, 240, 240, 168, 166, 244, 152, 192, 155, 146, 244, 244, 166,
240, 240, 180, 153, 240, 162, 157, 177, 159, 155, 244, 244, 244, 244, 244, 244, 180, 153, 244, 162,
240, 153, 153, 240, 168, 133, 145, 123, 138, 240, 157, 244, 177, 159, 155, 244, 153, 153, 244, 168,
240, 120, 240, 119, 133, 118, 130, 130, 119, 107, 133, 145, 123, 138, 244, 244, 120, 244, 119, 133,
122, 84, 240, 78, 64, 240, 240, 100, 76 118, 130, 130, 119, 107, 122, 84, 244, 78, 64,
244, 244, 100, 76
} ; } ;
static yyconst short int yy_def[160] = static yyconst short int yy_def[165] =
{ 0, { 0,
157, 1, 1, 1, 158, 158, 157, 157, 157, 157, 162, 1, 1, 1, 163, 163, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
159, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 164, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
159, 157, 159, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 164, 162, 164, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 0, 157, 157 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
162, 0, 162, 162
} ; } ;
static yyconst short int yy_nxt[294] = static yyconst short int yy_nxt[298] =
{ 0, { 0,
8, 9, 10, 8, 11, 12, 8, 13, 14, 15, 8, 9, 10, 8, 11, 12, 8, 13, 14, 15,
16, 17, 17, 17, 17, 17, 17, 18, 19, 20, 16, 17, 17, 17, 17, 17, 17, 18, 19, 20,
21, 22, 23, 24, 8, 8, 25, 26, 8, 27, 21, 22, 23, 24, 8, 8, 25, 26, 8, 27,
8, 28, 29, 8, 30, 31, 8, 32, 8, 33, 8, 28, 29, 8, 30, 31, 8, 32, 8, 33,
34, 35, 8, 8, 36, 37, 38, 39, 8, 40, 34, 35, 8, 8, 36, 37, 38, 39, 8, 40,
8, 41, 42, 8, 48, 48, 43, 43, 43, 43, 8, 41, 42, 43, 49, 49, 44, 44, 44, 44,
43, 43, 8, 48, 48, 43, 43, 43, 43, 43, 44, 44, 43, 49, 49, 44, 44, 44, 44, 44,
43, 45, 46, 45, 46, 47, 81, 47, 49, 49, 44, 46, 47, 46, 47, 48, 84, 48, 51, 51,
49, 49, 49, 49, 50, 48, 48, 52, 51, 53, 51, 51, 51, 51, 52, 49, 49, 54, 53, 55,
53, 53, 53, 53, 53, 55, 56, 58, 59, 66, 55, 55, 55, 55, 55, 57, 58, 60, 61, 68,
44, 70, 57, 74, 72, 60, 71, 75, 156, 67, 45, 72, 59, 76, 74, 62, 73, 77, 161, 69,
73, 155, 68, 82, 83, 82, 83, 69, 79, 79, 75, 160, 70, 85, 86, 85, 86, 71, 81, 81,
79, 79, 79, 79, 52, 154, 49, 49, 49, 49, 81, 81, 81, 81, 54, 159, 51, 51, 51, 51,
49, 49, 84, 84, 84, 84, 84, 84, 52, 95, 51, 51, 87, 87, 87, 87, 87, 87, 54, 98,
53, 53, 53, 53, 53, 53, 89, 90, 91, 105, 55, 55, 55, 55, 55, 55, 92, 93, 94, 108,
82, 83, 122, 96, 97, 153, 152, 106, 151, 150, 85, 86, 126, 99, 100, 158, 157, 109, 156, 155,
149, 148, 147, 107, 146, 145, 144, 143, 123, 92, 154, 153, 152, 110, 151, 150, 149, 148, 127, 95,
79, 79, 79, 79, 79, 79, 84, 84, 84, 84, 81, 81, 81, 81, 81, 81, 87, 87, 87, 87,
84, 84, 142, 141, 140, 139, 138, 137, 136, 135, 87, 87, 147, 146, 145, 144, 143, 142, 141, 140,
134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
124, 121, 120, 119, 118, 117, 116, 115, 114, 113, 129, 128, 125, 124, 123, 122, 121, 120, 119, 118,
112, 111, 110, 109, 108, 104, 103, 102, 101, 100, 117, 116, 115, 114, 113, 112, 111, 107, 106, 105,
99, 98, 94, 93, 88, 87, 86, 85, 80, 78, 104, 103, 102, 101, 97, 96, 91, 90, 89, 88,
77, 76, 65, 64, 63, 62, 61, 54, 157, 7, 83, 82, 80, 79, 78, 67, 66, 65, 64, 63,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 56, 50, 162, 7, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157 162, 162, 162, 162, 162, 162, 162
} ; } ;
static yyconst short int yy_chk[294] = static yyconst short int yy_chk[298] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -466,31 +470,31 @@ static yyconst short int yy_chk[294] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 3, 9, 9, 3, 3, 3, 3, 1, 1, 1, 3, 9, 9, 3, 3, 3, 3,
3, 3, 4, 10, 10, 4, 4, 4, 4, 4, 3, 3, 4, 10, 10, 4, 4, 4, 4, 4,
4, 5, 5, 6, 6, 5, 159, 6, 14, 14, 4, 5, 5, 6, 6, 5, 164, 6, 14, 14,
14, 14, 14, 14, 16, 48, 48, 17, 16, 17, 14, 14, 14, 14, 16, 49, 49, 17, 16, 17,
17, 17, 17, 17, 17, 25, 25, 27, 27, 34, 17, 17, 17, 17, 17, 25, 25, 27, 27, 34,
158, 35, 25, 37, 36, 27, 35, 37, 155, 34, 163, 35, 25, 37, 36, 27, 35, 37, 160, 34,
36, 154, 34, 51, 51, 81, 81, 34, 43, 43, 36, 159, 34, 53, 53, 84, 84, 34, 44, 44,
43, 43, 43, 43, 49, 152, 49, 49, 49, 49, 44, 44, 44, 44, 51, 157, 51, 51, 51, 51,
49, 49, 52, 52, 52, 52, 52, 52, 53, 66, 51, 51, 54, 54, 54, 54, 54, 54, 55, 68,
53, 53, 53, 53, 53, 53, 62, 62, 62, 74, 55, 55, 55, 55, 55, 55, 64, 64, 64, 76,
83, 83, 105, 66, 66, 151, 150, 74, 149, 148, 86, 86, 108, 68, 68, 156, 155, 76, 154, 153,
147, 146, 145, 74, 144, 142, 139, 138, 105, 62, 152, 151, 150, 76, 149, 147, 144, 143, 108, 64,
79, 79, 79, 79, 79, 79, 84, 84, 84, 84, 81, 81, 81, 81, 81, 81, 87, 87, 87, 87,
84, 84, 137, 136, 135, 133, 132, 130, 129, 128, 87, 87, 142, 141, 140, 138, 137, 135, 134, 133,
127, 126, 124, 123, 116, 113, 112, 111, 109, 108, 131, 130, 128, 127, 120, 117, 116, 115, 114, 112,
106, 104, 103, 102, 98, 97, 96, 95, 94, 93, 111, 109, 107, 106, 105, 101, 100, 99, 98, 97,
88, 78, 77, 76, 75, 73, 72, 71, 70, 69, 96, 91, 83, 80, 79, 78, 77, 75, 74, 73,
68, 67, 65, 63, 60, 59, 58, 54, 47, 40, 72, 71, 70, 69, 67, 65, 62, 61, 60, 56,
39, 38, 33, 32, 31, 29, 28, 23, 7, 157, 50, 48, 40, 39, 38, 33, 32, 31, 29, 28,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 23, 11, 7, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
157, 157, 157 162, 162, 162, 162, 162, 162, 162
} ; } ;
@ -719,14 +723,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 158 ) if ( yy_current_state >= 163 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
*yy_state_ptr++ = yy_current_state; *yy_state_ptr++ = yy_current_state;
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 240 ); while ( yy_base[yy_current_state] != 244 );
yy_find_action: yy_find_action:
yy_current_state = *--yy_state_ptr; yy_current_state = *--yy_state_ptr;
@ -961,58 +965,68 @@ YY_RULE_SETUP
#line 66 "lex.l" #line 66 "lex.l"
{ return DOT; } { return DOT; }
YY_BREAK YY_BREAK
/* XXX: this lexing of register files is shady */
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
#line 69 "lex.l" #line 67 "lex.l"
{ return MINUS; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 68 "lex.l"
{ return ABS; }
YY_BREAK
/* XXX: this lexing of register files is shady */
case 41:
YY_RULE_SETUP
#line 71 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return ACCREG; return ACCREG;
} }
YY_BREAK YY_BREAK
case 40: case 42:
YY_RULE_SETUP YY_RULE_SETUP
#line 73 "lex.l" #line 75 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return ADDRESSREG; return ADDRESSREG;
} }
YY_BREAK YY_BREAK
case 41: case 43:
YY_RULE_SETUP YY_RULE_SETUP
#line 77 "lex.l" #line 79 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return MSGREG; return MSGREG;
} }
YY_BREAK YY_BREAK
case 42: case 44:
YY_RULE_SETUP YY_RULE_SETUP
#line 81 "lex.l" #line 83 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return FLAGREG; return FLAGREG;
} }
YY_BREAK YY_BREAK
case 43: case 45:
YY_RULE_SETUP YY_RULE_SETUP
#line 85 "lex.l" #line 87 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return GENREG; return GENREG;
} }
YY_BREAK YY_BREAK
case 44: case 46:
YY_RULE_SETUP YY_RULE_SETUP
#line 89 "lex.l" #line 91 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return CONTROLREG; return CONTROLREG;
} }
YY_BREAK YY_BREAK
case 45: case 47:
YY_RULE_SETUP YY_RULE_SETUP
#line 93 "lex.l" #line 95 "lex.l"
{ {
BEGIN(IN_REG); BEGIN(IN_REG);
return IPREG; return IPREG;
@ -1022,99 +1036,99 @@ YY_RULE_SETUP
* Lexing of register types should probably require the ":" symbol specified * Lexing of register types should probably require the ":" symbol specified
* in the BNF of the assembly, but our existing source didn't use that syntax. * in the BNF of the assembly, but our existing source didn't use that syntax.
*/ */
case 46:
YY_RULE_SETUP
#line 102 "lex.l"
{ BEGIN(INITIAL); return TYPE_UD; }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 103 "lex.l"
{ BEGIN(INITIAL); return TYPE_D; }
YY_BREAK
case 48: case 48:
YY_RULE_SETUP YY_RULE_SETUP
#line 104 "lex.l" #line 104 "lex.l"
{ BEGIN(INITIAL); return TYPE_UW; } { BEGIN(INITIAL); return TYPE_UD; }
YY_BREAK YY_BREAK
case 49: case 49:
YY_RULE_SETUP YY_RULE_SETUP
#line 105 "lex.l" #line 105 "lex.l"
{ BEGIN(INITIAL); return TYPE_W; } { BEGIN(INITIAL); return TYPE_D; }
YY_BREAK YY_BREAK
case 50: case 50:
YY_RULE_SETUP YY_RULE_SETUP
#line 106 "lex.l" #line 106 "lex.l"
{ BEGIN(INITIAL); return TYPE_UB; } { BEGIN(INITIAL); return TYPE_UW; }
YY_BREAK YY_BREAK
case 51: case 51:
YY_RULE_SETUP YY_RULE_SETUP
#line 107 "lex.l" #line 107 "lex.l"
{ BEGIN(INITIAL); return TYPE_B; } { BEGIN(INITIAL); return TYPE_W; }
YY_BREAK YY_BREAK
case 52: case 52:
YY_RULE_SETUP YY_RULE_SETUP
#line 108 "lex.l" #line 108 "lex.l"
{ BEGIN(INITIAL); return TYPE_F; } { BEGIN(INITIAL); return TYPE_UB; }
YY_BREAK YY_BREAK
case 53: case 53:
YY_RULE_SETUP YY_RULE_SETUP
#line 110 "lex.l" #line 109 "lex.l"
{ return SATURATE; } { BEGIN(INITIAL); return TYPE_B; }
YY_BREAK YY_BREAK
case 54: case 54:
YY_RULE_SETUP YY_RULE_SETUP
#line 111 "lex.l" #line 110 "lex.l"
{ return ALIGN1; } { BEGIN(INITIAL); return TYPE_F; }
YY_BREAK YY_BREAK
case 55: case 55:
YY_RULE_SETUP YY_RULE_SETUP
#line 112 "lex.l" #line 112 "lex.l"
{ return ALIGN16; } { return SATURATE; }
YY_BREAK YY_BREAK
case 56: case 56:
YY_RULE_SETUP YY_RULE_SETUP
#line 113 "lex.l" #line 113 "lex.l"
{ return MASK_DISABLE; } { return ALIGN1; }
YY_BREAK YY_BREAK
case 57: case 57:
YY_RULE_SETUP YY_RULE_SETUP
#line 114 "lex.l" #line 114 "lex.l"
{ return EOT; } { return ALIGN16; }
YY_BREAK YY_BREAK
case 58: case 58:
YY_RULE_SETUP YY_RULE_SETUP
#line 115 "lex.l"
{ return MASK_DISABLE; }
YY_BREAK
case 59:
YY_RULE_SETUP
#line 116 "lex.l" #line 116 "lex.l"
{ return EOT; }
YY_BREAK
case 60:
YY_RULE_SETUP
#line 118 "lex.l"
{ {
yylval.integer = atoi(yytext); yylval.integer = atoi(yytext);
return INTEGER; return INTEGER;
} }
YY_BREAK YY_BREAK
case 59: case 61:
YY_RULE_SETUP YY_RULE_SETUP
#line 121 "lex.l" #line 123 "lex.l"
{ {
yylval.number = strtod(yytext, NULL); yylval.number = strtod(yytext, NULL);
return NUMBER; return NUMBER;
} }
YY_BREAK YY_BREAK
case 60: case 62:
YY_RULE_SETUP
#line 126 "lex.l"
{ } /* eat up whitespace */
YY_BREAK
case 61:
YY_RULE_SETUP YY_RULE_SETUP
#line 128 "lex.l" #line 128 "lex.l"
{ } /* eat up whitespace */
YY_BREAK
case 63:
YY_RULE_SETUP
#line 130 "lex.l"
{ {
printf("parse error at line %d: unexpected \"%s\"\n", printf("parse error at line %d: unexpected \"%s\"\n",
yylineno, yytext); yylineno, yytext);
exit(1); exit(1);
} }
YY_BREAK YY_BREAK
case 62: case 64:
YY_RULE_SETUP YY_RULE_SETUP
#line 133 "lex.l" #line 135 "lex.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
@ -1407,7 +1421,7 @@ static yy_state_type yy_get_previous_state()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 158 ) if ( yy_current_state >= 163 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1437,11 +1451,11 @@ yy_state_type yy_current_state;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 158 ) if ( yy_current_state >= 163 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 157); yy_is_jam = (yy_current_state == 162);
if ( ! yy_is_jam ) if ( ! yy_is_jam )
*yy_state_ptr++ = yy_current_state; *yy_state_ptr++ = yy_current_state;
@ -2002,7 +2016,7 @@ int main()
return 0; return 0;
} }
#endif #endif
#line 133 "lex.l" #line 135 "lex.l"
char * char *

View File

@ -64,6 +64,8 @@ int saved_state = INITIAL;
"}" { return RCURLY; } "}" { return RCURLY; }
"," { return COMMA; } "," { return COMMA; }
"." { return DOT; } "." { return DOT; }
"-" { return MINUS; }
"(abs)" { return ABS; }
/* XXX: this lexing of register files is shady */ /* XXX: this lexing of register files is shady */
"acc" { "acc" {

View File

@ -62,8 +62,8 @@ add (1) g7.28<1>F g1.22<0,1,0>UW 1UB { align1 };
/* Now, map these screen space coordinates into texture coordinates. */ /* Now, map these screen space coordinates into texture coordinates. */
/* subtract screen-space X origin of vertex 0. */ /* subtract screen-space X origin of vertex 0. */
add (8) g4<1>F g4<8,8,1>F g1<0,1,0>F { align1 }; add (8) g4<1>F g4<8,8,1>F -g1<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F g1<0,1,0>F { align1 }; add (8) g5<1>F g5<8,8,1>F -g1<0,1,0>F { align1 };
/* scale by texture X increment */ /* scale by texture X increment */
mul (8) g4<1>F g4<8,8,1>F g3<0,1,0>F { align1 }; mul (8) g4<1>F g4<8,8,1>F g3<0,1,0>F { align1 };
mul (8) g5<1>F g5<8,8,1>F g3<0,1,0>F { align1 }; mul (8) g5<1>F g5<8,8,1>F g3<0,1,0>F { align1 };
@ -71,8 +71,8 @@ mul (8) g5<1>F g5<8,8,1>F g3<0,1,0>F { align1 };
add (8) g4<1>F g4<8,8,1>F g3.12<0,1,0>F { align1 }; add (8) g4<1>F g4<8,8,1>F g3.12<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F g3.12<0,1,0>F { align1 }; add (8) g5<1>F g5<8,8,1>F g3.12<0,1,0>F { align1 };
/* subtract screen-space Y origin of vertex 0. */ /* subtract screen-space Y origin of vertex 0. */
add (8) g6<1>F g6<8,8,1>F g1.4<0,1,0>F { align1 }; add (8) g6<1>F g6<8,8,1>F -g1.4<0,1,0>F { align1 };
add (8) g7<1>F g7<8,8,1>F g1.4<0,1,0>F { align1 }; add (8) g7<1>F g7<8,8,1>F -g1.4<0,1,0>F { align1 };
/* scale by texture Y increment */ /* scale by texture Y increment */
mul (8) g6<1>F g6<8,8,1>F g3.20<0,1,0>F { align1 }; mul (8) g6<1>F g6<8,8,1>F g3.20<0,1,0>F { align1 };
mul (8) g7<1>F g7<8,8,1>F g3.20<0,1,0>F { align1 }; mul (8) g7<1>F g7<8,8,1>F g3.20<0,1,0>F { align1 };