From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PXM-0003kY-7u for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6PXG-0001CZ-9j for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:44 -0400 Received: from mail-qe0-x235.google.com ([2607:f8b0:400d:c02::235]:55814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PXG-0001CT-5O for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:38 -0400 Received: by mail-qe0-f53.google.com with SMTP id f6so1926939qej.40 for ; Mon, 05 Aug 2013 11:29:37 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Mon, 5 Aug 2013 08:28:40 -1000 Message-Id: <1375727330-30515-6-git-send-email-rth@twiddle.net> In-Reply-To: <1375727330-30515-1-git-send-email-rth@twiddle.net> References: <1375727330-30515-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH for-next 05/15] tcg-ppc64: Look through the function descriptor when profitable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Vassili Karpov (malc)" , Richard Henderson Loading 32-bit immediates instead of memory will be faster. Don't attempt to generate full 64-bit immediates. Signed-off-by: Richard Henderson --- tcg/ppc64/tcg-target.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c index ddc9581..2563253 100644 --- a/tcg/ppc64/tcg-target.c +++ b/tcg/ppc64/tcg-target.c @@ -722,6 +722,17 @@ static void tcg_out_call(TCGContext *s, tcg_target_long arg, #else TCGReg reg = arg; if (const_arg) { + uintptr_t tgt = ((uintptr_t *)arg)[0]; + uintptr_t toc = ((uintptr_t *)arg)[1]; + + /* Look through the function descriptor, if profitable. */ + if (tgt == (int32_t)tgt && toc == (int32_t)toc) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, toc); + tcg_out_b(s, lk, tgt); + return; + } + + /* Avoid generating two full 64-bit constants. */ reg = TCG_REG_R2; tcg_out_movi(s, TCG_TYPE_I64, reg, arg); } -- 1.8.3.1