From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjlJ3-0005E2-LV for qemu-devel@nongnu.org; Wed, 07 Oct 2015 05:46:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjlJ0-000785-B2 for qemu-devel@nongnu.org; Wed, 07 Oct 2015 05:46:41 -0400 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:34031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjlJ0-00077Z-0p for qemu-devel@nongnu.org; Wed, 07 Oct 2015 05:46:38 -0400 Received: by padhy16 with SMTP id hy16so16832343pad.1 for ; Wed, 07 Oct 2015 02:46:37 -0700 (PDT) Sender: Richard Henderson References: <1443788657-14537-1-git-send-email-james.hogan@imgtec.com> <1443788657-14537-7-git-send-email-james.hogan@imgtec.com> From: Richard Henderson Message-ID: <5614E9F6.8060102@twiddle.net> Date: Wed, 7 Oct 2015 20:46:30 +1100 MIME-Version: 1.0 In-Reply-To: <1443788657-14537-7-git-send-email-james.hogan@imgtec.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 6/6] tcg/mips: Support r6 SEL{NE, EQ}Z instead of MOVN/MOVZ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: James Hogan , qemu-devel@nongnu.org Cc: Leon Alrae , Aurelien Jarno On 10/02/2015 10:24 PM, James Hogan wrote: > Extend MIPS movcond implementation to support the SELNEZ/SELEQZ > instructions introduced in MIPS r6 (where MOVN/MOVZ have been removed). > > Whereas the "MOVN/MOVZ rd, rs, rt" instructions have the following > semantics: > rd = [!]rt ? rs : rd > > The "SELNEZ/SELEQZ rd, rs, rt" instructions are slightly different: > rd = [!]rt ? rs : 0 > > First we ensure that if one of the movcond input values is zero that it > comes last (we can swap the input arguments if we invert the condition). > This is so that it can exactly match one of the SELNEZ/SELEQZ > instructions and avoid the need to emit the other one. > > Otherwise we emit the opposite instruction first into a temporary > register, and OR that into the result: > SELNEZ/SELEQZ TMP1, v2, c1 > SELEQZ/SELNEZ ret, v1, c1 > OR ret, ret, TMP1 > > Which does the following: > ret = cond ? v1 : v2 > > Signed-off-by: James Hogan > Cc: Richard Henderson > Cc: Aurelien Jarno Reviewed-by: Richard Henderson > { INDEX_op_brcond_i32, { "rZ", "rZ" } }, > +#if !use_mips32r6_instructions > { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "0" } }, > +#else > + { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "rZ" } }, > +#endif The only thing I'd change is preferring positive tests to negative ones. So swap the order of these lines, and the sense of the #if. Leon, do you want to take this as a mips maintainer, or shall I as tcg maintainer? r~