public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64992] New: More optimize opportunity
@ 2015-02-10  3:01 ishiura-compiler at ml dot kwansei.ac.jp
  2015-02-10 10:18 ` [Bug tree-optimization/64992] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ishiura-compiler at ml dot kwansei.ac.jp @ 2015-02-10  3:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64992
           Summary: More optimize opportunity
           Product: gcc
           Version: 5.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

The two programs (A.c) and (B.c) only differ by one line (marked by "//
<---HERE"),
where (B.c) simply replace local variable b by its initial value 2U.
The code (A.s) for (A.c) is less optimized than (B.s) for (B.c).

(org.c)
int main (void)
{
  volatile int a = -1;
  unsigned int b = 2U;

  int          c = a + 0;
  unsigned     d = b * (1 == c);     //<---HERE

  if (c == -1) ;
  else __builtin_abort();
  if (d == 0U) ;
  else __builtin_abort();

  return 0;
}

(opt.c)
int main (void)
{
  volatile int a = -1;
  unsigned int b = 2U;

  int          c = a + 0;
  unsigned     d = 2U * (1 == c);    //<---HERE

  if (c == -1) ;
  else __builtin_abort();
  if (d == 0U) ;
  else __builtin_abort();

  return 0;
}

(org.s)
main:
.LFB0:
  .cfi_startproc
  subq   $24, %rsp
  .cfi_def_cfa_offset 32
  xorl   %eax, %eax
  movl   $-1, 12(%rsp)
  movl   12(%rsp), %edx
  cmpl   $1, %edx
  sete   %al
  addl   %eax, %eax
  cmpl   $-1, %edx
  jne    .L3
  testl  %eax, %eax
  jne    .L3
  addq   $24, %rsp
  .cfi_remember_state
  .cfi_def_cfa_offset 8
  ret
.L3:
  .cfi_restore_state
  call  abort
  .cfi_endproc
.LFE0:
  .size  main, .-main
  .section  .text.unlikely
.LCOLDE0:
  .section  .text.startup
.LHOTE0:
  .ident  "GCC: (GNU) 5.0.0 20150205 (experimental)"
  .section  .note.GNU-stack,"",@progbits

(opt.s)
main:
.LFB0:
  .cfi_startproc
  subq   $24, %rsp
  .cfi_def_cfa_offset 32
  movl   $-1, 12(%rsp)
  movl   12(%rsp), %eax
  cmpl   $-1, %eax
  jne    .L5
  xorl   %eax, %eax
  addq   $24, %rsp
  .cfi_remember_state
  .cfi_def_cfa_offset 8
  ret
.L5:
  .cfi_restore_state
  call  abort
  .cfi_endproc
.LFE0:
  .size  main, .-main
  .section  .text.unlikely
.LCOLDE0:
  .section  .text.startup
.LHOTE0:
  .ident  "GCC: (GNU) 5.0.0 20150205 (experimental)"
  .section  .note.GNU-stack,"",@progbits


$ x86_64-unknown-linux-gnu-gcc-5.0.0 -v
Using built-in specs.
COLLECT_GCC=x86_64-unknown-linux-gnu-gcc-5.0.0
COLLECT_LTO_WRAPPER=/usr/local/x86_64-tools/gcc-5.0.0/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/iwatsuji/gcc/configure
--prefix=/usr/local/x86_64-tools/gcc-5.0.0/
--with-gmp=/usr/local/gmp-5.1.1/ --with-mpfr=/usr/local/mpfr-3.1.2/
--with-mpc=/usr/local/mpc-1.0.1/ --disable-multilib --disable-nls
--enable-languages=c
Thread model: posix
gcc version 5.0.0 20150205 (experimental) (GCC)


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

end of thread, other threads:[~2022-09-10 21:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10  3:01 [Bug tree-optimization/64992] New: More optimize opportunity ishiura-compiler at ml dot kwansei.ac.jp
2015-02-10 10:18 ` [Bug tree-optimization/64992] " rguenth at gcc dot gnu.org
2015-02-15  5:15 ` ishiura-compiler at ml dot kwansei.ac.jp
2015-02-15 23:32 ` ishiura-compiler at ml dot kwansei.ac.jp
2021-11-29  3:51 ` pinskia at gcc dot gnu.org
2021-11-30 22:08 ` pinskia at gcc dot gnu.org
2021-11-30 22:18 ` pinskia at gcc dot gnu.org
2021-12-01  5:53 ` pinskia at gcc dot gnu.org
2022-08-15 16:41 ` cvs-commit at gcc dot gnu.org
2022-09-10 21:10 ` roger at nextmovesoftware dot com

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).