Received: from eggs.gnu.org ([2001:4830:134:3::10]:46532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhOqR-0004WU-RP for qemu-devel@nongnu.org; Wed, 30 Sep 2015 17:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhOqO-0005nK-Nc for qemu-devel@nongnu.org; Wed, 30 Sep 2015 17:23:23 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:5089 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhOqO-0005nC-GI for qemu-devel@nongnu.org; Wed, 30 Sep 2015 17:23:20 -0400 Date: Wed, 30 Sep 2015 22:23:18 +0100 From: James Hogan Message-ID: <20150930212318.GB23982@jhogan-linux.le.imgtec.org> References: <1443627027-2193-1-git-send-email-james.hogan@imgtec.com> <1443627027-2193-7-git-send-email-james.hogan@imgtec.com> <560C4C87.7070707@twiddle.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="V0207lvV8h4k8FAm" Content-Disposition: inline In-Reply-To: <560C4C87.7070707@twiddle.net> 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: Richard Henderson Cc: Leon Alrae , qemu-devel@nongnu.org, Aurelien Jarno --V0207lvV8h4k8FAm Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Richard, On Thu, Oct 01, 2015 at 06:56:39AM +1000, Richard Henderson wrote: > 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 =3D=3D dest), and allows it to be more easily extended to su= pport > > 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=3Ddest, cond > > > > With the host code: > > MOV[ZN] dest, v1, [!](c1 cond c2) > > > > Meaning: > > if (c1 cond c2) > > dest =3D 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 !=3D v1 > > MOV[ZN] dest, v1, [!](c1 cond c2) > > #endif > > #if dest !=3D v2 > > MOV[NZ] dest, v1, ![!](c1 cond c2) > > #endif > > > > Meaning: > > #if dest !=3D v1 > > if ([!](c1 cond c2)) > > dest =3D v1; > > #endif > > #if dest !=3D v2 > > if (![!](c1 cond c2)) > > dest =3D v2; > > #endif >=20 > I don't think this is a good change. In the case of dest !=3D v1 && dest= !=3D v2,=20 > we wind up with two conditional instructions. On most targets that I'm= =20 > familiar with, this is more expensive than a plain move. >=20 > If r6 was conditional, as opposed to something that we must perforce know= about=20 > at compilation time, then I'd say go ahead but split this into a normal m= ove=20 > followed by a conditional move. But since that's not the case, I don't s= ee the=20 > point in changing anything at all. Yeh, I think you're right. This is certainly the change I was struggling to convince myself about it being worthwhile, since it was unclear to me just what net effect the operand aliasing constraint would have on register allocation and the generated code. I'll resubmit my original version without this patch. R2/R6 will just have different constraints via an ifdef so that the R2 code doesn't have to deal with that case (since dest will always be v2). Thanks for the review! Cheers James --V0207lvV8h4k8FAm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWDFLGAAoJEGwLaZPeOHZ61NAP/2UHP441IdOg9xQ978JVC3oQ 54fUulgIu41iJ+smhvJLqWbkZAYtGGyfaU9ZwcrSDbEvl76NjP2VVBViSKI8EQeG I6P28S8fCwUHwhccpd85PbkzNTPKQAa43tnoGldkZiJCivGMFHy0p4e9hU5FTVjt UpfiOKFjZSUOB9yjHPcEOqCWvP6m5ouD7YVtewn6mqomWTtaVDiW87ufwEcOD5rH Wx4gXlDOzytc7xemcGakhjau5UnkO4F50f7vjWAuW1TM13Nx95BJP0kyPS+j4Lam OTvW4nwnNkzDCz9GG2XG4Mi5lUKQ72/JeMSwNP8ldenUcfkaMILOBD2E/bMG7/eu 71TZTV2Y1KAo3sFKSTmQpD28Hx6sVXoigOUEyfCxr95T0IpvyJHtti3DOMFmFZVg FVu5Z34Nvex3UZUJ7eOpL+rIo6tgPW+tukyXhLZ+ZhqgvWuiyVAqBILu8qBmtQxH QYB2MXGBj/py+qCiUJVTjJ3V1zGtC3CMqKYVUk9kRQK8YNbDZU8oRKAHfIgPmb+m 05w07KKXfWZL/dPkKUTwBSJt8IFyLQpOSHJYJXJHekd8PD4IyJLj6PBhnGjdCKtJ Ne99eoGr38CP0SHPXgzFLuhH3WBqpvChvORcqiKBHZ9bDv9jT17+wHqmJfMIQyjb 0hYLypdwn7GGI3YlhHG5 =EAP8 -----END PGP SIGNATURE----- --V0207lvV8h4k8FAm--