ICE in reload_cse_simplify_operands, at postreload.c:402 with neon optimized code

Bug #744754 reported by Luke Kim
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Medium
Ramana Radhakrishnan
gcc
Confirmed
Medium

Bug Description

While building neon optimized code

$ cat insn-unsat-constr.c
#include <arm_neon.h>

void test(signed int *output)
{
 int16_t * out = (int16_t *) output;
 {
  int16x4_t a = {0, };
  int16x4_t b = {1, };
  int16x4x4_t z;
  z.val[0] = vadd_s16(a, b);
  z.val[1] = vadd_s16(a, b);
  z.val[2] = vsub_s16(a, b);
  z.val[3] = vadd_s16(a, b);

  vst4_lane_s16(&out[0]+0*4, z, 0);
  vst4_lane_s16(&out[8]+0*4, z, 1);

 }
}

$ arm-linux-gnueabi-gcc -mfloat-abi=softfp -mfpu=neon -O1 -Wall -o insn-unsat-constr.o -c insn-unsat-constr.c
insn-unsat-constr.c: In function ‘test’:
insn-unsat-constr.c:19:1: error: insn does not satisfy its constraints:
(insn 40 38 26 2 /usr/lib/gcc/arm-linux-gnueabi/4.5.2/include/arm_neon.h:10277 (set (reg:OI 95 d16 [orig:152 __b ] [152])
        (mem/s/c:OI (pre_dec:SI (reg/f:SI 3 r3 [151])) [0 __b+0 S32 A64])) 786 {*neon_movoi} (expr_list:REG_INC (reg/f:SI 3 r3 [151])
        (nil)))
insn-unsat-constr.c:19:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:402
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.

$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.5.2/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-5ubuntu2~ppa1' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.5.2 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --build=i486-linux-gnu --host=i486-linux-gnu --target=arm-linux-gnueabi --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-5ubuntu2~ppa1)

Related branches

Revision history for this message
In , Luke Kim (nereusuj) wrote :
Download full text (3.5 KiB)

Created attachment 23794
preprocessed file

I have following error while building neon optimized code.

$ cat insn-unsat-constr.c
#include <arm_neon.h>

void test(signed int *output)
{
 int16_t * out = (int16_t *) output;
 {
  int16x4_t a = {0, };
  int16x4_t b = {1, };
  int16x4x4_t z;
  z.val[0] = vadd_s16(a, b);
  z.val[1] = vadd_s16(a, b);
  z.val[2] = vsub_s16(a, b);
  z.val[3] = vadd_s16(a, b);

  vst4_lane_s16(&out[0]+0*4, z, 0);
  vst4_lane_s16(&out[8]+0*4, z, 1);

 }
}

$ arm-none-linux-gnueabi-gcc -mfloat-abi=softfp -mfpu=neon -O1 -o insn-unsat-constr.o -c insn-unsat-constr.c
insn-unsat-constr.c: In function 'test':
insn-unsat-constr.c:19:1: error: insn does not satisfy its constraints:
(insn 40 38 26 2 /scratchbox/compilers/arm-linux-gnueabi-gcc4.5.1-2010.09-50/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1/include/arm_neon.h:10277 (set (reg:OI 95 d16 [orig:152 __b ] [152])
        (mem/s/c:OI (pre_dec:SI (reg/f:SI 3 r3 [151])) [0 __b+0 S32 A64])) 740 {*neon_movoi} (expr_list:REG_INC (reg/f:SI 3 r3 [151])
        (nil)))
insn-unsat-constr.c:19:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
Please submit a full bug report,
with preprocessed source if appropriate.

$ arm-none-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/scratchbox/compilers/arm-linux-gnueabi-gcc4.5.1-2010.09-50/bin/arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/scratchbox/compilers/arm-linux-gnueabi-gcc4.5.1-2010.09-50/bin/../libexec/gcc/arm-none-linux-gnueabi/4.5.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/nathan/arm-lite/src/gcc-4.5-2010.09/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} -D__CS_SOURCERYGXX_MAJ__=2010 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=50 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2010.09-50' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/nathan/arm-lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpc=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linu...

Read more...

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

That's a heavily modified compiler by CodeSourcery. Please reproduce with a vanilla FSF GCC, or report the problem to CodeSourcery as their compiler clearly directs you to do (see the --with-bugurl= setting).

Revision history for this message
In , Ibolton (ibolton) wrote :

I get the same thing when I use r171282 of FSF 4.5 branch.

arm-none-linux-gnueabi-gcc pr48325.c -mfloat-abi=softfp -mfpu=neon -O1
pr48325.c: In function 'test':
pr48325.c:19:1: error: insn does not satisfy its constraints:
(insn 40 38 26 2 /work/ianbol01/cross-build/gcc45-r171282-thumb/arm-none-linux-gnueabi/tools/lib/gcc/arm-none-linux-gnueabi/4.5.3/include/arm_neon.h:10277 (set (reg:OI 95 d16 [orig:152 __b ] [152])
        (mem/s/c:OI (pre_dec:SI (reg/f:SI 3 r3 [151])) [0 __b+0 S32 A64])) 731 {*neon_movoi} (expr_list:REG_INC (reg/f:SI 3 r3 [151])
        (nil)))
