From patchwork Wed Nov 8 20:52:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 742246 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp513035wrw; Wed, 8 Nov 2023 12:53:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKHfj//1+g/MZXjYLM5ICR6wGL7HUegYAohy8hEWiP+q1Kujl5kpFsrhQL2ej245iwgHwB X-Received: by 2002:a05:620a:45a9:b0:77a:75f7:d147 with SMTP id bp41-20020a05620a45a900b0077a75f7d147mr3198114qkb.18.1699476822269; Wed, 08 Nov 2023 12:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699476822; cv=none; d=google.com; s=arc-20160816; b=J3n/C4GBaCwmtiON9DGBXhzKW+M/WKru5XRaB+3UDJvhMvjFQKvAcgoPNI9XMmTgN5 dGIE7AWqPZjwZE82DpnkbzjJIRdlH4gcpjWapr3W90jlJ/qxj2cQXOcJ637LMSvRi4e6 ODFK4QEoqaZkCPyZDSUYag+WYmv1Qvxkfr4EPfkDy93rMWR1QAN6sB/W3TtQu04L6rUf L8gqLHYhPnYX/1kNw/COrwWI2VZ+yJSlV9cXoFSThgIJXFVXGo8t6bIGodvHcDMoF2xJ aR+2lxpGYrjnPwQJrpRODFsSCZpaCa1LnUWcjnhW25VJuu4G/olPL2CMsnkMHpkJIj9t HaQQ== 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=3258Ya/S+x5wNxL494Ng94PzU4Hq1EoIHA1WzmO4Z1Q=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=BpAax8ipZA3mI73R06GCCeCP+Esuir+IRlS1vXzx+vxIOKlHcT2RMAnZuRzz++Y6uc wDG1M2FCs0eZrtnFQ5IG3HP+4QoBCvIKr3tBUI9N+SwIEbI8e55VduhcDfYk+NbrLbnO 7MiLtvzOqtN+LBcYQcm0LqzHfyoaOCEIVoc7viVUqMnR0iLgbHd4rQbjx3BbP8N72C2z o69ngXhnMErJmkUhp0vBWlRWn3mExmOFeMNeabXKS1oHm4zPMxTN/ldKC8rd686a6d6p UcOwtWevWCL+1yINubfKll0TCQHynoV4a++VIUzIVmqy4fhBmgmZ014Hp5rLAx8XQb0z n5pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kl5R1BQu; 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 b16-20020a05620a127000b00778a570841fsi1706898qkl.717.2023.11.08.12.53.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Nov 2023 12:53:42 -0800 (PST) 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=kl5R1BQu; 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 1r0pXm-0002bD-EC; Wed, 08 Nov 2023 15:52:59 -0500 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 1r0pXk-0002aM-9p for qemu-devel@nongnu.org; Wed, 08 Nov 2023 15:52:56 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0pXg-0004fR-NB for qemu-devel@nongnu.org; Wed, 08 Nov 2023 15:52:54 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4084095722aso465615e9.1 for ; Wed, 08 Nov 2023 12:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699476771; x=1700081571; 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=3258Ya/S+x5wNxL494Ng94PzU4Hq1EoIHA1WzmO4Z1Q=; b=kl5R1BQurm2bk1NhwnmkpUkP3kQNve7ezLB0mfzVrrOzzoeA2uxDXuCmhN6gKNDOwY B8ZzCfr4CwYjjnuXK0mG5eOhwAovprC92rEU9KlHK5yCrEmGUpyjV9xr9WU4d9vbrBl9 lMBNC370CIMTKDpAH3lysnCTF11npKAdfGjAHknc3pKs2sP+rHWiDnxTIJ3PireDF2dd XDA5ipkn/7R6J0AZkrs/5CORkFEST0Inr5JVdyZhQvFGJZN3xbzcFUzCrMOuQedfTtMj KExA3W/oUhrlcf6seZvR3OTv4Yr/AC3mkqaGgYk8zEFFr/mr2Bl1baaM29V/II592JYK 2xZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699476771; x=1700081571; 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=3258Ya/S+x5wNxL494Ng94PzU4Hq1EoIHA1WzmO4Z1Q=; b=xRl3IxE9jk9Kjfsmzybaev9TRCR/ymLyW7A5p4vbt8dTEx7Xm3knaxBPErAumfBFrQ 9BrM+vxJAiQ/TeMjCsUn+wagRH0YuUC0Hk1xKu4zltw1qp0aThq3DTro0NEequ3Hydin xrP46j7tA09lb8ZnuwFPJOrY0W4aDzbHG6HiHFNiuGUPST7adEmZWQxUCPodx5k0fKCg 4csAmBcEOLQmFCiJrcnP+lWiooqicYXtyeWiUhV5DDkqEARbKR5aSQdOZa/CPR+Gkpnu c+EgTLwY4AWaUphUBKO8baQUNHEC7LWRTS37goS6wdT7oCtOixb/OUjg7g5tmwM5tS/G rpxQ== X-Gm-Message-State: AOJu0YwVOWoq8jy//GtYEzotDe4RaC10yae24qjAKzfZ48MISe2zQv3s 0NroVQwQxiF8loT2hZxmLhVOhzusBpVZp0zvzUM= X-Received: by 2002:a05:600c:4511:b0:3fe:1b4e:c484 with SMTP id t17-20020a05600c451100b003fe1b4ec484mr2782244wmo.5.1699476770898; Wed, 08 Nov 2023 12:52:50 -0800 (PST) Received: from m1x-phil.lan ([176.187.199.60]) by smtp.gmail.com with ESMTPSA id y23-20020a05600c341700b00406408dc788sm19896531wmp.44.2023.11.08.12.52.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Nov 2023 12:52:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH v2 32/35 1/2] target/alpha: Pass immediate value to gen_bcond_internal() Date: Wed, 8 Nov 2023 21:52:46 +0100 Message-ID: <20231108205247.83234-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231028194522.245170-33-richard.henderson@linaro.org> References: <20231028194522.245170-33-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Richard Henderson Simplify gen_bcond() by passing an immediate value. Signed-off-by: Richard Henderson Message-Id: <20231028194522.245170-33-richard.henderson@linaro.org> [PMD: Split from bigger patch, part 1/2] Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 32333081d8..46efe1df7c 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -453,13 +453,13 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) } static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, - TCGv cmp, int32_t disp) + TCGv cmp, uint64_t imm, int32_t disp) { uint64_t dest = ctx->base.pc_next + (disp << 2); TCGLabel *lab_true = gen_new_label(); if (use_goto_tb(ctx, dest)) { - tcg_gen_brcondi_i64(cond, cmp, 0, lab_true); + tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); tcg_gen_goto_tb(0); tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); @@ -472,11 +472,11 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, return DISAS_NORETURN; } else { - TCGv_i64 z = load_zero(ctx); + TCGv_i64 i = tcg_constant_i64(imm); TCGv_i64 d = tcg_constant_i64(dest); TCGv_i64 p = tcg_constant_i64(ctx->base.pc_next); - tcg_gen_movcond_i64(cond, cpu_pc, cmp, z, d, p); + tcg_gen_movcond_i64(cond, cpu_pc, cmp, i, d, p); return DISAS_PC_UPDATED; } } @@ -484,15 +484,8 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp, int mask) { - if (mask) { - TCGv tmp = tcg_temp_new(); - DisasJumpType ret; - - tcg_gen_andi_i64(tmp, load_gpr(ctx, ra), 1); - ret = gen_bcond_internal(ctx, cond, tmp, disp); - return ret; - } - return gen_bcond_internal(ctx, cond, load_gpr(ctx, ra), disp); + return gen_bcond_internal(ctx, cond, load_gpr(ctx, ra), + !!mask, disp); } /* Fold -0.0 for comparison with COND. */ @@ -533,7 +526,7 @@ static DisasJumpType gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, DisasJumpType ret; gen_fold_mzero(cond, cmp_tmp, load_fpr(ctx, ra)); - ret = gen_bcond_internal(ctx, cond, cmp_tmp, disp); + ret = gen_bcond_internal(ctx, cond, cmp_tmp, 0, disp); return ret; }