From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhOQl-0006jO-PX for qemu-devel@nongnu.org; Wed, 30 Sep 2015 16:56:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhOQi-0000MU-HX for qemu-devel@nongnu.org; Wed, 30 Sep 2015 16:56:51 -0400 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:33196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhOQi-0000MD-CC for qemu-devel@nongnu.org; Wed, 30 Sep 2015 16:56:48 -0400 Received: by pacex6 with SMTP id ex6so51068531pac.0 for ; Wed, 30 Sep 2015 13:56:47 -0700 (PDT) Sender: Richard Henderson References: <1443627027-2193-1-git-send-email-james.hogan@imgtec.com> <1443627027-2193-7-git-send-email-james.hogan@imgtec.com> From: Richard Henderson Message-ID: <560C4C87.7070707@twiddle.net> Date: Thu, 1 Oct 2015 06:56:39 +1000 MIME-Version: 1.0 In-Reply-To: <1443627027-2193-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 6/7] tcg/mips: Support full movcond select operation 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/01/2015 01:30 AM, James Hogan wrote: > Adapt the MIPS movcond implementation to handle the full select > operation using a pair of MOVN/MOVZ instructions. > > This allows the register alias constraint to be removed (which is what > ensured v2 == dest), and allows it to be more easily extended to support > the MIPS r6 instructions SELNEZ/SELEQZ which replace MOVN/MOVZ and > require similar logic. > > For example, previously we only supported: > movcond_i32 dest, c1, c2, v1, v2=dest, cond > > With the host code: > MOV[ZN] dest, v1, [!](c1 cond c2) > > Meaning: > if (c1 cond c2) > dest = v1; > > But now v2 doesn't have to equal dest, so we can support: > movcond_i32 dest, c1, c2, v1, v2, cond > > With the host code: > #if dest != v1 > MOV[ZN] dest, v1, [!](c1 cond c2) > #endif > #if dest != v2 > MOV[NZ] dest, v1, ![!](c1 cond c2) > #endif > > Meaning: > #if dest != v1 > if ([!](c1 cond c2)) > dest = v1; > #endif > #if dest != v2 > if (![!](c1 cond c2)) > dest = v2; > #endif I don't think this is a good change. In the case of dest != v1 && dest != v2, we wind up with two conditional instructions. On most targets that I'm familiar with, this is more expensive than a plain move. If r6 was conditional, as opposed to something that we must perforce know about at compilation time, then I'd say go ahead but split this into a normal move followed by a conditional move. But since that's not the case, I don't see the point in changing anything at all. r~