From patchwork Mon Jun 20 22:10:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 101217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 85666B6F82 for ; Tue, 21 Jun 2011 08:14:40 +1000 (EST) Received: from localhost ([::1]:58737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYmjs-0005Yf-L9 for incoming@patchwork.ozlabs.org; Mon, 20 Jun 2011 18:14:36 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYmgh-0005Y4-5F for qemu-devel@nongnu.org; Mon, 20 Jun 2011 18:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYmgg-0002KX-0B for qemu-devel@nongnu.org; Mon, 20 Jun 2011 18:11:18 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:61013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYmgf-0002KN-LW for qemu-devel@nongnu.org; Mon, 20 Jun 2011 18:11:17 -0400 Received: by qyk10 with SMTP id 10so1626477qyk.4 for ; Mon, 20 Jun 2011 15:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer; bh=RdS45OSSjOSUg9IHl4jV4LBzme3ThtbrkdMJMO7BcjE=; b=bHVlOqlSAjlrfi1PQSvAoGD/QsdAWXA8Q2YUfqfiVaZWpYHADNaGa3xggEi7tVWhFf siwvZo7cll+t/e+8SW+btrxPBnjTnJj9mg7vZ7HAZHo/sA6ifyrK6cl+3MJAMUdvAJ8A 5VwGWNGl/neN8C96bMryZSieTLnQYWlRE4/j8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer; b=b2R3Ge2sOrCXfOvtpJdihXsBw29afgmN9A6dxjqUx9XaNtO1qq+ibQvoV2ufOJpF11 /yhym5gsYRF2q8Swq3Ak5SbSIximB8OdHVMaC+fYY8G0Q9idBsmENRmUIdxzbS34na3q TZSGFpfaf1i9wnnB0iWvhInuCYEBhrlP0wZqQ= Received: by 10.229.114.194 with SMTP id f2mr4470977qcq.112.1308607877040; Mon, 20 Jun 2011 15:11:17 -0700 (PDT) Received: from localhost.localdomain (c-71-227-161-214.hsd1.wa.comcast.net [71.227.161.214]) by mx.google.com with ESMTPS id u15sm4442900qcq.36.2011.06.20.15.11.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 15:11:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 20 Jun 2011 15:10:49 -0700 Message-Id: <1308607849-20754-1-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.173 Subject: [Qemu-devel] [PATCH] tcg-hppa: Support deposit opcode. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/hppa/tcg-target.c | 24 ++++++++++++++++++++---- tcg/hppa/tcg-target.h | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c index 95f3316..16423aa 100644 --- a/tcg/hppa/tcg-target.c +++ b/tcg/hppa/tcg-target.c @@ -467,6 +467,14 @@ static inline void tcg_out_dep(TCGContext *s, int ret, int arg, | INSN_SHDEP_CP(31 - ofs) | INSN_DEP_LEN(len)); } +static inline void tcg_out_depi(TCGContext *s, int ret, int arg, + unsigned ofs, unsigned len) +{ + assert(ofs < 32 && len <= 32 - ofs); + tcg_out32(s, INSN_DEPI | INSN_R2(ret) | INSN_IM5(arg) + | INSN_SHDEP_CP(31 - ofs) | INSN_DEP_LEN(len)); +} + static inline void tcg_out_shd(TCGContext *s, int ret, int hi, int lo, unsigned count) { @@ -499,8 +507,7 @@ static void tcg_out_ori(TCGContext *s, int ret, int arg, tcg_target_ulong m) assert(bs1 == 32 || (1ul << bs1) > m); tcg_out_mov(s, TCG_TYPE_I32, ret, arg); - tcg_out32(s, INSN_DEPI | INSN_R2(ret) | INSN_IM5(-1) - | INSN_SHDEP_CP(31 - bs0) | INSN_DEP_LEN(bs1 - bs0)); + tcg_out_depi(s, ret, -1, bs0, bs1 - bs0); } static void tcg_out_andi(TCGContext *s, int ret, int arg, tcg_target_ulong m) @@ -529,8 +536,7 @@ static void tcg_out_andi(TCGContext *s, int ret, int arg, tcg_target_ulong m) tcg_out_extr(s, ret, arg, 0, ls0, 0); } else { tcg_out_mov(s, TCG_TYPE_I32, ret, arg); - tcg_out32(s, INSN_DEPI | INSN_R2(ret) | INSN_IM5(0) - | INSN_SHDEP_CP(31 - ls0) | INSN_DEP_LEN(ls1 - ls0)); + tcg_out_depi(s, ret, 0, ls0, ls1 - ls0); } } @@ -1459,6 +1465,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, args[4], args[5], const_args[2], const_args[4]); break; + case INDEX_op_deposit_i32: + if (const_args[2]) { + tcg_out_depi(s, args[0], args[2], args[3], args[4]); + } else { + tcg_out_dep(s, args[0], args[2], args[3], args[4]); + } + break; + case INDEX_op_qemu_ld8u: tcg_out_qemu_ld(s, args, 0); break; @@ -1552,6 +1566,8 @@ static const TCGTargetOpDef hppa_op_defs[] = { { INDEX_op_add2_i32, { "r", "r", "rZ", "rZ", "rI", "rZ" } }, { INDEX_op_sub2_i32, { "r", "r", "rI", "rZ", "rK", "rZ" } }, + { INDEX_op_deposit_i32, { "r", "0", "rJ" } }, + #if TARGET_LONG_BITS == 32 { INDEX_op_qemu_ld8u, { "r", "L" } }, { INDEX_op_qemu_ld8s, { "r", "L" } }, diff --git a/tcg/hppa/tcg-target.h b/tcg/hppa/tcg-target.h index a5cc440..f7919ce 100644 --- a/tcg/hppa/tcg-target.h +++ b/tcg/hppa/tcg-target.h @@ -94,6 +94,7 @@ enum { #define TCG_TARGET_HAS_not_i32 #define TCG_TARGET_HAS_andc_i32 // #define TCG_TARGET_HAS_orc_i32 +#define TCG_TARGET_HAS_deposit_i32 /* optional instructions automatically implemented */ #undef TCG_TARGET_HAS_neg_i32 /* sub rd, 0, rs */