From patchwork Wed Oct 18 21:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735135 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1229385wro; Wed, 18 Oct 2023 15:06:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKpOP8ikDbi5mIWJR9xdT0ZO5kluv6qPk7toBuFKRzT1OvdA4+3+F3sUgbJU6czqLK7ThA X-Received: by 2002:a05:6214:c2b:b0:65b:765:254 with SMTP id a11-20020a0562140c2b00b0065b07650254mr585077qvd.4.1697666774303; Wed, 18 Oct 2023 15:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697666774; cv=none; d=google.com; s=arc-20160816; b=PYYI5vCdI07x04lrTiS0jX++Qwd5UDkm3AFzaszuexvFPT6cEBaeGBCMnhTGzCOA4P RaunodncsK+oKq2VnL+RVrMrkakb8dUugSog+9RTFPSKRmY7U57X8VqTv+VVgPqAiaUD M6dzODnSap+2UCtCzukCRj9sH4+sqmQem8XB7TZPzVYrmB8CuwErjkBx3seMXPywqUdS 1CG2YI9NRkgXmwz4gfs7Sz6A7Id2fkeUZd7PLAm+1QhYEnItJgcpxdnawO0BDEt2oxUp lTl/mb5zOT2jEWXcM/Uytw+Mtr+5vfGlb9rCLcJPrBpT51sAHpF8D4hRArru0RRMPqxC v/mA== 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=UwyqjJ9QUSpnAuYnVaYNZPjS81j2Avs+ZfX6KYX0BS0=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=RKMezbXhwEbIeRqyMgEvdXh2xamxicdN2GuW1xkro8lRKMZUpB901blncuo26Iy5FM Nkv36uQ4Jp6o4wOaCVy8H0sZEMp/HL1ovypP8qAeNQdRzoR9c8ELXopr1h84RRdzyqfc D8NaTe1JhQ/dqZ68qH3E55P/nnZMG5A35VDRAMdRNQrjlFxAa8s9k949pJWIE7ySCe0z jZG2EmXwOdCjrA38aQTtTXPLWwNvj38Zuz/PRhSTR00CmUCnD7SuouI+0m3O9NeWzKZq e5VnFzgiKeuJ+WqWxfEUo0/GKxiRgS6BdctdROpQICz6BLabtH5AgspXbNkaKf/jCJ0L IYHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zx9HixpL; 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 bo8-20020a05621414a800b0066d07dcdceasi633653qvb.220.2023.10.18.15.06.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:06:14 -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=Zx9HixpL; 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 1qtESj-0001tI-N6; Wed, 18 Oct 2023 17:52:21 -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 1qtESO-00019R-0f for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:52:01 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtESL-0004RJ-Lj for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:51:59 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1dd8304b980so4636182fac.2 for ; Wed, 18 Oct 2023 14:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697665916; x=1698270716; 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=UwyqjJ9QUSpnAuYnVaYNZPjS81j2Avs+ZfX6KYX0BS0=; b=Zx9HixpLkS0tmEtuq9kMXnwQVGGyfxpWuKSrjhmZyKjBxOpTR6Fx8zvECnboEgRamh VxjU6kxaWixicD4ABfkjL7tnurTLHbxxC8dpdgZ2jlKfg0ZSqNCHm6r2xv6da8IPbrPy wr8QiIhFNe9xVNFQdY7Y8MQsaRIaZ4fC7CtfcUsJtpSCzAamo+M5Vm6dyhsB+QDb9l4I DU/8CSU8m+I5hQutZ3MOD4KNMjYJiljEz1VeUcw9g18fvCzXt2yFpfE+hv3dnBrnr7i3 i+3MVa8n7RI7YopTmhAMPqVgFKyzTY5fK+kjH9WlrOpNJ/B9jBsWbk0+T7oT0qEQOrrR YfrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697665916; x=1698270716; 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=UwyqjJ9QUSpnAuYnVaYNZPjS81j2Avs+ZfX6KYX0BS0=; b=o4CU4vx3MJLx/z5kpsiismMpQiB/33zR1dNiR235G3nDE2hnvghALRcyJuqTXJgaIj NrbyPN67rC3y7fvS0LCqhRMTqLaBU3OiOFSNJmOtThRddBuGYNpvz+nHsY7gGCX2sCHK yb1Ml3Dp+JOnNYzC5pz/+WkqkCBd/zialxqrGFBUbCs+JN8U6tw3w7ReRAjS8bQ6usyR oz9MkGHAI+BInfOrxrXR4kJIwtXwaE3RdtwsPbfEu/hqAolw6Sr97rjf5LRKYTeQm3Lq akeOj3ZXEhiBWaiNZ9kjBRIbvIrgRpIRalysSb4fs5dozeB2kBH8iCZura6KX+pZWmUd ytiw== X-Gm-Message-State: AOJu0Yz5TYRmODxMciIwGR0Y9hqs8nG5X4U9GWzqw+XdKnvVBxLcf8AR NYVtJBz3+3O+AI/bXiG7lttl/Z0d/FezElm1nrA= X-Received: by 2002:a05:6870:aa88:b0:1d0:f5bd:6d2 with SMTP id gr8-20020a056870aa8800b001d0f5bd06d2mr798424oab.38.1697665916443; Wed, 18 Oct 2023 14:51:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id w17-20020a63f511000000b005b61a024ec7sm2176380pgh.74.2023.10.18.14.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 14:51:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 23/61] target/hppa: Pass d to do_sub_cond Date: Wed, 18 Oct 2023 14:50:57 -0700 Message-Id: <20231018215135.1561375-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018215135.1561375-1-richard.henderson@linaro.org> References: <20231018215135.1561375-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x33.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_sub_cond. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index d6edad9adb..7c95c479dc 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -446,12 +446,15 @@ static DisasCond cond_make_n(void) }; } -static DisasCond cond_make_0_tmp(TCGCond c, TCGv_reg a0) +static DisasCond cond_make_tmp(TCGCond c, TCGv_reg a0, TCGv_reg a1) { assert (c != TCG_COND_NEVER && c != TCG_COND_ALWAYS); - return (DisasCond){ - .c = c, .a0 = a0, .a1 = tcg_constant_reg(0) - }; + return (DisasCond){ .c = c, .a0 = a0, .a1 = a1 }; +} + +static DisasCond cond_make_0_tmp(TCGCond c, TCGv_reg a0) +{ + return cond_make_tmp(c, a0, tcg_constant_reg(0)); } static DisasCond cond_make_0(TCGCond c, TCGv_reg a0) @@ -463,15 +466,12 @@ static DisasCond cond_make_0(TCGCond c, TCGv_reg a0) static DisasCond cond_make(TCGCond c, TCGv_reg a0, TCGv_reg a1) { - DisasCond r = { .c = c }; + TCGv_reg t0 = tcg_temp_new(); + TCGv_reg t1 = tcg_temp_new(); - assert (c != TCG_COND_NEVER && c != TCG_COND_ALWAYS); - r.a0 = tcg_temp_new(); - tcg_gen_mov_reg(r.a0, a0); - r.a1 = tcg_temp_new(); - tcg_gen_mov_reg(r.a1, a1); - - return r; + tcg_gen_mov_reg(t0, a0); + tcg_gen_mov_reg(t1, a1); + return cond_make_tmp(c, t0, t1); } static void cond_free(DisasCond *cond) @@ -910,36 +910,55 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, can use the inputs directly. This can allow other computation to be deleted as unused. */ -static DisasCond do_sub_cond(DisasContext *ctx, unsigned cf, TCGv_reg res, - TCGv_reg in1, TCGv_reg in2, TCGv_reg sv) +static DisasCond do_sub_cond(DisasContext *ctx, unsigned cf, bool d, + TCGv_reg res, TCGv_reg in1, + TCGv_reg in2, TCGv_reg sv) { - DisasCond cond; - bool d = false; + TCGCond tc; + bool ext_uns; switch (cf >> 1) { case 1: /* = / <> */ - cond = cond_make(TCG_COND_EQ, in1, in2); + tc = TCG_COND_EQ; + ext_uns = true; break; case 2: /* < / >= */ - cond = cond_make(TCG_COND_LT, in1, in2); + tc = TCG_COND_LT; + ext_uns = false; break; case 3: /* <= / > */ - cond = cond_make(TCG_COND_LE, in1, in2); + tc = TCG_COND_LE; + ext_uns = false; break; case 4: /* << / >>= */ - cond = cond_make(TCG_COND_LTU, in1, in2); + tc = TCG_COND_LTU; + ext_uns = true; break; case 5: /* <<= / >> */ - cond = cond_make(TCG_COND_LEU, in1, in2); + tc = TCG_COND_LEU; + ext_uns = true; break; default: return do_cond(ctx, cf, d, res, NULL, sv); } - if (cf & 1) { - cond.c = tcg_invert_cond(cond.c); - } - return cond; + if (cf & 1) { + tc = tcg_invert_cond(tc); + } + if (cond_need_ext(ctx, d)) { + TCGv_reg t1 = tcg_temp_new(); + TCGv_reg t2 = tcg_temp_new(); + + if (ext_uns) { + tcg_gen_ext32u_reg(t1, in1); + tcg_gen_ext32u_reg(t2, in2); + } else { + tcg_gen_ext32s_reg(t1, in1); + tcg_gen_ext32s_reg(t2, in2); + } + return cond_make_tmp(tc, t1, t2); + } + return cond_make(tc, in1, in2); } /* @@ -1267,7 +1286,7 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_reg in1, /* Compute the condition. We cannot use the special case for borrow. */ if (!is_b) { - cond = do_sub_cond(ctx, cf, dest, in1, in2, sv); + cond = do_sub_cond(ctx, cf, d, dest, in1, in2, sv); } else { cond = do_cond(ctx, cf, d, dest, get_carry(ctx, d, cb, cb_msb), sv); } @@ -1321,6 +1340,7 @@ static void do_cmpclr(DisasContext *ctx, unsigned rt, TCGv_reg in1, { TCGv_reg dest, sv; DisasCond cond; + bool d = false; dest = tcg_temp_new(); tcg_gen_sub_reg(dest, in1, in2); @@ -1332,7 +1352,7 @@ static void do_cmpclr(DisasContext *ctx, unsigned rt, TCGv_reg in1, } /* Form the condition for the compare. */ - cond = do_sub_cond(ctx, cf, dest, in1, in2, sv); + cond = do_sub_cond(ctx, cf, d, dest, in1, in2, sv); /* Clear. */ tcg_gen_movi_reg(dest, 0); @@ -3028,6 +3048,7 @@ static bool do_cmpb(DisasContext *ctx, unsigned r, TCGv_reg in1, { TCGv_reg dest, in2, sv; DisasCond cond; + bool d = false; in2 = load_gpr(ctx, r); dest = tcg_temp_new(); @@ -3039,7 +3060,7 @@ static bool do_cmpb(DisasContext *ctx, unsigned r, TCGv_reg in1, sv = do_sub_sv(ctx, dest, in1, in2); } - cond = do_sub_cond(ctx, c * 2 + f, dest, in1, in2, sv); + cond = do_sub_cond(ctx, c * 2 + f, d, dest, in1, in2, sv); return do_cbranch(ctx, disp, n, &cond); }