public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/54815] New: [avr] missed optimization with operations with constant operands
@ 2012-10-04 18:20 gjl at gcc dot gnu.org
  2012-10-08  8:33 ` [Bug other/54815] " gjl at gcc dot gnu.org
  2012-10-13  6:38 ` [Bug target/54815] " gjl at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-10-04 18:20 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54815
           Summary: [avr] missed optimization with operations with
                    constant operands
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@atmel.com
            Target: avr


Created attachment 28359
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28359
mov.c: C test case

== C code ==

void f (int, int);

void f_and (int x)
{
    f (x, x & 0xff23);
}

void f_or (int x)
{
    f (x, x | 42);
}

void f_xor (int x)
{
    f (x, x ^ 0x80);
}



== Compile with ==

$ avr-gcc mov.c -S -Os -mmcu=atmega8 -dp

The result is 

f_or:
    ldi r22,lo8(42)     ;  15    *movhi/5    [length = 2]
    ldi r23,0
    or r22,r24     ;  6    iorhi3/1    [length = 2]
    or r23,r25
    rjmp f

but the code could MOVW first to the destination and the IOR instead of loading
the target with the const and then IOR against the source:

f_or:
    movw r22,r24   ; *movhi    [length = 1]
    ori r22,lo8(42)     ;  iorhi3    [length = 1]
    rjmp f

Similar for the other test functions.


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

* [Bug other/54815] [avr] missed optimization with operations with constant operands
  2012-10-04 18:20 [Bug other/54815] New: [avr] missed optimization with operations with constant operands gjl at gcc dot gnu.org
@ 2012-10-08  8:33 ` gjl at gcc dot gnu.org
  2012-10-13  6:38 ` [Bug target/54815] " gjl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-10-08  8:33 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2012-10-08 08:32:56 UTC ---
Author: gjl
Date: Mon Oct  8 08:32:46 2012
New Revision: 192198

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192198
Log:
    PR target/54815
    * config/avr/avr.md (*add<mode>3, add<mode>3, addpsi3): Make
    constraint alternative "r,0,r" slighly more expensive.
    (sub<mode>3,
    (andqi3, andhi3, andpsi3, andsi3): Ditto.
    (iorqi3, iorhi3, iorpsi3, iorsi3): Ditto.
    (xorhi3, xorpsi3, xorsi3): Ditto.


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


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

* [Bug target/54815] [avr] missed optimization with operations with constant operands
  2012-10-04 18:20 [Bug other/54815] New: [avr] missed optimization with operations with constant operands gjl at gcc dot gnu.org
  2012-10-08  8:33 ` [Bug other/54815] " gjl at gcc dot gnu.org
@ 2012-10-13  6:38 ` gjl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-10-13  6:38 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |RESOLVED
          Component|other                       |target
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2012-10-13 06:38:07 UTC ---
fixed


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

end of thread, other threads:[~2012-10-13  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04 18:20 [Bug other/54815] New: [avr] missed optimization with operations with constant operands gjl at gcc dot gnu.org
2012-10-08  8:33 ` [Bug other/54815] " gjl at gcc dot gnu.org
2012-10-13  6:38 ` [Bug target/54815] " 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).