diff options
author | Nick Clifton <nickc@redhat.com> | 2001-06-27 08:15:52 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2001-06-27 08:15:52 +0000 |
commit | d827344236a4e852e15a74dfd23490c1fc2ac139 (patch) | |
tree | 2f857a26536459a8b470f2118b8d783e1d3230f1 /gas/config/tc-arm.c | |
parent | 1a16aca4b4da5fdb8613b3b0ee4285db7d9d26ce (diff) | |
download | gdb-d827344236a4e852e15a74dfd23490c1fc2ac139.zip gdb-d827344236a4e852e15a74dfd23490c1fc2ac139.tar.gz gdb-d827344236a4e852e15a74dfd23490c1fc2ac139.tar.bz2 |
Use MVN to build simple inverted constants.
Diffstat (limited to 'gas/config/tc-arm.c')
-rw-r--r-- | gas/config/tc-arm.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 57a82ef..da8ffc0 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -4413,38 +4413,53 @@ do_ldst (str, flags) return; } - if (inst.reloc.exp.X_op == O_constant - && (value = validate_immediate (inst.reloc.exp.X_add_number)) != FAIL) - { - /* This can be done with a mov instruction. */ - inst.instruction &= LITERAL_MASK; - inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT); - inst.instruction |= (flags & COND_MASK) | (value & 0xfff); - end_of_line (str); - return; - } - else + if (inst.reloc.exp.X_op == O_constant) { - /* Insert into literal pool. */ - if (add_to_lit_pool () == FAIL) + value = validate_immediate (inst.reloc.exp.X_add_number); + + if (value != FAIL) { - if (!inst.error) - inst.error = _("literal pool insertion failed"); + /* This can be done with a mov instruction. */ + inst.instruction &= LITERAL_MASK; + inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT); + inst.instruction |= (flags & COND_MASK) | (value & 0xfff); + end_of_line (str); return; } + + value = validate_immediate (~ inst.reloc.exp.X_add_number); - /* Change the instruction exp to point to the pool. */ - if (halfword) + if (value != FAIL) { - inst.instruction |= HWOFFSET_IMM; - inst.reloc.type = BFD_RELOC_ARM_HWLITERAL; + /* 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; } - else - inst.reloc.type = BFD_RELOC_ARM_LITERAL; - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = 1; } + + /* Insert into literal pool. */ + if (add_to_lit_pool () == FAIL) + { + if (!inst.error) + inst.error = _("literal pool insertion failed"); + return; + } + + /* Change the instruction exp to point to the pool. */ + if (halfword) + { + inst.instruction |= HWOFFSET_IMM; + inst.reloc.type = BFD_RELOC_ARM_HWLITERAL; + } + else + inst.reloc.type = BFD_RELOC_ARM_LITERAL; + + inst.reloc.pc_rel = 1; + inst.instruction |= (REG_PC << 16); + pre_inc = 1; } else { |