[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ce48c59-4b9c-bd48-ce07-b230376fba0f@zytor.com>
Date: Wed, 8 Jun 2016 02:31:31 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly
outputs
On 06/08/16 02:20, Ingo Molnar wrote:
>
> Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates worse code
> with modern compilers then I'm not going to argue for worse code. Would a 'char'
> return type be very weird?
>
Yes. I have to admit I don't share your hatred for "bool" -- it gives
the compiler a fairly crucial bit of information about what the possible
values are for a certain piece of data.
Upcasting to char loses that, and may case gcc to manifest the value as
an integer instead of retaining it in the flags. It is, however, less
likely to cause gcc to then try to widen the value to word size (which
is an extra instruction on x86), but moving the value out of and back
into the flags register is the big cost.
-hpa
Powered by blists - more mailing lists