From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbcIDFHI (ORCPT ); Sun, 4 Sep 2016 01:07:08 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:54120 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbcIDFHH (ORCPT ); Sun, 4 Sep 2016 01:07:07 -0400 Date: Sun, 4 Sep 2016 02:01:44 +0100 From: Al Viro To: Chen Gang Cc: Vineet Gupta , Arnd Bergmann , "akpm@linux-foundation.org" , "minchan@kernel.org" , "vbabka@suse.cz" , "gi-oh.kim@profitbricks.com" , "iamjoonsoo.kim@lge.com" , "hillf.zj@alibaba-inc.com" , "mgorman@techsingularity.net" , "mhocko@suse.com" , "rientjes@google.com" , "linux-kernel@vger.kernel.org" , "rth@twiddle.net" , "ink@jurassic.park.msu.ru" , "mattst88@gmail.com" , "linux@armlinux.org.uk" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "hskinnemoen@gmail.com" , "egtvedt@samfundet.no" , "realmz6@gmail.com" , "ysato@users.sourceforge.jp" , "rkuo@codeaurora.org" , "tony.luck@intel.com" , "fenghua.yu@intel.com" , "geert@linux-m68k.org" , "james.hogan@imgtec.com" , "ralf@linux-mips.org" , "dhowells@redhat.com" , "deller@gmx.de" , "benh@kernel.crashing.org" , "paulus@samba.org" , "mpe@ellerman.id.au" , "schwidefsky@de.ibm.com" , "heiko.carstens@de.ibm.com" , "dalias@libc.org" , "David S. Miller" Subject: Re: cmsg newgroup alt.sex.fetish.bool (was Re: [PATCH] arch: all: include: asm: bitops: Use bool instead of int for all bit test functions) Message-ID: <20160904010144.GD2356@ZenIV.linux.org.uk> References: <1472362755-26776-1-git-send-email-chengang@emindsoft.com.cn> <201608291503.41630.arnd@arndb.de> <80e3ae6c-e81d-3541-9051-07ad726b59cd@synopsys.com> <57C4ADD1.6020609@emindsoft.com.cn> <20160901204348.GQ2356@ZenIV.linux.org.uk> <57CA0C5D.1080701@emindsoft.com.cn> <8f1f06e3-0ca1-dfec-3ccf-ca155c61fdc6@synopsys.com> <57CB5088.6050007@emindsoft.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57CB5088.6050007@emindsoft.com.cn> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 04, 2016 at 06:36:56AM +0800, Chen Gang wrote: > And for all: shall I provide the proof for another archs? > > For me, Boolean gives additional chance to compiler to improve the code. Whereas for compiler it gives nothing. Not in those cases. > If the compiler can not improve the code, it can treat it as int simply. > So theoretically, at least, Boolean should not be worse than int. Except for pointless code churn and pandering to irrational beliefs, that is... Please, RTFISO9899 and learn the semantics of _Bool; it's not that complicated. Start with 6.2.5[2,6] and 6.3.1.2, then look through 6.8.4 and 6.8.5 to figure out the semantics of conditions in if/while/for. Note also 6.5.8, 6.5.9, 6.5.13 and 6.5.14 and observe that type of (x > 5 && y < 1) is *NOT* _Bool; it's int. If you can show any improvement or loss in code generation in this case (static inline int converted to static inline bool), I would really like to see the details. As in .config/file/function/gcc version/target architecture. Optimizer bugs happens, but they should be reported when found, and I would expect _Bool handling to be _less_ exercised than that of normal logical expressions, so loss is probably more likely. And yes, it also should be reported.