public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/31137]  New: missing "break" in switch for MULT in avr_rtx_costs
@ 2007-03-11 20:47 christer at weinigel dot se
  2007-03-16 21:35 ` [Bug target/31137] " eweddington at cso dot atmel dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: christer at weinigel dot se @ 2007-03-11 20:47 UTC (permalink / raw)
  To: gcc-bugs

I have just started reading the gcc code a bit, and while looking at the avr
port I noticed that in the function avr_rtx_costs in avr.c there is some code
to calculate the cost of a multiplication:

    case MULT:
      switch (mode)
        {
        case QImode:
          if (AVR_HAVE_MUL)
            *total = COSTS_N_INSNS (optimize_size ? 3 : 4);
          else if (optimize_size)
            *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
          else
            return false;

        case HImode:
          if (AVR_HAVE_MUL)
            *total = COSTS_N_INSNS (optimize_size ? 7 : 10);
          else if (optimize_size)
            *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
          else
            return false;

        default:
          return false;
        }
      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code);
      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code);
      return true;

if AVR_HAVE_MUL is true, the above code will be equal to the following:

    case MULT:
      switch (mode)
        {
        case QImode:
          *total = COSTS_N_INSNS (optimize_size ? 3 : 4);

        case HImode:
          *total = COSTS_N_INSNS (optimize_size ? 7 : 10);

        default:
          return false;
        }
      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code);
      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code);
      return true;

which I belive is incorrect since it means that the assignments to *total in
the switch statement are useless.  It probably doesn't break anything serious
but might give slightly worse optimizations.


-- 
           Summary: missing "break" in switch for MULT in avr_rtx_costs
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: christer at weinigel dot se
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: avr-unknown-none


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
@ 2007-03-16 21:35 ` eweddington at cso dot atmel dot com
  2007-04-02 21:44 ` aesok at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: eweddington at cso dot atmel dot com @ 2007-03-16 21:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from eweddington at cso dot atmel dot com  2007-03-16 21:34 -------
Created an attachment (id=13217)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13217&action=view)
Patch to add in the missing break statements.


-- 


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
  2007-03-16 21:35 ` [Bug target/31137] " eweddington at cso dot atmel dot com
@ 2007-04-02 21:44 ` aesok at gcc dot gnu dot org
  2007-04-02 21:53 ` aesok at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: aesok at gcc dot gnu dot org @ 2007-04-02 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from aesok at gcc dot gnu dot org  2007-04-02 22:44 -------
Subject: Bug 31137

Author: aesok
Date: Mon Apr  2 22:43:53 2007
New Revision: 123437

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123437
Log:
        PR target/31137
        * config/avr/avr.c (avr_rtx_costs): Add missing 'break' statements.

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


-- 


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
  2007-03-16 21:35 ` [Bug target/31137] " eweddington at cso dot atmel dot com
  2007-04-02 21:44 ` aesok at gcc dot gnu dot org
@ 2007-04-02 21:53 ` aesok at gcc dot gnu dot org
  2007-04-02 22:00 ` aesok at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: aesok at gcc dot gnu dot org @ 2007-04-02 21:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from aesok at gcc dot gnu dot org  2007-04-02 22:53 -------
Subject: Bug 31137

Author: aesok
Date: Mon Apr  2 22:53:14 2007
New Revision: 123438

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123438
Log:
        PR target/31137
        * config/avr/avr.c (avr_rtx_costs): Add missing 'break' statements.

Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/avr/avr.c


-- 


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
                   ` (2 preceding siblings ...)
  2007-04-02 21:53 ` aesok at gcc dot gnu dot org
@ 2007-04-02 22:00 ` aesok at gcc dot gnu dot org
  2007-04-02 22:04 ` aesok at gcc dot gnu dot org
  2007-04-09 22:45 ` eweddington at cso dot atmel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: aesok at gcc dot gnu dot org @ 2007-04-02 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from aesok at gcc dot gnu dot org  2007-04-02 23:00 -------
Subject: Bug 31137

Author: aesok
Date: Mon Apr  2 23:00:28 2007
New Revision: 123439

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123439
Log:
        PR target/31137
        * config/avr/avr.c (avr_rtx_costs): Add missing 'break' statements.



Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/config/avr/avr.c


-- 


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
                   ` (3 preceding siblings ...)
  2007-04-02 22:00 ` aesok at gcc dot gnu dot org
@ 2007-04-02 22:04 ` aesok at gcc dot gnu dot org
  2007-04-09 22:45 ` eweddington at cso dot atmel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: aesok at gcc dot gnu dot org @ 2007-04-02 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from aesok at gcc dot gnu dot org  2007-04-02 23:03 -------
Fixed.


-- 

aesok at gcc dot gnu dot org changed:

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


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


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

* [Bug target/31137] missing "break" in switch for MULT in avr_rtx_costs
  2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
                   ` (4 preceding siblings ...)
  2007-04-02 22:04 ` aesok at gcc dot gnu dot org
@ 2007-04-09 22:45 ` eweddington at cso dot atmel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: eweddington at cso dot atmel dot com @ 2007-04-09 22:45 UTC (permalink / raw)
  To: gcc-bugs



-- 

eweddington at cso dot atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

end of thread, other threads:[~2007-04-09 22:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-11 20:47 [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs christer at weinigel dot se
2007-03-16 21:35 ` [Bug target/31137] " eweddington at cso dot atmel dot com
2007-04-02 21:44 ` aesok at gcc dot gnu dot org
2007-04-02 21:53 ` aesok at gcc dot gnu dot org
2007-04-02 22:00 ` aesok at gcc dot gnu dot org
2007-04-02 22:04 ` aesok at gcc dot gnu dot org
2007-04-09 22:45 ` eweddington at cso dot 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).