public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
@ 2011-09-18 13:12 gjl at gcc dot gnu.org
  2011-09-18 13:23 ` [Bug target/50447] " gjl at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-18 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50447
           Summary: [avr] Better support of AND, OR, XOR and PLUS with
                    constant integers for 16- and 32-bit values
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
            Target: avr


The current implementation sometimes leads to poor code for several reasons:

o Insn "*iorsi3_clobber" is hidden behind "iorsi3" and thus will never
  be used.

o There are no such insn for AND, XOR, PLUS so that the constant gets 
  reloaded to a same-width register where a QI was sufficient.

o If a clobber is needed, the value in the clobber reg is not reused.

o Work out if a clobber is actually needed.


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
@ 2011-09-18 13:23 ` gjl at gcc dot gnu.org
  2011-09-22 10:00 ` gjl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-18 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2011-09-18
                 CC|                            |eric.weddington at atmel
                   |                            |dot com
     Ever Confirmed|0                           |1
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.6.1
           Severity|normal                      |enhancement


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
  2011-09-18 13:23 ` [Bug target/50447] " gjl at gcc dot gnu.org
@ 2011-09-22 10:00 ` gjl at gcc dot gnu.org
  2011-09-23 17:09 ` gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-22 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-22 09:55:21 UTC ---
Author: gjl
Date: Thu Sep 22 09:55:13 2011
New Revision: 179081

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179081
Log:
    PR target/50447
    PR target/50465
    * config/avr/avr-protos.h (avr_out_bitop): New prototype.
    (avr_popcount_each_byte): New prototype.
    * config/avr/avr.c (avr_popcount): New static function.
    (avr_popcount_each_byte): New function.
    (avr_out_bitop): New function.
    (adjust_insn_length): ADJUST_LEN_OUT_BITOP dispatches to
    avr_out_bitop.  Cleanup code.
    * config/avr/constraints.md (Ca2, Co2, Cx2): New constraints.
    (Ca4, Co4, Cx4): New constraints.
    * config/avr/avr.md (adjust_len): Add "out_bitop" insn attribute
    alternative.
    (andhi3, iorhi3, xorhi3): Rewrite insns using avr_out_bitop.
    (andsi3, iorsi3, xorsi3): Ditto.
    (*iorhi3_clobber, *iorsi3_clobber): Remove insns.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md
    trunk/gcc/config/avr/constraints.md


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
  2011-09-18 13:23 ` [Bug target/50447] " gjl at gcc dot gnu.org
  2011-09-22 10:00 ` gjl at gcc dot gnu.org
@ 2011-09-23 17:09 ` gjl at gcc dot gnu.org
  2011-09-23 17:11 ` gjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-23 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-23 17:02:20 UTC ---
Author: gjl
Date: Fri Sep 23 17:02:10 2011
New Revision: 179123

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179123
Log:
    PR target/50447
    * config/avr/avr.md: (adjust_len): Add alternative "out_plus".
    (addsi3): Rewrite using QI scratch register.  Adjust text
    peepholes using plus:SI.
    (*addsi3_zero_extend.hi): New insn.
    (*subsi3_zero_extend.hi): New insn.
    (*subhi3_zero_extend1): Set attribute "cc" to "set_czn".
    (*subsi3_zero_extend): Ditto.
    (subsi3): Change predicate #2 to register_operand.
    * config/avr/avr-protos.h (avr_out_plus): New prototype.
    (avr_out_plus_1): New static function.
    (avr_out_plus): New function.
    (adjust_insn_length): Handle ADJUST_LEN_OUT_PLUS.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-09-23 17:09 ` gjl at gcc dot gnu.org
@ 2011-09-23 17:11 ` gjl at gcc dot gnu.org
  2011-09-23 17:21 ` gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-23 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-23 17:06:49 UTC ---
Author: gjl
Date: Fri Sep 23 17:06:44 2011
New Revision: 179124

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179124
Log:
    * config/avr/avr.md (adjust_len): Add alternatives "tsthi",
    "tstsi", "compare".
    (*cmpqi_sign_extend): Use s8_operand.
    (*cmphi, *cmpsi): Rewrite using avr_out_compare.
    * config/avr/avr-protos.h (compare_diff_p, compare_eq_p): Remove
    prototypes.
    (out_tsthi, out_tstsi): Remove prototypes.
    (avr_out_tsthi, avr_out_tstsi): New prototypes.
    * config/avr/avr.c (out_tsthi, out_tstsi): Remove functions.
    (avr_asm_len): Negative length now sets *plen to -length.
    (compare_sign_p): Return bool instead of int.
    (compare_diff_p, compare_eq_p): Ditto and make static.
    (avr_out_tsthi): New function.
    (avr_out_tstsi): New function.
    (avr_out_compare): New function.
    (adjust_insn_length): Handle ADJUST_LEN_TSTHI, ADJUST_LEN_TSTSI,
    ADJUST_LEN_COMPARE.
    PR target/50447


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-09-23 17:11 ` gjl at gcc dot gnu.org
@ 2011-09-23 17:21 ` gjl at gcc dot gnu.org
  2011-10-11 18:29 ` gjl at gcc dot gnu.org
  2011-10-19 15:00 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-23 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-23 17:11:06 UTC ---
