This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ARM][PR gas/19217] Fix wrong use of MOVT to replace LDR
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Matthew Wahab <matthew dot wahab at foss dot arm dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Nick Clifton <nickc at redhat dot com>
- Date: Thu, 12 Nov 2015 10:28:42 +0000
- Subject: Re: [ARM][PR gas/19217] Fix wrong use of MOVT to replace LDR
- Authentication-results: sourceware.org; auth=none
- References: <564463D4 dot 6000908 at foss dot arm dot com>
On Thu, Nov 12, 2015 at 10:03 AM, Matthew Wahab
<matthew.wahab@foss.arm.com> wrote:
> Hello,
>
> PR gas/18499 implemented an optimization in which a load-immediate (LDR
> _, =<imm>) was replaced by a MOVW if the bottom half of <imm> was
> non-zero or by a MOVT if the top half was non-zero
>
> This optimization is wrong because, unlike the LDR, the MOVT leaves
> the bottom half of the destination register unchanged. The
> implementation also doesn't deal with the case when the immediate is
> non-zero in both halves. In that case, the LDR would have to be replaced
> with a MOVW+MOVT sequence.
Yep.
>
> The use of MOVT appears to be the cause of PR gas/19217. This patch
> fixes that miscompilation by dropping the use of MOVT, so that the LDR _,
> =<imm> will only be replaced by MOVW and only if the upper half of <imm>
> is zero. It also removes a redundant feature check and fixes some
> formatting in the code.
>
> Tested arm-none-linux-gnueabihf with cross-compiled check-binutils and
> check-gas.
>
> Ok for trunk?
Ok.
regards
Ramana
> Matthew
>
> gas/
> 2015-11-11 Matthew Wahab <matthew.wahab@arm.com>
>
> * config/tc-arm.c (move_or_literal_pool): Remove redundant feature
> check. Fix some code formatting. Drop use of MOVT. Add some
> comments.
>
> gas/testsuite/
> 2015-11-11 Matthew Wahab <matthew.wahab@arm.com>
>
> * gas/arm/thumb2_ldr_immediate_armv6t2.d: Update expected output.