Large immediate for neon vmov doesn't work correctly

Bug #772200 reported by Luke Kim
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Binutils
Fix Released
Medium
Unassigned
binutils
Fix Released
Medium
binutils (Ubuntu)
Fix Released
High
Unassigned
Natty
Won't Fix
Medium
Unassigned
Oneiric
Fix Released
High
Unassigned

Bug Description

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ cat neon-large-immediate-moves.s
.cpu cortex-a9
.fpu neon
.text

vmov.i64 d9,#0xffffffffffffffff

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ arm-linux-gnueabi-as neon-large-immediate-moves.s

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ arm-linux-gnueabi-objdump -d a.out

a.out: file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: f2809e3f vmov.i64 d9, #0x00000000ffffffff

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ arm-linux-gnueabi-as --version
GNU assembler (GNU Binutils for Ubuntu) 2.21.0.20110302
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-linux-gnueabi'.

the immediate value should be 0xffffffffffffffff but the assembled result are ox00000000ffffffff

Revision history for this message
Luke Kim (nereusuj) wrote :
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

Thank you for the bug report. I'm afraid I can't reproduce this with:
 * binutils-2.21 on ARM
 * binutils-2.21.0.20110327 on x86_64
 * Ubuntu binutils-2.21.0.20110327 on x86_64
 * Ubuntu 2.20.51-system.20100908 on ARM

In all cases I get the following from objdump:

neon-large-immediate-moves.o: file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: f3879e3f vmov.i64 d9, #0xffffffffffffffff

Could you try a plain binutils-2.21 on your system and see if the fault exits?

