public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/41894] wrong code with -fno-split-wide-types
       [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-13 12:07 ` avr at gjlay dot de
  2011-04-14 18:51 ` gjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: avr at gjlay dot de @ 2011-03-13 12:07 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <avr at gjlay dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |avr at gjlay dot de

--- Comment #10 from Georg-Johann Lay <avr at gjlay dot de> 2011-03-13 12:07:06 UTC ---
(In reply to comment #9)
> Closing as fixed in 4.5.0.

Why and how is this bug fixed? Slight variations in source/compiler will make
this bug appear/disappear, so that testing the same source against other
compiler version does not tell wether or not the bug actually has gone.

QImode still is not allowed in r28/r29.

PR46779 (4.4.x) and PR45291 (4.5.x) are duplicates for this bug in different
compiler versions.

Some passes like subreg lowering, RTL lowering generate 
  (set (subreg:QI (REG:HI ...
where HI reg finally gets allocated to r29:r28, however, the subreg is not
allowed in r28 resp. r29 leading to wrong code.

See also comment in 
http://gcc.gnu.org/ml/gcc/2011-02/msg00498.html

All the hacks in avr_hard_regno_mode_ok just work around prolems somewhere
else, and maybe around problems that have been fixed long ago.

IMO avr_hard_regno_mode_ok should be written according to documentation and
look what regressions that triggers, if any.

Johann


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

* [Bug target/41894] wrong code with -fno-split-wide-types
       [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
  2011-03-13 12:07 ` [Bug target/41894] wrong code with -fno-split-wide-types avr at gjlay dot de
@ 2011-04-14 18:51 ` gjl at gcc dot gnu.org
  2011-05-21 15:15 ` ilya.lesokhin at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-04-14 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-04-14 18:50:15 UTC ---
Author: gjl
Date: Thu Apr 14 18:50:02 2011
New Revision: 172442

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172442
Log:
    PR target/46779
    PR target/45291
    PR target/41894
    * gcc.target/avr/pr46779-1.c: New test case
    * gcc.target/avr/pr46779-2.c: New test case


Added:
    trunk/gcc/testsuite/gcc.target/avr/pr46779-1.c
    trunk/gcc/testsuite/gcc.target/avr/pr46779-2.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/41894] wrong code with -fno-split-wide-types
       [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
  2011-03-13 12:07 ` [Bug target/41894] wrong code with -fno-split-wide-types avr at gjlay dot de
  2011-04-14 18:51 ` gjl at gcc dot gnu.org
@ 2011-05-21 15:15 ` ilya.lesokhin at gmail dot com
  2011-07-23 15:12 ` gjl at gcc dot gnu.org
  2011-07-23 15:14 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 15+ messages in thread
From: ilya.lesokhin at gmail dot com @ 2011-05-21 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Ilya Lesokhin <ilya.lesokhin at gmail dot com> 2011-05-21 14:47:33 UTC ---
Created attachment 24319
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24319
simple test case

i belive this is the same bug.

the problem occurs when using r28,r29 and accesing one of them.

as can be seen badCode() doesnt put the value 5 in tester. while goodCode does.


void badCode()
{
  a4:    ef 92           push    r14
  a6:    ff 92           push    r15
  a8:    cf 93           push    r28
  aa:    df 93           push    r29
    } t;

    t.deletedbyte = 5;
    asm (""    : "+y" (t) :);

    t.otherbyte = 17;
  ac:    81 e1           ldi    r24, 0x11    ; 17
  ae:    ec 01           movw    r28, r24

    asm (""    : "+y" (t) :);

    tester = t.deletedbyte;
  b0:    7e 01           movw    r14, r28
  b2:    f0 92 00 01     sts    0x0100, r15
}
  b6:    df 91           pop    r29
  b8:    cf 91           pop    r28
  ba:    ff 90           pop    r15
  bc:    ef 90           pop    r14
  be:    08 95           ret

000000c0 <goodCode>:

void goodCode()
{
  c0:    a0 e0           ldi    r26, 0x00    ; 0
  c2:    b5 e0           ldi    r27, 0x05    ; 5
    } t;

    t.deletedbyte = 5;
    asm (""    : "+x" (t) :);

    t.otherbyte = 17;
  c4:    a1 e1           ldi    r26, 0x11    ; 17

    asm (""    : "+x" (t) :);

    tester = t.deletedbyte;
  c6:    b0 93 00 01     sts    0x0100, r27
}
  ca:    08 95           ret


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

* [Bug target/41894] wrong code with -fno-split-wide-types
       [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-05-21 15:15 ` ilya.lesokhin at gmail dot com
@ 2011-07-23 15:12 ` gjl at gcc dot gnu.org
  2011-07-23 15:14 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 15+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-23 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|avr at gjlay dot de         |gjl at gcc dot gnu.org
         Resolution|FIXED                       |DUPLICATE
   Target Milestone|4.5.0                       |4.6.2

--- Comment #13 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-23 15:09:49 UTC ---


*** This bug has been marked as a duplicate of bug 46779 ***


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

* [Bug target/41894] wrong code with -fno-split-wide-types
       [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-07-23 15:12 ` gjl at gcc dot gnu.org
@ 2011-07-23 15:14 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 15+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-23 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.5.0                       |
      Known to fail|                            |4.5.0, 4.5.2, 4.6.1

--- Comment #14 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-23 15:13:45 UTC ---
Adapted known-o-fail as of attachement 24319 from Ilya.


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (8 preceding siblings ...)
  2009-11-02  0:54 ` hutchinsonandy at gcc dot gnu dot org
@ 2010-09-20  3:03 ` eric dot weddington at atmel dot com
  9 siblings, 0 replies; 15+ messages in thread
From: eric dot weddington at atmel dot com @ 2010-09-20  3:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from eric dot weddington at atmel dot com  2010-09-20 03:03 -------
Closing as fixed in 4.5.0.


-- 

eric dot weddington at atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (7 preceding siblings ...)
  2009-11-01 17:45 ` eric dot weddington at atmel dot com
@ 2009-11-02  0:54 ` hutchinsonandy at gcc dot gnu dot org
  2010-09-20  3:03 ` eric dot weddington at atmel dot com
  9 siblings, 0 replies; 15+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-02  0:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hutchinsonandy at gcc dot gnu dot org  2009-11-02 00:54 -------
The problem seems related to use of R28+r29 - which is also frame pointer.

avr_hard_regno_mode_ok allows R28 in HIMODE but not any other mode. (This hack
was made to avoid reload problem where r29 was used as well as R28 frame
pointer)

It looks like the "not ok" QI subreg 28/29 of "ok" HImode r28 is not handled
well. 

The mode restriction is ignored for input reload. (Perhaps because reload
decides to use available frame pointer)

The output reload needed is 16bit HImode but must be accessible as two QImode 
subregs. Somehow the mode of output reload gets mangled so we get movw r28,r18


Originally ~2005 the rejection of other modes by avr_hard_regno_mode_ok for r28
was only applied when reload was in progress and frame_pointer_required.

So I reapplied this condition and the bug was solved. This function does not
need frame pointer so r28 and r29 are indeed freely available.

  /* Otherwise disallow all regno/mode combinations that span r28:r29.  */
  if (reload_in_progress && frame_pointer_needed && regno <= (REG_Y + 1) &&
(regno + GET_MODE_SIZE (mode)) >= (REG_Y + 1))
    return 0;


This also produces better code!

One concern is that the modes deemed ok or not are now not constant - and
perhaps is the reason why condition was removed.

In Gcc 4.5 the spill is exactly the same but it uses R16/r17 with the correct
output reload subreg - so seems to figure out that r28 is "not ok" - suggesting
problem is fixed.


This may take a while to resolve, with some further research and testing.


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (6 preceding siblings ...)
  2009-11-01 17:28 ` hutchinsonandy at gcc dot gnu dot org
@ 2009-11-01 17:45 ` eric dot weddington at atmel dot com
  2009-11-02  0:54 ` hutchinsonandy at gcc dot gnu dot org
  2010-09-20  3:03 ` eric dot weddington at atmel dot com
  9 siblings, 0 replies; 15+ messages in thread
From: eric dot weddington at atmel dot com @ 2009-11-01 17:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from eric dot weddington at atmel dot com  2009-11-01 17:44 -------
(In reply to comment #4)
> The problem is still present on 4.3.5 head
> I cannot reproduce on 4.5 

Can someone check this to see if bug exists on any 4.4.x?


-- 

eric dot weddington at atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.5.0


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (5 preceding siblings ...)
  2009-11-01 17:27 ` hutchinsonandy at gcc dot gnu dot org
@ 2009-11-01 17:28 ` hutchinsonandy at gcc dot gnu dot org
  2009-11-01 17:45 ` eric dot weddington at atmel dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-01 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hutchinsonandy at gcc dot gnu dot org  2009-11-01 17:27 -------
Created an attachment (id=18946)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18946&action=view)
dump file


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (4 preceding siblings ...)
  2009-11-01 17:24 ` hutchinsonandy at gcc dot gnu dot org
@ 2009-11-01 17:27 ` hutchinsonandy at gcc dot gnu dot org
  2009-11-01 17:28 ` hutchinsonandy at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-01 17:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hutchinsonandy at gcc dot gnu dot org  2009-11-01 17:27 -------
Created an attachment (id=18945)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18945&action=view)
dump file


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (3 preceding siblings ...)
  2009-10-31 23:55 ` eric dot weddington at atmel dot com
@ 2009-11-01 17:24 ` hutchinsonandy at gcc dot gnu dot org
  2009-11-01 17:27 ` hutchinsonandy at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-01 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hutchinsonandy at gcc dot gnu dot org  2009-11-01 17:24 -------
The problem is still present on 4.3.5 head
I cannot reproduce on 4.5 

It looks like reload issue with SUBREG. 

Instruction 18 gets reloaded. The output reload is HImode. I will post dump
files but here is extract that appears to highlight problem.

>From lreg dump file:

;; Pred edge  3 [50.0%]  (fallthru)
(note 16 15 17 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(note 17 16 18 4 NOTE_INSN_DELETED)

(insn 18 17 54 4 pr41894.c:29 (set (subreg:QI (reg/v:HI 43 [ tmp ]) 0)
        (plus:QI (reg:QI 42 [ D.1188 ])
            (const_int -1 [0xffffffff]))) 15 {addqi3} (expr_list:REG_DEAD
(reg:QI 42 [ D.1188 ])
        (nil)))

(jump_insn 54 18 55 4 (set (pc)
        (label_ref 26)) 101 {jump} (nil))
;; End of basic block 4 -> ( 6)
;; lr  out       28 [r28] 32 [__SP_L__] 34 [argL] 43
;; live  out     28 [r28] 32 [__SP_L__] 34 [argL] 43


from greg dump file:

Spilling for insn 18.
Using reg 18 for reload 0
Spilling for insn 18.
Using reg 18 for reload 0

Reloads for insn # 18
Reload 0: reload_in (QI) = (reg:QI 24 r24 [orig:42 D.1188 ] [42])
        reload_out (HI) = (reg/v:HI 28 r28 [orig:43 tmp ] [43])
        LD_REGS, RELOAD_OTHER (opnum = 0)
        reload_in_reg: (reg:QI 24 r24 [orig:42 D.1188 ] [42])
        reload_out_reg: (reg/v:HI 28 r28 [orig:43 tmp ] [43])
        reload_reg_rtx: (reg:HI 18 r18)
deleting insn with uid = 2.
;; Register dispositions:
42 in 24  43 in 28  44 in 24  

;; Hard regs used:  18 19 24 25 28 29 32


Giving


(insn 57 17 18 4 pr41894.c:29 (set (reg:QI 18 r18)
        (reg:QI 24 r24 [orig:42 D.1188 ] [42])) 4 {*movqi} (nil))

(insn 18 57 58 4 pr41894.c:29 (set (reg:QI 18 r18)
        (plus:QI (reg:QI 18 r18)
            (const_int -1 [0xffffffff]))) 15 {addqi3} (nil))

(insn 58 18 54 4 pr41894.c:29 (set (reg/v:HI 28 r28 [orig:43 tmp ] [43])
        (reg:HI 18 r18)) 8 {*movhi} (nil))

(jump_insn 54 58 55 4 (set (pc)


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
                   ` (2 preceding siblings ...)
  2009-10-31 23:12 ` j at uriah dot heep dot sax dot de
@ 2009-10-31 23:55 ` eric dot weddington at atmel dot com
  2009-11-01 17:24 ` hutchinsonandy at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: eric dot weddington at atmel dot com @ 2009-10-31 23:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

eric dot weddington at atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.3.2
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-31 23:55:40
               date|                            |


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
  2009-10-31 23:02 ` [Bug target/41894] " hutchinsonandy at gcc dot gnu dot org
  2009-10-31 23:10 ` j at uriah dot heep dot sax dot de
@ 2009-10-31 23:12 ` j at uriah dot heep dot sax dot de
  2009-10-31 23:55 ` eric dot weddington at atmel dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: j at uriah dot heep dot sax dot de @ 2009-10-31 23:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from j at uriah dot heep dot sax dot de  2009-10-31 23:11 -------
The bug was originally reported in the (Germany-language) mikrocontroller.net
forum, and I confirmed the bug on my local GCC 4.3.2 setup before asking
Frank to submit it as an official bug report.


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
  2009-10-31 23:02 ` [Bug target/41894] " hutchinsonandy at gcc dot gnu dot org
@ 2009-10-31 23:10 ` j at uriah dot heep dot sax dot de
  2009-10-31 23:12 ` j at uriah dot heep dot sax dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: j at uriah dot heep dot sax dot de @ 2009-10-31 23:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from j at uriah dot heep dot sax dot de  2009-10-31 23:10 -------
Created an attachment (id=18944)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18944&action=view)
Full assembler code I get from GCC 4.3.2


-- 


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


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

* [Bug target/41894] wrong code with -fno-split-wide-types
  2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
@ 2009-10-31 23:02 ` hutchinsonandy at gcc dot gnu dot org
  2009-10-31 23:10 ` j at uriah dot heep dot sax dot de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-10-31 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hutchinsonandy at gcc dot gnu dot org  2009-10-31 23:02 -------
Please post entire assembler code.


-- 

hutchinsonandy at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hutchinsonandy at gcc dot
                   |                            |gnu dot org


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


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

end of thread, other threads:[~2011-07-23 15:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-41894-4@http.gcc.gnu.org/bugzilla/>
2011-03-13 12:07 ` [Bug target/41894] wrong code with -fno-split-wide-types avr at gjlay dot de
2011-04-14 18:51 ` gjl at gcc dot gnu.org
2011-05-21 15:15 ` ilya.lesokhin at gmail dot com
2011-07-23 15:12 ` gjl at gcc dot gnu.org
2011-07-23 15:14 ` gjl at gcc dot gnu.org
2009-10-31 21:44 [Bug c/41894] New: " frank at mynety dot net
2009-10-31 23:02 ` [Bug target/41894] " hutchinsonandy at gcc dot gnu dot org
2009-10-31 23:10 ` j at uriah dot heep dot sax dot de
2009-10-31 23:12 ` j at uriah dot heep dot sax dot de
2009-10-31 23:55 ` eric dot weddington at atmel dot com
2009-11-01 17:24 ` hutchinsonandy at gcc dot gnu dot org
2009-11-01 17:27 ` hutchinsonandy at gcc dot gnu dot org
2009-11-01 17:28 ` hutchinsonandy at gcc dot gnu dot org
2009-11-01 17:45 ` eric dot weddington at atmel dot com
2009-11-02  0:54 ` hutchinsonandy at gcc dot gnu dot org
2010-09-20  3:03 ` eric dot weddington at atmel 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).