Use MVN to build simple inverted constants.

This commit is contained in:
Nick Clifton 2001-06-27 08:15:52 +00:00
parent 1a16aca4b4
commit d827344236
2 changed files with 44 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2001-06-27 Nick Clifton <nickc@cambridge.redhat.com>
* config/tc-arm.c (do_ldst): Use MVN to build simple inverted
constants.
2001-06-27 Alan Modra <amodra@bigpond.net.au> 2001-06-27 Alan Modra <amodra@bigpond.net.au>
* write.c (fixup_segment <Difference of 2 syms same seg>): Don't * write.c (fixup_segment <Difference of 2 syms same seg>): Don't

View File

@ -4413,8 +4413,11 @@ do_ldst (str, flags)
return; return;
} }
if (inst.reloc.exp.X_op == O_constant if (inst.reloc.exp.X_op == O_constant)
&& (value = validate_immediate (inst.reloc.exp.X_add_number)) != FAIL) {
value = validate_immediate (inst.reloc.exp.X_add_number);
if (value != FAIL)
{ {
/* This can be done with a mov instruction. */ /* This can be done with a mov instruction. */
inst.instruction &= LITERAL_MASK; inst.instruction &= LITERAL_MASK;
@ -4423,8 +4426,20 @@ do_ldst (str, flags)
end_of_line (str); end_of_line (str);
return; return;
} }
else
value = validate_immediate (~ inst.reloc.exp.X_add_number);
if (value != FAIL)
{ {
/* This can be done with a mvn instruction. */
inst.instruction &= LITERAL_MASK;
inst.instruction |= INST_IMMEDIATE | (OPCODE_MVN << DATA_OP_SHIFT);
inst.instruction |= (flags & COND_MASK) | (value & 0xfff);
end_of_line (str);
return;
}
}
/* Insert into literal pool. */ /* Insert into literal pool. */
if (add_to_lit_pool () == FAIL) if (add_to_lit_pool () == FAIL)
{ {
@ -4441,11 +4456,11 @@ do_ldst (str, flags)
} }
else else
inst.reloc.type = BFD_RELOC_ARM_LITERAL; inst.reloc.type = BFD_RELOC_ARM_LITERAL;
inst.reloc.pc_rel = 1; inst.reloc.pc_rel = 1;
inst.instruction |= (REG_PC << 16); inst.instruction |= (REG_PC << 16);
pre_inc = 1; pre_inc = 1;
} }
}
else else
{ {
if (my_get_expression (&inst.reloc.exp, &str)) if (my_get_expression (&inst.reloc.exp, &str))