mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-28 12:24:04 +08:00
* config/tc-d30v.c (check_range): Allow signed or unsigned 32-bit
quantities. Correct right shift sign extension. (build_insn): Make `number' unsigned long. Mask top 6 bits of 32-bit value when shifting into place.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2000-04-02 Richard Henderson <rth@cygnus.com>
|
||||||
|
|
||||||
|
* config/tc-d30v.c (check_range): Allow signed or unsigned 32-bit
|
||||||
|
quantities. Correct right shift sign extension.
|
||||||
|
(build_insn): Make `number' unsigned long. Mask top 6 bits of
|
||||||
|
32-bit value when shifting into place.
|
||||||
|
|
||||||
2000-04-01 Ian Lance Taylor <ian@zembu.com>
|
2000-04-01 Ian Lance Taylor <ian@zembu.com>
|
||||||
|
|
||||||
* app.c: Add ATTRIBUTE_UNUSED as needed.
|
* app.c: Add ATTRIBUTE_UNUSED as needed.
|
||||||
|
@ -241,11 +241,19 @@ check_range (num, bits, flags)
|
|||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
long min, max;
|
long min, max;
|
||||||
int retval=0;
|
|
||||||
|
|
||||||
/* don't bother checking 32-bit values */
|
/* Don't bother checking 32-bit values. */
|
||||||
if (bits == 32 && sizeof(unsigned long) * CHAR_BIT == 32)
|
if (bits == 32)
|
||||||
return 0;
|
{
|
||||||
|
if (sizeof(unsigned long) * CHAR_BIT == 32)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* We don't record signed or unsigned for 32-bit quantities.
|
||||||
|
Allow either. */
|
||||||
|
min = -((unsigned long)1 << (bits - 1));
|
||||||
|
max = ((unsigned long)1 << bits) - 1;
|
||||||
|
return (long)num < min || (long)num > max;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & OPERAND_SHIFT)
|
if (flags & OPERAND_SHIFT)
|
||||||
{
|
{
|
||||||
@ -254,7 +262,7 @@ check_range (num, bits, flags)
|
|||||||
if (flags & OPERAND_SIGNED)
|
if (flags & OPERAND_SIGNED)
|
||||||
num = (unsigned long) ( (long) num >= 0)
|
num = (unsigned long) ( (long) num >= 0)
|
||||||
? ( ((long) num) >> 3 )
|
? ( ((long) num) >> 3 )
|
||||||
: ( (num >> 3) | ((unsigned long)-1 << (32 - 3)) );
|
: ( (num >> 3) | ~(~(unsigned long)0 >> 3) );
|
||||||
else
|
else
|
||||||
num >>= 3;
|
num >>= 3;
|
||||||
}
|
}
|
||||||
@ -263,18 +271,14 @@ check_range (num, bits, flags)
|
|||||||
{
|
{
|
||||||
max = ((unsigned long)1 << (bits - 1)) - 1;
|
max = ((unsigned long)1 << (bits - 1)) - 1;
|
||||||
min = - ((unsigned long)1 << (bits - 1));
|
min = - ((unsigned long)1 << (bits - 1));
|
||||||
if (((long)num > max) || ((long)num < min))
|
return (long)num > max || (long)num < min;
|
||||||
retval = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
max = ((unsigned long)1 << bits) - 1;
|
max = ((unsigned long)1 << bits) - 1;
|
||||||
min = 0;
|
min = 0;
|
||||||
if ((num > max) || (num < min))
|
return num > max || num < min;
|
||||||
retval = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,7 +582,7 @@ build_insn (opcode, opers)
|
|||||||
expressionS *opers;
|
expressionS *opers;
|
||||||
{
|
{
|
||||||
int i, length, bits, shift, flags;
|
int i, length, bits, shift, flags;
|
||||||
unsigned int number, id=0;
|
unsigned long number, id=0;
|
||||||
long long insn;
|
long long insn;
|
||||||
struct d30v_opcode *op = opcode->op;
|
struct d30v_opcode *op = opcode->op;
|
||||||
struct d30v_format *form = opcode->form;
|
struct d30v_format *form = opcode->form;
|
||||||
@ -653,10 +657,10 @@ build_insn (opcode, opers)
|
|||||||
if (bits == 32)
|
if (bits == 32)
|
||||||
{
|
{
|
||||||
/* it's a LONG instruction */
|
/* it's a LONG instruction */
|
||||||
insn |= (number >> 26); /* top 6 bits */
|
insn |= ((number & 0xffffffff) >> 26); /* top 6 bits */
|
||||||
insn <<= 32; /* shift the first word over */
|
insn <<= 32; /* shift the first word over */
|
||||||
insn |= ((number & 0x03FC0000) << 2); /* next 8 bits */
|
insn |= ((number & 0x03FC0000) << 2); /* next 8 bits */
|
||||||
insn |= number & 0x0003FFFF; /* bottom 18 bits */
|
insn |= number & 0x0003FFFF; /* bottom 18 bits */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
insn |= number << shift;
|
insn |= number << shift;
|
||||||
|
Reference in New Issue
Block a user