public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56442] New: Could not identify that register is clobbered already
@ 2013-02-25  8:42 pitchumani.s at atmel dot com
  2013-02-25  8:43 ` [Bug target/56442] " pitchumani.s at atmel dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pitchumani.s at atmel dot com @ 2013-02-25  8:42 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56442
           Summary: Could not identify that register is clobbered already
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pitchumani.s@atmel.com


Wrong code is generated for avr target when gcc-4.7.2 is used.

Test case: dejagnu test gcc.dg/var-expand2.c
command line options: -O2 -funroll-loops -ffast-math -mmcu=atxmega128b1

(snip of assembly)
ldi r24,lo8(array+4)
ldi r25,hi8(array+4)
sub r14,r24
sbc r15,r25
lsr r15
ror r14
lsr r15
ror r14
ldi r25,3        ;; r25 is overwritten
and r14,r25
clr r15
lds r18,array
lds r19,array+1
lds r20,array+2
lds r21,array+3
movw r28,r24    ;; register pair r24/r25 is used
(snip of assembly)

conversation on mailing list:
http://gcc.gnu.org/ml/gcc/2013-02/msg00264.html


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

* [Bug target/56442] Could not identify that register is clobbered already
  2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
@ 2013-02-25  8:43 ` pitchumani.s at atmel dot com
  2013-02-25 10:56 ` [Bug other/56442] " gjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pitchumani.s at atmel dot com @ 2013-02-25  8:43 UTC (permalink / raw)
  To: gcc-bugs


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

Pitchumani <pitchumani.s at atmel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |a

--- Comment #1 from Pitchumani <pitchumani.s at atmel dot com> 2013-02-25 08:43:22 UTC ---
(In reply to comment #0)
> Wrong code is generated for avr target when gcc-4.7.2 is used.
> 
> Test case: dejagnu test gcc.dg/var-expand2.c
> command line options: -O2 -funroll-loops -ffast-math -mmcu=atxmega128b1

-mmcu=atxmega128a1


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

* [Bug other/56442] Could not identify that register is clobbered already
  2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
  2013-02-25  8:43 ` [Bug target/56442] " pitchumani.s at atmel dot com
@ 2013-02-25 10:56 ` gjl at gcc dot gnu.org
  2013-06-06 13:26 ` gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-02-25 10:56 UTC (permalink / raw)
  To: gcc-bugs


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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-25
                 CC|                            |gjl at gcc dot gnu.org
          Component|target                      |other
     Ever Confirmed|0                           |1
           Severity|major                       |normal

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2013-02-25 10:56:02 UTC ---
Enabling others to understand this...

In .reload dump, we have correct code:

(insn 418 417 113 3 (set (reg:HI 24 r24)
        (const:HI (plus:HI (symbol_ref:HI ("array") [flags 0x2]  <var_decl
0x1e405a0 array>)
                (const_int 4 [0x4])))) 32 {*movhi}
     (nil))

(insn 113 418 114 3 (set (reg:HI 14 r14 [94])
        (minus:HI (reg:HI 14 r14 [94])
            (reg:HI 24 r24))) 65 {subhi3}
     (nil))

(insn 114 113 115 3 (set (reg:HI 14 r14 [94])
        (lshiftrt:HI (reg:HI 14 r14 [94])
            (const_int 2 [0x2]))) 217 {lshrhi3}
     (nil))

(insn 115 114 118 3 (parallel [
            (set (reg:HI 14 r14 [94])
                (and:HI (reg:HI 14 r14 [94])
                    (const_int 3 [0x3])))
            (clobber (reg:QI 25 r25))
        ]) 175 {andhi3}
     (nil))

(insn 118 115 119 3 (set (reg:SF 18 r18 [orig:65 D.1335 ] [65])
        (mem:SF (symbol_ref:HI ("array") [flags 0x2]  <var_decl 0x1e405a0
array>) [2 MEM[base: D.1358_18, offset: 0B]+0 S4 A8])) foo.c:15 37 {*movsf}
     (nil))

(insn 119 118 122 3 (set (reg:HI 28 r28 [orig:96 ivtmp.10 ] [96])
        (const:HI (plus:HI (symbol_ref:HI ("array") [flags 0x2]  <var_decl
0x1e405a0 array>)
                (const_int 4 [0x4])))) 32 {*movhi}
     (expr_list:REG_EQUAL (const:HI (plus:HI (symbol_ref:HI ("array") [flags
0x2]  <var_decl 0x1e405a0 array>)
                (const_int 4 [0x4])))
        (nil)))


This is changed by .postreload to:


(insn 119 118 122 3 (set (reg:HI 28 r28 [orig:96 ivtmp.10 ] [96])
        (reg:HI 24 r24)) 32 {*movhi}
     (expr_list:REG_EQUAL (const:HI (plus:HI (symbol_ref:HI ("array") [flags
0x2]  <var_decl 0x1e405a0 array>)
                (const_int 4 [0x4])))
        (nil)))


This is wrong because reg:HI 24 is (partly) clobbered by insn 115 and thus
reg:HI 24 must not be used past insn 115.

Component is not target, the target description of andhi3 insn is all right.

According to S, the bad transformation happens in:
postreload.c:reload_cse_move2add()


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

* [Bug other/56442] Could not identify that register is clobbered already
  2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
  2013-02-25  8:43 ` [Bug target/56442] " pitchumani.s at atmel dot com
  2013-02-25 10:56 ` [Bug other/56442] " gjl at gcc dot gnu.org
@ 2013-06-06 13:26 ` gjl at gcc dot gnu.org
  2014-06-12 13:53 ` [Bug other/56442] postreload uses content of clobbered register rguenth at gcc dot gnu.org
  2024-01-18  9:55 ` [Bug rtl-optimization/56442] " gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-06-06 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eric.weddington at atmel dot com
   Target Milestone|---                         |4.7.4


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

* [Bug other/56442] postreload uses content of clobbered register
  2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
                   ` (2 preceding siblings ...)
  2013-06-06 13:26 ` gjl at gcc dot gnu.org
@ 2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  2024-01-18  9:55 ` [Bug rtl-optimization/56442] " gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56442

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.4                       |---

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Unsetting target milestone of open non-regression bug from version of branch
being closed.


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

* [Bug rtl-optimization/56442] postreload uses content of clobbered register
  2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
                   ` (3 preceding siblings ...)
  2014-06-12 13:53 ` [Bug other/56442] postreload uses content of clobbered register rguenth at gcc dot gnu.org
@ 2024-01-18  9:55 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56442

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Maybe this is similar to PR101188.

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

end of thread, other threads:[~2024-01-18  9:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25  8:42 [Bug target/56442] New: Could not identify that register is clobbered already pitchumani.s at atmel dot com
2013-02-25  8:43 ` [Bug target/56442] " pitchumani.s at atmel dot com
2013-02-25 10:56 ` [Bug other/56442] " gjl at gcc dot gnu.org
2013-06-06 13:26 ` gjl at gcc dot gnu.org
2014-06-12 13:53 ` [Bug other/56442] postreload uses content of clobbered register rguenth at gcc dot gnu.org
2024-01-18  9:55 ` [Bug rtl-optimization/56442] " gjl at gcc dot gnu.org

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).