Bug 31943 - very missed optimization.
Summary: very missed optimization.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-15 21:46 UTC by Pawel Sikora
Modified: 2007-11-09 20:43 UTC (History)
2 users (show)

See Also:
Host:
Target: i386-linux
Build:
Known to work: 4.3.0
Known to fail: 4.2.2
Last reconfirmed:


Attachments
sources (29.09 KB, application/octet-stream)
2007-05-15 21:47 UTC, Pawel Sikora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2007-05-15 21:46:45 UTC
please look at the 32-bit asm. dump:

_Z3msby:
        pushl   %ebx
        movl    12(%esp), %edx
        movl    8(%esp), %eax
        popl    %ebx
        movl    %edx, %eax
        xorl    %edx, %edx
        shrl    $24, %eax
        movzbl  %al,%ecx
        movzbl  %cl, %eax
        ret

wow! this could be done within two intructions:

        movzbl  11(%esp), %eax
        ret

the 64-bits variant looks fine:

_Z3msby:
        movq    %rdi, %rax
        shrq    $56, %rax
        ret
Comment 1 Pawel Sikora 2007-05-15 21:47:44 UTC
Created attachment 13563 [details]
sources
Comment 2 Andrew Pinski 2007-05-15 22:15:55 UTC
Try with -fomit-frame-pointer.
Comment 3 Pawel Sikora 2007-05-15 22:17:37 UTC
(In reply to comment #2)
> Try with -fomit-frame-pointer.

Andrew, please look at the makefile. -fomit.. is there already.
Comment 4 Pawel Sikora 2007-11-09 20:33:33 UTC
current 4.3 works fine:

(32-bits):

_Z3msby:
        movzbl  11(%esp), %eax
        ret

(64-bits):
_Z3msby:
        shrq    $56, %rdi
        movl    %edi, %eax
        ret
Comment 5 Andrew Pinski 2007-11-09 20:43:35 UTC
This was the normal "subreg" issue which was fixed by Ian back on 2007-01-31.