From patchwork Fri Nov 3 17:38:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 740694 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp1515678wrv; Fri, 3 Nov 2023 10:41:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ4FtRgLct+gRIUgj3fUw+gasInNzh5av8UTaYhKwBrvVYAJEFMEnX6gMYMcU2dBkTAfX2 X-Received: by 2002:a05:620a:4c4:b0:774:2113:7432 with SMTP id 4-20020a05620a04c400b0077421137432mr21711910qks.67.1699033297162; Fri, 03 Nov 2023 10:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699033297; cv=none; d=google.com; s=arc-20160816; b=sPnsK7+VwuMh+SL/G+2YMzr4YnRU6WMe8ChViivhcYa6jOPfxjCJ7kKDEQ0jVps8C/ nbK+jplzyoWNXYUzYlsXWfvbon/hwK3HVUbDozY67Blza3rdOmtn0zZMWYcEvom7nmeF z/XEAYfd4A/1JsTDCb5HVA2BvJxqV7FI5GACLG8uZmD7HFCiFO9Jvz2BHlemA4P/MDVj tPXwUcgu+t+jTkSYowPVW8DC7nIa7sDFQ8gKmXLLBrxJ0s9f8BddAOvEEjOgo07dbqA6 Z+VXfV/g0QvNgTWjb6WHF6hpX4SLKpCQnAIm7dSTl/huuEVBPrvWexut/z+AMPtd41ne 1G0g== 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=YO+NoiOvuNpNkKkH1QgyxJDWN9EGHZREt+ntpOXGlhM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Zx+caxnUCQZN+mmLWS8879QsUWGSnEZ9RnabpahOgcT3w5FCw8iVIePnlXYo7y+Srw BkznYlcqttxcX/2SiYZLCue9YuLDOBg0xi3RxDtpdxauqXQ/Q29S7WbIh7TtUeaY3jxm TwzJCIx9ctU4H4nA1qB3hyDoEsw1yfB8ixWHjN3ZPaANP5Oj3yrg0IWfvOQpSPs0AoFo UCXARZpRlbOgXkoF+RiAYF3yW4YAAmOoA1cqGG7Eb44U50QjMot3CDF/9NB6sdWpCpg5 KjRaVYV9c+UgdICPOZWe8LF8CTdbAHliduPARwZzQSVCrCGcAWDDm6NCEDJ903+bOscL nElw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zAaRB/py"; 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 y8-20020ae9f408000000b00770753a1153si1835534qkl.25.2023.11.03.10.41.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Nov 2023 10:41:37 -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="zAaRB/py"; 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 1qyy8q-0005Mj-Gf; Fri, 03 Nov 2023 13:39:32 -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 1qyy8D-0005DY-3Y for qemu-devel@nongnu.org; Fri, 03 Nov 2023 13:38:55 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyy8A-0003Qs-3W for qemu-devel@nongnu.org; Fri, 03 Nov 2023 13:38:52 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1cc9b626a96so9883445ad.2 for ; Fri, 03 Nov 2023 10:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699033128; x=1699637928; 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=YO+NoiOvuNpNkKkH1QgyxJDWN9EGHZREt+ntpOXGlhM=; b=zAaRB/pyAJIt3zt6HdwpDXwFJnL7SHMC8nhnOxSZLUeHCsW5w6LZw8SUbUHBy7D2Bi 4mLAyd96/tZ8zDyr4h174hYK5sB7Y58HkZWnwwLjh3C4laHKaGLrKQUuquOp2nLglWT+ balc8ar1zHwSpj2AoaPgwwODmWRL9UerJAphDHx4VdxAk+YhOux6v9xHiGbR2PjjeH21 fru/lumWhyrE2yM35RaSZ5IvpnuCz5c8oIbuvL8UrdIAKnp4BXVMzKd4DcVqrtCi4wAs c+8bxRFdHZtzcl7o7pl7t5Km3K9eHkJUC5sfWEqIYrPQnbv7G2+omSqlm1yhmA7umn80 8huQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699033128; x=1699637928; 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=YO+NoiOvuNpNkKkH1QgyxJDWN9EGHZREt+ntpOXGlhM=; b=SUV4q/0t3p/D2dB/d42nbHIVaQ52XL6Sn/+o9ZQ7UbYuQR1ZImzp8swWlRzMDzfoSQ YL24VJqqXxHkcEhWNn8aAjV4qliWk9tsjxebS95FO1rs6ozxS2qZSbMjvqcVrXbJmJc+ 1CPRsh8GW5s4+3Iwo7mCOkqbtTKKMs6sIJYtwg2mPrdaXga1EUKEVlzWT1vVNVk+Z6/g w/ME9pA++ZgeHLiGaBXBkaVEgznQCnaprwQNF0hNImAtiuH5RduoGUpzJ507pOBdAsBJ TTtFRp0+XnD/n1T0oj+ruEA510Xet2uSi+0dEciAKMBoPUaOnw1EItQitUEhxi1/T/Vl n7/w== X-Gm-Message-State: AOJu0YxwpqljvHH5QWPHvp/88fR+E44PA1fiDFF7lOVneseQ5Xg3qUKP lUm5oFBFnx7deWeY7oaGdpaPxvqht6dJti6HO/o= X-Received: by 2002:a17:902:ec81:b0:1cc:6e5e:a980 with SMTP id x1-20020a170902ec8100b001cc6e5ea980mr11930660plg.3.1699033127770; Fri, 03 Nov 2023 10:38:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id c10-20020a170902c1ca00b001c0cb2aa2easm1628267plc.121.2023.11.03.10.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 10:38:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH 06/22] target/sparc: Use i128 for FSQRTq Date: Fri, 3 Nov 2023 10:38:25 -0700 Message-Id: <20231103173841.33651-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231103173841.33651-1-richard.henderson@linaro.org> References: <20231103173841.33651-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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, T_SCC_BODY_TEXT_LINE=-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 Signed-off-by: Richard Henderson --- target/sparc/helper.h | 2 +- target/sparc/fop_helper.c | 26 ++++++++++++++++++++++++-- target/sparc/translate.c | 12 +++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 74a1575d21..eea2fa570c 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -43,7 +43,7 @@ DEF_HELPER_FLAGS_3(fcmps, TCG_CALL_NO_WG, tl, env, f32, f32) DEF_HELPER_FLAGS_3(fcmpd, TCG_CALL_NO_WG, tl, env, f64, f64) DEF_HELPER_FLAGS_3(fcmpes, TCG_CALL_NO_WG, tl, env, f32, f32) DEF_HELPER_FLAGS_3(fcmped, TCG_CALL_NO_WG, tl, env, f64, f64) -DEF_HELPER_FLAGS_1(fsqrtq, TCG_CALL_NO_RWG, void, env) +DEF_HELPER_FLAGS_2(fsqrtq, TCG_CALL_NO_RWG, i128, env, i128) DEF_HELPER_FLAGS_1(fcmpq, TCG_CALL_NO_WG, tl, env) DEF_HELPER_FLAGS_1(fcmpeq, TCG_CALL_NO_WG, tl, env) #ifdef TARGET_SPARC64 diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c index d6fb769769..d639e50965 100644 --- a/target/sparc/fop_helper.c +++ b/target/sparc/fop_helper.c @@ -26,6 +26,28 @@ #define QT0 (env->qt0) #define QT1 (env->qt1) +static inline float128 f128_in(Int128 i) +{ + union { + Int128 i; + float128 f; + } u; + + u.i = i; + return u.f; +} + +static inline Int128 f128_ret(float128 f) +{ + union { + Int128 i; + float128 f; + } u; + + u.f = f; + return u.i; +} + static target_ulong do_check_ieee_exceptions(CPUSPARCState *env, uintptr_t ra) { target_ulong status = get_float_exception_flags(&env->fp_status); @@ -222,9 +244,9 @@ float64 helper_fsqrtd(CPUSPARCState *env, float64 src) return float64_sqrt(src, &env->fp_status); } -void helper_fsqrtq(CPUSPARCState *env) +Int128 helper_fsqrtq(CPUSPARCState *env, Int128 src) { - QT0 = float128_sqrt(QT1, &env->fp_status); + return f128_ret(float128_sqrt(f128_in(src), &env->fp_status)); } #define GEN_FCMP(name, size, reg1, reg2, FS, E) \ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 254f185b83..6c08bf909e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4669,8 +4669,10 @@ TRANS(FNEGq, 64, do_qq, a, gen_op_fnegq) TRANS(FABSq, 64, do_qq, a, gen_op_fabsq) static bool do_env_qq(DisasContext *dc, arg_r_r *a, - void (*func)(TCGv_env)) + void (*func)(TCGv_i128, TCGv_env, TCGv_i128)) { + TCGv_i128 t; + if (gen_trap_ifnofpu(dc)) { return true; } @@ -4679,11 +4681,11 @@ static bool do_env_qq(DisasContext *dc, arg_r_r *a, } gen_op_clear_ieee_excp_and_FTT(); - gen_op_load_fpr_QT1(QFPREG(a->rs)); - func(tcg_env); + + t = gen_load_fpr_Q(dc, a->rs); + func(t, tcg_env, t); gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - gen_op_store_QT0_fpr(QFPREG(a->rd)); - gen_update_fprs_dirty(dc, QFPREG(a->rd)); + gen_store_fpr_Q(dc, a->rd, t); return advance_pc(dc); }