pr48325.c:19:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:396

Here is the command-line just for cc1:

cc1 -quiet pr48325.c -mfloat-abi=softfp -mfpu=neon -marm -mcpu=cortex-a9 -O1

Doesn't work for thumb either.

It also fails on trunk.

There are two other bugs in flight that manifest in reload_cse_simplify_operands: PR48250 (broke on trunk for EABI, works on 4.5 for EABI) and PR42949 (works on EABI for trunk and gcc4.5, broke for OABI).

I do not know if they are duplicates of each other, or if there are two or more separate bugs causing this.

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

Confirmed in gcc-linaro-4.5-2011.03-0:

michaelh@ursa3:~/linaro/bugs$ /tools/toolchains/gcc-linaro-4.5-2011.03-0-armv7l-maverick-cbuild71-carina7-cortexa8r1/bin/gcc -mfpu=neon -O1 -c insn-unsat-constr.i
insn-unsat-constr.c: In function 'test':
insn-unsat-constr.c:19:1: error: insn does not satisfy its constraints:
(insn 40 38 26 2 /usr/lib/gcc/arm-linux-gnueabi/4.5.2/include/arm_neon.h:10277 (set (reg:OI 95 d16 [orig:152 __b ] [152])
        (mem/s/c:OI (pre_dec:SI (reg/f:SI 3 r3 [151])) [0 __b+0 S32 A64])) 786 {*neon_movoi} (expr_list:REG_INC (reg/f:SI 3 r3 [151])
        (nil)))
insn-unsat-constr.c:19:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:402

Does not occur in gcc-linaro-4.4-2010.10-0. Does not occur at -O0, but does at -O1, -O2, -O3.

The work around is to supply -fno-auto-inc-dec.

Changed in gcc-linaro:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Michael Hope (michaelh1) wrote :

Also occurs in trunk in gcc 4.5.1 and gcc-4.5.2+svn171194.

Could you also report this in the GCC bugzilla please?

Revision history for this message
Luke Kim (nereusuj) wrote :
Revision history for this message
Chung-Lin Tang (cltang) wrote :

I also saw several other testsuite regressions on upstream trunk with a similar ICE too, will look at this.

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Chung-Lin Tang (cltang) wrote :

Correct comment #6, the regressions I saw on upstream trunk should be different from this; this is another bug.

Revision history for this message
Chung-Lin Tang (cltang) wrote :
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Triaged → In Progress
assignee: nobody → Chung-Lin Tang (cltang)
Revision history for this message
Michael Hope (michaelh1) wrote :

Chung-Lin, could you ping this patch please?

Revision history for this message
Ira Rosen (irar) wrote : AUTO: Ira Rosen is out of the office. (returning 17/04/2011)

I am out of the office until 17/04/2011.

Note: This is an automated response to your message "[Bug 744754] Re: ICE
in reload_cse_simplify_operands, at postreload.c:402 with neon optimized
code" sent on 15/4/2011 4:47:17.

This is the only notification you will receive while this person is away.

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

No longer occurs in gcc-linaro-4.5-2011.05 and gcc-linaro-4.6-2011.05 due to the changes Richard made on general NEON accesses.

Richard is looking into pre/post inc/dec in general so we'll mark this as fixed.

Changed in gcc-linaro:
milestone: none → 4.5-2011.06-0
status: In Progress → Fix Committed
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Revision history for this message
Michael K. Edwards (m-k-edwards) wrote :

I encountered this bug again with 4.6-2011.06-0 + patches. (See comment 3 on https://bugs.launchpad.net/gcc-linaro/+bug/803232 .) I will test with Chung-Lin's patch.

Revision history for this message
Michael K. Edwards (m-k-edwards) wrote :

Before Chung-Lin's patch, compiling jsimd_arm-min12.i fails:

build@ctbu-bld5:~/stuff$ ./compile.sh jsimd_arm-min12.i
jsimd_arm-min12.i: In function 'jsimd_idct_ifast':
jsimd_arm-min12.i:73:1: error: insn does not satisfy its constraints:
(insn 113 21 22 2 (set (mem/s/c:XI (post_inc:SI (reg/f:SI 4 r4 [184])) [0 MEM[(struct int8x8x4_t *)&coef].__o+0 S64 A128])
        (reg:XI 75 s12)) jsimd_arm-min12.i:40 757 {*neon_movxi}
     (expr_list:REG_INC (reg/f:SI 4 r4 [184])
        (nil)))
jsimd_arm-min12.i:73:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403

After patch, compile succeeds.

Michael Hope (michaelh1)
Changed in gcc-linaro:
milestone: 4.5-2011.06-0 → 4.6-2011.07
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Released → Fix Committed
assignee: Chung-Lin Tang (cltang) → Ramana Radhakrishnan (ramana)
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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