public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
       [not found] <bug-16541-1008@http.gcc.gnu.org/bugzilla/>
@ 2008-09-14  4:21 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-14  4:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-09-14 04:20 -------
IRA produces even worse code ...


-- 


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


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

* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
       [not found] <bug-16541-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-22 15:51 ` steven at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu.org @ 2011-05-22 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

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

--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> 2011-05-22 15:21:05 UTC ---
(In reply to comment #2)
> Here is a simplified test case that shows a code quality regression:
> 
> extern unsigned char first_one[65536];
> int FirstOnet(unsigned long long arg1)
> {
>   if (arg1 >> 48)
>     return (first_one[arg1 >> 48]);
>   return 0;
> }
> 
> the code generated by gcc-3.0 -O2 -fomit-frame-pointer is:
> 
>         movl    8(%esp), %edx
>         movl    %edx, %eax
>         shrl    $16, %eax
>         xorl    %edx, %edx
>         movl    %eax, %ecx
>         orl     %edx, %ecx
>         je      .L3
>         movzbl  first_one(%eax), %eax
>         ret
>         .p2align 2
> .L3:
>         xorl    %eax, %eax
>         ret
> 
> and by mainline (a bit worse): 
> 
>         pushl   %ebx               <- using a callee saved register
>         xorl    %ecx, %ecx
>         movl    12(%esp), %edx
>         movl    %edx, %eax         <- why not load directly to eax?
>         xorl    %edx, %edx
>         shrl    $16, %eax
>         movl    %edx, %ebx
>         orl     %eax, %ebx
>         je      .L4
>         movzbl  first_one(%eax), %ecx
> .L4:
>         popl    %ebx
>         movl    %ecx, %eax
>         ret
> 
> 
> Here is what Intel's compiler generates:
> 
>         movzwl    10(%esp), %edx                                #28.5
>         xorl      %eax, %eax                                    #30.3
>         orl       %edx, %eax                                    #30.3
>         je        ..B1.3        # Prob 50%                      #30.3
>                                 # LOE edx ebx ebp esi edi
> ..B1.2:                         # Preds ..B1.1
>         movzbl    first_one(%edx), %eax                         #31.13
>         ret                                                     #31.13
>                                 # LOE
> ..B1.3:                         # Preds ..B1.1
>         xorl      %eax, %eax                                    #32.10
>         ret                                                     #32.10
> 
> 
> 

$ cc1 -quiet -m32 -O2 t.c -fdump-tree-optimized
$ cat t.s 
    .file    "t.c"
    .text
    .p2align 4,,15
    .globl    FirstOnet
    .type    FirstOnet, @function
FirstOnet:
.LFB0:
    .cfi_startproc
    movzwl    10(%esp), %edx
    xorl    %eax, %eax
    testl    %edx, %edx
    je    .L2
    movzbl    first_one(%edx), %eax
.L2:
    rep
    ret
    .cfi_endproc
.LFE0:
    .size    FirstOnet, .-FirstOnet
    .ident    "GCC: (GNU) 4.6.0 20110312 (experimental) [trunk revision
170907]"
    .section    .note.GNU-stack,"",@progbits


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

* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
  2004-07-14 16:17 [Bug middle-end/16541] New: code quality issue for bit manipulations dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-08-31 17:22 ` dann at godzilla dot ics dot uci dot edu
@ 2005-05-12 17:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-12 17:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-12 17:40 -------
Looks like a register allocation issue.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra


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


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

* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
  2004-07-14 16:17 [Bug middle-end/16541] New: code quality issue for bit manipulations dann at godzilla dot ics dot uci dot edu
  2004-07-14 16:28 ` [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit pinskia at gcc dot gnu dot org
  2004-07-14 21:58 ` dann at godzilla dot ics dot uci dot edu
