From patchwork Sat Oct 28 19:45:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738959 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp481226wrt; Sat, 28 Oct 2023 12:48:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgrQNcZcAQ2xUtYga2UI/qNSrjBDLQ4w5DHybgO5kJd+aRZs7mxQWCiYNrXjWVAfduDwRs X-Received: by 2002:a05:6214:3b84:b0:66d:ad78:130d with SMTP id nf4-20020a0562143b8400b0066dad78130dmr6415989qvb.21.1698522488140; Sat, 28 Oct 2023 12:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698522488; cv=none; d=google.com; s=arc-20160816; b=o1gFoUsRAauXeP2iCl+oYbnWnOq+qM5w/Ye05zgnbaHJRE8h/67bJSW9TdzuIkzjTW rn+dCRNRIHoW7YqG5vmVGPTnu6jYHsE2gKljbT/M07maa0285/yyjexWiavPXSwE533V ts9aVOU0+GsaFGSEhQm5Yjn2q4leK74MfqzMzV0yswlXW6ROjxVjplfq7WCzRzem60wQ AE//RNwIvRlV4EDWiKm8NPdErNE23IlNVDp8NCUfPrvDB5KVD2nIBqSj1UFf0kqaZF18 TrCJLHTgDZUisbs9GNR1JwCHGWTvI3PHSRxmIfTfER6L/Z/CE8L+m8qLGst3/PHFzyhO G8/A== 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=bILXU6Tv3/UsJC5IcZK0AlLd3YFdGLp0U4K4tlGQLvs=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=wwbSoQnrlMtxcBEv2TxyUAGa1ZACkmqeLBQUytKuvmdroQFJhxgjshxIh28xMLHKWj Hec7lvOlV5m1sDB6+qa0FWuVjCf4luRpT7fT41xNGOIfzfWkdBybUE5Viim67juqfgxr v3Cpebhks/X/AxVl+sMGXwwVWSGrqV9zZlDjh+JqIev7jrh8zEwXP4WbP7VdbjVrlQLp 29frwRYl0AnaXTNdeo8BVIbT8ktSsGURl23LelOOfkRrOEbM5fhmuuULlrh7GGOCM7kQ c83Y9LPkH4U2L/+uPgwTA4tU7wYROWsY1ph06e+DWT502nkDIKep1gliCXLEb/ubNY3I 28sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wsKrDK4V; 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 i7-20020a056214030700b0066b0f53b19asi1046320qvu.242.2023.10.28.12.48.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Oct 2023 12:48:08 -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=wsKrDK4V; 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 1qwpG6-0005Ee-Uo; Sat, 28 Oct 2023 15:46:10 -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 1qwpFi-0004l1-Sv 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 1qwpFh-00049G-DR for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:46 -0400 Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3576121362eso9787735ab.1 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=1698522344; x=1699127144; 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=bILXU6Tv3/UsJC5IcZK0AlLd3YFdGLp0U4K4tlGQLvs=; b=wsKrDK4VxrHWc/x5L15gEIxQsQ6OUYWH9xdkpcl7YlmEftdoxImKEnQuKC4zet5Dsa oA3hIm0ocgYIsYt54oMPcxiq59t39aRwKHZU7q4WVvyuq/NAJVv+gGQA4kgcH/N5Dh9x UbDNIIvwv3rk8uCeTxSSogxG3cSBmOQtRdqJGGt5/yefQ1ez7shtPl+Ex01zCYnSAZYY 3Twtj4U3SeZhjeVuy3vS+wiR5HfBxZX5tEmNMSf7lpa9OIOPWuJoxmUBdfZcUx/VXngH wjLI7DtM4x2K4vBNLZK8a18ZtsDzbPjos4loEiboD3bLuvA9/N7Da74QzF3jgQJeMJSv 46yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698522344; x=1699127144; 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=bILXU6Tv3/UsJC5IcZK0AlLd3YFdGLp0U4K4tlGQLvs=; b=KoE8TX0HuOR5BNpwTP8HixorryJ4ZUCts8IPT+foY/gdrb7OnVKuFWJWMPJMpn+n0a ag5WcLzmY3Xw9lnaf56bJnDh+uB+/NrQPZq7u8aai4cncjiUB+YW93DdpJ5zD2y7yP2C 5m6OpcvCg1DHVqyfJy4fJ0waQqxjeVm4HDpawj540vAkoa64KR3Q/SuTrwDigkyzme2t 90VcGNg7UrMVMvTDARg6PHFwUptpeo4WCQsbqUXMySV4fqGxOK5domdWKPlaY6GS2fOy +jBoDv/8w6NrM/uG+4W9cHrPtAA/iC2bH5dI6sXo2lSt2OE+6nE6YngB+7Z8cz3LeCQM 0/Hg== X-Gm-Message-State: AOJu0Yyu1eGFiYmV3V6gaIjaFWVx9t5DpHD3kAazkB8EfFDP61PjhtkR 1uHtkF171bAiDj3cgjtEeW5BxPW1ALG4p0tSNm4= X-Received: by 2002:a05:6e02:2163:b0:357:704a:8699 with SMTP id s3-20020a056e02216300b00357704a8699mr10683602ilv.8.1698522344165; Sat, 28 Oct 2023 12:45:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f7c900b001b8a3e2c241sm3600096plw.14.2023.10.28.12.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 12:45:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v2 22/35] tcg/sparc64: Support TCG_COND_TST{EQ,NE} Date: Sat, 28 Oct 2023 12:45:09 -0700 Message-Id: <20231028194522.245170-23-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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/sparc64/tcg-target.c.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index 10fb8a1a0d..176c98740b 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -607,9 +607,11 @@ static void tcg_out_div32(TCGContext *s, TCGReg rd, TCGReg rs1, uns ? ARITH_UDIV : ARITH_SDIV); } -static const uint8_t tcg_cond_to_bcond[] = { +static const uint8_t tcg_cond_to_bcond[16] = { [TCG_COND_EQ] = COND_E, [TCG_COND_NE] = COND_NE, + [TCG_COND_TSTEQ] = COND_E, + [TCG_COND_TSTNE] = COND_NE, [TCG_COND_LT] = COND_L, [TCG_COND_GE] = COND_GE, [TCG_COND_LE] = COND_LE, @@ -649,7 +651,8 @@ static void tcg_out_bpcc(TCGContext *s, int scond, int flags, TCGLabel *l) static void tcg_out_cmp(TCGContext *s, TCGCond cond, TCGReg c1, int32_t c2, int c2const) { - tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, ARITH_SUBCC); + tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, + is_tst_cond(cond) ? ARITH_ANDCC : ARITH_SUBCC); } static void tcg_out_brcond_i32(TCGContext *s, TCGCond cond, TCGReg arg1, @@ -744,6 +747,15 @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, cond = (cond == TCG_COND_EQ ? TCG_COND_GEU : TCG_COND_LTU); break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + /* Transform to inequality vs zero. */ + tcg_out_arithc(s, TCG_REG_T1, c1, c2, c2const, ARITH_AND); + c1 = TCG_REG_G0; + c2 = TCG_REG_T1, c2const = 0; + cond = (cond == TCG_COND_TSTEQ ? TCG_COND_GEU : TCG_COND_LTU); + break; + case TCG_COND_GTU: case TCG_COND_LEU: /* If we don't need to load a constant into a register, we can