From patchwork Sun Nov 5 20:12:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741065 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp793733wrr; Sun, 5 Nov 2023 12:16:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHV7RwwQ2ySH+aft9ixLVRgjlKO0pEGeqdX6bkX+AsX5zLxQmnsShmOmmqNMa00OD8nqpN1 X-Received: by 2002:ac8:580f:0:b0:418:1f3c:5120 with SMTP id g15-20020ac8580f000000b004181f3c5120mr30799251qtg.46.1699215360689; Sun, 05 Nov 2023 12:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699215360; cv=none; d=google.com; s=arc-20160816; b=yAqFIRrfYpI1HlMkqOuD8Jj54WVeBfCAIwCAd/azifB5/8Exacn42JAukoOrv2uvXy hWUy2F6l7AVZ7fuZGS+XksJeHyxsYOErrPRTSQ9cBp5i+cv/v2seImhkAjpEYq4twQw1 mMzT/O+W/mUU9HeD4I1cjJuYw3H/GeViDCNChpB1JEhyXV6uBr18I+g+9IsMYspqx041 DpsQHh795wL32iO/XiI+meolFDyaZg/hUrCHtKlUZRd9X0EXUs0KZs/K57IYrRdFxt8u veqJgbqifn9LVhWdPc5yDda3eFF5PjmGNJWP81Pgk421OIyDS20r11Jf9wuo1MVB967p SRtQ== 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=bkAbPNyjzsZeyxWh+5iNiCPTFDeY/R9h3v6lIAuzON8=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=mq5QTFwDfcTCynGLkj8zGYDvDaXWrcC73GjEfqwwYqWhwchj3Rs8253bWAFNrJ9/Pk shAyoHxShf3pHT3akxtMnSTK81eVuF90ee0QV+dMC2Rja8cLKGewGkXwRpGlgc97CB9h aqUMvQH3eYAUIiU3uRt+wu6wXAWUe9BSK26h4afjOYf06J2T7fhEaFoVxzk5WFMK7kSw 26sEXZpy3lCyTUiDnOAy5h6cpv9O32eRgz+2zzX97e+p7N+6RHpxc2821Vk/93DUadPU Vuq8GjkrjFnJ+ycK2gBb1v24Z+dveG5NgSQ6pNboGHPziroeCMZ55S9Tnr9kTmN9q/6p YkWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMT6Cm+S; 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 e14-20020ac85dce000000b00417f87ff854si4585987qtx.46.2023.11.05.12.16.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Nov 2023 12:16:00 -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=AMT6Cm+S; 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 1qzjU5-0003N0-8l; Sun, 05 Nov 2023 15:12:37 -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 1qzjU3-0003J1-N7 for qemu-devel@nongnu.org; Sun, 05 Nov 2023 15:12:35 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzjU1-000294-VA for qemu-devel@nongnu.org; Sun, 05 Nov 2023 15:12:35 -0500 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5b980391d70so2927748a12.0 for ; Sun, 05 Nov 2023 12:12:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699215152; x=1699819952; 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=bkAbPNyjzsZeyxWh+5iNiCPTFDeY/R9h3v6lIAuzON8=; b=AMT6Cm+Ski86UkB8bYk+KHg4hrXUp3MY1yuWLyznqyp07RB59nznixJ0kHkJppEAl8 87ZdYyAPwJ9oicNeHJPcXmOQiCR3zljDIyMMWMxbDFp2LB5CxmfQGXDuzushfnj0aGoM 0xpZjJnrSkDH46jDFnv7Vss8+wrjZAvghNjS0dJ9Ogn867ZTLdeXW9kxE59yjXeMOgGb 5xAUI+4uP1YiIfzFn71n1ilsBE4cDo1H+onY9y5p00nWv7LnYEKHaYx6pGDRoaFEy5F+ cv8J8FYyZzrBpW/mcDKjzwkhSeZOO318bLg2rmMEDBHiIkG1bDecjpzE8d2EqEOn7Cxx A8QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699215152; x=1699819952; 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=bkAbPNyjzsZeyxWh+5iNiCPTFDeY/R9h3v6lIAuzON8=; b=oZDs9GbsX5bNLTyOV/ak9z8/BboqyjL9Usa4wW4+KXGz+k+FtWqWydL2Oskf/C3lf4 ZwUHf0rF6rkj+pc88XchTADr0oU91V+kvb6hgmlZQxnWrin0mUkhrQxFUyzh9b1T3e+4 3CL6CC9GGVOM5//6TB5Bl9/hXVS0hh8/7mvZxIGRaFd6oGl05Ro3GmJDVN2WTsu5Jg1L l9zZu1L2DQrquSMdnF693uiiozGjvuPN4vwj5TJUVedV6x/2WOBOu0pLJbwiJrfWc0sb 6hOTH9mTyU6EzviDyGpyEPTm6g8yDiD59GAVD74dcCMSR/FqloYErIPVasozgdeseerA XJuA== X-Gm-Message-State: AOJu0YwgvR8ZwjqrCGBgeq5cpEToiCMpcP/sIshtCJaaUxlQlb/5IZj8 XnTiGMXTrKM1+X2oI4fd+I7aNKHZmzWBRoSdWfY= X-Received: by 2002:a05:6a20:a220:b0:17b:e0a3:f6f4 with SMTP id u32-20020a056a20a22000b0017be0a3f6f4mr20241438pzk.25.1699215152488; Sun, 05 Nov 2023 12:12:32 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id u23-20020a056a00099700b006884549adc8sm4359777pfg.29.2023.11.05.12.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 12:12:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 10/21] target/sparc: Change DisasCompare.c2 to int Date: Sun, 5 Nov 2023 12:12:11 -0800 Message-Id: <20231105201222.202395-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231105201222.202395-1-richard.henderson@linaro.org> References: <20231105201222.202395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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 We don't require c2 to be variable, so emphasize that. We don't currently require c2 to be non-zero, but that will change. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 464f1607e3..a405512e6c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -180,7 +180,8 @@ typedef struct DisasContext { typedef struct { TCGCond cond; - TCGv c1, c2; + TCGv c1; + int c2; } DisasCompare; // This function uses non-native bit order @@ -1039,12 +1040,12 @@ static void gen_compare(DisasCompare *cmp, bool xcc, unsigned int cond, TCGv t1; cmp->c1 = t1 = tcg_temp_new(); - cmp->c2 = tcg_constant_tl(0); + cmp->c2 = 0; switch (cond & 7) { case 0x0: /* never */ cmp->cond = TCG_COND_NEVER; - cmp->c1 = cmp->c2; + cmp->c1 = tcg_constant_tl(0); break; case 0x1: /* eq: Z */ @@ -1140,7 +1141,7 @@ static void gen_fcompare(DisasCompare *cmp, unsigned int cc, unsigned int cond) /* For now we still generate a straight boolean result. */ cmp->cond = TCG_COND_NE; cmp->c1 = r_dst = tcg_temp_new(); - cmp->c2 = tcg_constant_tl(0); + cmp->c2 = 0; switch (cc) { default: @@ -1226,7 +1227,7 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) { cmp->cond = tcg_invert_cond(gen_tcg_cond_reg[cond]); cmp->c1 = r_src; - cmp->c2 = tcg_constant_tl(0); + cmp->c2 = 0; } static void gen_op_clear_ieee_excp_and_FTT(void) @@ -2232,7 +2233,7 @@ static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) or fold the comparison down to 32 bits and use movcond_i32. Choose the later. */ c32 = tcg_temp_new_i32(); - tcg_gen_setcond_i64(cmp->cond, c64, cmp->c1, cmp->c2); + tcg_gen_setcondi_i64(cmp->cond, c64, cmp->c1, cmp->c2); tcg_gen_extrl_i64_i32(c32, c64); s1 = gen_load_fpr_F(dc, rs); @@ -2252,7 +2253,7 @@ static void gen_fmovd(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { #ifdef TARGET_SPARC64 TCGv_i64 dst = gen_dest_fpr_D(dc, rd); - tcg_gen_movcond_i64(cmp->cond, dst, cmp->c1, cmp->c2, + tcg_gen_movcond_i64(cmp->cond, dst, cmp->c1, tcg_constant_tl(cmp->c2), gen_load_fpr_D(dc, rs), gen_load_fpr_D(dc, rd)); gen_store_fpr_D(dc, rd, dst); @@ -2266,10 +2267,11 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) #ifdef TARGET_SPARC64 int qd = QFPREG(rd); int qs = QFPREG(rs); + TCGv c2 = tcg_constant_tl(cmp->c2); - tcg_gen_movcond_i64(cmp->cond, cpu_fpr[qd / 2], cmp->c1, cmp->c2, + tcg_gen_movcond_i64(cmp->cond, cpu_fpr[qd / 2], cmp->c1, c2, cpu_fpr[qs / 2], cpu_fpr[qd / 2]); - tcg_gen_movcond_i64(cmp->cond, cpu_fpr[qd / 2 + 1], cmp->c1, cmp->c2, + tcg_gen_movcond_i64(cmp->cond, cpu_fpr[qd / 2 + 1], cmp->c1, c2, cpu_fpr[qs / 2 + 1], cpu_fpr[qd / 2 + 1]); gen_update_fprs_dirty(dc, qd); @@ -2409,7 +2411,7 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, if (annul) { TCGLabel *l1 = gen_new_label(); - tcg_gen_brcond_tl(tcg_invert_cond(cmp->cond), cmp->c1, cmp->c2, l1); + tcg_gen_brcondi_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); @@ -2423,7 +2425,7 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, tcg_gen_mov_tl(cpu_pc, cpu_npc); tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); tcg_gen_movcond_tl(cmp->cond, cpu_npc, - cmp->c1, cmp->c2, + cmp->c1, tcg_constant_tl(cmp->c2), tcg_constant_tl(dest), cpu_npc); dc->pc = npc; break; @@ -2438,9 +2440,9 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, /* The condition for cpu_cond is always NE -- normalize. */ if (cmp->cond == TCG_COND_NE) { - tcg_gen_xor_tl(cpu_cond, cmp->c1, cmp->c2); + tcg_gen_xori_tl(cpu_cond, cmp->c1, cmp->c2); } else { - tcg_gen_setcond_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); + tcg_gen_setcondi_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); } } } @@ -2612,7 +2614,7 @@ static bool do_tcc(DisasContext *dc, int cond, int cc, flush_cond(dc); lab = delay_exceptionv(dc, trap); gen_compare(&cmp, cc, cond, dc); - tcg_gen_brcond_tl(cmp.cond, cmp.c1, cmp.c2, lab); + tcg_gen_brcondi_tl(cmp.cond, cmp.c1, cmp.c2, lab); return advance_pc(dc); } @@ -3849,8 +3851,9 @@ static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) static bool do_mov_cond(DisasContext *dc, DisasCompare *cmp, int rd, TCGv src2) { TCGv dst = gen_load_gpr(dc, rd); + TCGv c2 = tcg_constant_tl(cmp->c2); - tcg_gen_movcond_tl(cmp->cond, dst, cmp->c1, cmp->c2, src2, dst); + tcg_gen_movcond_tl(cmp->cond, dst, cmp->c1, c2, src2, dst); gen_store_gpr(dc, rd, dst); return advance_pc(dc); }