aboutsummaryrefslogtreecommitdiff
path: root/opcodes/frv-asm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-12-15 10:21:51 +0000
committerNick Clifton <nickc@redhat.com>2011-12-15 10:21:51 +0000
commit5011093dd0015bc0eaff522b4e0a18250725d4b4 (patch)
treeda04ec25c27553e8690c4029cb23fea59cdb2f9c /opcodes/frv-asm.c
parent370a075d4837b62334a012279faaa95cf8028f51 (diff)
downloadgdb-5011093dd0015bc0eaff522b4e0a18250725d4b4.zip
gdb-5011093dd0015bc0eaff522b4e0a18250725d4b4.tar.gz
gdb-5011093dd0015bc0eaff522b4e0a18250725d4b4.tar.bz2
* frv.opc (parse_uhi16): Fix handling of %hi operator on 64-bit
hosts. * cgen-asm.c (cgen_parse_signed_integer): Add code to handle the sign extension of negative values on a 64-bit host. * frv-asm.c: Regenerate. * gas/frv/immediates.s: New test file - checks assembly of constant values. * gas/frv/immediates.d: Expected disassmbly. * gas/frv/allinsn.exp: Run the new test.
Diffstat (limited to 'opcodes/frv-asm.c')
-rw-r--r--opcodes/frv-asm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c
index dffa059..3da8261 100644
--- a/opcodes/frv-asm.c
+++ b/opcodes/frv-asm.c
@@ -465,11 +465,11 @@ parse_uhi16 (CGEN_CPU_DESC cd,
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{
- /* If bfd_vma is wider than 32 bits, but we have a sign-
- or zero-extension, truncate it. */
- if (value >= - ((bfd_vma)1 << 31)
- || value <= ((bfd_vma)1 << 31) - (bfd_vma)1)
- value &= (((bfd_vma)1 << 16) << 16) - 1;
+ /* If value is wider than 32 bits then be
+ careful about how we extract bits 16-31. */
+ if (sizeof (value) > 4)
+ value &= (((bfd_vma)1 << 16) << 16) - 1;
+
value >>= 16;
}
*valuep = value;