public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110811] New: under-optimized code for x86_64
@ 2023-07-26  7:46 lixinyu20s at ict dot ac.cn
  2023-07-26  9:54 ` [Bug target/110811] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: lixinyu20s at ict dot ac.cn @ 2023-07-26  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110811
           Summary: under-optimized code for x86_64
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lixinyu20s at ict dot ac.cn
  Target Milestone: ---

The following example is not properly optimized, resulting in low quality code:

long a;
int b;
void foo(int c) {
    int t = c > 0;
    b += t;
    a += t;
}

Compile command: gcc -O3 foo.c -S

Output:
foo:
        testl   %edi, %edi
        setg    %al
        setg    %dl
        movzbl  %dl, %edx
        movzbl  %al, %eax
        addl    %edx, b(%rip)
        addq    %rax, a(%rip)
        ret

There are redundant setg and movzbl.

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

end of thread, other threads:[~2023-07-26  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26  7:46 [Bug target/110811] New: under-optimized code for x86_64 lixinyu20s at ict dot ac.cn
2023-07-26  9:54 ` [Bug target/110811] " rguenth 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).