From patchwork Wed Jan 10 22:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761473 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2112521wrz; Wed, 10 Jan 2024 14:46:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvTKhYiykMBj/a08R3Zvwb3oH9QPr2jCM0Xos+p2q6Nx3TJ1jYaksOy66a8ne/iatFgbPu X-Received: by 2002:a81:4c8d:0:b0:5fb:1f9:64ff with SMTP id z135-20020a814c8d000000b005fb01f964ffmr83540ywa.12.1704926813886; Wed, 10 Jan 2024 14:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704926813; cv=none; d=google.com; s=arc-20160816; b=BJg064UdojDvP/R6TVDnyooc/CFq8PMTMQKx1VDfpr7RXdR/7lLlmlXhxH0gGGF0bi fDIq+HrW49UxoghdCi40utTxXoIxURmO9Hswl64/X1t2W8af0ES82CcTOkPhYOgSwyjA /aiWT2UcuFIj+cuQpGfm4MSHfZoJJDirjUQaMRbBj0nw5L8aNsiIYihKY1Y2BX1ENqdM ac7TYv7TfB8QhxOz3WFvuKQQYOcAvwJbkBuuV1Aus57+n/394JXil90OXnThOrukODCA H22kjvF5qKdBu1DXTa78kQXIGD4RjCeNzgaQpCkmGTgm0Avw4ie4orjlK4ZGexq/Rhck DUFw== 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=/Mi02s/8pPhslq92YCDg9owTXJVUIjB51aqomHFCjPA=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=XAXqNeuC7LzJwbSIrtxSryRe0VWjG69pmDC4EcfUrhcNSeHsgtyMALErjL2Ce6UwMt OI+URfvMSKowxfcJaA4NdqV2m6qHgGnluyk877ijb6GIr3TeP/wsfwAqY6HII8XBz9Kx YL/wc9rFSFBwYVzTRUq/W42GVATXDuCAXWc9yhXJXZ57XNyWMCzbiTN4XXAZfNJx8eIl fLoES9TenD11NVUfDwsRoRN6Bz76JZY6O3v9DZZUhjmFFuJS4v9JsMNVgyH8a2lxJKoD P13bhAOYxhdKL8iNTiN00doLvvTg8WulHQ/YGr5iCUgR6QMyePdQU+TQw1WM9fKGDDrQ BJEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UFG6cNwE; 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 ay30-20020a05620a179e00b007833008db9bsi3990217qkb.602.2024.01.10.14.46.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 14:46:53 -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=UFG6cNwE; 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 1rNhKe-0005Pt-SJ; Wed, 10 Jan 2024 17:45:57 -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 1rNhKG-0004y2-Fh for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:45:33 -0500 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNhKC-0002wZ-Ce for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:45:29 -0500 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-429be919998so1957051cf.0 for ; Wed, 10 Jan 2024 14:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704926727; x=1705531527; 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=/Mi02s/8pPhslq92YCDg9owTXJVUIjB51aqomHFCjPA=; b=UFG6cNwE2nYjK72QtMVbbEHP1lnq6X+5vqew8499JX0guQ+h1tLEciNXnleoEzIdN2 ZIOwyu0tjs53t1T7YAFZNkvxVQTe/49vHGYknCN5Vh9oj+fo1nTJHwv9WOlDDNC+Gu8w rhy/zq2ZLSQFqDGYvJ5SMqGtrQj7x+DrXceoowxqFnjmr/FI4pn+yZH8P3/bcAsfm2Mm DXU8Hzz2ZzIw2DX3Zh3qXGRp0vC8diSIYXk2rvaSfvE/wG9+SUryy3Klk6oy+WHPYCU6 0gcDcVhvQl8SPz4MrhfRZe0POFBdNQveuRK4F9kWMgHG0atKpGYJySw/VHA3fM91B0O8 vv4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926727; x=1705531527; 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=/Mi02s/8pPhslq92YCDg9owTXJVUIjB51aqomHFCjPA=; b=lXsIIgd1heKGzQ13QXc4DbJqkNP+69mDYLfqxG3fsFRWuKZ8Jl5HIoORZsFbbaLaSP 3Yq+FVjJ55PB4XJltrGqzW9GuzIjP/ruzJu3QBuyKHxPRq0AdE5X7XpgvNKxxz+GdFcG 4Uf5vwskuFYV4DkOndQlZmc3qumYTkv25SFAcmQeV1HIZYgdasyo/63gfHkFS0u6emFn NCClukPre6LFp1kveGSMyA5BwknyKZTmsiXkOWcyHK1k45muK7HZWNQfz5F9ZosHswsJ bl0v+1Y2Jo97OH2ya+OQlie9yBlpE4hqdG1pLkYnJwOw7kHpecvATa4f1jOFbo6mxXju ypaA== X-Gm-Message-State: AOJu0YzfhJ258NRoHRR8uMcNLb102+PcXFCVEag56IZUqd3xi5r8CYLR DL9VceGsqoK5XKa2JLlmeDf1WNO1v0ZnCtSusi8+B0LvECxo0reU X-Received: by 2002:a05:622a:e:b0:429:bb88:6f1e with SMTP id x14-20020a05622a000e00b00429bb886f1emr252029qtw.118.1704926727080; Wed, 10 Jan 2024 14:45:27 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b0042987f6874bsm2092281qtb.92.2024.01.10.14.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:45:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 11/38] target/alpha: Use TCG_COND_TSTNE for gen_fold_mzero Date: Thu, 11 Jan 2024 09:43:41 +1100 Message-Id: <20240110224408.10444-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110224408.10444-1-richard.henderson@linaro.org> References: <20240110224408.10444-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/alpha/translate.c | 49 +++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index c7daf46de7..c68c2bcd21 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -490,56 +490,53 @@ static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, /* Fold -0.0 for comparison with COND. */ -static void gen_fold_mzero(TCGCond cond, TCGv dest, TCGv src) +static TCGv_i64 gen_fold_mzero(TCGCond *pcond, uint64_t *pimm, TCGv_i64 src) { - uint64_t mzero = 1ull << 63; + TCGv_i64 tmp; - switch (cond) { + *pimm = 0; + switch (*pcond) { case TCG_COND_LE: case TCG_COND_GT: /* For <= or >, the -0.0 value directly compares the way we want. */ - tcg_gen_mov_i64(dest, src); - break; + return src; case TCG_COND_EQ: case TCG_COND_NE: - /* For == or !=, we can simply mask off the sign bit and compare. */ - tcg_gen_andi_i64(dest, src, mzero - 1); - break; + /* For == or !=, we can compare without the sign bit. */ + *pcond = *pcond == TCG_COND_EQ ? TCG_COND_TSTEQ : TCG_COND_TSTNE; + *pimm = INT64_MAX; + return src; case TCG_COND_GE: case TCG_COND_LT: /* For >= or <, map -0.0 to +0.0. */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, src, tcg_constant_i64(mzero), - src, tcg_constant_i64(0)); - break; + tmp = tcg_temp_new_i64(); + tcg_gen_movcond_i64(TCG_COND_EQ, tmp, + src, tcg_constant_i64(INT64_MIN), + tcg_constant_i64(0), src); + return tmp; default: - abort(); + g_assert_not_reached(); } } static DisasJumpType gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp) { - TCGv cmp_tmp = tcg_temp_new(); - DisasJumpType ret; - - gen_fold_mzero(cond, cmp_tmp, load_fpr(ctx, ra)); - ret = gen_bcond_internal(ctx, cond, cmp_tmp, 0, disp); - return ret; + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + return gen_bcond_internal(ctx, cond, tmp, imm, disp); } static void gen_fcmov(DisasContext *ctx, TCGCond cond, int ra, int rb, int rc) { - TCGv_i64 va, vb, z; - - z = load_zero(ctx); - vb = load_fpr(ctx, rb); - va = tcg_temp_new(); - gen_fold_mzero(cond, va, load_fpr(ctx, ra)); - - tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), va, z, vb, load_fpr(ctx, rc)); + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), + tmp, tcg_constant_i64(imm), + load_fpr(ctx, rb), load_fpr(ctx, rc)); } #define QUAL_RM_N 0x080 /* Round mode nearest even */