diff options
author | Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> | 2015-11-12 10:50:22 +0000 |
---|---|---|
committer | Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> | 2015-11-12 10:52:03 +0000 |
commit | 582cfe03cb7496371bc6d83af49b6324d0c36887 (patch) | |
tree | 3382604cc2f568865f25f1239cbb3bd098b76236 /gas/config | |
parent | df3b6708fe2384913e66d90340b619190cc4530e (diff) | |
download | gdb-582cfe03cb7496371bc6d83af49b6324d0c36887.zip gdb-582cfe03cb7496371bc6d83af49b6324d0c36887.tar.gz gdb-582cfe03cb7496371bc6d83af49b6324d0c36887.tar.bz2 |
Fix PR gas/19217
2015-11-11 Matthew Wahab <matthew.wahab@arm.com>
PR gas/19217
* config/tc-arm.c (move_or_literal_pool): Remove redundant feature
check. Fix some code formatting. Drop use of MOVT. Add some
comments.
2015-11-11 Matthew Wahab <matthew.wahab@arm.com>
PR gas/19217
* gas/arm/thumb2_ldr_immediate_armv6t2.d: Update expected output.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arm.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index e33a77f..5a8ac95 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -7847,10 +7847,10 @@ move_or_literal_pool (int i, enum lit_type t, bfd_boolean mode_3) return TRUE; } - if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_arch_t2) - && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2)) + if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_arch_t2)) { - /* Check if on thumb2 it can be done with a mov.w or mvn.w instruction. */ + /* Check if on thumb2 it can be done with a mov.w or mvn.w + instruction. */ unsigned int newimm; bfd_boolean isNegated; @@ -7859,36 +7859,27 @@ move_or_literal_pool (int i, enum lit_type t, bfd_boolean mode_3) isNegated = FALSE; else { - newimm = encode_thumb32_immediate (~ v); + newimm = encode_thumb32_immediate (~v); if (newimm != (unsigned int) FAIL) isNegated = TRUE; } if (newimm != (unsigned int) FAIL) { - inst.instruction = 0xf04f0000 | (inst.operands[i].reg << 8); - inst.instruction |= (isNegated?0x200000:0); + inst.instruction = (0xf04f0000 + | (inst.operands[i].reg << 8)); + inst.instruction |= (isNegated ? 0x200000 : 0); inst.instruction |= (newimm & 0x800) << 15; inst.instruction |= (newimm & 0x700) << 4; inst.instruction |= (newimm & 0x0ff); return TRUE; } - else if ((v & ~0xFFFF) == 0 || (v & ~0xFFFF0000) == 0) + else if ((v & ~0xFFFF) == 0) { - /* The number may be loaded with a movw/movt instruction. */ - int imm; - - if ((inst.reloc.exp.X_add_number & ~0xFFFF) == 0) - { - inst.instruction= 0xf2400000; - imm = v; - } - else - { - inst.instruction = 0xf2c00000; - imm = v >> 16; - } + /* The number can be loaded with a mov.w instruction. */ + int imm = v & 0xFFFF; + inst.instruction = 0xf2400000; /* MOVW. */ inst.instruction |= (inst.operands[i].reg << 8); inst.instruction |= (imm & 0xf000) << 4; inst.instruction |= (imm & 0x0800) << 15; |