https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78166
Bug ID: 78166 Summary: [6 Regression] hash.c:1887:1: error: unrecognizable insn Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: danglin at gcc dot gnu.org CC: law at gcc dot gnu.org Target Milestone: --- Host: hppa-unknown-linux-gnu Target: hppa-unknown-linux-gnu Build: hppa-unknown-linux-gnu Created attachment 39924 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39924&action=edit Patch Building racket-6.7, we have the following error: gcc -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wall -I./.. -I/<<PKGBUILDDIR>>/src/racket/src/../include -Wdate-time -D_FORTIFY_SOURCE=2 -DUSE_SENORA_GC -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c /<<PKGBUILDDIR>>/src/racket/src/hash.c -o hash.o /<<PKGBUILDDIR>>/src/racket/src/hash.c: In function 'equal_hash_key': /<<PKGBUILDDIR>>/src/racket/src/hash.c:1887:1: error: unrecognizable insn: } ^ (insn 1891 425 1572 62 (set (reg:SI 21 %r21) (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137]))) -1 (nil)) /<<PKGBUILDDIR>>/src/racket/src/hash.c:1887:1: internal compiler error: in extract_insn, at recog.c:2287 This insn doesn't exist. However, we do have the corresponding shadd patterns. We have the following after ira: (insn 424 435 425 62 (set (reg/v:DF 227 [ d ]) (mem:DF (plus:SI (mult:SI (reg:SI 163 [ ivtmp.808 ]) (const_int 8 [0x8])) (reg/v/f:SI 137 [ o ])) [36 MEM[base: o_4, index: ivtmp.808_501, step: 8, offset: 0B]+0 S8 A64])) /home/dave/debian/racket/racket-6.7/src/racket /src/hash.c:1608 74 {*pa.md:3808} (expr_list:REG_EQUIV (mem:DF (plus:SI (mult:SI (reg:SI 163 [ ivtmp.808 ]) (const_int 8 [0x8])) (reg/v/f:SI 137 [ o ])) [36 MEM[base: o_4, index: ivtmp.808_501, step: 8, offset: 0B]+0 S8 A64]) (nil))) (debug_insn 425 424 1572 62 (var_location:DF d (reg/v:DF 227 [ d ])) /home/dave/ debian/racket/racket-6.7/src/racket/src/hash.c:1608 -1 (nil)) (insn 1572 425 1573 62 (set (reg:SI 715 [ _479 ]) (subreg:SI (reg/v:DF 227 [ d ]) 0)) 42 {*pa.md:2184} (nil)) (insn 1573 1572 437 62 (set (reg:SI 716 [ _479+4 ]) (subreg:SI (reg/v:DF 227 [ d ]) 4)) 42 {*pa.md:2184} (nil)) Then, during reload, we have: Spilling for insn 1572. Using reg 28 for reload 0 Spilling for insn 1573. Using reg 28 for reload 0 Using reg 28 for reload 1 Reloads for insn # 1572 Reload 0: reload_in (SI) = (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137])) GENERAL_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1) reload_in_reg: (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137])) reload_reg_rtx: (reg:SI 21 %r21) Reloads for insn # 1573 Reload 0: reload_in (SI) = (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4])) GENERAL_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1) reload_in_reg: (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4])) reload_reg_rtx: (reg:SI 22 %r22)Reload 1: reload_in (SI) = (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4]))) GENERAL_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1) reload_in_reg: (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4]))) reload_reg_rtx: (reg:SI 23 %r23) Reloads for insn # 443 Reload 0: reload_in (SI) = (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137])) GENERAL_REGS, RELOAD_FOR_INPUT_ADDRESS (opnum = 1) reload_in_reg: (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137])) reload_reg_rtx: (reg:SI 24 %r24) Reload 1: reload_in (SI) = (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4])) GENERAL_REGS, RELOAD_FOR_INPUT_ADDRESS (opnum = 2) reload_in_reg: (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4])) reload_reg_rtx: (reg:SI 24 %r24) Reload 2: reload_in (SI) = (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (plus:SI (reg/v/f:SI 3 %r3 [ orig:137 o ] [137]) (const_int 4 [0x4]))) GENERAL_REGS, RELOAD_FOR_INPUT_ADDRESS (opnum = 2) reload_in_reg: (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4]))) reload_reg_rtx: (reg:SI 29 %r29) Reload 3: reload_in (SI) = (mem:SI (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (reg/v/f:SI 3 %r3 [orig:137 o ] [137])) [36 MEM[base: o_4, index: ivtmp.808_501, step: 8, offset: 0B]+0 S4 A64]) GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine reload_in_reg: (subreg:SI (reg/v:DF 227 [ d ]) 0) reload_reg_rtx: (reg:SI 31 %r31) Reload 4: reload_in (SI) = (mem:SI (plus:SI (mult:SI (reg:SI 4 %r4 [orig:163 ivtmp.808 ] [163]) (const_int 8 [0x8])) (plus:SI (reg/v/f:SI 3 %r3 [orig:137 o ] [137]) (const_int 4 [0x4]))) [36 MEM[base: o_4, index: ivtmp.808_501, step: 8, offset: 0B]+4 S4 A32]) GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 2), can't combine reload_in_reg: (subreg:SI (reg/v:DF 227 [ d ]) 4) reload_reg_rtx: (reg:SI 24 %r24) The above was with gcc-6: dave@mx3210:~/debian/racket/racket-6.7$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/hppa-linux-gnu/6/lto-wrapper Target: hppa-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.2.0-10' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=hppa-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libssp --disable-libitm --disable-libsanitizer --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-hppa/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-hppa --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-hppa --with-arch-directory=parisc --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-libstdcxx-pch --enable-checking=release --build=hppa-linux-gnu --host=hppa-linux-gnu --target=hppa-linux-gnu Thread model: posix gcc version 6.2.0 20161027 (Debian 6.2.0-10) I believe this problem was introduced by the following change: 2015-05-22 Jeff Law <l...@redhat.com> * config/pa/pa.md (integer_indexed_store splitters): Use mem_shadd_operand. Use ASHIFT rather than MULT in the resulting insns -- adjusting the constant 2nd operand accordingly. * combine.c (try_combine): Canonicalize (plus (mult X pow2) Y) into (plus (ashift X log2) Y) if it is a split point. * config/pa/pa.c (mem_shadd_or_shadd_rtx_p): New function factoredx out of hppa_legitimize_address to handle both forms of a multiply by 2, 4 or 8. (hppa_legitimize_address): Use mem_shadd_or_shadd_rtx_p. Always generate the ASHIFT variant as the result is not directly used in a MEM. Update comments and refactor slightly to improve readability. At least for gcc-6, the safest thing seems to be to add the missing MULT patterns as they are needed by reload. However, the goal of Jeff's change was to use ASHIFT rather than MULT. Testing attached change.