summaryrefslogtreecommitdiff
path: root/assembler
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-08-22 13:33:41 -0700
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:20 +0000
commit0d929b430b301859d775c05f4687db1665a1f6f9 (patch)
tree6bd4edf12e733609f5c826bdc3bd093ccf4e4e93 /assembler
parent0edcb2561d5ccde869b6f3b67479de37a62ceeb6 (diff)
Fix imm32 translation.
Diffstat (limited to 'assembler')
-rw-r--r--assembler/gram.y46
1 files changed, 26 insertions, 20 deletions
diff --git a/assembler/gram.y b/assembler/gram.y
index 5c56d5be5..fdbd8c1df 100644
--- a/assembler/gram.y
+++ b/assembler/gram.y
@@ -80,7 +80,7 @@
%type <instruction> binaryaccinstruction triinstruction sendinstruction
%type <instruction> specialinstruction
%type <instruction> dst dstoperand dstoperandex dstreg
-%type <instruction> directsrcaccoperand src directsrcoperand srcimm
+%type <instruction> directsrcaccoperand src directsrcoperand srcimm imm32reg
%type <instruction> srcacc srcaccimm
%type <instruction> instoptions instoption_list
%type <program> instrseq
@@ -270,32 +270,19 @@ dstreg: directgenreg
;
/* 1.4.3: Source register */
-srcaccimm: srcacc
- | imm32 srcimmtype
- {
- $$.bits1.da1.src0_reg_file = BRW_IMMEDIATE_VALUE;
- switch ($2) {
- case BRW_REGISTER_TYPE_UD:
- $$.bits3.ud = $1;
- break;
- case BRW_REGISTER_TYPE_D:
- $$.bits3.id = $1;
- break;
- case BRW_REGISTER_TYPE_F:
- $$.bits3.fd = $1;
- break;
- }
- }
+srcaccimm: srcacc | imm32reg
;
/* XXX: indirectsrcaccoperand */
srcacc: directsrcaccoperand
;
-srcimm: directsrcoperand
- | imm32 srcimmtype
+srcimm: directsrcoperand | imm32reg
+
+imm32reg: imm32 srcimmtype
{
$$.bits1.da1.src0_reg_file = BRW_IMMEDIATE_VALUE;
+ $$.bits1.da1.src0_reg_type = $2;
switch ($2) {
case BRW_REGISTER_TYPE_UD:
$$.bits3.ud = $1;
@@ -303,9 +290,28 @@ srcimm: directsrcoperand
case BRW_REGISTER_TYPE_D:
$$.bits3.id = $1;
break;
+ case BRW_REGISTER_TYPE_UW:
+ $$.bits3.ud = $1;
+ break;
+ case BRW_REGISTER_TYPE_W:
+ $$.bits3.id = $1;
+ break;
+ case BRW_REGISTER_TYPE_UB:
+ $$.bits3.ud = $1;
+ /* There is no native byte immediate type */
+ $$.bits1.da1.src0_reg_type = BRW_REGISTER_TYPE_UD;
+ break;
+ case BRW_REGISTER_TYPE_B:
+ $$.bits3.id = $1;
+ /* There is no native byte immediate type */
+ $$.bits1.da1.src0_reg_type = BRW_REGISTER_TYPE_D;
+ break;
case BRW_REGISTER_TYPE_F:
$$.bits3.fd = $1;
break;
+ default:
+ fprintf(stderr, "unknown immediate type %d\n", $2);
+ YYERROR;
}
}
;
@@ -427,7 +433,7 @@ regtype: TYPE_F { $$ = BRW_REGISTER_TYPE_F; }
| TYPE_UD { $$ = BRW_REGISTER_TYPE_UD; }
| TYPE_D { $$ = BRW_REGISTER_TYPE_D; }
| TYPE_UW { $$ = BRW_REGISTER_TYPE_UW; }
- | TYPE_W { $$ = BRW_REGISTER_TYPE_UW; }
+ | TYPE_W { $$ = BRW_REGISTER_TYPE_W; }
| TYPE_UB { $$ = BRW_REGISTER_TYPE_UB; }
| TYPE_B { $$ = BRW_REGISTER_TYPE_B; }
/* XXX: Add TYPE_VF and TYPE_HF */