From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxLnE-0004JL-Dv for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:18:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxLnC-0004IX-Qi for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:18:00 -0500 Received: from [199.232.76.173] (port=56505 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxLnC-0004IO-MR for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:17:58 -0500 Received: from mail.codesourcery.com ([65.74.133.4]:40991) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxLnC-0005jI-8M for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:17:58 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [RFC] TCG new op: setcond Date: Tue, 4 Nov 2008 14:16:38 +0100 References: <761ea48b0811040215l3fa16cd6j41e7ee750602e6ea@mail.gmail.com> In-Reply-To: <761ea48b0811040215l3fa16cd6j41e7ee750602e6ea@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200811041316.39122.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laurent Desnogues > this patch implements a new TCG op, setcond, that sets a temp > to 1 if the condition is true, else to 0. The benefit is the potential > removal of brcond instructions, and helpers size reduction which > can lead to using TCG instead of helpers. > - a variant that sets -1 instead of 1 for masking I'm worried about this. If we're not careful we'll end up with an explosion= of=20 different patterns, many of which aren't optimal of different hosts. > =A0 - 64 bit setcond's You should do this sooner rather than later, and on a 32-bit host. > + /* clear ret since setcc only sets the lower 8 bits */ > + tcg_out_modrm(s, 0x01 | (ARITH_XOR << 3) | rexw, ret, ret); This is broken. Inputs and outputs may overlap. > + // TODO this should use tcg_out_modrm > + // however currently tcg_out_modrm outputs an extra byte for > [abcd]l + //tcg_out_modrm(s, (0x90 + tcg_cond_to_jcc[cond]) | P_EXT | > P_REXB, ret, 0) This is the wrong way to fix this. If you really care about the extra code= =20 byte (which is harmless) you should fix tcg_out_modrm. Also, please use C comments, not c++ style //. Paul