From patchwork Tue Jul 3 05:57:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 140888 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp756709ljj; Mon, 2 Jul 2018 22:58:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeS333aBBaHwezOXIDh0CHkqTUsAEpLGnQ0fZ6opZaPGrc9I5jArMbJzVPj9bmeK0RdknKV X-Received: by 2002:a37:258b:: with SMTP id l11-v6mr23876493qkl.438.1530597532386; Mon, 02 Jul 2018 22:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530597532; cv=none; d=google.com; s=arc-20160816; b=nXtcfeLHcgFDONKSq4N50XS33Nb82bZuv+cbzWuymAxQMvNMYZCd9AkB/T00sLv1of vVV+V0XIzJXaM6raRBMicPfSQQ0tVRZi0+a8NNFNF2dWtXbqTFm8tRb3HXgZZKyRmoV9 KQ/Qkn46aOrXhHeKsZzkkzv5lzNCn3zPi9rhJs/pbCulZNJnJ6bdx8Xlf3Gg7rWJmFZN kyAY0btCGndOEmqePyq3Nt9ZP0YlWc7joqW1XGZU6rvZN3Ksw9PWUhx70+YbOTSFIYhq YZcqYvCKNg5JSfQs0mCkzcJvXrEIatcNNYHh1EV5ZHTGYM/NQqJb84jEzfzOuiaPUBp/ k/Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=tuBXnu7qY45o7+ayJX5gnvnCXU+3wpzMRmkL4imSlgY=; b=nmCXPtruylcgqNAjuOM0z12Ux2z3C8+LvEBzh94+AbTWF90IM82tm0iUSZfHEkgwzX qObbNxLmU8b4v1dbakKf86EQYhyjF1/hGWwkzsPB46tQu66ExBnEPgDe6TFPrWqoDG+g KRz9jFfacBEDz6gU6he52J4uUXfRF0GWKwgFE6PFb2XIYnxrVqgjwOI3UdFcRmgCHR5P xON7+vOOFRRnC6WD2TxDyMeKc5UpqBR7thgdMpTmUTrVazTOpX92OYYSvtKEOy6urKLv xdMHCU7Rbvb4gmPB2au1W0Oh7SMTTWgVT1TWOoS4w/CZO0IVOkYj4e5AfJRZxEUpPjQ/ PGyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=QcFArCdX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g4-v6si322763qth.293.2018.07.02.22.58.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 22:58:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=QcFArCdX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:37930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEKx-0002t5-TL for patch@linaro.org; Tue, 03 Jul 2018 01:58:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEKT-0002pS-Md for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faEKS-0006x1-0q for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:21 -0400 Received: from ozlabs.org ([203.11.71.1]:41219) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faEKR-0006tz-Jc; Tue, 03 Jul 2018 01:58:19 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41KYM94Y0Bz9s9T; Tue, 3 Jul 2018 15:58:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1530597493; bh=jQ+D44/6jbdI34RwZC4Q7pAZmq+H1BaA5lJmD7EFNgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QcFArCdXduJQnmhMmaW8S3ClL1fpk6OwWHH7Ao3RRXk5oMEDjMIMdZRTUHPxgCWHD hcieqOttoGAyOk4eVtEcRW/0XmhKabvD27rz4vCoJrOMr0Sq3HhCx2FF65nZLezFRo sUK4/1Z6K3N9adCXBbSK6Ed8efR5Nrpxq+pmWHik= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 3 Jul 2018 15:57:46 +1000 Message-Id: <20180703055804.13449-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180703055804.13449-1-david@gibson.dropbear.id.au> References: <20180703055804.13449-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 17/35] target/ppc: Split out gen_load_locked X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Richard Henderson , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Leave only the minimal amount of code within the LDAR macro, moving the rest of the code into gen_load_locked. Use MO_ALIGN and remove the explicit call to gen_check_align. Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e751072404..f48fcbeefb 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3070,23 +3070,24 @@ static void gen_isync(DisasContext *ctx) #define MEMOP_GET_SIZE(x) (1 << ((x) & MO_SIZE)) -#define LARX(name, memop) \ -static void gen_##name(DisasContext *ctx) \ -{ \ - TCGv t0; \ - TCGv gpr = cpu_gpr[rD(ctx->opcode)]; \ - int len = MEMOP_GET_SIZE(memop); \ - gen_set_access_type(ctx, ACCESS_RES); \ - t0 = tcg_temp_local_new(); \ - gen_addr_reg_index(ctx, t0); \ - if ((len) > 1) { \ - gen_check_align(ctx, t0, (len)-1); \ - } \ - tcg_gen_qemu_ld_tl(gpr, t0, ctx->mem_idx, memop); \ - tcg_gen_mov_tl(cpu_reserve, t0); \ - tcg_gen_mov_tl(cpu_reserve_val, gpr); \ - tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); \ - tcg_temp_free(t0); \ +static void gen_load_locked(DisasContext *ctx, TCGMemOp memop) +{ + TCGv gpr = cpu_gpr[rD(ctx->opcode)]; + TCGv t0 = tcg_temp_new(); + + gen_set_access_type(ctx, ACCESS_RES); + gen_addr_reg_index(ctx, t0); + tcg_gen_qemu_ld_tl(gpr, t0, ctx->mem_idx, memop | MO_ALIGN); + tcg_gen_mov_tl(cpu_reserve, t0); + tcg_gen_mov_tl(cpu_reserve_val, gpr); + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); + tcg_temp_free(t0); +} + +#define LARX(name, memop) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + gen_load_locked(ctx, memop); \ } /* lwarx */