* config/bfin-parse.y (asm_1): Check value range for 16 bit immediate

in load immediate intruction.
This commit is contained in:
Jie Zhang 2006-01-20 17:22:50 +00:00
parent 39cd1c7675
commit b14273fe33
2 changed files with 20 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2006-01-21 Jie Zhang <jie.zhang@analog.com>
* config/bfin-parse.y (asm_1): Check value range for 16 bit immediate
in load immediate intruction.
2006-01-21 Jie Zhang <jie.zhang@analog.com> 2006-01-21 Jie Zhang <jie.zhang@analog.com>
* config/bfin-parse.y (value_match): Use correct conversion * config/bfin-parse.y (value_match): Use correct conversion

View File

@ -1221,24 +1221,21 @@ asm_1:
/* 7 bit immediate value if possible. /* 7 bit immediate value if possible.
We will check for that constant value for efficiency We will check for that constant value for efficiency
If it goes to reloc, it will be 16 bit. */ If it goes to reloc, it will be 16 bit. */
if (IS_CONST ($3) && IS_IMM ($3, 7) && (IS_DREG ($1) || IS_PREG ($1))) if (IS_CONST ($3) && IS_IMM ($3, 7) && IS_DREG ($1))
{ {
/* if the expr is a relocation, generate it. */ notethat ("COMPI2opD: dregs = imm7 (x) \n");
if (IS_DREG ($1) && IS_IMM ($3, 7)) $$ = COMPI2OPD (&$1, imm7 ($3), 0);
{ }
notethat ("COMPI2opD: dregs = imm7 (x) \n"); else if (IS_CONST ($3) && IS_IMM ($3, 7) && IS_PREG ($1))
$$ = COMPI2OPD (&$1, imm7 ($3), 0); {
} notethat ("COMPI2opP: pregs = imm7 (x)\n");
else if (IS_PREG ($1) && IS_IMM ($3, 7)) $$ = COMPI2OPP (&$1, imm7 ($3), 0);
{
notethat ("COMPI2opP: pregs = imm7 (x)\n");
$$ = COMPI2OPP (&$1, imm7 ($3), 0);
}
else
return yyerror ("Bad register or value for assigment");
} }
else else
{ {
if (IS_CONST ($3) && !IS_IMM ($3, 16))
return yyerror ("Immediate value out of range");
notethat ("LDIMMhalf: regs = luimm16 (x)\n"); notethat ("LDIMMhalf: regs = luimm16 (x)\n");
/* reg, H, S, Z. */ /* reg, H, S, Z. */
$$ = LDIMMHALF_R5 (&$1, 0, 1, 0, $3); $$ = LDIMMHALF_R5 (&$1, 0, 1, 0, $3);
@ -1248,6 +1245,10 @@ asm_1:
{ {
/* (z) There is no 7 bit zero extended instruction. /* (z) There is no 7 bit zero extended instruction.
If the expr is a relocation, generate it. */ If the expr is a relocation, generate it. */
if (IS_CONST ($3) && !IS_UIMM ($3, 16))
return yyerror ("Immediate value out of range");
notethat ("LDIMMhalf: regs = luimm16 (x)\n"); notethat ("LDIMMhalf: regs = luimm16 (x)\n");
/* reg, H, S, Z. */ /* reg, H, S, Z. */
$$ = LDIMMHALF_R5 (&$1, 0, 0, 1, $3); $$ = LDIMMHALF_R5 (&$1, 0, 0, 1, $3);