[Bug target/120351] ldrex r1, [s14], invalid use of NEON registers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120351 Sam James changed: What|Removed |Added CC||sjames at gcc dot gnu.org --- Comment #3 from Sam James --- Created attachment 61469 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61469&action=edit a.cxx
[Bug target/120351] ldrex r1, [s14], invalid use of NEON registers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120351 Sam James changed: What|Removed |Added Component|c++ |target Keywords||assemble-failure, ||wrong-code --- Comment #1 from Sam James --- Please always include relevant files as attachments. See https://gcc.gnu.org/bugs/#need. Anyway, I can reproduce it: ``` $ g++-14 /tmp/a.cxx -O2 -c -mfpu=neon $ g++-15 /tmp/a.cxx -O2 -c -mfpu=neon /tmp/ccTgsrnS.s: Assembler messages: /tmp/ccTgsrnS.s:47: Error: ARM register expected -- `ldrex r1,[s14]' /tmp/ccTgsrnS.s:49: Error: ARM register expected -- `strex r2,r1,[s14]' ``` ``` Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armv7a-unknown-linux-gnueabihf/15/lto-wrapper Target: armv7a-unknown-linux-gnueabihf Configured with: /var/tmp/portage/sys-devel/gcc-15.1./work/gcc-15.1./configure --host=armv7a-unknown-linux-gnueabihf --build=armv7a-unknown-linux-gnueabihf --prefix=/usr --bindir=/usr/armv7a-unknown-linux-gnueabihf/gcc-bin/15 --includedir=/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/15/include --datadir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/15 --mandir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/15/man --infodir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/15/info --with-gxx-include-dir=/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/15/include/g++-v15 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/armv7a-unknown-linux-gnueabihf/15/python --enable-libphobos --enable-objc-gc --enable-languages=c,c++,d,objc,obj-c++,fortran,ada,rust --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 15.1. p, commit 931f2ec7eafda39ea33684e191c9e2e8b4239fdc' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --with-float=hard --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --enable-libgomp --disable-libssp --enable-libada --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --with-isl --disable-isl-version-check --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-O3 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.1.1 20250518 848e7b119cc4558aec8f473dced811ae8b54829f (Gentoo 15.1. p, commit 931f2ec7eafda39ea33684e191c9e2e8b4239fdc) ```
[Bug target/120351] ldrex r1, [s14], invalid use of NEON registers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120351 --- Comment #2 from Sam James --- ``` # diff -u <(g++-14 /tmp/a.cxx -O2 -S -mfpu=neon -o -) <(g++-15 /tmp/a.cxx -O2 -S -mfpu=neon -o -) --- /dev/fd/63 2025-05-19 10:57:07.663372453 - +++ /dev/fd/62 2025-05-19 10:57:07.666705782 - @@ -31,10 +31,9 @@ .pad #32 sub sp, sp, #32 ldr r3, .L7+4 - add r4, sp, #20 + add r0, sp, #20 .LPIC0: add r2, pc, r2 - mov r0, r4 ldr r3, [r2, r3] ldr r3, [r3] str r3, [sp, #28] @@ -43,16 +42,15 @@ mov r0, sp bl _ZN1BC1Ev(PLT) vldrd7, [sp] - vmovr3, s14 @ int vstrd7, [sp, #8] .L3: - ldrex r1, [r3] + ldrex r1, [s14] add r1, r1, #1 - strex r2, r1, [r3] + strex r2, r1, [s14] cmp r2, #0 bne .L3 add r1, sp, #8 - mov r0, r4 + add r0, sp, #20 bl _ZN1B9insertOneES_(PLT) ldr r2, .L7+8 ldr r3, .L7+4 ```