From patchwork Mon May 13 07:46:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796523 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1884317wra; Mon, 13 May 2024 00:52:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+Kwl4TpGUwSwZvI/skTgsCVIaLOomK/ugKeIqLbUvW7OEjj6v29G82J7VsiGzJvbke1CwMPB9YnW24Glc2GDw X-Google-Smtp-Source: AGHT+IG04WnkKSuT0NmLZ9dM0U7f7y4v09ADhQLULcryLtT/34H88U0YsW1NosMpPUydO1djOvmI X-Received: by 2002:a05:620a:258c:b0:790:f369:396e with SMTP id af79cd13be357-792bbe4e4admr1922960885a.31.1715586776499; Mon, 13 May 2024 00:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715586776; cv=none; d=google.com; s=arc-20160816; b=ewFdWGJmzbGKGuupZLqb7I5tdOtIsEFIDlv4qwvIA9gbisYJ5FFY7LjxDFnR55ke5h dZkEpmiaW+aBwnQlSGaJsu1o74oNiDpFV6heokot5C+8PWW7HJmPTtVs7o92IUZymHmh /9eGmbxZhxDEPb1+FteilLnCR2TUeDwWQ6LFvqjjtcFFt9U0kTC3bYWtHD/CIzrkbSD0 3riShNsV2bKSEYLpurucXfaMKsTIZhTahjC1hQxF5HcyedXmCSy+AeA45IiHx46b1DgI DLIIesPA9YAne8UJjNZ2eAKF2bVgBz/bJ/vIkKKwOO5e1JA+LdQOyud+KAMt8vIp1a9Z cRvg== 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=hthpAUDZCE7MsS8KK7tEgLctoSvSemW+A0a2D7pgGUw=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=CPQn4DRPDc8/RhJdhGea+Sf4mqlasG+hQ+w0dYQQCqmVwGRODP2ae6LK3Mk8MTQoKA eBM/lY385PU2wJN7ygJRhf5DcvW4wN8pMyxgd3naDydHDg2/4asiPfuzFKMGPg5FaB0u HYS7PtG+f1b46Y7+cUGUvRNz8DqQYmeVSXiaqiw8aGL2xOFuqNmJzWlCeSUd6Kc97i8U sQzYK/8RFuH0qeEflctlKH4vthizqtPOHfjQsdk7OX/Yci5L3AvFkJI15HkH9HcwKOap nWlLJqz/p+WbdI6gpMphTiLJbM7WF8E4A6ag6x4QUglrYVJy0RsqSRnJINAPsF3fpyQ2 isVA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OR3wn0BR; 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 d75a77b69052e-43e12d201fcsi28052631cf.398.2024.05.13.00.52.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2024 00:52:56 -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=OR3wn0BR; 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 1s6QRC-0006Ri-82; Mon, 13 May 2024 03:49:34 -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 1s6QPR-0002uU-Iw for qemu-devel@nongnu.org; Mon, 13 May 2024 03:47:45 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6QPH-0001Nf-Ku for qemu-devel@nongnu.org; Mon, 13 May 2024 03:47:45 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-420180b59b7so2956305e9.0 for ; Mon, 13 May 2024 00:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715586454; x=1716191254; 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=hthpAUDZCE7MsS8KK7tEgLctoSvSemW+A0a2D7pgGUw=; b=OR3wn0BRMhmpVe8Uajcned/Y2FWjYVOPCwkhZf+XSdzJkNz4gfCM9gQo8mOIlwWWMO KXjo5Gbd2QRo11btCU8e+6qotrc8n2Qdjhk6r0/MNJ86yKmQaYAGTXiUkT5XSJ7UHRUe wsNH0AtEk+mXackoax8Pdp2KOikRv7q55b2aFeBBJo65TC9U1PzEClgihW+cDbEBb62F HCRmQwtlJuX455xIm/IQWZd1XJRKbKsVI0fFeKDZ5KNkSsMmP9ZZchdCYD5thfbiLKKh XPMSU/wDUOe22p0/zAlNgPfNjGwP5q0uXaCMC0i5OyxRSmpSnj1fC88Zh5NQglYJDTlF Scsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715586454; x=1716191254; 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=hthpAUDZCE7MsS8KK7tEgLctoSvSemW+A0a2D7pgGUw=; b=d7ct5tc/Ljk6ns8IE4mlO+MwMHnCRMmI8LBNXDEsV1V1c7F++spLJ4Wgy6EdAmcMNw Qv1urtMxekzls9K8sJDRJ/yxh5EhMwAoVItcitlFntzk9ydKN7C/L8WUP1o8jiYd9+TB XBF//3BqUHn0AMDdTAkEb3+3BbiU96/FOa+KJsjd4PL0lmJrBHE7qgdaI+fFmtAnNeAv hXOU9M+JC3SHthu4BLcmP+gCKKFx5AXhvvmH7f1TiA8r7jlMFK6jzvC9APicyn8SahxW Smf8pwwwchhbJ7oL8AJkY22lhkbLhLUyhwoz13Fgl6meTOFjvZe9UVUHk/SIvLRwx1sZ KDwQ== X-Gm-Message-State: AOJu0YzOirNms7ZsqMN6e2gWSb/R3PokDMG9rammA63AajGLCnkL3zVR ux7DhKHKtPbpRz+clrW6WGT3RPEMvTQgcqKybjsFO8ObfxdciFgcZpwR3eVS9WDaxZeanWCc1BV LB7Q= X-Received: by 2002:a05:600c:450e:b0:41e:c9ad:c729 with SMTP id 5b1f17b1804b1-41feac59d29mr66574075e9.28.1715586454192; Mon, 13 May 2024 00:47:34 -0700 (PDT) Received: from stoup.. (12.red-213-97-13.staticip.rima-tde.net. [213.97.13.12]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9318sm148204765e9.30.2024.05.13.00.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 00:47:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v2 21/45] target/hppa: Use TCG_COND_TST* in do_log_cond Date: Mon, 13 May 2024 09:46:53 +0200 Message-Id: <20240513074717.130949-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513074717.130949-1-richard.henderson@linaro.org> References: <20240513074717.130949-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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 We can directly test bits of a 32-bit comparison without zero or sign-extending an intermediate result. We can directly test bit 0 for odd/even. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/translate.c | 78 ++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 421b0df9d4..e4e8034c5f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -914,65 +914,41 @@ static DisasCond do_log_cond(DisasContext *ctx, unsigned cf, bool d, TCGv_i64 res) { TCGCond tc; - bool ext_uns; + uint64_t imm; - switch (cf) { - case 0: /* never */ - case 9: /* undef, C */ - case 11: /* undef, C & !Z */ - case 12: /* undef, V */ - return cond_make_f(); - - case 1: /* true */ - case 8: /* undef, !C */ - case 10: /* undef, !C | Z */ - case 13: /* undef, !V */ - return cond_make_t(); - - case 2: /* == */ - tc = TCG_COND_EQ; - ext_uns = true; + switch (cf >> 1) { + case 0: /* never / always */ + case 4: /* undef, C */ + case 5: /* undef, C & !Z */ + case 6: /* undef, V */ + return cf & 1 ? cond_make_t() : cond_make_f(); + case 1: /* == / <> */ + tc = d ? TCG_COND_EQ : TCG_COND_TSTEQ; + imm = d ? 0 : UINT32_MAX; break; - case 3: /* <> */ - tc = TCG_COND_NE; - ext_uns = true; + case 2: /* < / >= */ + tc = d ? TCG_COND_LT : TCG_COND_TSTNE; + imm = d ? 0 : 1ull << 31; break; - case 4: /* < */ - tc = TCG_COND_LT; - ext_uns = false; + case 3: /* <= / > */ + tc = cf & 1 ? TCG_COND_GT : TCG_COND_LE; + if (!d) { + TCGv_i64 tmp = tcg_temp_new_i64(); + tcg_gen_ext32s_i64(tmp, res); + return cond_make_ti(tc, tmp, 0); + } + return cond_make_vi(tc, res, 0); + case 7: /* OD / EV */ + tc = TCG_COND_TSTNE; + imm = 1; break; - case 5: /* >= */ - tc = TCG_COND_GE; - ext_uns = false; - break; - case 6: /* <= */ - tc = TCG_COND_LE; - ext_uns = false; - break; - case 7: /* > */ - tc = TCG_COND_GT; - ext_uns = false; - break; - - case 14: /* OD */ - case 15: /* EV */ - return do_cond(ctx, cf, d, res, NULL, NULL); - default: g_assert_not_reached(); } - - if (!d) { - TCGv_i64 tmp = tcg_temp_new_i64(); - - if (ext_uns) { - tcg_gen_ext32u_i64(tmp, res); - } else { - tcg_gen_ext32s_i64(tmp, res); - } - return cond_make_ti(tc, tmp, 0); + if (cf & 1) { + tc = tcg_invert_cond(tc); } - return cond_make_vi(tc, res, 0); + return cond_make_vi(tc, res, imm); } /* Similar, but for shift/extract/deposit conditions. */