You might want to ask the binutils mailing list (see http://sourceware.org/binutils/). Linaro doesn't currently produce a binutils version.

Changed in binutils-linaro:
status: New → Incomplete
Revision history for this message
In , Luke Kim (nereusuj) wrote :

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ cat neon-large-immediate-moves.s
.cpu cortex-a9
.fpu neon
.text

vmov.i64 d9,#0xffffffffffffffff

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ arm-linux-gnueabi-as neon-large-immediate-moves.s

ujkim@DO-ujkim04:~/work/toolchain-bug/as-2.21/neon-immediate-moves$ arm-linux-gnueabi-objdump -d a.out

a.out: file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: f2809e3f vmov.i64 d9, #0x00000000ffffffff

The immediate value should be 0xffffffffffffffff but the assembled result are ox00000000ffffffff

The toolchain is configured with following option.
../configure --host=i486-linux-gnu --build=i486-linux-gnu --target=arm-linux-gnueabi --prefix=/tmp/cross/usr --enable-shared --enable-plugins --enable-targets=x86_64-linux-gnu --disable-werror --enable-ld=default --enable-gold

If I remove '--enable-targets=x86_64-linux-gnu' from the configure args, it seems no problem.

Revision history for this message
In , Luke Kim (nereusuj) wrote :

Created attachment 5697
assembly source code

Revision history for this message
Luke Kim (nereusuj) wrote :

I wonder if there is any host platform dependency because I can reproduce it in my x86 ubuntu box.

I cannot reproduce with plain binutils-2.21 with following configure option.
../configure --host=i486-linux-gnu --build=i486-linux-gnu --target=arm-linux-gnueabi --prefix=/tmp/cross

But I can reproduce it with following configure option.
../configure --host=i486-linux-gnu --build=i486-linux-gnu --target=arm-linux-gnueabi --prefix=/tmp/cross --enable-shared --enable-plugins --enable-targets=x86_64-linux-gnu --disable-werror --enable-ld=default --enable-gold

It seems fine if I remove --enable-targets=x86_64-linux-gnu.

I'm afraid I'm not sure if linaro binutils is using this option.

Revision history for this message
Michael Hope (michaelh1) wrote :

Ah, I found the problem. I can reproduce this on binutils-2.21 on i686 but not on x86_64:

michaelh@scorpius:~/linaro/misc/build/binutils$ uname -a
Linux scorpius 2.6.35-21-generic #30~lucid1-Ubuntu SMP Sat Sep 11 14:43:11 UTC 2010 i686 GNU/Linux

michaelh@scorpius:~/linaro/misc/build/binutils$ ../../binutils-git/configure --host=i486-linux-gnu --build=i486-linux-gnu --target=arm-linux-gnueabi --prefix=/tmp/cross --enable-shared --enable-plugins --enable-targets=x86_64-linux-gnu --disable-werror --enable-ld=default --enable-gold

michaelh@scorpius:~/linaro/misc/build/binutils$ ./gas/as-new -o neon-large-immediate-moves.o neon-large-immediate-moves.s
michaelh@scorpius:~/linaro/misc/build/binutils$ ./binutils/objdump -d neon-large-immediate-moves.o

neon-large-immediate-moves.o: file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: f2809e3f vmov.i64 d9, #0x00000000ffffffff

This suggests that there's a cast or similar that's wrong on a 32 bit host but succeeds on 64 bit.

The fault also exists in binutils trunk. Could you report it up there please and attach the bugzilla ticket to this?

Changed in binutils-linaro:
status: Incomplete → Triaged
importance: Undecided → Medium
Revision history for this message
Luke Kim (nereusuj) wrote :
Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

CVSROOT: /cvs/src
Module name: src
Changes by: <email address hidden> 2011-05-12 12:41:45

Modified files:
 gas : ChangeLog
 gas/config : tc-arm.c
 gas/testsuite : ChangeLog
 gas/testsuite/gas/arm: neon-const.d neon-const.s

Log message:
 PR gas/12715
 * gas/config/tc-arm.c (parse_big_immediate): Fix parsing of 64-bit
 immediates on 32-bit hosts.
 * gas/testsuite/gas/arm/neon-const.s: Add testcase for 64-bit Neon constants.
 * gas/testsuite/gas/arm/neon-const.d: Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4479&r2=1.4480
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.483&r2=1.484
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1897&r2=1.1898
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-const.d.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-const.s.diff?cvsroot=src&r1=1.2&r2=1.3

Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

CVSROOT: /cvs/src
Module name: src
Branch: binutils-2_21-branch
Changes by: <email address hidden> 2011-05-13 14:19:04

Modified files:
 gas : ChangeLog
 gas/config : tc-arm.c
 gas/testsuite : ChangeLog
 gas/testsuite/gas/arm: neon-const.d neon-const.s

Log message:
 Apply from mainline.
 2011-05-12 Matthew Gretton-Dann <email address hidden>
 PR gas/12715
 * gas/config/tc-arm.c (parse_big_immediate): Fix parsing of 64-bit
 immediates on 32-bit hosts.
 * gas/testsuite/gas/arm/neon-const.s: Add testcase for 64-bit Neon constants.
 * gas/testsuite/gas/arm/neon-const.d: Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.4320.2.27&r2=1.4320.2.28
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.471.2.2&r2=1.471.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1802.2.9&r2=1.1802.2.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-const.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.16.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-const.s.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2&r2=1.2.14.1

Revision history for this message
In , Matthew Gretton-Dann (matthew-gretton-dann) wrote :

Fixes committed to both trunk and 2.21 branches.

Revision history for this message
Matthew Gretton-Dann (matthew-gretton-dann) wrote :

This has now been fixed upstream on both trunk and binutils 2.21 branches.

Matthias Klose (doko)
Changed in binutils (Ubuntu Natty):
importance: Undecided → Medium
milestone: none → natty-updates
status: New → Confirmed
Changed in binutils (Ubuntu Oneiric):
importance: Undecided → Medium
milestone: none → oneiric-alpha-1
status: New → Confirmed
Revision history for this message
Ramana Radhakrishnan (ramana) wrote :

To be clear this bug will manifest itself in a binutils that has been built with --enable-targets=all or any binutils that has a 64 bit target in it's target list. Otherwise this will not manifest itself. That is not an immediate problem for natty but it would be good to have the patch in the source base so that we don't accidentally hit this in a cross-compiler or in the cases detailed in the upstream bug report / patch.

The risk of a real package being affected by this bug is low because most packages are built with the native binutils which seems to only target armel and no other target.

Looking at a log from a native build of binutils in natty this is how it is configured :

../configure --with-sysroot=/ --enable-shared --enable-plugins --prefix=/usr --build=arm-linux-gnueabi --host=arm-linux-gnueabi --with-pkgversion="GNU Binutils for Ubuntu" --disable-werror --enable-ld=default --enable-gold

cheers
Ramana

Changed in binutils:
importance: Unknown → Medium
status: Unknown → Fix Released
Changed in binutils (Ubuntu Oneiric):
milestone: oneiric-alpha-1 → oneiric-alpha-2
importance: Medium → High
Revision history for this message
Matthias Klose (doko) wrote :

according to the upstream report, this is fixed in oneiric

Changed in binutils (Ubuntu Oneiric):
status: Confirmed → Fix Released
Michael Hope (michaelh1)
Changed in binutils-linaro:
status: Triaged → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote :

natty has seen the end of its life and is no longer receiving any updates. Marking the natty task for this ticket as "Won't Fix".

Changed in binutils (Ubuntu Natty):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.