Bug 16722

Summary: arm: literal pool syntax for vldr is broken
Product: binutils Reporter: Will Newton <will.newton>
Component: gasAssignee: Jiong. Wang <wong.kwongyuan>
Status: RESOLVED FIXED    
Severity: minor CC: gregory.0xf0, wong.kwongyuan
Priority: P2    
Version: 2.25   
Target Milestone: ---   
Host: Target: arm
Build: Last reconfirmed:

Description Will Newton 2014-03-18 15:15:04 UTC
Using the literal pool syntax with the vldr instruction works in an unexpected way:

[will@localhost gas]$ cat lit.s
	.text
	vldr d0, =0xffff
[will@localhost gas]$ ./as-new -mfpu=neon lit.s
[will@localhost gas]$ ../binutils/objdump -d a.out 

a.out:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:	ed900b00 	vldr	d0, [r0]
Comment 1 Jiong. Wang 2014-04-11 17:47:40 UTC
generally, "encode_arm_cp_address" need to invoke "move_or_literal_pool" which need to extend the support to vmov also.
Comment 2 Sourceware Commits 2014-07-08 11:17:52 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  8335d6aa34b88ce31b62e1b578d54ab4aa364435 (commit)
      from  bffebb6ba5b4ddbca7353626d682f9f974584dbf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8335d6aa34b88ce31b62e1b578d54ab4aa364435

commit 8335d6aa34b88ce31b62e1b578d54ab4aa364435
Author: Jiong Wang <jiong.wang@arm.com>
Date:   Tue Jul 8 12:14:56 2014 +0100

    Fix PR 16722 by adding support for 8-byte vector constants.
    
     * config/tc-arm.c (literal_pool): New field "alignment".
      (find_or_make_literal_pool): Initialize "alignment" to 2.
      (s_ltorg): Align the pool using value of "alignment"
      (parse_big_immediate): New parameter "in_exp". Return
      parsed expression if "in_exp" is not null.
      (parse_address_main): Invoke "parse_big_immediate" for
      constant parameter.
      (add_to_lit_pool): Add one parameter 'nbytes'.
      Split 8 byte entry into two 4 byte entry.
      Add padding to align 8 byte entry to 8 byte boundary.
      (encode_arm_cp_address): Generate literal pool entry if possible.
      (move_or_literal_pool): Generate entry for vldr case.
      (enum lit_type): New enum type.
      (do_ldst): Use new enum type.
      (do_ldstv4): Likewise.
      (do_t_ldst): Likewise.
      (neon_write_immbits): Support Thumb-2 mode.
    
      * gas/arm/ldconst.s: Add test cases for symbol literal.
      * gas/arm/ldconst.d: Likewise.
      * gas/arm/vldconst.s: Add test cases for vldr.
      * gas/arm/thumb2_vpool.s: Likewise.
      * gas/arm/vldconst.d: New pattern for little-endian.
      * gas/arm/thumb2_vpool.d: Likewise.
      * gas/arm/vldconst_be.d: New pattern for big-endian.
      * gas/arm/thumb2_vpool_be.d: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 gas/ChangeLog                                 |   20 +
 gas/config/tc-arm.c                           |  739 +++++++++++++++----------
 gas/testsuite/ChangeLog                       |   21 +
 gas/testsuite/gas/arm/armv8-a+crypto.d        |    1 +
 gas/testsuite/gas/arm/armv8-a+fp.d            |    1 +
 gas/testsuite/gas/arm/armv8-a+simd.d          |    1 +
 gas/testsuite/gas/arm/armv8-a-barrier-thumb.d |    1 +
 gas/testsuite/gas/arm/bl-local-2.d            |    1 +
 gas/testsuite/gas/arm/ldconst.d               |   15 +
 gas/testsuite/gas/arm/ldconst.s               |   11 +
 gas/testsuite/gas/arm/ldgesb-bad.d            |    1 +
 gas/testsuite/gas/arm/ldgesh-bad.d            |    1 +
 gas/testsuite/gas/arm/thumb2_pool.d           |   15 +
 gas/testsuite/gas/arm/thumb2_pool.s           |   11 +
 gas/testsuite/gas/arm/thumb2_vpool.d          |  169 ++++++
 gas/testsuite/gas/arm/thumb2_vpool.s          |   95 ++++
 gas/testsuite/gas/arm/thumb2_vpool_be.d       |  176 ++++++
 gas/testsuite/gas/arm/vldconst.d              |  280 ++++++++++
 gas/testsuite/gas/arm/vldconst.s              |  146 +++++
 gas/testsuite/gas/arm/vldconst_be.d           |  285 ++++++++++
 20 files changed, 1705 insertions(+), 285 deletions(-)
 create mode 100644 gas/testsuite/gas/arm/thumb2_vpool.d
 create mode 100644 gas/testsuite/gas/arm/thumb2_vpool.s
 create mode 100644 gas/testsuite/gas/arm/thumb2_vpool_be.d
 create mode 100644 gas/testsuite/gas/arm/vldconst.d
 create mode 100644 gas/testsuite/gas/arm/vldconst.s
 create mode 100644 gas/testsuite/gas/arm/vldconst_be.d
Comment 3 Will Newton 2014-07-08 14:43:23 UTC
Fixed in the above commit.
Comment 4 Gregory Fong 2014-09-19 22:44:10 UTC
Could this be backported to binutils-2_24-branch?