public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions
@ 2011-12-05 18:08 gjl at gcc dot gnu.org
  2011-12-05 18:09 ` [Bug target/51425] " gjl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-12-05 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51425
           Summary: [4.7 Regression] Compiler fails to produce SBIS/SBIC
                    instructions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@atmel.com
            Target: avr


Versions <= 4.6 of avr-gcc produce the SBIC/SBIC (Skip one instruction if Bit
in I/O is Clear/Set), but 4.7 fails to synthesize these instructions for bit
numbers 0..6.

Test program:

#define PORTB (*((unsigned char volatile*) 0x38))

extern char c;

void skip_1 (void)
{ 
    if (PORTB & 0x20)        c = 0;
}

void skip_2 (void)
{ 
    if (!(PORTB & 0x20))     c = 0;
}

Compiled with

$ avr-gcc -Os -S -dp -mmcu=atmega128 -fdump-rtl-combine-details

Output with 4.7:

skip_1:
    in r24,56-0x20     ;  6    *movqi/4    [length = 1]
    sbrs r24,5     ;  9    *sbrx_branchqi    [length = 2]
    rjmp .L1
    sts c,__zero_reg__     ;  11    *movqi/3    [length = 2]
.L1:
    ret     ;  28    return    [length = 1]

skip_2:
    in r24,56-0x20     ;  6    *movqi/4    [length = 1]
    sbrc r24,5     ;  9    *sbrx_branchqi    [length = 2]
    rjmp .L6
    sts c,__zero_reg__     ;  11    *movqi/3    [length = 2]
.L6:
    ret     ;  20    return    [length = 1]


Output with 4.6.2:

skip_1:
    sbis 56-0x20,5     ;  10    *sbix_branch    [length = 2]
    rjmp .L1
    sts c,__zero_reg__     ;  12    *movqi/3    [length = 2]
.L1:
    ret     ;  22    return    [length = 1]

skip_2:
    sbic 56-0x20,5     ;  10    *sbix_branch    [length = 2]
    rjmp .L3
    sts c,__zero_reg__     ;  12    *movqi/3    [length = 2]
.L3:
    ret     ;  20    return    [length = 1]



*sbix_branch is a combine pattern that is matched by 4.6:

Trying 6 -> 10:
Successfully matched this instruction:
(set (pc)
    (if_then_else (eq (zero_extract:HI (mem/v:QI (const_int 56 [0x38]) [0
MEM[(volatile unsigned char *)56B]+0 S1 A8])
                (const_int 1 [0x1])
                (const_int 5 [0x5]))
            (const_int 0 [0]))
        (label_ref:HI 15)
        (pc)))
deferring deletion of insn with uid = 6.
modifying insn i3    10 pc={(zero_extract([0x38],0x1,0x5)==0)?L15:pc}
      REG_BR_PROB: 0xf3c
deferring rescan insn with uid = 10.


but rejected by 4.7:


Trying 6 -> 9:
Failed to match this instruction:
(set (pc)
    (if_then_else (eq (zero_extract:QI (mem/v:QI (const_int 56 [0x38]) [0
MEM[(volatile unsigned char *)56B]+0 S1 A8])
                (const_int 1 [0x1])
                (const_int 5 [0x5]))
            (const_int 0 [0]))
        (label_ref:HI 14)
        (pc)))

4.7 tries zero_extract:QI whereas 4.6 tried zero_extract:HI so that using QIHI
mode iterator in *sbix_branch/*sbix_branch_tmp instead of HI maybe does the
trick.


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

* [Bug target/51425] [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions
  2011-12-05 18:08 [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions gjl at gcc dot gnu.org
@ 2011-12-05 18:09 ` gjl at gcc dot gnu.org
  2011-12-05 18:10 ` gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-12-05 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-05
          Component|rtl-optimization            |target
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-12-05 18:09:12 UTC ---
Setting component to "target".


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

* [Bug target/51425] [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions
  2011-12-05 18:08 [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions gjl at gcc dot gnu.org
  2011-12-05 18:09 ` [Bug target/51425] " gjl at gcc dot gnu.org
@ 2011-12-05 18:10 ` gjl at gcc dot gnu.org
  2011-12-09 11:55 ` gjl at gcc dot gnu.org
  2011-12-09 12:02 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-12-05 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
           Severity|normal                      |minor


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

* [Bug target/51425] [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions
  2011-12-05 18:08 [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions gjl at gcc dot gnu.org
  2011-12-05 18:09 ` [Bug target/51425] " gjl at gcc dot gnu.org
  2011-12-05 18:10 ` gjl at gcc dot gnu.org
@ 2011-12-09 11:55 ` gjl at gcc dot gnu.org
  2011-12-09 12:02 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-12-09 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-12-09 11:54:34 UTC ---
Author: gjl
Date: Fri Dec  9 11:54:29 2011
New Revision: 182159

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182159
Log:
    PR target/51425
    * config/avr/avr.md (config/avr/avr.md, *sbix_branch_tmp): Use
    zero_extract:QIHI instead of zero_extract:HI.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.md


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

* [Bug target/51425] [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions
  2011-12-05 18:08 [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-12-09 11:55 ` gjl at gcc dot gnu.org
@ 2011-12-09 12:02 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-12-09 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-12-09 11:56:11 UTC ---
Fixed for 4.7.0


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

end of thread, other threads:[~2011-12-09 11:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 18:08 [Bug rtl-optimization/51425] New: [4.7 Regression] Compiler fails to produce SBIS/SBIC instructions gjl at gcc dot gnu.org
2011-12-05 18:09 ` [Bug target/51425] " gjl at gcc dot gnu.org
2011-12-05 18:10 ` gjl at gcc dot gnu.org
2011-12-09 11:55 ` gjl at gcc dot gnu.org
2011-12-09 12:02 ` 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).