Closed this one as fixed for 4.7 trunk.


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-09-23 17:21 ` gjl at gcc dot gnu.org
@ 2011-10-11 18:29 ` gjl at gcc dot gnu.org
  2011-10-19 15:00 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-11 18:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-11 18:28:52 UTC ---
Author: gjl
Date: Tue Oct 11 18:28:49 2011
New Revision: 179816

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179816
Log:
    PR target/50447
    * config/avr/avr.md (cc): Add out_plus attribute alternative.
    (addsi3): Use it.  Adapt avr_out_plus to new prototype.  Use
    avr_out_plus for all CONST_INT addends.
    * config/avr/avr-protos.h (avr_out_plus): Change prototype.
    * config/avr/avr.c (notice_update_cc): Call avr_out_plus on
    CC_OUT_PLUS.
    (avr_out_plus_1): Change prototype and report effect on cc0.
    (avr_out_plus): Ditto.
    (adjust_insn_length): Adapt call to avr_out_plus to new prototype.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md


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

* [Bug target/50447] [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values
  2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-10-11 18:29 ` gjl at gcc dot gnu.org
@ 2011-10-19 15:00 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-19 15:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-19 14:59:05 UTC ---
Author: gjl
Date: Wed Oct 19 14:59:00 2011
New Revision: 180193

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180193
Log:
    PR target/50447
    * config/avr/avr.md (cc): New alternative out_plus_noclobber.
    (adjust_len): Ditto.
    (addhi3): Don't pipe through short; use gen_int_mode instead.
    Prior to reload, expand to gen_addhi3_clobber.
    (*addhi3): Use avr_out_plus_noclobber if applicable, use
    out_plus_noclobber in cc and adjust_len attribute.
    (addhi3_clobber): 2 new RTL peepholes.
    (addhi3_clobber): New insn.
    * config/avr/avr-protos.h: (avr_out_plus_noclobber): New prototype.
    * config/avr/avr.c (avr_out_plus_noclobber): New function.
    (notice_update_cc): Handle CC_OUT_PLUS_NOCLOBBER.
    (avr_out_plus_1): Tweak if only MSB is +/-1 and other bytes are 0.
    Set cc0 to set_zn for adiw on 16-bit values.
    (adjust_insn_length): Handle ADJUST_LEN_OUT_PLUS_NOCLOBBER.
    (expand_epilogue): No need to add 0 to frame_pointer_rtx.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md


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

end of thread, other threads:[~2011-10-19 15:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-18 13:12 [Bug target/50447] New: [avr] Better support of AND, OR, XOR and PLUS with constant integers for 16- and 32-bit values gjl at gcc dot gnu.org
2011-09-18 13:23 ` [Bug target/50447] " gjl at gcc dot gnu.org
2011-09-22 10:00 ` gjl at gcc dot gnu.org
2011-09-23 17:09 ` gjl at gcc dot gnu.org
2011-09-23 17:11 ` gjl at gcc dot gnu.org
2011-09-23 17:21 ` gjl at gcc dot gnu.org
2011-10-11 18:29 ` gjl at gcc dot gnu.org
2011-10-19 15:00 ` 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).