http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46247
Summary: bug with loading constant to neon quad register
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
code:
+--------------------------------------------------------+
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <arm_neon.h>
void dbg_neon(uint32x4_t d, char* name){
uint32_t t[4];
int i;
*((uint32x4_t*)&(t[0])) = d;
printf("\n==== %s debug ====\n", name);
for(i=0;i<4;++i){
printf(" %s[%2d] = %08X\n",name, i,t[i]);
}
}
int main(){
uint32x4_t qa0, qt0, qx0;
uint32_t t[8]={ 0x78797A63, 0x7C7D7E7F, 0xC0222022, 0x44454647 };
qt0 = (uint32x4_t){ 0, 0xffffffff, 0, 0xffffffff};
// qa0 = *((uint32x4_t*)&(t[0]));
qa0 = vld1q_u32 (&(t[0]));
qx0 = veorq_u32(qa0, qt0);
dbg_neon(qt0, "qt0");
dbg_neon(qa0, "qa0");
dbg_neon(qx0, "qx0");
return 0;
}
+--------------------------------------------------------+
output:
+--------------------------------------------------------+
==== qt0 debug ====
qt0[ 0] = 00000000
qt0[ 1] = 0000FFFF
qt0[ 2] = 00000000
qt0[ 3] = 0000FFFF
==== qa0 debug ====
qa0[ 0] = 78797A63
qa0[ 1] = 7C7D7E7F
qa0[ 2] = C0222022
qa0[ 3] = 44454647
==== qx0 debug ====
qx0[ 0] = 78797A63
qx0[ 1] = 7C7D8180
qx0[ 2] = C0222022
qx0[ 3] = 4445B9B8
+--------------------------------------------------------+
tested with the following gccs:
$ LC_ALL=C
~/infos/boxes/beagleboard/2010-10-29/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc
-v
Using built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with:
/OE/angstrom/build/tmp-angstrom_2008_1/work/i686-armv7a-sdk-angstrom-linux-gnueabi/gcc-cross-sdk-4.3.3-r17.2/gcc-4.3.3/configure
--build=i686-linux --host=i686-linux --target=arm-angstrom-linux-gnueabi
--prefix=/usr/local/angstrom/arm --exec_prefix=/usr/local/angstrom/arm
--bindir=/usr/local/angstrom/arm/bin --sbindir=/usr/local/angstrom/arm/bin
--libexecdir=/usr/local/angstrom/arm/libexec
--datadir=/usr/local/angstrom/arm/share
--sysconfdir=/usr/local/angstrom/arm/etc
--sharedstatedir=/usr/local/angstrom/arm/share/com
--localstatedir=/usr/local/angstrom/arm/var
--libdir=/usr/local/angstrom/arm/lib
--includedir=/usr/local/angstrom/arm/include
--oldincludedir=/usr/local/angstrom/arm/include
--infodir=/usr/local/angstrom/arm/share/info
--mandir=/usr/local/angstrom/arm/share/man --with-gnu-ld --enable-shared
--enable-languages=c,c++,objc,fortran --enable-threads=posix --disable-multilib
--enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch
--program-prefix=arm-angstrom-linux-gnueabi- --enable-target-optspace
--enable-cheaders=c_std --enable-libssp --disable-bootstrap --disable-libgomp
--disable-libmudflap
--with-sysroot=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi
--with-build-time-tools=/OE/angstrom/build/tmp-angstrom_2008_1/sysroots/i686-linux/usr/armv7a/arm-angstrom-linux-gnueabi/bin
--with-build-sysroot=/OE/angstrom/build/tmp-angstrom_2008_1/sysroots/armv7a-angstrom-linux-gnueabi
--disable-libunwind-exceptions --disable-libssp --disable-libgomp
--disable-libmudflap
--with-mpfr=/OE/angstrom/build/tmp-angstrom_2008_1/sysroots/i686-linux/usr
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.3 (GCC)
$ LC_ALL=C arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/bg/sat/libexec/gcc/arm-none-eabi/4.5.1/lto-wrapper
Target: arm-none-eabi
Configured with: ../gcc-4.5.1/configure --target=arm-none-eabi
--prefix=/home/bg/sat --enable-interwork --enable-multilib
--enable-languages=c,c++ --with-newlib --disable-shared --with-gnu-as
--with-gnu-ld --disable-nls --disable-werror --with-system-zlib :
(reconfigured) ../gcc-4.5.1/configure --target=arm-none-eabi
--prefix=/home/bg/sat --enable-interwork --enable-multilib
--enable-languages=c,c++ --with-newlib --disable-shared --with-gnu-as
--with-gnu-ld --disable-nls --disable-werror --with-system-zlib
Thread model: single
gcc version 4.5.1 (GCC)
commandline:
$GCC -O2 -S -Wall -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon -static
gcc_bug.c
additional information:
does not happen with -O0 but with -O1, -O2 and -O3.