Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752317AbbEDUnB (ORCPT ); Mon, 4 May 2015 16:43:01 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40901 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbbEDUmx (ORCPT ); Mon, 4 May 2015 16:42:53 -0400 Message-ID: <5547D999.9040005@zytor.com> Date: Mon, 04 May 2015 13:42:01 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Linus Torvalds CC: Richard Henderson , Peter Zijlstra , Vladimir Makarov , Jakub Jelinek , Ingo Molnar , Thomas Gleixner , Linux Kernel Mailing List , Borislav Petkov , "gcc@gcc.gnu.org" Subject: Re: [RFC] Design for flag bit outputs from asms References: <20150501151630.GH5029@twins.programming.kicks-ass.net> <20150501163329.GU1751@tucnak.redhat.com> <5543CDC0.6010206@redhat.com> <20150502123958.GK5029@twins.programming.kicks-ass.net> <5547C992.9000703@redhat.com> <5547D30B.2020507@zytor.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1215 Lines: 32 On 05/04/2015 01:35 PM, Linus Torvalds wrote: > On Mon, May 4, 2015 at 1:14 PM, H. Peter Anvin wrote: >> >> I would argue that for x86 what you actually want is to model the >> *conditions* that are available on the flags, not the flags themselves. > > Yes. Otherwise it would be a nightmare to try to describe simple > conditions like "le", which a rather complicated combination of three > of the actual flag bits: > > ((SF ^^ OF) || ZF) = 1 > > which would just be ridiculously painful for (a) the user to describe > and (b) fior the compiler to recognize once described. > > Now, I do admit that most of the cases where you'd use inline asm with > condition codes would probably fall into just simple "test ZF or CF". > But I could certainly imagine other cases. > Yes, although once again I'm more than happy to let gcc do the boolean optimizations if it already has logic to do so (which it might have/want for its own reasons.) -hpa -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/