From patchwork Wed Oct 26 21:15:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122026 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 64A791007D2 for ; Thu, 27 Oct 2011 09:10:05 +1100 (EST) Received: from localhost ([::1]:41957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJArL-0007JJ-P4 for incoming@patchwork.ozlabs.org; Wed, 26 Oct 2011 17:18:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJAqF-0005aG-VT for qemu-devel@nongnu.org; Wed, 26 Oct 2011 17:16:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJAqE-0005ET-K0 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 17:16:55 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:62059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJAqE-000560-51 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 17:16:54 -0400 Received: by mail-wy0-f173.google.com with SMTP id 15so2370708wyh.4 for ; Wed, 26 Oct 2011 14:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=7K1cTtvEHWxSrIJf78k0JkA3tLPbEFWw7sU3BoNkliU=; b=tFwxikOXM9py3i3m32cfT52iZnwCqjeeuVl2ElDYymIAe+a6ES9TtTq5nd2p+b9ByF 4I9AjcGJ4y9w6w+9VjBHlSbnEyNA0/6Z1jJ0wzIow233TkXszk7cAdj5Ksoq6nBDPJJU x1NyTrutUVH7a5RYERhEE4KPJPVmfyBideIkE= Received: by 10.227.58.15 with SMTP id e15mr12367137wbh.10.1319663813742; Wed, 26 Oct 2011 14:16:53 -0700 (PDT) Received: from localhost.localdomain (c-98-203-235-125.hsd1.wa.comcast.net. [98.203.235.125]) by mx.google.com with ESMTPS id gd18sm5462382wbb.5.2011.10.26.14.16.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Oct 2011 14:16:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Oct 2011 14:15:34 -0700 Message-Id: <1319663736-7545-15-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1319663736-7545-1-git-send-email-rth@twiddle.net> References: <1319663736-7545-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.173 Cc: blauwirbel@gmail.com Subject: [Qemu-devel] [PATCH 14/16] target-sparc: Implement ALIGNADDR* inline. 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 While ALIGNADDR was implemented out-of-line, ALIGNADDRL was not implemeneted at all. However, this is a very simple operation so we're better off doing this inline. Signed-off-by: Richard Henderson --- target-sparc/helper.h | 1 - target-sparc/translate.c | 24 ++++++++++++++++++++++-- target-sparc/vis_helper.c | 11 ----------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/target-sparc/helper.h b/target-sparc/helper.h index 07c39a9..73fb0ee 100644 --- a/target-sparc/helper.h +++ b/target-sparc/helper.h @@ -17,7 +17,6 @@ DEF_HELPER_2(wrccr, void, env, tl) DEF_HELPER_1(rdcwp, tl, env) DEF_HELPER_2(wrcwp, void, env, tl) DEF_HELPER_FLAGS_2(array8, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl, tl) -DEF_HELPER_3(alignaddr, tl, env, tl, tl) DEF_HELPER_1(popc, tl, tl) DEF_HELPER_3(ldda_asi, void, tl, int, int) DEF_HELPER_4(ldf_asi, void, tl, int, int, int) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index d02cf06..685a907 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -2324,6 +2324,20 @@ static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, tcg_temp_free(t1); tcg_temp_free(t2); } + +static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) +{ + TCGv tmp = tcg_temp_new(); + + tcg_gen_add_tl(tmp, s1, s2); + tcg_gen_andi_tl(dst, tmp, -8); + if (left) { + tcg_gen_neg_tl(tmp, tmp); + } + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); + + tcg_temp_free(tmp); +} #endif #define CHECK_IU_FEATURE(dc, FEATURE) \ @@ -4167,11 +4181,17 @@ static void disas_sparc_insn(DisasContext * dc) CHECK_FPU_FEATURE(dc, VIS1); cpu_src1 = get_src1(insn, cpu_src1); gen_movl_reg_TN(rs2, cpu_src2); - gen_helper_alignaddr(cpu_dst, cpu_env, cpu_src1, cpu_src2); + gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 0); gen_movl_TN_reg(rd, cpu_dst); break; - case 0x019: /* VIS II bmask */ case 0x01a: /* VIS I alignaddrl */ + CHECK_FPU_FEATURE(dc, VIS1); + cpu_src1 = get_src1(insn, cpu_src1); + gen_movl_reg_TN(rs2, cpu_src2); + gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 1); + gen_movl_TN_reg(rd, cpu_dst); + break; + case 0x019: /* VIS II bmask */ // XXX goto illegal_insn; case 0x020: /* VIS I fcmple16 */ diff --git a/target-sparc/vis_helper.c b/target-sparc/vis_helper.c index 59ca8d7..40adb47 100644 --- a/target-sparc/vis_helper.c +++ b/target-sparc/vis_helper.c @@ -41,17 +41,6 @@ target_ulong helper_array8(target_ulong pixel_addr, target_ulong cubesize) GET_FIELD_SP(pixel_addr, 11, 12); } -target_ulong helper_alignaddr(CPUState *env, target_ulong addr, - target_ulong offset) -{ - uint64_t tmp; - - tmp = addr + offset; - env->gsr &= ~7ULL; - env->gsr |= tmp & 7ULL; - return tmp & ~7ULL; -} - uint64_t helper_faligndata(CPUState *env, uint64_t src1, uint64_t src2) { uint64_t tmp;