public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109476] New: Missing optimization for 8bit/8bit multiplication / regression
@ 2023-04-11 19:19 klaus.doldinger64 at googlemail dot com
  2023-04-11 19:27 ` [Bug target/109476] " klaus.doldinger64 at googlemail dot com
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: klaus.doldinger64 at googlemail dot com @ 2023-04-11 19:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109476

            Bug ID: 109476
           Summary: Missing optimization for 8bit/8bit multiplication /
                    regression
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: klaus.doldinger64 at googlemail dot com
  Target Milestone: ---

For avr-gcc > 4.6.4 the follwing function

uint16_t mul(const uint8_t a, const uint16_t b) {
    return static_cast<uint8_t>((b >> 8) + 0) * a ;
}

produces suboptimal

mul(unsigned char, unsigned int):
        mov r18,r23
        ldi r19,0
        mov r20,r24
        mul r20,r18
        movw r24,r0
        mul r20,r19
        add r25,r0
        clr __zero_reg__
        ret

whereas avr-gcc 4.6.4 produces optimal

mul(unsigned char, unsigned int):
        mul r23,r24
        movw r24,r0
        clr r1
        ret

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

end of thread, other threads:[~2023-05-07  8:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 19:19 [Bug c++/109476] New: Missing optimization for 8bit/8bit multiplication / regression klaus.doldinger64 at googlemail dot com
2023-04-11 19:27 ` [Bug target/109476] " klaus.doldinger64 at googlemail dot com
2023-04-12 11:14 ` rguenth at gcc dot gnu.org
2023-04-12 11:33 ` klaus.doldinger64 at googlemail dot com
2023-04-12 12:21 ` [Bug rtl-optimization/109476] " rguenth at gcc dot gnu.org
2023-04-12 15:43 ` segher at gcc dot gnu.org
2023-04-12 16:48 ` klaus.doldinger64 at googlemail dot com
2023-04-12 18:43 ` roger at nextmovesoftware dot com
2023-04-12 20:20 ` klaus.doldinger64 at googlemail dot com
2023-04-12 20:56 ` segher at gcc dot gnu.org
2023-04-13  7:01 ` rguenth at gcc dot gnu.org
2023-04-13 12:55 ` klaus.doldinger64 at googlemail dot com
2023-04-13 15:19 ` segher at gcc dot gnu.org
2023-04-13 17:57 ` klaus.doldinger64 at googlemail dot com
2023-04-13 21:49 ` roger at nextmovesoftware dot com
2023-04-14  7:42 ` klaus.doldinger64 at googlemail dot com
2023-04-14  7:46 ` klaus.doldinger64 at googlemail dot com
2023-04-23 20:22 ` roger at nextmovesoftware dot com
2023-04-28 13:22 ` cvs-commit at gcc dot gnu.org
2023-05-07  8:30 ` roger at nextmovesoftware 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).