Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751823AbbEDVX7 (ORCPT ); Mon, 4 May 2015 17:23:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:41379 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751012AbbEDVXw (ORCPT ); Mon, 4 May 2015 17:23:52 -0400 Message-ID: <5547E335.5060708@zytor.com> Date: Mon, 04 May 2015 14:23: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: Richard Henderson , Linus Torvalds CC: 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> <5547D7A3.2010203@redhat.com> <5547DD29.2020805@redhat.com> In-Reply-To: <5547DD29.2020805@redhat.com> 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: 1321 Lines: 42 On 05/04/2015 01:57 PM, Richard Henderson wrote: > > Sure. > > I'd be more inclined to support these compound conditionals directly, rather > than try to get the compiler to recognize them after the fact. > > Indeed, I believe we have a near complete set of them in the x86 backend > already. It'd just be a matter of selecting the spellings for the constraints. > Whichever works for you. The full set of conditions, mnemonics, and a bitmask with the bits in the order from MSB to LSB (OF,SF,ZF,PF,CF) which is probably the sanest way to model these for the purpose of boolean optimization. Opcode Mnemonics Condition Bitmask 0 o OF 0xffff0000 1 no !OF 0x0000ffff 2 b/c/nae CF 0xaaaaaaaa 3 ae/nb/nc !CF 0x55555555 4 e/z ZF 0xf0f0f0f0 5 ne/nz !ZF 0x0f0f0f0f 6 na CF || ZF 0xfafafafa 7 a !CF && !ZF 0x05050505 8 s SF 0xff00ff00 9 ns !SF 0x00ff00ff A p/pe PF 0xcccccccc B np/po !PF 0x33333333 C l/nge SF != OF 0x00ffff00 D ge/nl SF == OF 0xff0000ff E le/ng ZF || (SF != OF) 0xf0fffff0 F g/nle !ZF && (SF == OF) 0x0f00000f -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/