diff options
author | Jeff Law <law@redhat.com> | 1997-07-31 21:11:17 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1997-07-31 21:11:17 +0000 |
commit | 15d8ae9d857326ccb9623c2c4ab8fe2ab8474049 (patch) | |
tree | 2cf41de8161a68d5e11ccb1c22b2800d378c966c /gas/config/tc-v850.c | |
parent | 3745ac6db2ecae6db35b5078b67813e7388e9a56 (diff) | |
download | gdb-15d8ae9d857326ccb9623c2c4ab8fe2ab8474049.zip gdb-15d8ae9d857326ccb9623c2c4ab8fe2ab8474049.tar.gz gdb-15d8ae9d857326ccb9623c2c4ab8fe2ab8474049.tar.bz2 |
* 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.
Diffstat (limited to 'gas/config/tc-v850.c')
-rw-r--r-- | gas/config/tc-v850.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 59dfb6c..5ee6528 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -655,13 +655,28 @@ md_assemble (str) } 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: - ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff) - + ((ex.X_add_number >> 15) & 1); - break; + { + /* Truncate, then sign extend the value. */ + 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: break; @@ -1062,7 +1077,7 @@ v850_insert_operand (insn, operand, val, file, line) char *file; unsigned int line; { - if (operand->bits != 16) + if (operand->bits != 32) { long min, max; offsetT test; |