From patchwork Sat Oct 28 19:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738947 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp480846wrt; Sat, 28 Oct 2023 12:46:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHk9AdTdT5zWsEYBGP1xA9j/r2H/5SvTHEOAO7I6ez/698TY8QYbouT0aptSb+X6NnVmyib X-Received: by 2002:ad4:5b83:0:b0:66d:1f11:8b7c with SMTP id 3-20020ad45b83000000b0066d1f118b7cmr8080949qvp.52.1698522389027; Sat, 28 Oct 2023 12:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698522389; cv=none; d=google.com; s=arc-20160816; b=nH07FxJXo3FBFMda/s/8QKXNjFT1BOMoKQuGxgPqHV5QTQeOMdNtjH5zbJFdoQSFXp yszpNgbJddwycc7hlUdKzJsuUEyZjlL1QoOblt/OlZSktTDQ7SlYDVejjxQUvS4FFyEX Io1MZlo0/sVOuaVgtTPXQRTGXpPdM4E64aVTynJFF7hFgeOAUZwHeap8r0WFv1f5bvSv dABHoOV46wwe4hEqutCo+/ZdAh7VOgbexqZM4N80Z6ecK5qxVNZcon+Tu1FAigpvmFdm CfkYG/10sArTg4YNrNtJ/krXm8y1dqmDYEO0/mGsyHOdtgBdouHaNWcDU/1yD0TwKlfl ctsA== 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=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=PD67zvZd2JQS/u3K249g8iUpUud0fLeEcSua2Czya62IzWDJfEZW8XPNNXs22/oJyO CTzrq+wYAl6R5nKuFP9yi2iK3HbTYTv5u+D5U7vOSwGxlj03KfTiiiMAZhJ5RLCWT5Hd E6M8WZGrn5kLK2/BM+P4dTtlenX3wSPCVmiPQvjaGYTryPRcxxlxI37F6wg2ABOpOjBL SH+6qxxTQ8sY8YW1r9Wpf7ShKOlRvSaRQls6EaK1sZ02gwWlsGR3onwad1thLbwx44Ru Q0GfzBy4vFbFxpU22UdZWfOexFADKVLthH+cRJWLPkWTtch2JuydocNPnk9QPh1D15uy SymQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PA+rCgEf; 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 cx12-20020a056214188c00b00670a8441692si1735087qvb.568.2023.10.28.12.46.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Oct 2023 12:46:29 -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=PA+rCgEf; 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 1qwpG9-0005Xu-MM; Sat, 28 Oct 2023 15:46:13 -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 1qwpFu-0004pj-6f for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:58 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwpFr-0004Bd-Ew for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:56 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so2765381b3a.3 for ; Sat, 28 Oct 2023 12:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698522354; x=1699127154; 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=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; b=PA+rCgEf9DOIvJgR9vXeAZx0v1wkvPaDPb9AWIGuo8nqX41BmaSaPzTe1YZhiMYHiJ rfmc31p7FlYFouFfT6RARbmXIaTfM5o4FGg/nVn1zlUpNx1BVWE4Tdxtt+EQ2qL12+PE A0S9NvbeRt4Os/+a0EyIuTi8LKbUUcEoJnkctku+Bu1g3Jfyi26ZaEUL54MI1jF5v2VJ l6t25RpZKTqHfKdI4nGySCHIoBY7Wu5whAUxVQi+26U5AKaNnEX5vJdI1Uukl8R6Q9WK mwowR8nNklgVam0lB3AJaKIAzQssayDRApTknQPkh4gGJKsD4cXA8pKIgNklKoD6JNXL TCzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698522354; x=1699127154; 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=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; b=Al74QNpr6nTUQtgs/csuQdi2IWNlSPu0+sgLUWZnrYuvdGKUjqI3QR+/dBHjQFV6ZT CBHu0Vt7WH10qhqiDg8z+5OaZOPn+ijtnXTS3eWocdEoAcpbiMXjE4hHucsFJv+qVydX ceFunGfffhHKZwKbCVTOAEhh1ZUYrYrQbbzw6+OX33JmFiLdRblBEUTOvGqgXiBK2ZhG DBJSJNuk87gjjE1XqnrHkokWB9uARdir5BJD50EAlQ8LpWciYN/t9WGJ0TZ0BJYaG4oH OTNui0JxBb4B4AI1K24R7ej45NP6fzhOZO4UKKTCbF7luVn21aNtaj4EcxeIcptFCekQ PbKw== X-Gm-Message-State: AOJu0YyX0LzQkZmv5vmlCHaPCWfbSEZvhCP4hYK5P8e8o2mdUfI0OAkp Nf63lBhm47R+qpa2dwprcVDPDYyqowUzglXv+aw= X-Received: by 2002:a05:6a20:918d:b0:17a:eddb:ac65 with SMTP id v13-20020a056a20918d00b0017aeddbac65mr6266375pzd.9.1698522354229; Sat, 28 Oct 2023 12:45:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f7c900b001b8a3e2c241sm3600096plw.14.2023.10.28.12.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 12:45:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v2 34/35] target/alpha: Use TCG_COND_TSTNE for gen_fold_mzero Date: Sat, 28 Oct 2023 12:45:21 -0700 Message-Id: <20231028194522.245170-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231028194522.245170-1-richard.henderson@linaro.org> References: <20231028194522.245170-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 49 +++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index c7daf46de7..c68c2bcd21 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -490,56 +490,53 @@ static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, /* Fold -0.0 for comparison with COND. */ -static void gen_fold_mzero(TCGCond cond, TCGv dest, TCGv src) +static TCGv_i64 gen_fold_mzero(TCGCond *pcond, uint64_t *pimm, TCGv_i64 src) { - uint64_t mzero = 1ull << 63; + TCGv_i64 tmp; - switch (cond) { + *pimm = 0; + switch (*pcond) { case TCG_COND_LE: case TCG_COND_GT: /* For <= or >, the -0.0 value directly compares the way we want. */ - tcg_gen_mov_i64(dest, src); - break; + return src; case TCG_COND_EQ: case TCG_COND_NE: - /* For == or !=, we can simply mask off the sign bit and compare. */ - tcg_gen_andi_i64(dest, src, mzero - 1); - break; + /* For == or !=, we can compare without the sign bit. */ + *pcond = *pcond == TCG_COND_EQ ? TCG_COND_TSTEQ : TCG_COND_TSTNE; + *pimm = INT64_MAX; + return src; case TCG_COND_GE: case TCG_COND_LT: /* For >= or <, map -0.0 to +0.0. */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, src, tcg_constant_i64(mzero), - src, tcg_constant_i64(0)); - break; + tmp = tcg_temp_new_i64(); + tcg_gen_movcond_i64(TCG_COND_EQ, tmp, + src, tcg_constant_i64(INT64_MIN), + tcg_constant_i64(0), src); + return tmp; default: - abort(); + g_assert_not_reached(); } } static DisasJumpType gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp) { - TCGv cmp_tmp = tcg_temp_new(); - DisasJumpType ret; - - gen_fold_mzero(cond, cmp_tmp, load_fpr(ctx, ra)); - ret = gen_bcond_internal(ctx, cond, cmp_tmp, 0, disp); - return ret; + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + return gen_bcond_internal(ctx, cond, tmp, imm, disp); } static void gen_fcmov(DisasContext *ctx, TCGCond cond, int ra, int rb, int rc) { - TCGv_i64 va, vb, z; - - z = load_zero(ctx); - vb = load_fpr(ctx, rb); - va = tcg_temp_new(); - gen_fold_mzero(cond, va, load_fpr(ctx, ra)); - - tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), va, z, vb, load_fpr(ctx, rc)); + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), + tmp, tcg_constant_i64(imm), + load_fpr(ctx, rb), load_fpr(ctx, rc)); } #define QUAL_RM_N 0x080 /* Round mode nearest even */