@ 2004-08-31 17:22 ` dann at godzilla dot ics dot uci dot edu
  2005-05-12 17:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-08-31 17:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-08-31 17:22 -------
Using -fno-if-conversion when compiling to the code in comment #2 improves the
generated assembly a bit:

        movl    8(%esp), %edx
        movl    %edx, %eax
        xorl    %edx, %edx
        shrl    $16, %eax
        movl    %edx, %ecx
        orl     %eax, %ecx
        jne     .L2
        xorl    %eax, %eax
        ret
        .p2align 4,,7
.L2:
        movzbl  first_one(%eax), %eax
        ret


-- 


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


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

* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
  2004-07-14 16:17 [Bug middle-end/16541] New: code quality issue for bit manipulations dann at godzilla dot ics dot uci dot edu
  2004-07-14 16:28 ` [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit pinskia at gcc dot gnu dot org
@ 2004-07-14 21:58 ` dann at godzilla dot ics dot uci dot edu
  2004-08-31 17:22 ` dann at godzilla dot ics dot uci dot edu
  2005-05-12 17:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-07-14 21:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-07-14 21:58 -------
Here is a simplified test case that shows a code quality regression:

extern unsigned char first_one[65536];
int FirstOnet(unsigned long long arg1)
{
  if (arg1 >> 48)
    return (first_one[arg1 >> 48]);
  return 0;
}

the code generated by gcc-3.0 -O2 -fomit-frame-pointer is:

        movl    8(%esp), %edx
        movl    %edx, %eax
        shrl    $16, %eax
        xorl    %edx, %edx
        movl    %eax, %ecx
        orl     %edx, %ecx
        je      .L3
        movzbl  first_one(%eax), %eax
        ret
        .p2align 2
.L3:
        xorl    %eax, %eax
        ret

and by mainline (a bit worse): 

        pushl   %ebx               <- using a callee saved register
        xorl    %ecx, %ecx
        movl    12(%esp), %edx
        movl    %edx, %eax         <- why not load directly to eax?
        xorl    %edx, %edx
        shrl    $16, %eax
        movl    %edx, %ebx
        orl     %eax, %ebx
        je      .L4
        movzbl  first_one(%eax), %ecx
.L4:
        popl    %ebx
        movl    %ecx, %eax
        ret


Here is what Intel's compiler generates:

        movzwl    10(%esp), %edx                                #28.5
        xorl      %eax, %eax                                    #30.3
        orl       %edx, %eax                                    #30.3
        je        ..B1.3        # Prob 50%                      #30.3
                                # LOE edx ebx ebp esi edi
..B1.2:                         # Preds ..B1.1
        movzbl    first_one(%edx), %eax                         #31.13
        ret                                                     #31.13
                                # LOE
..B1.3:                         # Preds ..B1.1
        xorl      %eax, %eax                                    #32.10
        ret                                                     #32.10




-- 


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


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

* [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit
  2004-07-14 16:17 [Bug middle-end/16541] New: code quality issue for bit manipulations dann at godzilla dot ics dot uci dot edu
@ 2004-07-14 16:28 ` pinskia at gcc dot gnu dot org
  2004-07-14 21:58 ` dann at godzilla dot ics dot uci dot edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-14 16:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-14 16:28 -------
Confirmed, basically 64bit and subregisters are not optimized that well on x86, see PR 15792 for 
another example.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15792
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
          Component|middle-end                  |rtl-optimization
     Ever Confirmed|                            |1
 GCC target triplet|                            |i686-pc-linux-gnu
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-14 16:28:16
               date|                            |
            Summary|code quality issue for bit  |code quality issue for bit
                   |manipulations               |manipulations with 64bit


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


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

end of thread, other threads:[~2011-05-22 15:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-16541-1008@http.gcc.gnu.org/bugzilla/>
2008-09-14  4:21 ` [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit pinskia at gcc dot gnu dot org
     [not found] <bug-16541-4@http.gcc.gnu.org/bugzilla/>
2011-05-22 15:51 ` steven at gcc dot gnu.org
2004-07-14 16:17 [Bug middle-end/16541] New: code quality issue for bit manipulations dann at godzilla dot ics dot uci dot edu
2004-07-14 16:28 ` [Bug rtl-optimization/16541] code quality issue for bit manipulations with 64bit pinskia at gcc dot gnu dot org
2004-07-14 21:58 ` dann at godzilla dot ics dot uci dot edu
2004-08-31 17:22 ` dann at godzilla dot ics dot uci dot edu
2005-05-12 17:40 ` pinskia at gcc dot gnu dot 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).