From patchwork Wed May 15 09:40:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796926 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2890911wra; Wed, 15 May 2024 02:44:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8W6+W9JnTpjmD6U/6F8q02OLnE5qmsAl+R22qG3NR0yGYaYRHD//cRtEusOrlXJQz+Ueg+CkfJZVGXVCwLRbm X-Google-Smtp-Source: AGHT+IFDUainxPjdFFvGXaiQ115o4C8aT+Mu6gInAhKPS8erPANpVwsjJl4a0uI8OowOEMwz8nwa X-Received: by 2002:a05:6214:5c44:b0:6a0:d20e:5406 with SMTP id 6a1803df08f44-6a16814f5b6mr159451436d6.17.1715766252053; Wed, 15 May 2024 02:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715766252; cv=none; d=google.com; s=arc-20160816; b=T7EXf0OTTKcRsMeO9aXRGd6uup0eBsE0AuSoAwbyFup+l5rBa0XUV6z/195L8KskyI lEZM96hWgd/as6H7PDWq7oWc/3QasebWXcjUhYXlWDg/uHWp3jxA1a4sCAlz/wGFv4xx BeJ058DyDmKVjBC9W4qMHz//d3k+5pkSUQx+wQ9qzyY9aUjtXpgCtbx1z3p56FpW4Ezs zHG0Dv/L36lHbTu9us7TpxWOyBNn8opHZ1PorrlmnypQkbPlomZoBJJhqNRAquqLwRwP 2w46xIE2r0A/axKH3Os96AFL13LYsSwANxXXmWz2f/5yjSZ0IbZ6WlOFN58p5Mcc1Ufn fEvg== 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=Bc9+7FT9ewR5kS1vQGkFjz332Ns1o4RnoFgiZ7ZrChg=; fh=wDljmxUHXfz9MGj2//jPHYRc53BMWF157v8rVKELrf4=; b=SxzSemErJ//MgiCCyw/VVUr0F3s72XEyPirpuvh79TKM3MYl31rdYo7ULRnnBBXD8p xVquG/ZjCeIkT/rWOLo5t0a0QHIypQ3ESty9T7q/mxPjCbDoAs2cfzKh1RdnzUx5TjaL acRR27Xhex88H3hC4JUx8Z+iwLCSWMAD2EUAM+wqXkE1LDrj8Lh0IaguBnPKejLWdB/U GZK52FRcpwCD5sECnKJvs0WSkTvDDIya5efEBNYCA7ZV1sGkz40gVSa017AbDQyG5PAF 47DgNhZBn1wH3fFKSlxfSqRF2ekur9CI3SPPVvl4DNwEa35g6j+TP8oVmHX4XMOpa3wc Gedw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZxKitB7h; 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 6a1803df08f44-6a15f29b3acsi134702666d6.254.2024.05.15.02.44.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 02:44:12 -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=ZxKitB7h; 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 1s7B8J-0006Rf-M6; Wed, 15 May 2024 05:41:11 -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 1s7B8D-000606-H9 for qemu-devel@nongnu.org; Wed, 15 May 2024 05:41:05 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7B8A-0001fh-80 for qemu-devel@nongnu.org; Wed, 15 May 2024 05:41:05 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-51f12ccff5eso9109214e87.1 for ; Wed, 15 May 2024 02:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715766060; x=1716370860; 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=Bc9+7FT9ewR5kS1vQGkFjz332Ns1o4RnoFgiZ7ZrChg=; b=ZxKitB7hhV68mhtrrdMBU8nm0iIjxQEEDu7t3BGytcy7cqxFDun2lNPVy/sLdRL4/O 4Yb7RX9EencsQ1euoqRmfeu9ucbkB3XtdDrsEHQdEoWe0Bd/GIhauJVS/7dLUoDeiUNL VTtJsGzn92FKQMjrSKtjMu+MdxISlV+90JkaJfyNod3g+E5ObizOUNJs+5XQ0tB/xlbN +/WZ0OmTJwhh7P36OSkDF8OUZ3LZAnEJjert85Pc6OgS3XH4ODSIC0g66UFIf5x6AFl6 KGbfu54Uw3n01vLJC8DJTLlWEK3mDi1Uzy9bMEqLS2vubE9sBBLY9g0F5Ar+MVKBD1RB 47gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715766060; x=1716370860; 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=Bc9+7FT9ewR5kS1vQGkFjz332Ns1o4RnoFgiZ7ZrChg=; b=wztr0+sIfhf2sihf6q5TiIRdULLAUJ/joKLWf0fjs1CwXaRwy6sb028nCt1ojYWScj 4SSmNZgpfmyrMwcOMzZF1oGbn4zLIJlCFHk1YhpeuAzO/YRD+Pxb+6+4xYcm8yF9f7Ol uqN7tIXGq54wGPi5W5Mlgu+yGUJPNhKmsUTaO8TIsmz773Ya2/36XJrgzs2jpq1yo5iO ekEqHLOG9SE+lnnqmHkZLTuYIDbExGu6HcqnGFm2J/Gxw2lwv8Yc3EYqOsTE+rZC9tvz 9EZqDpOVAMerCivDS9qqzeLqjOAW9HjzGwkwjzxOTekkfEZIovzHzK6DaTtbxLTYg9wO Kfjw== X-Gm-Message-State: AOJu0YzpgOC3gI89sZgA7ZCzF1zcXmqd/zc7tZchHLVG6OCymUB16O0P 6dYkxXdn9rUa/l7YZXj7PGdpO7qrOT05PucrDVwsPXzRukFySX74vGWI/L+fbOvd4+f/o+WKPPz BAzw= X-Received: by 2002:a19:f004:0:b0:515:d038:5548 with SMTP id 2adb3069b0e04-5221016e9aamr9515473e87.31.1715766060738; Wed, 15 May 2024 02:41:00 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbefdsm15897058f8f.94.2024.05.15.02.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 02:41:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 21/43] target/hppa: Use TCG_COND_TST* in do_log_cond Date: Wed, 15 May 2024 11:40:21 +0200 Message-Id: <20240515094043.82850-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515094043.82850-1-richard.henderson@linaro.org> References: <20240515094043.82850-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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. Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- 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 813f1571e9..62cc3c3117 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -915,65 +915,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. */