public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/101226] New: Suboptimal codegen for >>/>>>
@ 2021-06-26 16:14 maxsamukha at gmail dot com
  2021-07-16 22:51 ` [Bug tree-optimization/101226] " pinskia at gcc dot gnu.org
  2023-05-02  4:06 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: maxsamukha at gmail dot com @ 2021-06-26 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101226
           Summary: Suboptimal codegen for >>/>>>
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: maxsamukha at gmail dot com
  Target Milestone: ---
            Target: AVR

example.d:

void f1()
{
    __gshared ubyte value;
    value >>>= 5;
}

void f2()
{
    __gshared ubyte value;
    value = value >>> 5;
}

----
avr-gcc -fno-druntime -O3 example.d:

example.f1():
        lds r24,example.f1().value
        swap r24
        lsr r24
        andi r24,lo8(7)
        sts example.f1().value,r24
        ret
example.f2():
        lds r24,example.f2().value
        ldi r25,0
        ldi r27,0
        ldi r26,0
        ldi r18,5
        1:
        lsr r27
        ror r26
        ror r25
        ror r24
        dec r18
        brne 1b
        sts example.f2().value,r24
        ret

The compiler apparently fails to optimize out the integer promotion for >>> in
f2 and produces inefficient machine code.

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

end of thread, other threads:[~2023-05-02  4:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 16:14 [Bug d/101226] New: Suboptimal codegen for >>/>>> maxsamukha at gmail dot com
2021-07-16 22:51 ` [Bug tree-optimization/101226] " pinskia at gcc dot gnu.org
2023-05-02  4:06 ` pinskia 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).