From patchwork Tue Jun 26 16:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140015 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5445475lji; Tue, 26 Jun 2018 09:23:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcnFgYLc6NPip6jNMtdzqXOnd2htRrjbwfGr/YMSx8VBLXKNDtZNxngKexqaMltMPwphGkW X-Received: by 2002:ac8:43ce:: with SMTP id w14-v6mr2072720qtn.137.1530030189862; Tue, 26 Jun 2018 09:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530030189; cv=none; d=google.com; s=arc-20160816; b=x+FDGGwLXTqqYIiJ8/ORsexVafaGm4D2VlvfiJemYKzyxpkVE84Pyrcr59v+Dw8jNV ga7HI+qbf76zrqKLCKGAzVbMnLYD0kN5TQxWRDEAByAa9lhAsTb2/qtVhxW0NCUYDx65 9yEBb0TlMqPsHQhxCxH/hQxiTs0CqYK6mA04QnKBsS+rBgQTT3JZcdRQWJkVXYDjauCb Qdq08oahygLiCTznXuwIplta96RqzPRnANgSdSmJAQ5JXb9T8WMt5w1Ii9n+a2pWyQC8 83ph+9W5SloNhIP7A5vhaWM5ZS78M3QNUbAzvwEPiAh+3qZkf7Q19bIUydkLu783TzQQ p3tA== 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=uAlbnLmHMOKDyUSFoJ7XopmxrfJEtu2R4neeK2RMIio=; b=sycLNfSf7SDJSYUXfq5h1rIjgS99T5I0HT0il9D6yy6Svp8yc8UTeNkYXE26/CSRMJ kJLRGZkoBvGkL4c5jqoy8G/eBuU2Qw+rBYlXSLqv4PjvhaLPumbxha2yg6ml/ywIlGwY OUvqP0PVupkwKMLZdEyf96u1jS9u0vBm/NT9wugSjdva8JzvBkbCho4RmMnlvOsr4SV4 wqf4hpTByEch+oPIxqLPJ5G/R8KGAKJDGJDRD2iBRvI7rBMzJvhSQ51FtPtD/yJ8KFZa HsdKUXAwkpm0gdw+k61DHcIG+q/HFq+j/9O4TXVfqfZ8zfq69UFez0uIGmzqkcLlpUSw JsNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gMvYp74D; 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 u185-v6si1921215qkd.12.2018.06.26.09.23.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jun 2018 09:23:09 -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=gMvYp74D; 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]:53772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqkH-0003kU-8s for patch@linaro.org; Tue, 26 Jun 2018 12:23:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqgq-0000xi-T1 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 1fXqgp-0005wd-R8 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:36 -0400 Received: from mail-pl0-x22f.google.com ([2607:f8b0:400e:c01::22f]:38636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXqgp-0005w4-Kc for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:35 -0400 Received: by mail-pl0-x22f.google.com with SMTP id d10-v6so8792605plo.5 for ; Tue, 26 Jun 2018 09:19:35 -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=uAlbnLmHMOKDyUSFoJ7XopmxrfJEtu2R4neeK2RMIio=; b=gMvYp74Dw0eJsmauoJ512whtdVp5Tewr0AuD7zV57TW9jidUyq104eNyBR/r7cTDEG 6mNCqpJ6JgrCwYhVfOnO7eGScPfC6UwAOJPktFdRchkABYCyYNz3R0491n4bcnHKZW5c t1L6tVJtUcgLoo2dVnikHSZnJRtjMFYuEGhXk= 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=uAlbnLmHMOKDyUSFoJ7XopmxrfJEtu2R4neeK2RMIio=; b=s2dPH3AbFpp3LG4/Vgkw95mHaUSV38RsUtZiOS9k77OGXPfj2vZbPi/OcwkKDF6+OO VNJ5CDf39U2vvN899kelLI+HAjkHLkJsx218gVnr6RhCZpYKSOpt8DxwWAapfOUXIKh3 twqNC364XRRMOM/O5oEEtszdwtUBdTS8+tsoIMQaiXaIOoyLPenrZ06WpV5ZfhIn9vwW xTdWNWnv5j2TT2ZtLN5IgP6TgwcfFFrXzc2/MfoGfhBjVW7sGsguwUSkqVGGBPi7oj1z 6j9/DQDP+g6oxNk2MPfbjgEa/Glowxm3YP/v/phUyH95eGvOYv9WfLgwdTW9DSfe2lEJ 6dCQ== X-Gm-Message-State: APt69E1dpbYMOwzrbmmyze0bEDF5624npewl3IChuQwlQI9XKv/aUoBA R+HkYPOKGr5VYfTYM64XXkwxcdBkwg4= X-Received: by 2002:a17:902:7686:: with SMTP id m6-v6mr2355740pll.340.1530029974437; Tue, 26 Jun 2018 09:19:34 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 09:19:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 09:19:15 -0700 Message-Id: <20180626161921.27941-8-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:c01::22f Subject: [Qemu-devel] [PATCH 07/13] 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-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 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 --- 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 */