[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #15 from Eric Botcazou ebotcazou at gcc dot gnu.org 2012-11-11 21:52:53 UTC --- Author: ebotcazou Date: Sun Nov 11 21:52:49 2012 New Revision: 193415 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=193415 Log: PR rtl-optimization/55247 PR middle-end/55259 * emit-rtl.c (adjust_address_1): If POINTERS_EXTEND_UNSIGNED 0, handle ZERO_EXTEND. * recog.c (offsettable_address_addr_space_p): Likewise. Added: trunk/gcc/testsuite/gcc.target/i386/pr55247-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/emit-rtl.c trunk/gcc/recog.c trunk/gcc/testsuite/ChangeLog
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||FIXED --- Comment #16 from H.J. Lu hjl.tools at gmail dot com 2012-11-11 23:55:38 UTC --- Fixed.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #7 from Uros Bizjak ubizjak at gmail dot com 2012-11-10 09:15:32 UTC --- (In reply to comment #2) (define_insn *movti_internal_rex64 [(set (match_operand:TI 0 nonimmediate_operand =!r ,!o ,x,x ,m) (match_operand:TI 1 general_operand riFo,riF,C,xm,x))] TARGET_64BIT !(MEM_P (operands[0]) MEM_P (operands[1])) Uros, is this change ok for you? If it is ok I can commit the patch only on Wednesday (I'll be away for a few days). Yes, the change looks correct to me. I'll take care of the patch.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #8 from Uros Bizjak ubizjak at gmail dot com 2012-11-10 09:22:03 UTC --- (In reply to comment #3) There are 2 issues here: 1. Should we use movdqu(%eax), %xmm0# 19*movti_internal_rex64/4[length = 5] movdqa%xmm0, (%rsp)# 29*movti_internal_rex64/5[length = 5] to copy 16 bytes? Yes, and this is the intention of all these ! marks. 2. Should we split *movti_internal_rex64 if -mno-sse is used? Movti is used for TARGET_64BIT only. Please keep in mind that *_doubleword instructions operate on TImode values, so we rely completely on register allocator to NOT allocate XMM register moves in this case. According to the documentation, ! means that alternative is OK if no reloading is needed, so this fits our purpose to use SSE moves unless we move value directly to TImode arithmetic operation (*_doubleword patterns).
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #9 from uros at gcc dot gnu.org 2012-11-10 11:28:17 UTC --- Author: uros Date: Sat Nov 10 11:28:12 2012 New Revision: 193388 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=193388 Log: PR target/55247 * config/i386/i386.md (*movti_internal_rex64): Add ! to riF-o alternative. testsuite/ChangeLog: PR target/55247 * gcc.target/i386/pr55247.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr55247.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md trunk/gcc/testsuite/ChangeLog
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|NEW |UNCONFIRMED Component|middle-end |rtl-optimization Depends on||55259 Ever Confirmed|1 |0 --- Comment #12 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 19:02:04 UTC --- (In reply to comment #11) ~/gcc-build/gcc/cc1 -O2 -mx32 -maddress-mode=long pr55247.c results in following sequence: movdqu (%eax), %xmm0 movdqa %xmm0, (%rsp) movq(%rsp), %rax movq8(%rsp), %rdx movq%rax, 16(%rsp) movq%rdx, 24(%rsp) while -maddress=mode=short produces expected code: movq8(%eax), %rdx movq(%eax), %rax movq%rdx, 8(%esp) movq%rax, (%esp) This is related to PR 55259. This patch: http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00799.html fixes it.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #13 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 19:11:03 UTC --- (In reply to comment #12) (In reply to comment #11) ~/gcc-build/gcc/cc1 -O2 -mx32 -maddress-mode=long pr55247.c results in following sequence: movdqu (%eax), %xmm0 movdqa %xmm0, (%rsp) movq(%rsp), %rax movq8(%rsp), %rdx movq%rax, 16(%rsp) movq%rdx, 24(%rsp) while -maddress=mode=short produces expected code: movq8(%eax), %rdx movq(%eax), %rax movq%rdx, 8(%esp) movq%rax, (%esp) This is related to PR 55259. This patch: http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00799.html fixes it. With this fix, we don't need to change *movti_internal_rex64 since it generates redundant load/store.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #14 from Uros Bizjak ubizjak at gmail dot com 2012-11-10 19:41:31 UTC --- (In reply to comment #13) With this fix, we don't need to change *movti_internal_rex64 since it generates redundant load/store. True, IIRC this was the reason for asymmetry in alternatives. Please revert the *movti_internal_rex64 change when the middle-end patch goes in.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 Vladimir Makarov vmakarov at redhat dot com changed: What|Removed |Added CC||ubizjak at gmail dot com --- Comment #2 from Vladimir Makarov vmakarov at redhat dot com 2012-11-09 19:42:30 UTC --- Here is the insn in question: (insn 26 25 27 2 (set (reg:TI 115 [orig:100 *defsym_17 ] [100]) (mem:TI (zero_extend:DI (reg:SI 98)) [7 *defsym_17+0 S16 A32])) h.i:54 61 {*movti_internal_rex64} As I understand the first alternative has ! to strongly encourage to use SSE instead of GENERAL registers. (define_insn *movti_internal_rex64 [(set (match_operand:TI 0 nonimmediate_operand =!r ,o ,x,x ,m) (match_operand:TI 1 general_operand riFo,riF,C,xm,x))] TARGET_64BIT !(MEM_P (operands[0]) MEM_P (operands[1])) For some reasons, the second alternative does not have !. I don't know why it is different from the first alternative. For reload it works as it already substituted hard register for the first operand and in this case it rejects the 2nd alternative. (insn 26 25 27 2 (set (reg:TI 0 ax [orig:100 *defsym_17 ] [100]) (mem:TI (zero_extend:DI (reg:SI 2 cx [98])) [7 *defsym_17+0 S16 A32])) h.i:54 61 {*movti_internal_rex64} Adding ! for the second alternative (as I believe it should be) solves the problem. (define_insn *movti_internal_rex64 [(set (match_operand:TI 0 nonimmediate_operand =!r ,!o ,x,x ,m) (match_operand:TI 1 general_operand riFo,riF,C,xm,x))] TARGET_64BIT !(MEM_P (operands[0]) MEM_P (operands[1])) Uros, is this change ok for you? If it is ok I can commit the patch only on Wednesday (I'll be away for a few days).
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #3 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 01:32:06 UTC --- There are 2 issues here: 1. Should we use movdqu(%eax), %xmm0# 19*movti_internal_rex64/4[length = 5] movdqa%xmm0, (%rsp)# 29*movti_internal_rex64/5[length = 5] to copy 16 bytes? 2. Should we split *movti_internal_rex64 if -mno-sse is used?
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #4 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 01:39:16 UTC --- We don't properly handle memory operand in (insn 19 17 20 2 (set (reg:TI 85 [ *_15 ]) (mem:TI (zero_extend:DI (reg:SI 82)) [0 *_15+0 S16 A32])) x.i:29 61 {*movti_internal_rex64} (expr_list:REG_DEAD (reg:SI 82) (expr_list:REG_EQUIV (mem/c:TI (plus:DI (reg/f:DI 20 frame) (const_int -16 [0xfff0])) [0 sym+0 S16 A64])
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #5 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 01:58:31 UTC --- We fail to see (mem:TI (zero_extend:DI (reg:SI 82))) is offsettable.
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #6 from H.J. Lu hjl.tools at gmail dot com 2012-11-10 02:30:16 UTC --- Something like this: diff --git a/gcc/explow.c b/gcc/explow.c index 6109832..9ec38f9 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -84,12 +84,22 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c) rtx y; rtx tem; int all_constant = 0; + enum machine_mode zero_extend_mode; gcc_assert (GET_MODE (x) == VOIDmode || GET_MODE (x) == mode); if (c == 0) return x; + if (GET_CODE (x) == ZERO_EXTEND) +{ + zero_extend_mode = GET_MODE (x); + x = XEXP (x, 0); + mode = GET_MODE (x); +} + else +zero_extend_mode = VOIDmode; + restart: code = GET_CODE (x); @@ -195,7 +205,11 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c) else if (all_constant) return gen_rtx_CONST (mode, x); else -return x; +{ + if (zero_extend_mode != VOIDmode) +x = gen_rtx_ZERO_EXTEND (zero_extend_mode, x); + return x; +} } ^L /* If X is a sum, return a new sum like X but lacking any constant terms. diff --git a/gcc/recog.c b/gcc/recog.c index ee68e30..d3dd591 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1934,15 +1934,21 @@ int offsettable_address_addr_space_p (int strictp, enum machine_mode mode, rtx y, addr_space_t as) { - enum rtx_code ycode = GET_CODE (y); + enum rtx_code ycode; rtx z; - rtx y1 = y; + rtx y1; rtx *y2; int (*addressp) (enum machine_mode, rtx, addr_space_t) = (strictp ? strict_memory_address_addr_space_p : memory_address_addr_space_p); unsigned int mode_sz = GET_MODE_SIZE (mode); + if (GET_CODE (y) == ZERO_EXTEND) +y = XEXP (y, 0); + + ycode = GET_CODE (y); + y1 = y; + if (CONSTANT_ADDRESS_P (y)) return 1;
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Target Milestone|--- |4.8.0
[Bug rtl-optimization/55247] [4.8 Regression] internal compiler error: Max. number of generated reload insns per insn is achieved (90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55247 --- Comment #1 from H.J. Lu hjl.tools at gmail dot com 2012-11-09 05:08:29 UTC --- [hjl@gnu-tools-1 gcc]$ cat /export/gnu/import/delta-2006.08.03/x.c typedef unsigned int uint32_t; typedef unsigned int uintptr_t; typedef uint32_t Elf32_Word; typedef uint32_t Elf32_Addr; typedef struct { Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_other; } Elf32_Sym; typedef struct { Elf32_Word r_info; } Elf32_Rela; typedef struct { union { Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; struct link_map { Elf32_Dyn *l_info[34]; }; typedef struct link_map *lookup_t; extern void symbind32 (Elf32_Sym *); void _dl_profile_fixup (struct link_map *l, Elf32_Word reloc_arg) { const Elf32_Sym *const symtab = (const void *) (l)-l_info[6]-d_un.d_ptr; const Elf32_Rela *const reloc = (const void *) ((l)-l_info[23]-d_un.d_ptr + reloc_arg * sizeof (Elf32_Rela)); const Elf32_Sym *refsym = symtab[((reloc-r_info) 8)]; const Elf32_Sym *defsym = refsym; Elf32_Sym sym = *defsym; symbind32 (sym); } [hjl@gnu-tools-1 gcc]$ ./xgcc -B./ -mx32 -mtune=generic -march=x86-64 -maddress-mode=long -c -std=gnu99 -fgnu89-inline -O3-fPIC -mno-sse -mno-mmx/export/gnu/import/delta-2006.08.03/x.c /export/gnu/import/delta-2006.08.03/x.c: In function ‘_dl_profile_fixup’: /export/gnu/import/delta-2006.08.03/x.c:35:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90) } ^ 0x8d78cd lra_constraints(bool) /export/gnu/import/git/gcc/gcc/lra-constraints.c:3381 0x8c8169 lra(_IO_FILE*) /export/gnu/import/git/gcc/gcc/lra.c:2274 0x87dc24 do_reload /export/gnu/import/git/gcc/gcc/ira.c:4624 0x87de32 rest_of_handle_reload /export/gnu/import/git/gcc/gcc/ira.c:4737 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. [hjl@gnu-tools-1 gcc]$ ./xgcc -B./ -mx32 -mtune=generic -march=x86-64 -maddress-mode=long -c -std=gnu99 -fgnu89-inline -O3-fPIC -mno-sse -mno-mmx/export/gnu/import/delta-2006.08.03/x.c -mno-lra [hjl@gnu-tools-1 gcc]$