X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Ftilepro-opc.c;h=dbe0605e0c6e4d9960cc473758a5588a972961e0;hb=708a2ffff5cc2d280968a6b28268d8276d391bb4;hp=d62b03e80933a6f2000d3d6776850f08f2186669;hpb=4b95cf5c0c75d6efc1b2f96af72317aecca079f1;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/tilepro-opc.c b/opcodes/tilepro-opc.c index d62b03e809..dbe0605e0c 100644 --- a/opcodes/tilepro-opc.c +++ b/opcodes/tilepro-opc.c @@ -1,6 +1,6 @@ /* TILEPro opcode information. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10215,21 +10215,18 @@ parse_insn_tilepro (tilepro_bundle_bits bits, { const struct tilepro_operand *op = &tilepro_operands[opc->operands[pipe][i]]; - int opval = op->extract (bits); + unsigned int opval = op->extract (bits); if (op->is_signed) { /* Sign-extend the operand. */ - int shift = (int)((sizeof(int) * 8) - op->num_bits); - opval = (opval << shift) >> shift; + unsigned int sign = 1u << (op->num_bits - 1); + opval = ((opval & (sign + sign - 1)) ^ sign) - sign; } /* Adjust PC-relative scaled branch offsets. */ if (op->type == TILEPRO_OP_TYPE_ADDRESS) - { - opval *= TILEPRO_BUNDLE_SIZE_IN_BYTES; - opval += (int)pc; - } + opval = opval * TILEPRO_BUNDLE_SIZE_IN_BYTES + pc; /* Record the final value. */ d->operands[i] = op;