* config/tc-v850.c (md_assemble): Sign extend constants value

for hi and hi0 expressions.
        (v850_insert_operand): Enable range checking for generic 16bit
        operands.
finish work for pr12944.
This commit is contained in:
Jeff Law 1997-07-31 21:11:17 +00:00
parent 3745ac6db2
commit 15d8ae9d85
2 changed files with 28 additions and 6 deletions

View File

@ -1,4 +1,11 @@
start-sanitize-v850 start-sanitize-v850
Thu Jul 31 15:13:43 1997 Jeffrey A Law (law@cygnus.com)
* config/tc-v850.c (md_assemble): Sign extend constants value
for hi and hi0 expressions.
(v850_insert_operand): Enable range checking for generic 16bit
operands.
Tue Jul 29 14:20:43 1997 Jeffrey A Law (law@cygnus.com) Tue Jul 29 14:20:43 1997 Jeffrey A Law (law@cygnus.com)
* config/tc-v850.c (md_assemble): Turn on fx_no_overflow for * config/tc-v850.c (md_assemble): Turn on fx_no_overflow for

View File

@ -655,13 +655,28 @@ md_assemble (str)
} }
case BFD_RELOC_HI16: case BFD_RELOC_HI16:
ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff); {
break; /* Truncate, then sign extend the value. */
int temp = (ex.X_add_number >> 16) & 0xffff;
/* XXX Assumes 32bit ints! */
temp = (temp << 16) >> 16;
ex.X_add_number = temp;
break;
}
case BFD_RELOC_HI16_S: case BFD_RELOC_HI16_S:
ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff) {
+ ((ex.X_add_number >> 15) & 1); /* Truncate, then sign extend the value. */
break; int temp = (ex.X_add_number >> 16) & 0xffff;
temp += (ex.X_add_number >> 15) & 1;
/* XXX Assumes 32bit ints! */
temp = (temp << 16) >> 16;
ex.X_add_number = temp;
break;
}
default: default:
break; break;
@ -1062,7 +1077,7 @@ v850_insert_operand (insn, operand, val, file, line)
char *file; char *file;
unsigned int line; unsigned int line;
{ {
if (operand->bits != 16) if (operand->bits != 32)
{ {
long min, max; long min, max;
offsetT test; offsetT test;