public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly
@ 2011-03-16 20:19 hjl.tools at gmail dot com
  2011-04-02  5:28 ` [Bug rtl-optimization/48155] " hjl at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2011-03-16 20:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

           Summary: Reload doesn't handle subreg properly
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


Given input:

(plus:SI (subreg:SI (plus:DI (reg/f:DI 7 sp)
            (const_int 16 [0x10])) 0)
    (const_int -1 [0xffffffffffffffff]))

reloads tries to add

(subreg:SI (plus:DI (reg/f:DI 7 sp)
        (const_int 16 [0x10])) 0)

to

(reg:SI 1 dx)

This code:

 /* How to do this reload can get quite tricky.  Normally, we are being
     asked to reload a simple operand, such as a MEM, a constant, or a pseudo
     register that didn't get a hard register.  In that case we can just
     call emit_move_insn.

     We can also be asked to reload a PLUS that adds a register or a MEM to
     another register, constant or MEM.  This can occur during frame pointer
     elimination and while reloading addresses.  This case is handled by
     trying to emit a single insn to perform the add.  If it is not valid,
     we use a two insn sequence.

     Or we can be asked to reload an unary operand that was a fragment of
     an addressing mode, into a register.  If it isn't recognized as-is,
     we try making the unop operand and the reload-register the same:
     (set reg:X (unop:X expr:Y))
     -> (set reg:Y expr:Y) (set reg:X (unop:X reg:Y)).

     Finally, we could be called to handle an 'o' constraint by putting
     an address into a register.  In that case, we first try to do this
     with a named pattern of "reload_load_address".  If no such pattern
     exists, we just emit a SET insn and hope for the best (it will normally
     be valid on machines that use 'o').

     This entire process is made complex because reload will never
     process the insns we generate here and so we must ensure that
     they will fit their constraints and also by the fact that parts of
     IN might be being reloaded separately and replaced with spill registers.
     Because of this, we are, in some sense, just guessing the right approach
     here.  The one listed above seems to work.

     ??? At some point, this whole thing needs to be rethought.  */

  if (GET_CODE (in) == PLUS
      && (REG_P (XEXP (in, 0))
          || GET_CODE (XEXP (in, 0)) == SUBREG
          || MEM_P (XEXP (in, 0)))
      && (REG_P (XEXP (in, 1))
          || GET_CODE (XEXP (in, 1)) == SUBREG
          || CONSTANT_P (XEXP (in, 1))
          || MEM_P (XEXP (in, 1))))

doesn't check if XEXP (in, 0/1) is a SUBREG of REG.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
@ 2011-04-02  5:28 ` hjl at gcc dot gnu.org
  2011-06-29 13:32 ` hjl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-04-02  5:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

--- Comment #1 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-04-02 05:28:37 UTC ---
Author: hjl
Date: Sat Apr  2 05:28:34 2011
New Revision: 171870

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171870
Log:
Add and use reload_plus_ok.

2011-03-16  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/48155
    * reload1.c (reload_plus_ok): New.
    (gen_reload_chain_without_interm_reg_p): Use it.
    (gen_reload): Likewise.

Modified:
    branches/x32/gcc/ChangeLog.x32
    branches/x32/gcc/reload1.c


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
  2011-04-02  5:28 ` [Bug rtl-optimization/48155] " hjl at gcc dot gnu.org
@ 2011-06-29 13:32 ` hjl at gcc dot gnu.org
  2011-06-29 13:34 ` hjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-06-29 13:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-06-29 13:32:09 UTC ---
Author: hjl
Date: Wed Jun 29 13:32:06 2011
New Revision: 175635

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175635
Log:
Remove reload_plus_ok.

2011-06-27  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/48155
    * reload1.c (reload_plus_ok): Removed.
    (gen_reload_chain_without_interm_reg_p): Updated.
    (gen_reload): Likewise.

Modified:
    branches/x32/gcc/ChangeLog.x32
    branches/x32/gcc/reload1.c


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
  2011-04-02  5:28 ` [Bug rtl-optimization/48155] " hjl at gcc dot gnu.org
  2011-06-29 13:32 ` hjl at gcc dot gnu.org
@ 2011-06-29 13:34 ` hjl at gcc dot gnu.org
  2011-07-22  5:58 ` [Bug target/48155] " pbone at csse dot unimelb.edu.au
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-06-29 13:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-06-29 13:34:25 UTC ---
Author: hjl
Date: Wed Jun 29 13:34:20 2011
New Revision: 175638

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175638
Log:
Add *lea_0_x32 to support addresses with complex expressions.

2011-06-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR target/48155
    * config/i386/i386.md (*lea_0_x32): New.
    * config/i386/predicates.md (pointer_register_operand): Likewise.

