From patchwork Tue Jun 26 16:19:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140026 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5455188lji; Tue, 26 Jun 2018 09:32:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQZ7ynPTV/ikmJ9VfzOqLZ6o4m0T4zhqTs+Nmtkcc3dAtFniSjT7q8wqdctI+afyPftONt X-Received: by 2002:ac8:28a4:: with SMTP id i33-v6mr2175144qti.112.1530030740651; Tue, 26 Jun 2018 09:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530030740; cv=none; d=google.com; s=arc-20160816; b=iwvao07VDEqYpABTgHJWL8Tz4eha82nfNaVH8iMzsNpqFvFbcBhxdsPsh6DNvbqp/u MBVkwlkYqClFes1XpQDHF9Wn1pRZeN7vrwx0CYtRgZK0ixe1T7OL8dl3cxRP9LJWawry zQx8B8EMq+/vSJMDv5ficzJuxYE0DWrfXm0hrV1u9/CVoCb4FqTfBaYVHTnu3rDD2SWx f3ybjOpPFFMWVpT6oa/ocxbSukFHcgeIC+lylGLOx/ULj30Mqta8gcXJOnNGNUmK7aGq PgyhrEx3rgOq8UBicz99YBmO1WNKM05OVv4KgfDj2metrVgMv718QK5z2/NoD9s28wVp k/Cg== 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=lH6SYbZrp1nnxM5Q44b5Tfdrejt+qZBPLKp5dGcXBeE=; b=vi4vYcOG9ILY6+kWDKCHF3RRLTk+1pEpDXqSMsnXiV11lJ+fujRupRgpQiP58OrOMk 0jmZdpB7D+s3QRQk90NjK0eVVXXaX0LXNchkVYA3XW6U4FTQfhZs5anRBRq1xMPQP3np M+WcigiIUbQtYn6yLW9xBBULiRCCaAtXecuUd8vq3h5V8/WfbFJhDHYMk5htZNCLFJ5Z y/R1hzjnIiHyszrUdFtyztOUIlCY/tVSDiATLjgqZk2bA62DOS+jrAsDxNi8XCNVCQFP tgJUnUbvn/Fk1oZYTAuXssiUdmQAqSi6ioVktqWc/qYAuubRha7+qEUy5ynhtMH/Y3St Mk3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kPh4XGKg; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h15-v6si1962395qta.82.2018.06.26.09.32.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jun 2018 09:32:20 -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=@linaro.org header.s=google header.b=kPh4XGKg; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqtA-0002cC-2Q for patch@linaro.org; Tue, 26 Jun 2018 12:32:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqgq-0000xh-TC for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXqgo-0005vM-25 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:36 -0400 Received: from mail-pg0-x22b.google.com ([2607:f8b0:400e:c05::22b]:32893) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXqgn-0005v2-TK for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:34 -0400 Received: by mail-pg0-x22b.google.com with SMTP id e11-v6so7849502pgq.0 for ; Tue, 26 Jun 2018 09:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lH6SYbZrp1nnxM5Q44b5Tfdrejt+qZBPLKp5dGcXBeE=; b=kPh4XGKgOSW+QNnDUjlZbvQMhmo6klxkDtdgr3Otpp2rLeEfO7lpEpriRpfCWlPm28 JL2zM6obpzZO1GuzjLLse6HarP51sN4L0/YIVmfroiX4KMn7512dQeTOj+FfTr0UWV0C qxgB5m9Ynz9STpT2TPTnblD84k37qb8ySlC9c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lH6SYbZrp1nnxM5Q44b5Tfdrejt+qZBPLKp5dGcXBeE=; b=tQeKc8dDzvLz923Id4whd4e4YE8p1iITOMWnQrE8QMrzMqEbjhhMng8uFm4YTOM3Rp x1ijCP8uSnlmL1NZO0d9V6KEQcLjDZL+kCHGS8pvoEeqTL30h1P7S7BcnoM5t6FZGlrN mRSa3QkjFMDOH49J6A1boJlWhUqX7xhe+AwX7EkDyONOKHOj5ckAk3Lz77IremDzG9nw trWRdNR0B/VjWkd0douJVkXIMVK+tDUxGCkhxp4+9NZOjh4xzvplxJkThkFzzarwogIY aDPXQkA6mEX3rmvHAVzQNxl46//6+3n+8aslj7WSyikA8TeS5LO6/jVFGGewQno6+955 2NCg== X-Gm-Message-State: APt69E22mO/EDTY4HjatU5y1qk4FlF9I8Z3lqYZndhuTxq7ookTSBp5X fvlyCfKqO5NG+Izh9kxcoaEEPNO13Bg= X-Received: by 2002:a63:ba43:: with SMTP id l3-v6mr1928478pgu.295.1530029972682; Tue, 26 Jun 2018 09:19:32 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id 67-v6sm5054306pfm.171.2018.06.26.09.19.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 09:19:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 09:19:14 -0700 Message-Id: <20180626161921.27941-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626161921.27941-1-richard.henderson@linaro.org> References: <20180626161921.27941-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22b Subject: [Qemu-devel] [PATCH 06/13] target/ppc: Tidy gen_conditional_store 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-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Leave only the minimal amount of code within the STCX macro, moving the rest of the code into gen_conditional_store. Remove the explicit call to gen_check_align; the matching LDAX will have already checked alignment, and we verify the same address. Signed-off-by: Richard Henderson --- target/ppc/translate.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 03e8c5df03..e751072404 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3201,14 +3201,17 @@ ST_ATOMIC(stwat, DEF_MEMOP(MO_UL), i32, trunc_tl_i32) ST_ATOMIC(stdat, DEF_MEMOP(MO_Q), i64, mov_i64) #endif -static void gen_conditional_store(DisasContext *ctx, TCGv EA, - int reg, int memop) +static void gen_conditional_store(DisasContext *ctx, TCGMemOp memop) { TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - TCGv t0; + TCGv t0 = tcg_temp_new(); + int reg = rS(ctx->opcode); - tcg_gen_brcond_tl(TCG_COND_NE, EA, cpu_reserve, l1); + gen_set_access_type(ctx, ACCESS_RES); + gen_addr_reg_index(ctx, t0); + tcg_gen_brcond_tl(TCG_COND_NE, t0, cpu_reserve, l1); + tcg_temp_free(t0); t0 = tcg_temp_new(); tcg_gen_atomic_cmpxchg_tl(t0, cpu_reserve, cpu_reserve_val, @@ -3232,19 +3235,10 @@ static void gen_conditional_store(DisasContext *ctx, TCGv EA, tcg_gen_movi_tl(cpu_reserve, -1); } -#define STCX(name, memop) \ -static void gen_##name(DisasContext *ctx) \ -{ \ - TCGv t0; \ - 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); \ - } \ - gen_conditional_store(ctx, t0, rS(ctx->opcode), memop); \ - tcg_temp_free(t0); \ +#define STCX(name, memop) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + gen_conditional_store(ctx, memop); \ } STCX(stbcx_, DEF_MEMOP(MO_UB))