From patchwork Sun Oct 22 05:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736934 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003734wrl; Sat, 21 Oct 2023 23:04:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJReLYUef4j27Mvjm0jXZrafMMLoEmuyGU2jugwCJqm0ysM3qJ81aeOnML/TXMmnxQLTn7 X-Received: by 2002:ac8:5843:0:b0:41b:7738:a8cf with SMTP id h3-20020ac85843000000b0041b7738a8cfmr9004742qth.17.1697954654441; Sat, 21 Oct 2023 23:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954654; cv=none; d=google.com; s=arc-20160816; b=hTb0N8AbmUGrPDbRDKaH8R5C1agVgLCp4rWoxSjtblsGYAwFRBjg/ybCQ9++NTODP9 Bpq0AGn0jlsbzSYjw6dLcoptKj7S4cYlgXrJbE/s6QYzq2fYtyambb7loJI7cBUcVuc7 Vw6rNhUobOsGj6a5ZfRcjbeI8j6DErgRLjmJWSGkdnM6CN1b+dxgmYjZCjnhf/sFP9Rm SrI+4cFR4+/uW3/SHXaRr0DFeHJNXHGTluy5fvoHxGaVC6Kb6jOU/jOvAxNRQqNIWaF4 LO+e+ZuSOydZHVrzzxEROfzWND5bKxY/V9CBi7KvAm93PUFD7LjGeIEAqcQ2f43cRZTw coQA== 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=kAOP85LOpsJpCOGLew06+pNcWSuPjUESIziZ7CR8eKz5nmbSZfrBcltn96KUWWFsod XoT/gyScTae9K/SFZfl1YDjKV66tP7PjkMfkEf2AMCvS0z+5ItfV+EQ6OER/YOKOdyBI 8dv9PJxAZiNz1z0Xq3XmpXQ1LCn2YyMRDD8ijcDhZw17TF8hmMg9t5hohHFCGF7oUWUA f5KTw/kAJ0bIRGMohZilH7dcBLEgxZ5suuoUP91TV5ANN8pF01ji4DPQxWTDKcF0oTbz ylYzhbztIRjopz4gS8gAihim68K3NC7FbLv0PSGfpKB+PeConW6jX2cbhsnfWls+W1qR +lgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zm1Q7pHT; 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 j22-20020ac85c56000000b004199dd36307si3653533qtj.484.2023.10.21.23.04.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:04:14 -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=zm1Q7pHT; 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 1quRW7-0000ZD-UT; Sun, 22 Oct 2023 02:00:51 -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 1quRW6-0000Xr-MO for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:50 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW5-0001Z0-1V for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:50 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3b2ea7cc821so1666759b6e.1 for ; Sat, 21 Oct 2023 23:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954448; x=1698559248; 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; b=zm1Q7pHT9rXmSo+W5bf99I1vq7NtEmq8gcKxd9JmyZef2yH4obToeTQ1tuJk44461r KGMc5RhgNV4bTOZPEHg+XhOvCRDlnqlkfcHUq5/FT/2O2lEH+TJ7z9hpBt3eOyH54/Rf PtD9uKPX3ZLQGtClMRU9E0AzGH1T4UASNTkT3LEx7naRtPvMSId6Iyf5BFr+4HQ+Y9Hy ELLcAxX4Xn4Q2W7twwUvwSx+Riymxx9JC/AAO5C5Ow3vZGwvTyQ6C1FC6quUD0sTzzou A49JZubfRAaAezmJT3dz7JzDIziWDfFPa49Ym8z7/bgpjYhaQC36vYb0QYDE7EltST2C K1ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954448; x=1698559248; 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; b=bR35FEov3/fpOtZ8Fs5ex+/sDwi07Nm6qVXvmYeawKhaCTKRhKFbGx+VLZd/vSkz/R nmV/yFzmz+Q6trqjF6fy91D2G0ew0Uo4FgxxkUmmM2TUoDp5lcNyps4njygDMcvKe0Hr feyiGUiIWaAo4mCoUhnG4a15VBjOCVuhsMiTGbJdc25fB6Qya0dXTCIVm+6HnLlOKbuZ 0iOr8fgKqVU1Y4OVGGH3mCYBaRDy2L4syXXXKu0jYeWP+qT1CGCFC8As5SOyFfi129nx sGKkwien8F91GvTHabx/KIn2MN7dtJKDIXFYGAqWOmk3SzabfWeTTkUb7rP/ZbFVe+3k c1Kw== X-Gm-Message-State: AOJu0Yxg2vO6eDHSYjoIVhtIVdE5NVf4lsKeC6yiJ4jcOOV0JU2CRWlN OMM+1+MS7FBnzmwxm1wBsbmFEIsomFfgOgJpzlQ= X-Received: by 2002:a05:6808:1990:b0:3a9:7634:23f9 with SMTP id bj16-20020a056808199000b003a9763423f9mr7066025oib.12.1697954447994; Sat, 21 Oct 2023 23:00:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 18/90] target/sparc: Pass DisasCompare to advance_jump_cond Date: Sat, 21 Oct 2023 22:59:19 -0700 Message-Id: <20231022060031.490251-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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 Fold the condition into the branch or movcond when possible. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 503598ed93..d12f2b4b87 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2899,14 +2899,15 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, return true; } -static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, + bool annul, target_ulong dest) { target_ulong npc = dc->npc; if (annul) { TCGLabel *l1 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + tcg_gen_brcond_tl(tcg_invert_cond(cmp->cond), cmp->c1, cmp->c2, l1); gen_goto_tb(dc, 0, npc, dest); gen_set_label(l1); gen_goto_tb(dc, 1, npc + 4, npc + 8); @@ -2919,8 +2920,8 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) case DYNAMIC_PC_LOOKUP: tcg_gen_mov_tl(cpu_pc, cpu_npc); tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), + tcg_gen_movcond_tl(cmp->cond, cpu_npc, + cmp->c1, cmp->c2, tcg_constant_tl(dest), cpu_npc); dc->pc = npc; break; @@ -2932,6 +2933,11 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) dc->jump_pc[0] = dest; dc->jump_pc[1] = npc + 4; dc->npc = JUMP_PC; + if (cmp->is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp->c1); + } else { + tcg_gen_setcond_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); + } } } return true; @@ -2951,12 +2957,7 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_compare(&cmp, a->cc, a->cond, dc); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -2980,12 +2981,7 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_fcompare(&cmp, a->cc, a->cond); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -3006,8 +3002,7 @@ static bool trans_BPr(DisasContext *dc, arg_BPr *a) flush_cond(dc); gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } static bool trans_CALL(DisasContext *dc, arg_CALL *a)