From patchwork Tue Nov 7 03:03:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741792 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1419620wrr; Mon, 6 Nov 2023 19:06:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuHF5U1DMHMQt0DO76O+OhpBAfaaLaBBlbBspcXM4oSxoHXzgfyIJsDTbX8Qi2B6MqCxBC X-Received: by 2002:a05:622a:648:b0:41e:1774:7504 with SMTP id a8-20020a05622a064800b0041e17747504mr35624629qtb.60.1699326415871; Mon, 06 Nov 2023 19:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699326415; cv=none; d=google.com; s=arc-20160816; b=tjKST+0XnqXhlzGWBVzSb8DLc2A+ZVArOTwGzdZwocL9T3hCK9B/sKwuh+urdqhD9O h0Mah7QBCWClaYUWbPuX9/tqrwG+2OqYaE74qhdXNtn8C/r2M8sEXhUgGTJQtvKPPzUq jEnNMHb6YV9pf+LRz4Mi1xZJlaBxqYWAjFM1wCFnOBrPKbVOdhHD4gZZPv7cCvyzQeFt hNOYPHCRAouNslvWKOWEFlC2X6gG3xcGHwLSTXlYV33eZ+fK/6tCyeYTo8+Cyykw2MWr o3AdQeDuoLj4mOZjJEcmd5Q4XgVJkRkA2QYnRzMOXPwtprtGddrMy6WTX16o6fOw8Ep0 jrlQ== 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:to:from :dkim-signature; bh=w81PJS53UwmAAbSwfGTJnD1xAO9wqXFrjFhUaqgumJk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=TTWphgGtDGw/v2+fomCdwrnGYAJiPv4XUI0LLzkhwe5/vMs6wBxG9eY5dzmJiaK6y4 Fr96xenE7jG/hhmU+27Osu/gfjr77iGg5rblLlrfeMxCWT+CkCjlfRAfw4qEG2DJjLh3 PZ6IPkt/SqBOyG8uN2XIU+uPs1Pjuz9Tusfs9GmCW5X1qn7niQjHyxEOxA9RFfYGoEcE N42c4mlb0Hj+46C2KoITGSfJpHYemnKGEfsA328yiJFhoY/ltWvCQW5X21Nxq238IANx gHeVo6UXh9nmhNm+yyPAHcV/1hzGYjWdBr3rIoa9d0SxoatagNFBroeEBC4J91BeHKVy QzTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fuphqHYn; 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 f14-20020a05622a104e00b00419537da80bsi6663043qte.117.2023.11.06.19.06.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 19:06:55 -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=fuphqHYn; 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 1r0CPU-0001Rg-IU; Mon, 06 Nov 2023 22:05:48 -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 1r0COd-0007VA-7V for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:04:55 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0COL-0000hO-6z for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:04:54 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cc0d0a0355so39075725ad.3 for ; Mon, 06 Nov 2023 19:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699326274; x=1699931074; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w81PJS53UwmAAbSwfGTJnD1xAO9wqXFrjFhUaqgumJk=; b=fuphqHYnwRakjIHAY1wBDCAr29DJinQ74olhOS9V3qJ0+XI1t2hyJDbeeg6uyx+LNM Z3onHu6Bon0NfZorQgWnOaek6i/+uQzlbxnKin7mUoFIioEivxUS4BFO2djm2pTAADSr Q7mpZvZzx0ISy29wMKfRiOfsNHtQnpOh6UJRXKAO+airInOzbO7RwkcL+FhBDrDytNUA oOSjEIw92tr0rhIMiAa7z1S8mvqW8lzZeRokIWRRhPxG+hqnjW1R25Oa6gVsdEYBAbnw XFpBALoYXZQhk4kKiKj0aw5oNttpYupGf7LM3ii3XYeJosbMYg2C3kRQQcBWd9Vo1D0q b5vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699326274; x=1699931074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w81PJS53UwmAAbSwfGTJnD1xAO9wqXFrjFhUaqgumJk=; b=bmUtJ4wyPvnwIzUUNB0HUbvuvKyaYm87YABjO6Manb7oEerMypxRYrmA0Vvb49Eqfv DYGaqgUyf1wKu+FZCWdqjTBSwnjk4b1gwzeHp6VKM1hy0wQ0cOfZP7OG01+zBxG0hkyM JgzArx7lLPLWOJDGyUedR+Hvt7m187Gu6mCZ8u7XiRWk71+/pP+RWP2Tuwt3SzETMJHh RYxPms9bLj2rdcjKmjmYW/F66uU/sDXaaSvm+ibWXMttCuu2QEZNzxU92aLHVCHEZnxw v7iaI4daD2fRgkRPUs3Fpj8rF49yNRRIdCffk2wKebk9v7ZtdpLgpRToStHAcl18Lpqn Slxw== X-Gm-Message-State: AOJu0YxvrZ5AjoI4yS7xA3ol0pcngwP2iAPDN/Gag08fqYFbM7gQbmNg vz1zpGNohQK6mBg69mvPnmVJNCX0r6XJYqkFZvo= X-Received: by 2002:a17:902:fb4c:b0:1cc:501b:1d13 with SMTP id lf12-20020a170902fb4c00b001cc501b1d13mr17632066plb.40.1699326273823; Mon, 06 Nov 2023 19:04:33 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id u9-20020a17090282c900b001c72d5e16acsm6518012plz.57.2023.11.06.19.04.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 19:04:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 34/85] target/hppa: Pass d to do_unit_cond Date: Mon, 6 Nov 2023 19:03:16 -0800 Message-Id: <20231107030407.8979-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107030407.8979-1-richard.henderson@linaro.org> References: <20231107030407.8979-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 Hoist the resolution of d up one level above do_unit_cond. All computations are logical, and are simplified by using a mask of the correct width, after which the result may be compared with zero. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index eb4605a9c7..41f4e06841 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1069,11 +1069,12 @@ static DisasCond do_sed_cond(DisasContext *ctx, unsigned orig, bool d, /* Similar, but for unit conditions. */ -static DisasCond do_unit_cond(unsigned cf, TCGv_reg res, +static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_reg res, TCGv_reg in1, TCGv_reg in2) { DisasCond cond; TCGv_reg tmp, cb = NULL; + target_ureg d_repl = d ? 0x0000000100000001ull : 1; if (cf & 8) { /* Since we want to test lots of carry-out bits all at once, do not @@ -1100,32 +1101,32 @@ static DisasCond do_unit_cond(unsigned cf, TCGv_reg res, * https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord */ tmp = tcg_temp_new(); - tcg_gen_subi_reg(tmp, res, 0x01010101u); + tcg_gen_subi_reg(tmp, res, d_repl * 0x01010101u); tcg_gen_andc_reg(tmp, tmp, res); - tcg_gen_andi_reg(tmp, tmp, 0x80808080u); + tcg_gen_andi_reg(tmp, tmp, d_repl * 0x80808080u); cond = cond_make_0(TCG_COND_NE, tmp); break; case 3: /* SHZ / NHZ */ tmp = tcg_temp_new(); - tcg_gen_subi_reg(tmp, res, 0x00010001u); + tcg_gen_subi_reg(tmp, res, d_repl * 0x00010001u); tcg_gen_andc_reg(tmp, tmp, res); - tcg_gen_andi_reg(tmp, tmp, 0x80008000u); + tcg_gen_andi_reg(tmp, tmp, d_repl * 0x80008000u); cond = cond_make_0(TCG_COND_NE, tmp); break; case 4: /* SDC / NDC */ - tcg_gen_andi_reg(cb, cb, 0x88888888u); + tcg_gen_andi_reg(cb, cb, d_repl * 0x88888888u); cond = cond_make_0(TCG_COND_NE, cb); break; case 6: /* SBC / NBC */ - tcg_gen_andi_reg(cb, cb, 0x80808080u); + tcg_gen_andi_reg(cb, cb, d_repl * 0x80808080u); cond = cond_make_0(TCG_COND_NE, cb); break; case 7: /* SHC / NHC */ - tcg_gen_andi_reg(cb, cb, 0x80008000u); + tcg_gen_andi_reg(cb, cb, d_repl * 0x80008000u); cond = cond_make_0(TCG_COND_NE, cb); break; @@ -1441,6 +1442,7 @@ static void do_unit(DisasContext *ctx, unsigned rt, TCGv_reg in1, { TCGv_reg dest; DisasCond cond; + bool d = false; if (cf == 0) { dest = dest_gpr(ctx, rt); @@ -1451,7 +1453,7 @@ static void do_unit(DisasContext *ctx, unsigned rt, TCGv_reg in1, dest = tcg_temp_new(); fn(dest, in1, in2); - cond = do_unit_cond(cf, dest, in1, in2); + cond = do_unit_cond(cf, d, dest, in1, in2); if (is_tc) { TCGv_reg tmp = tcg_temp_new();