From patchwork Fri Oct 20 20:42:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736308 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp502180wrl; Fri, 20 Oct 2023 13:48:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7xZU1n+R3QdCrGZJtsvWHXtjqVMPC1DVUr5AJSHPieI+S7ikrbRZYfmvC52BCu0KT7zv9 X-Received: by 2002:a05:620a:40d2:b0:775:99dd:431b with SMTP id g18-20020a05620a40d200b0077599dd431bmr3104393qko.58.1697834927837; Fri, 20 Oct 2023 13:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697834927; cv=none; d=google.com; s=arc-20160816; b=Ws2p3MCr/0+pFCSQwtkt7wTjylrK9VqS3JxcG9vbFRF/o0VAfcWZfwE6vF/sdtaLuv PduQLTDJzBXJUJeTWQ9Pb5ux0FpOszLheRqaDLzKVnDnEn6z4MErKPqTjq+IwswuZLeS ZsQFXqe64SQGY3QzXqlW1DgbrYmANILnWbxMCPa5h7p+JUkoxkrrNur9C+6LGlS3aUiM jddsyxRdeJ0NBrcAby/RNc1l+B+KrTfVlJJLvMfxdpOXcyI4eCl3c+yrRNkTIi0F3d3B n2XNL3u4QaTc8t4e36DZOErRQext1bxMn8Ca5QA2VihMcrNXmPlH1OLu4Sphx/Qdcyot kBWg== 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=z2Fl5YhgRkzSF9REjLtMOkcrzmKFDkU8I1AFTwJdP2A=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=Vu2VyBrKsfqGq4iT/NfGX/CVVXoKlw73nNfU3RI3u3KrT7B2oDLmmef6H9c98Sw5An +a2nD09DJwHHshpGeuuhjkk0IPR6aaaKYfS18U/d0ZZx4jgYDcEVh1L9K8PwoQvTsz4X zXIJ8VbPkE4nnno4lKw1LkzjVbYfp17njHfEKSiFq2/ILVjhPNu7my5BcVgvuhtl/L1W xSmW+PJthRKpV6RYh59ioicP8jK3Tv0CEo46Iafi7gUAlITs3aaUxLQ/92eEsXc1NwxJ gwH3MDQUw5a4wPLyfKGyFVw9vNkbRKE50TzAtWsQI7zWpj7xCfnqLHoTxcuanF0cP39R 9dMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vcvQZwCJ; 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 x12-20020a05620a098c00b007771d46fd50si1872550qkx.111.2023.10.20.13.48.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 13:48:47 -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=vcvQZwCJ; 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 1qtwM3-0007yO-6Y; Fri, 20 Oct 2023 16:44:23 -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 1qtwLk-0007lI-3X for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:44:08 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtwLd-0008Dn-ID for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:44:03 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so1225089b3a.0 for ; Fri, 20 Oct 2023 13:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697834636; x=1698439436; 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=z2Fl5YhgRkzSF9REjLtMOkcrzmKFDkU8I1AFTwJdP2A=; b=vcvQZwCJ2UXqZUx/rEdiLvl5rQtfm+5CEraMApVzNpOE3Y4ZGaxu2ucRPjlA3BaZT6 V3VJphOYcNisLP39aeFW/XPDuDSFOmkdNOMdo/lKODdRnnmckX4dTttKXA2C/7cBYood 7gX6Do23JLw5ctE8XExQDIk38MGuU5WaQpiuM1hYVXoU4iErtArEGs0KXZmKq9CyvYJM +VoEg4skgOcxTZyCxAhUGDY/pRFisqGVzbeKFtwKU00vRxQZ4EgxyeXv1zbpdo2nH7EE zARWqw2LeeKMl1IipgpEJyhUvFaG7FT/kQicVELEHtDmWfNOUkE5viPVzb83AgAScsUO +2vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697834636; x=1698439436; 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=z2Fl5YhgRkzSF9REjLtMOkcrzmKFDkU8I1AFTwJdP2A=; b=nkzLefBNn8jzaAqwMXfRluMHPTSxB3I/Z/trRvALiH0jYQuJDXYrwswQJFLBmK7t91 QdfVd2H4IkU38VGN/E32vYPMQo8ajduyTFuTsuMwCBRPc/NeBBpeHHVfSPsB+W6/5dfC S+g9JEQvppJ8zDvhubz42PdfkUM+QXZ/pjHFFljQ9jjIMfSYZdjWTtc7hPzYRktaYZJt /fqUmWUjMCn+PFefWi+HJqOFT83Sn9CwBWf62olrJIR6PcfOY0xF/4Cpu/ruxflWLWoe GfSCatWMvQMILwYGisXS7eAiomwHEC4MTh3VYu98chV40W+Kf/GDn+LmWo2YMHl8gxYs uecA== X-Gm-Message-State: AOJu0Yzamdm0JV4d/TS8FeXrfjrgPWhlrIo1Ny19UOnVp0Jw5CsA6yHa 869J4KD/KBqQtxqhaQYA+Diy/n6T97n0HE4/ooE= X-Received: by 2002:a05:6a00:10c4:b0:6b5:608d:64f6 with SMTP id d4-20020a056a0010c400b006b5608d64f6mr3132724pfu.20.1697834636206; Fri, 20 Oct 2023 13:43:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id k15-20020aa7998f000000b00688965c5227sm1944975pfh.120.2023.10.20.13.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:43:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v2 26/65] target/hppa: Pass d to do_unit_cond Date: Fri, 20 Oct 2023 13:42:52 -0700 Message-Id: <20231020204331.139847-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020204331.139847-1-richard.henderson@linaro.org> References: <20231020204331.139847-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 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 9995749237..be1763cb45 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1056,11 +1056,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 @@ -1087,32 +1088,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; @@ -1428,6 +1429,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); @@ -1438,7 +1440,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();