Received: from eggs.gnu.org ([2001:4830:134:3::10]:53583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXjD-0001GY-Ov for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:35:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTXj8-0003wK-QF for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:34:55 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:37783 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXj8-0003tb-HF for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:34:50 -0500 Date: Wed, 10 Feb 2016 16:34:39 +0000 From: James Hogan Message-ID: <20160210163439.GI3678@jhogan-linux.le.imgtec.org> References: <1455014403-10742-1-git-send-email-rth@twiddle.net> <1455014403-10742-8-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lqaZmxkhekPBfBzr" Content-Disposition: inline In-Reply-To: <1455014403-10742-8-git-send-email-rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH 07/15] tcg-mips: Adjust qemu_ld/st for mips64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, aurelien@aurel32.net --lqaZmxkhekPBfBzr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Richard, On Tue, Feb 09, 2016 at 09:39:55PM +1100, Richard Henderson wrote: > @@ -1212,11 +1237,24 @@ static void tcg_out_tlb_load(TCGContext *s, TCGRe= g base, TCGReg addrl, > : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); > int add_off =3D offsetof(CPUArchState, tlb_table[mem_index][0].adden= d); > =20 > - tcg_out_opc_sa(s, OPC_SRL, TCG_REG_A0, addrl, > - TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); > - tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_A0, TCG_REG_A0, > - (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); > - tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_A0, TCG_REG_A0, TCG_AREG0); > + if (use_mips32r2_instructions) { > + if (TCG_TARGET_REG_BITS =3D=3D 32 || TARGET_LONG_BITS =3D=3D 32)= { > + tcg_out_opc_bf(s, OPC_EXT, TCG_REG_A0, addrl, > + TARGET_PAGE_BITS + CPU_TLB_ENTRY_BITS - 1, > + CPU_TLB_ENTRY_BITS); > + } else { > + tcg_out_opc_bf64(s, OPC_DEXT, OPC_DEXTM, OPC_DEXTU, > + TCG_REG_A0, addrl, > + TARGET_PAGE_BITS + CPU_TLB_ENTRY_BITS - 1, > + CPU_TLB_ENTRY_BITS); > + } The ext/dext here will end up with bits below bit CPU_TLB_ENTRY_BITS set, which will result in load of addend from slightly offset address, so things go badly wrong. You still need to either ANDI off the low bits or trim them off with the ext/dext and shift it left again. So I don't think there's any benefit to the use of these instructions unless CPU_TLB_SIZE + CPU_TLB_ENTRY_BITS exceeds the 16-bits available in the ANDI immediate field for the non r2 case. Cheers James > + } else { > + tcg_out_opc_sa(s, ALIAS_TSRL, TCG_REG_A0, addrl, > + TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); > + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_A0, TCG_REG_A0, > + (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); > + } > + tcg_out_opc_reg(s, ALIAS_PADD, TCG_REG_A0, TCG_REG_A0, TCG_AREG0); > =20 > /* Compensate for very large offsets. */ > if (add_off >=3D 0x8000) { --lqaZmxkhekPBfBzr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWu2afAAoJEGwLaZPeOHZ6aQoP/2B/c9yXQHBP966hETozSUpj 7YnvAdrDLrrb9H5JvLULVjgd6zL8+29GOtDwpjw+j6cdlRrVLdk6mGCRBK7OKGQb JPQfpPUdIVNtD7W3il/5jKYQ4LFlqmdtWI1WGIBmi3mPx2VfOX/n+zCB7pKLG5a6 ql/gdB5bVUjDDtZdvDVaMJUgR0zmE6P22mWCNHmabARAY9h9PpEUeBbCqbFHBj6j OZw0v62sFUbH0hZRgb/V+TGOC/fPcjFPNYbjqZcDvFSu2kmcnBlh9pEo81pF08fc 6AGJFWbG/l6IJS6AquAgqgjgVj1q10iDaF7hQEI4lVIz3H/1iqnHGIhnfSjDApK5 swjlhjWNrZcxB35dy0Aacrgcw81UOwk4Pxsk/j0+c7YVRds7AGXL9e1pHEnn+cHK ro9/eW5zC0Zo7Q6YizwKoPKSROXHD8XJ3+t2cW38nTwJjU/IM3cbGc8YbjJ6fGyz Di9MARdow73p01zVYZYkLW4+44HFRpgh1aBNywiZQsYYqfq9JPwp6mmaq9JTYTc3 YQKPIgGXWQaMCmhsuUfhII+3lUl887e2/s8T8Ge4NzztKRPzWaFd8XrFvyRlzPWZ xuLx1kKSjxbbaj69z0fDzvMbWljMTZjtJ6p/rAKWvFt5TwubeRd262CvxSeDlfup u/17w3+/hciD44BdmWbb =vLRL -----END PGP SIGNATURE----- --lqaZmxkhekPBfBzr--