Fix occurrences of left-shifting negative constants in C code.
sim/arm/ChangeLog:
* thumbemu.c (handle_T2_insn): Fix left shift of negative value.
* armemu.c (handle_v6_insn): Likewise.
sim/avr/ChangeLog:
* interp.c (sign_ext): Fix left shift of negative value.
sim/mips/ChangeLog:
* micromips.igen (process_isa_mode): Fix left shift of negative
value.
sim/msp430/ChangeLog:
* msp430-sim.c (get_op, put_op): Fix left shift of negative value.
sim/v850/ChangeLog:
* simops.c (v850_bins): Fix left shift of negative value.
+2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * thumbemu.c (handle_T2_insn): Fix left shift of negative value.
+ * armemu.c (handle_v6_insn): Likewise.
+
2015-11-14 Mike Frysinger <vapier@gentoo.org>
* wrapper.c (sim_close): Delete.
{
n = (val1 >> i) & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = (val2 >> i) & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n + m;
case 0xF3: /* QASX<c> <Rd>,<Rn>,<Rm>. */
n = val1 & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = (val2 >> 16) & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n - m;
n = (val1 >> 16) & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = val2 & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n + m;
case 0xF5: /* QSAX<c> <Rd>,<Rn>,<Rm>. */
n = val1 & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = (val2 >> 16) & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n + m;
n = (val1 >> 16) & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = val2 & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n - m;
{
n = (val1 >> i) & 0xFFFF;
if (n & 0x8000)
- n |= -1 << 16;
+ n |= -(1 << 16);
m = (val2 >> i) & 0xFFFF;
if (m & 0x8000)
- m |= -1 << 16;
+ m |= -(1 << 16);
r = n - m;
{
n = (val1 >> i) & 0xFF;
if (n & 0x80)
- n |= -1 << 8;
+ n |= - (1 << 8);
m = (val2 >> i) & 0xFF;
if (m & 0x80)
- m |= -1 << 8;
+ m |= - (1 << 8);
r = n + m;
{
n = (val1 >> i) & 0xFF;
if (n & 0x80)
- n |= -1 << 8;
+ n |= - (1 << 8);
m = (val2 >> i) & 0xFF;
if (m & 0x80)
- m |= -1 << 8;
+ m |= - (1 << 8);
r = n - m;
state->Emulate = FALSE;
}
- mask = -1 << lsb;
- mask &= ~(-1 << (msb + 1));
+ mask = -(1 << lsb);
+ mask &= ~(-(1 << (msb + 1)));
state->Reg[Rd] &= ~ mask;
Rn = BITS (0, 3);
if (Rn != 0xF)
{
- ARMword val = state->Reg[Rn] & ~(-1 << ((msb + 1) - lsb));
+ ARMword val = state->Reg[Rn] & ~(-(1 << ((msb + 1) - lsb)));
state->Reg[Rd] |= val << lsb;
}
return 1;
val = state->Reg[Rn];
val >>= lsb;
- val &= ~(-1 << (widthm1 + 1));
+ val &= ~(-(1 << (widthm1 + 1)));
state->Reg[Rd] = val;
simm32 = (J1 << 19) | (J2 << 18) | (imm6 << 12) | (imm11 << 1);
if (S)
- simm32 |= (-1 << 20);
+ simm32 |= -(1 << 20);
break;
}
simm32 = (I1 << 23) | (I2 << 22) | (imm10 << 12) | (imm11 << 1);
if (S)
- simm32 |= (-1 << 24);
+ simm32 |= -(1 << 24);
break;
}
simm32 = (I1 << 23) | (I2 << 22) | (imm10h << 12) | (imm10l << 2);
if (S)
- simm32 |= (-1 << 24);
+ simm32 |= -(1 << 24);
CLEART;
state->Reg[14] = (pc + 4) | 1;
simm32 = (I1 << 23) | (I2 << 22) | (imm10 << 12) | (imm11 << 1);
if (S)
- simm32 |= (-1 << 24);
+ simm32 |= -(1 << 24);
state->Reg[14] = (pc + 4) | 1;
break;
}
ARMword Rn = tBITS (0, 3);
ARMword msbit = ntBITS (0, 5);
ARMword lsbit = (ntBITS (12, 14) << 2) | ntBITS (6, 7);
- ARMword mask = -1 << lsbit;
+ ARMword mask = -(1 << lsbit);
tASSERT (tBIT (4) == 0);
tASSERT (ntBIT (15) == 0);
state->Reg[Rt] = ARMul_LoadByte (state, address);
if (state->Reg[Rt] & 0x80)
- state->Reg[Rt] |= -1 << 8;
+ state->Reg[Rt] |= -(1 << 8);
* pvalid = t_resolved;
break;
state->Reg[Rt] = ARMul_LoadHalfWord (state, address);
if (state->Reg[Rt] & 0x8000)
- state->Reg[Rt] |= -1 << 16;
+ state->Reg[Rt] |= -(1 << 16);
* pvalid = t_branch;
break;
val = state->Reg[Rm];
val = (val >> ror) | (val << (32 - ror));
if (val & 0x8000)
- val |= -1 << 16;
+ val |= -(1 << 16);
state->Reg[Rd] = val;
}
else
+2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * interp.c (sign_ext): Fix left shift of negative value.
+
2015-11-21 Mike Frysinger <vapier@gentoo.org>
* interp.c (pc, cycles, avr_pc22): Delete.
static int sign_ext (word val, int nb_bits)
{
if (val & (1 << (nb_bits - 1)))
- return val | (-1 << nb_bits);
+ return val | -(1 << nb_bits);
return val;
}
+2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * micromips.igen (process_isa_mode): Fix left shift of negative
+ value.
+
2015-11-17 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (WITH_MODULO_MEMORY): Delete.
:function:::address_word:process_isa_mode:address_word target
{
SD->isa_mode = target & 0x1;
- return (target & (-1 << 1));
+ return (target & (-(1 << 1)));
}
:function:::address_word:do_micromips_jalr:int rt, int rs, address_word nia, int delayslot_instruction_size
+2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * msp430-sim.c (get_op, put_op): Fix left shift of negative value.
+
2015-12-07 Nick Clifton <nickc@redhat.com>
* msp430-sim.c (sim_open): Check for needed memory at address
/* Index values are signed. */
if (addr & (1 << (sign - 1)))
- addr |= -1 << sign;
+ addr |= -(1 << sign);
addr += reg;
/* Index values are signed. */
if (addr & (1 << (sign - 1)))
- addr |= -1 << sign;
+ addr |= -(1 << sign);
addr += reg;
+2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * simops.c (v850_bins): Fix left shift of negative value.
+
2015-11-17 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (WITH_CORE): Delete.
pos = lsb;
width = (msb - lsb) + 1;
- mask = ~ (-1 << width);
+ mask = ~ (-(1 << width));
source &= mask;
mask <<= pos;
result = (* dest) & ~ mask;