+2021-06-08 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (optimize_imm): Use fits_in_unsigned_word
+ and fits_in_unsigned_long.
+
2021-06-08 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (optimize_disp): Use fits_in_unsigned_word
This allows a 16-bit operand such as $0xffe0 to
be recognised as within Imm8S range. */
if ((i.types[op].bitfield.imm16)
- && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0)
+ && fits_in_unsigned_word (i.op[op].imms->X_add_number))
{
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
^ 0x8000) - 0x8000);
#ifdef BFD64
/* Store 32-bit immediate in 64-bit for 64-bit BFD. */
if ((i.types[op].bitfield.imm32)
- && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
- == 0))
+ && fits_in_unsigned_long (i.op[op].imms->X_add_number))
{
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
^ ((offsetT) 1 << 31))