From patchwork Sat Oct 28 19:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738970 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp481498wrt; Sat, 28 Oct 2023 12:49:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA71srVIjNtirdNRci2wXmVAjXeqpLaLBovmPYbxSfqYKlvfx8PUu5Y9M9MAkSDU5iJUB+ X-Received: by 2002:a05:622a:1890:b0:41e:1eb2:6265 with SMTP id v16-20020a05622a189000b0041e1eb26265mr6484698qtc.67.1698522569602; Sat, 28 Oct 2023 12:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698522569; cv=none; d=google.com; s=arc-20160816; b=mzG88+wzzqv5RRM6BXzldrG2QfDXNru5zYYbdbQLH9hNpjhQEohwzMZTitLjI19Ihs 4LplBoKYAQI0aXlHNCuqW4bv4a/v11Vg6/LmPNEujp3hVGLV7kknfAd4d1/blF8rH8lX FJ/fB0Dg3PViuSgz0wbd9KV4YKRpxhIZJRIpI6U8ZC32pZMdx5kRVUZsu1YXPxQjuXW/ 2puid+ajXg0g087JA7xowyrCAfotPF3fnNvpJdUC3+LusSAg+nW5EI7NdcHnxoK57c8R Y7V005cIhv4EMxjEAIthsjWGCCOm528Pw6uOEhEU/CS/COFwFLlRHe4kHB6aSm7K0EGX zHtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GQqAIZ7Xh7BNepoaMPlY+YxkKXZzZN5XYqBDd4SweoE=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=hTa/bq9jxIR8Z4PGSQvYO7JHBfez4lQStpG9ncIyvZR/M4e3lI3e5kVl/4Z1e9ygTr uyZ2338jOB2a9/lu786ekBuY3//Qri5+If037oqpOWKgEhB9tQjVwYCMgPTTEaH9AClY EhTBy39FIbzLQUbgmnSQDaYIYidosGANEafu7Lg80+2SGtAQIE7xxq8AUCmsdgIf1plW Rhmcsc6s2ADhc6/7oWOnc2KqwazcMz9D6pNOCguWiron4t7+yh0fKJEgyHUp8i//EpYi 1rVnz3TZsP4vbPKglM2BvGikJfQHNqo9UBtu46DIYQxx4AGpveXgIRFP3CZ8nCQD8aOZ q6jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lqe2NBNv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j8-20020ac85c48000000b0041b773b255bsi2997177qtj.582.2023.10.28.12.49.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Oct 2023 12:49:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lqe2NBNv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwpG1-0004v1-47; Sat, 28 Oct 2023 15:46:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwpFk-0004l6-93 for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:49 -0400 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwpFi-00049W-28 for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:47 -0400 Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3577ce73552so9702295ab.2 for ; Sat, 28 Oct 2023 12:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698522345; x=1699127145; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GQqAIZ7Xh7BNepoaMPlY+YxkKXZzZN5XYqBDd4SweoE=; b=lqe2NBNvhpGXDAetg4hf8J4xMjDUxWOyLj7HQoIcsAA4F76I9X8l9dq4O145n7BojG wP3OiZgw8fbhoex5dHFGwURT8GyJSdssEtcNaggQYU/Athy6DKTDnlYmsZ1qxoGQ8XxK /cCtRJgRjkYBzklMDjt3JA2TY4FfiAvnCl28XzT2kLUqkJ6NsZ9/FcM/Q91JUy7zY4qF 7u5dT0Q9UadIdq6qCcbxOMni8WI4xQ4afrhtu+K1ZU+iACGSYdvWChCQQLXa62Ql+pSM Y8nRDoUGbSSmhtqlXNDpbfziujx7aUMmZZqQm5bSoQRoXnaD78vJLZjcp6dmEGCkdOhD xIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698522345; x=1699127145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GQqAIZ7Xh7BNepoaMPlY+YxkKXZzZN5XYqBDd4SweoE=; b=BJ1xPSeQCpSMJjsr2xcuulYljrMJ8O6kLml3ojj1nLYfYBdD2/rudWtywd3VPc9AbA a/cvvIwYw/K7tD6yYJcp13MjO9wHYwVy25BzoQC4KMleoKAHKalyOFlNNYIlyDsjR+rG uZrBOE+AX0WG2O5eTWblJI25LmZbPG14GBt9uqqepQG9eAEEsxJ16uHvxgrJpmwA+N5+ cXAnQ3yWwY0GWOoo0PmDMLE5wkX1YA61lISAE+2k/59RYQauxBm5wEfy7O/wjpblCX+1 zMruSQULmX2R5KP0VV1er4P0OXKl0dKBzxFMdkKchKNYoMtb/cBbUfMH3WRdqM2gV5lc iX7Q== X-Gm-Message-State: AOJu0YzViYZ6gzqZGhSmFO8OCmC7NwY2+5TfYL27TJuCcbm0OgY034RU ct6hFwdVTBKWUgqocDw67HfmNPJQmHJqYF7+lts= X-Received: by 2002:a05:6e02:748:b0:359:92:48aa with SMTP id x8-20020a056e02074800b00359009248aamr5196351ils.28.1698522345032; Sat, 28 Oct 2023 12:45:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f7c900b001b8a3e2c241sm3600096plw.14.2023.10.28.12.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 12:45:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v2 23/35] tcg/ppc: Sink tcg_to_bc usage into tcg_out_bc Date: Sat, 28 Oct 2023 12:45:10 -0700 Message-Id: <20231028194522.245170-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231028194522.245170-1-richard.henderson@linaro.org> References: <20231028194522.245170-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rename the current tcg_out_bc function to tcg_out_bc_lab, and create a new function that takes an integer displacement + link. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/ppc/tcg-target.c.inc | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index a5871f55b1..ca281dd33e 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1946,14 +1946,20 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, } } -static void tcg_out_bc(TCGContext *s, int bc, TCGLabel *l) +static void tcg_out_bc(TCGContext *s, TCGCond cond, int bd) { + tcg_out32(s, tcg_to_bc[cond] | bd); +} + +static void tcg_out_bc_lab(TCGContext *s, TCGCond cond, TCGLabel *l) +{ + int bd = 0; if (l->has_value) { - bc |= reloc_pc14_val(tcg_splitwx_to_rx(s->code_ptr), l->u.value_ptr); + bd = reloc_pc14_val(tcg_splitwx_to_rx(s->code_ptr), l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr, R_PPC_REL14, l, 0); } - tcg_out32(s, bc); + tcg_out_bc(s, cond, bd); } static void tcg_out_brcond(TCGContext *s, TCGCond cond, @@ -1961,7 +1967,7 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGLabel *l, TCGType type) { tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type); - tcg_out_bc(s, tcg_to_bc[cond], l); + tcg_out_bc_lab(s, cond, l); } static void tcg_out_movcond(TCGContext *s, TCGType type, TCGCond cond, @@ -2003,7 +2009,7 @@ static void tcg_out_movcond(TCGContext *s, TCGType type, TCGCond cond, } } /* Branch forward over one insn */ - tcg_out32(s, tcg_to_bc[cond] | 8); + tcg_out_bc(s, cond, 8); if (v2 == 0) { tcg_out_movi(s, type, dest, 0); } else { @@ -2024,11 +2030,11 @@ static void tcg_out_cntxz(TCGContext *s, TCGType type, uint32_t opc, tcg_out32(s, opc | RA(TCG_REG_R0) | RS(a1)); tcg_out32(s, tcg_to_isel[TCG_COND_EQ] | TAB(a0, a2, TCG_REG_R0)); } else if (!const_a2 && a0 == a2) { - tcg_out32(s, tcg_to_bc[TCG_COND_EQ] | 8); + tcg_out_bc(s, TCG_COND_EQ, 8); tcg_out32(s, opc | RA(a0) | RS(a1)); } else { tcg_out32(s, opc | RA(a0) | RS(a1)); - tcg_out32(s, tcg_to_bc[TCG_COND_NE] | 8); + tcg_out_bc(s, TCG_COND_NE, 8); if (const_a2) { tcg_out_movi(s, type, a0, 0); } else { @@ -2108,11 +2114,11 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, tcg_out_rlw(s, RLWINM, args[0], TCG_REG_R0, 31, 31, 31); } -static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args, - const int *const_args) +static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, + const int *const_args) { tcg_out_cmp2(s, args, const_args); - tcg_out_bc(s, BC | BI(7, CR_EQ) | BO_COND_TRUE, arg_label(args[5])); + tcg_out_bc_lab(s, TCG_COND_EQ, arg_label(args[5])); } static void tcg_out_mb(TCGContext *s, TCGArg a0) @@ -2446,7 +2452,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, /* Load a pointer into the current opcode w/conditional branch-link. */ ldst->label_ptr[0] = s->code_ptr; - tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); + tcg_out_bc(s, TCG_COND_NE, LK); h->base = TCG_REG_TMP1; } else {