aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2006-01-20 17:22:50 +0000
committerJie Zhang <jie.zhang@analog.com>2006-01-20 17:22:50 +0000
commitb14273fe3337c98feafab588b6def21fa6ac76da (patch)
treec394052c55c81c917d38105ca0a6d989bdc2b441 /gas
parent39cd1c7675f07c2dfbde11baaaea28d8899fa51f (diff)
downloadfsf-binutils-gdb-b14273fe3337c98feafab588b6def21fa6ac76da.zip
fsf-binutils-gdb-b14273fe3337c98feafab588b6def21fa6ac76da.tar.gz
fsf-binutils-gdb-b14273fe3337c98feafab588b6def21fa6ac76da.tar.bz2
* config/bfin-parse.y (asm_1): Check value range for 16 bit immediate
in load immediate intruction.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/bfin-parse.y29
2 files changed, 20 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d62394e..8dc8025 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
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>
+
* config/bfin-parse.y (value_match): Use correct conversion
specifications in template string for __FILE__ and __LINE__.
(binary): Ditto.
diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y
index 38c3f6e..f1e4887 100644
--- a/gas/config/bfin-parse.y
+++ b/gas/config/bfin-parse.y
@@ -1221,24 +1221,21 @@ asm_1:
/* 7 bit immediate value if possible.
We will check for that constant value for efficiency
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. */
- if (IS_DREG ($1) && IS_IMM ($3, 7))
- {
- notethat ("COMPI2opD: dregs = imm7 (x) \n");
- $$ = COMPI2OPD (&$1, imm7 ($3), 0);
- }
- else if (IS_PREG ($1) && IS_IMM ($3, 7))
- {
- notethat ("COMPI2opP: pregs = imm7 (x)\n");
- $$ = COMPI2OPP (&$1, imm7 ($3), 0);
- }
- else
- return yyerror ("Bad register or value for assigment");
+ notethat ("COMPI2opD: dregs = imm7 (x) \n");
+ $$ = COMPI2OPD (&$1, imm7 ($3), 0);
+ }
+ else if (IS_CONST ($3) && IS_IMM ($3, 7) && IS_PREG ($1))
+ {
+ notethat ("COMPI2opP: pregs = imm7 (x)\n");
+ $$ = COMPI2OPP (&$1, imm7 ($3), 0);
}
else
{
+ if (IS_CONST ($3) && !IS_IMM ($3, 16))
+ return yyerror ("Immediate value out of range");
+
notethat ("LDIMMhalf: regs = luimm16 (x)\n");
/* reg, H, S, Z. */
$$ = LDIMMHALF_R5 (&$1, 0, 1, 0, $3);
@@ -1248,6 +1245,10 @@ asm_1:
{
/* (z) There is no 7 bit zero extended instruction.
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");
/* reg, H, S, Z. */
$$ = LDIMMHALF_R5 (&$1, 0, 0, 1, $3);