mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Gang <chengang@emindsoft.com.cn>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: dhowells@redhat.com, akpm@linux-foundation.org,
	nicolas.iooss_linux@m4x.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: dcache: Use bool return value instead of int
Date: Tue, 26 Jan 2016 05:24:58 +0800	[thread overview]
Message-ID: <56A692AA.20902@emindsoft.com.cn> (raw)
In-Reply-To: <20160124212728.GA17997@ZenIV.linux.org.uk>


On 1/25/16 05:27, Al Viro wrote:
> 
> Again, do you have _any_ evidence of improved code generation with that
> patch?  Because if you do, I would really like to see it, so I could file
> bugs against gcc optimizer.
> 
> Your impression of what _Bool is and what semantics does it have appears
> to be rather different from that described in C99, but that's a secondary
> issue - first and foremost, on which .config and with which gcc version
> do you see improvements from that change?
> 

For our case, the check_mount function have smaller size under x86_64
(movl for int, movb for bool, movl is longer than movb).

The related objdump is below, welcome any ideas, suggestions, and
discussions for it.

  origin (for int):

00000000 <check_mount>:
       0:       8b 12                   mov    (%edx),%edx
       2:       81 e2 00 00 01 00       and    $0x10000,%edx
       8:       74 16                   je     20 <check_mount+0x20>
       a:       c7 00 01 00 00 00       movl   $0x1,(%eax)
      10:       b8 01 00 00 00          mov    $0x1,%eax
      15:       c3                      ret
      16:       8d 76 00                lea    0x0(%esi),%esi
      19:       8d bc 27 00 00 00 00    lea    0x0(%edi,%eiz,1),%edi
      20:       31 c0                   xor    %eax,%eax
      22:       c3                      ret
      23:       8d b6 00 00 00 00       lea    0x0(%esi),%esi
      29:       8d bc 27 00 00 00 00    lea    0x0(%edi,%eiz,1),%edi

  new (for bool):

00000000 <check_mount>:
       0:       8b 12                   mov    (%edx),%edx
       2:       81 e2 00 00 01 00       and    $0x10000,%edx
       8:       74 0e                   je     18 <check_mount+0x18>
       a:       c6 00 01                movb   $0x1,(%eax)
       d:       b8 01 00 00 00          mov    $0x1,%eax
      12:       c3                      ret
      13:       90                      nop
      14:       8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi
      18:       31 c0                   xor    %eax,%eax
      1a:       c3                      ret
      1b:       90                      nop
      1c:       8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi

[root@localhost fs]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-ana/configure
Thread model: posix
gcc version 6.0.0 20151121 (experimental) (GCC) 


-- 
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed

  reply	other threads:[~2016-01-25 21:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 21:30 chengang
2016-01-11 22:51 ` Al Viro
2016-01-12 21:42   ` Chen Gang
2016-01-12 22:21     ` Al Viro
2016-01-13 22:39       ` Chen Gang
2016-01-13 22:54         ` Al Viro
2016-01-14 15:39           ` Chen Gang
2016-01-24 21:19             ` Chen Gang
2016-01-24 21:27               ` Al Viro
2016-01-25 21:24                 ` Chen Gang [this message]
2016-01-12  0:33 ` David Howells
2016-01-12  1:02   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A692AA.20902@emindsoft.com.cn \
    --to=chengang@emindsoft.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.iooss_linux@m4x.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome