public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66299] New: more optimize oppotunity
@ 2015-05-27  7:34 ishiura-compiler at ml dot kwansei.ac.jp
  2015-05-27  7:47 ` [Bug tree-optimization/66299] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ishiura-compiler at ml dot kwansei.ac.jp @ 2015-05-27  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66299
           Summary: more optimize oppotunity
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ishiura-compiler at ml dot kwansei.ac.jp
  Target Milestone: ---

We compiled a program (A.c) by GCC-6.0.0 and LLVM/Clang-3.7.0 with -O3 option.
LLVM/Clang worked better on this test case, where the shift operation is
optimized out. 

(A.c)
int main (void)
{
        volatile signed int x = 1;
        unsigned int t = ((unsigned int)1U<<x);

        if (t == 2U) ;
        else __builtin_abort();

    return 0;
}

+--------------------------------------------------------+------------------------------------------------------+
|                gcc.s (gcc A.c -O3 -S)                  |             clang.s
(clang A.c -O3 -S)               |
+--------------------------------------------------------+------------------------------------------------------+
|main:                                                   |                     
                                *
|.LFB11:                                                 |main:                
                  # @main       *
|        .cfi_startproc                                  |       
.cfi_startproc                                |
|        subq  $24, %rsp                                 |# BB#0:              
                  # %entry      *
|        .cfi_def_cfa_offset 32                          |        pushq   %rax 
                                *
|        movl  $1, %eax                                  |.Ltmp0:              
                                *
|        movl    $1, 12(%rsp)                            |       
.cfi_def_cfa_offset 16                        *
|        movl    12(%rsp), %ecx                          |        movl    $1,
4(%rsp)                           *
|        sall    %cl, %eax                               |        movl   
4(%rsp), %eax                         *
|        cmpl    $2, %eax                                |        cmpl    $1,
%eax                              *
|        jne     .L5                                     |        jne    
.LBB0_2                               *
|                                                        |# BB#1:              
                  # %if.end     *
|        xorl    %eax, %eax                              |        xorl    %eax,
%eax                            |
|        addq    $24, %rsp                               |        popq    %rdx 
                                *
|        .cfi_remember_state                             |        retq         
                                *
|        .cfi_def_cfa_offset 8                           |.LBB0_2:             
                  # %if.else    *
|        ret                                             |        callq   abort
                                *
|.L5:                                                    |.Ltmp1:              
                                *
|        .cfi_restore_state                              |        .size   main,
.Ltmp1-main                     *
|        call    abort                                   |                     
                                |
|        .cfi_endproc                                    |        .cfi_endproc 
                                |
|.LFE11:                                                 |                     
                                *
|        .size\tmain, .-main                             |                     
                                *
|        .section        .text.unlikely                  |                     
                                *
|.LCOLDE0:                                               |                     
                                *
|        .section        .text.startup                   |                     
                                |
|.LHOTE0:                                                |                     
                                |
+--------------------------------------------------------+------------------------------------------------------+


gcc (GCC) 6.0.0 20150416 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

clang version 3.7.0 (trunk 237801)
Target: x86_64-unknown-linux-gnu
Thread model: posix


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

end of thread, other threads:[~2015-06-09 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27  7:34 [Bug tree-optimization/66299] New: more optimize oppotunity ishiura-compiler at ml dot kwansei.ac.jp
2015-05-27  7:47 ` [Bug tree-optimization/66299] " pinskia at gcc dot gnu.org
2015-05-27  7:59 ` jakub at gcc dot gnu.org
2015-05-27  8:29 ` mpolacek at gcc dot gnu.org
2015-05-28 10:27 ` mpolacek at gcc dot gnu.org
2015-05-28 10:27 ` mpolacek at gcc dot gnu.org
2015-06-09 14:24 ` [Bug tree-optimization/66299] more optimize opportunity mpolacek at gcc dot gnu.org
2015-06-09 14:27 ` mpolacek 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).