Modified:
    branches/x32/gcc/ChangeLog.x32
    branches/x32/gcc/config/i386/i386.md
    branches/x32/gcc/config/i386/predicates.md


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2011-06-29 13:34 ` hjl at gcc dot gnu.org
@ 2011-07-22  5:58 ` pbone at csse dot unimelb.edu.au
  2011-07-22  5:59 ` pbone at csse dot unimelb.edu.au
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pbone at csse dot unimelb.edu.au @ 2011-07-22  5:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

Paul Bone <pbone at csse dot unimelb.edu.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pbone at csse dot
                   |                            |unimelb.edu.au

--- Comment #4 from Paul Bone <pbone at csse dot unimelb.edu.au> 2011-07-22 05:57:44 UTC ---
I'm seeing the same problem in gcc 4.4 and 4.6, I did not test 4.5:

paul@semillion:~/code/mercury-compiler-rotd-2011-06-23/compiler$ gcc-4.4 -v -c
-o /tmp/out.o -O1 ml_backend.ml_closure_gen.i
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --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/include/c++/4.4 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-targets=all --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8) 
COLLECT_GCC_OPTIONS='-v' '-c' '-o' '/tmp/out.o' '-O1' '-mtune=generic'
'-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.4.5/cc1 -fpreprocessed
ml_backend.ml_closure_gen.i -quiet -dumpbase ml_backend.ml_closure_gen.i
-mtune=generic -march=i586 -auxbase-strip /tmp/out.o -O1 -version -o
/tmp/ccbABR7o.s
GNU C (Debian 4.4.5-8) version 4.4.5 (i486-linux-gnu)
        compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version
3.0.0-p3.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127992
Compiler executable checksum: 0192d925385d4e6642a93c63f245f907
ml_backend.ml_closure_gen.c:32: warning:
‘mercury__ml_backend__ml_closure_gen__ml_gen_maybe_pseudo_type_info_defn_4_0’
used but never defined
ml_backend.ml_closure_gen.c: In function ‘ml_backend__ml_closure_gen_module11’:
ml_backend.ml_closure_gen.c:230: error: unable to find a register to spill in
class ‘DIREG’
ml_backend.ml_closure_gen.c:230: error: this is the insn:
(insn 123 122 124 11 ml_backend.ml_closure_gen.c:105 (parallel [
            (set (mem:SI (reg/f:SI 136) [0 S4 A32])
                (reg/v:SI 80 [ MR_tempr3 ]))
            (set (reg/v:SI 82 [ MR_tempr1 ])
                (plus:SI (reg/f:SI 136)
                    (const_int 4 [0x4])))
        ]) 852 {*strsetsi_1} (expr_list:REG_DEAD (reg/f:SI 136)
        (nil)))
ml_backend.ml_closure_gen.c:230: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/cccXoZX2.out file, please attach this to
your bugreport.

I will attach the generated test case.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2011-07-22  5:58 ` [Bug target/48155] " pbone at csse dot unimelb.edu.au
@ 2011-07-22  5:59 ` pbone at csse dot unimelb.edu.au
  2013-11-10  6:07 ` pinskia at gcc dot gnu.org
  2013-11-10 17:12 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pbone at csse dot unimelb.edu.au @ 2011-07-22  5:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

--- Comment #5 from Paul Bone <pbone at csse dot unimelb.edu.au> 2011-07-22 05:59:24 UTC ---
(In reply to comment #4)

Sorry, this comment was filed against the wrong bug.  Please ignore/delete it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2011-07-22  5:59 ` pbone at csse dot unimelb.edu.au
@ 2013-11-10  6:07 ` pinskia at gcc dot gnu.org
  2013-11-10 17:12 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-10  6:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-11-10
     Ever confirmed|0                           |1

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Is this fixed?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/48155] Reload doesn't handle subreg properly
  2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2013-11-10  6:07 ` pinskia at gcc dot gnu.org
@ 2013-11-10 17:12 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2013-11-10 17:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48155

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Should be fixed now in 4.7.0.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-10 17:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-16 20:19 [Bug rtl-optimization/48155] New: Reload doesn't handle subreg properly hjl.tools at gmail dot com
2011-04-02  5:28 ` [Bug rtl-optimization/48155] " hjl at gcc dot gnu.org
2011-06-29 13:32 ` hjl at gcc dot gnu.org
2011-06-29 13:34 ` hjl at gcc dot gnu.org
2011-07-22  5:58 ` [Bug target/48155] " pbone at csse dot unimelb.edu.au
2011-07-22  5:59 ` pbone at csse dot unimelb.edu.au
2013-11-10  6:07 ` pinskia at gcc dot gnu.org
2013-11-10 17:12 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).