From patchwork Wed Dec 11 16:29:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849233 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp422500wry; Wed, 11 Dec 2024 08:37:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVE/v3/bb+Czl1Wde1SbY0ye6AaWA0Gq0zr5OESuX7ERTl07HwZbHPId39iOaR3rlLShawdJA==@linaro.org X-Google-Smtp-Source: AGHT+IEERqJScz1zWZAh2qX/ntVa5pJ+OWUVs60Z6Jb8ZrwXoZ/B8Q/8Cm5zL4znxH5Ww3KYSCWT X-Received: by 2002:a05:6214:c8b:b0:6d8:9bbe:393d with SMTP id 6a1803df08f44-6d9348d216emr58118006d6.1.1733935025680; Wed, 11 Dec 2024 08:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733935025; cv=none; d=google.com; s=arc-20240605; b=XFU7bN/b4mXxLzebhZjyEi5Ci/dteHvj+EHeFMjNt5DTISUDFa0WObz9IPnrQ4MmOi 637sF9uuMerBHYVevPke4rvzYMeca877XJ0mdyBvcOf4Lc5quDCwkebsNxXqen7gHUJY KEABr9/yOxHoMqTq1YtRj4EN20iqflSUcf4ksQgpIWhs7gOPaVqaB9ftvCV88GYyoFzl lnjv177B+pMOvqs0GFAMAQrFVnzSOaODlmXbMA1HLcKSzI6zQ2nYSdlDxufqMITktzRf FLBunVtnVCm6Fdkfym6MZj4HWwF5Kuajr1HL3fFWZ0ne2W+FZfgRTQacuGyomKziY7D2 67sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=r5VrSZsZ86taNiV6RjVqL+y8dhQuQVzVoICeQS9NllM=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=hXmokJsz6dEuI8FGSiyuA+at6wz4bNK4wx7W6M+z90EQ2nLQcIR9g0RWX7/CvFUrBK 45KEan8LOhHouwIuyA6FuCDWJCHJFUBN91H12wWgKG9tgWXByiMw2tXGqIb2hmuMU+Ay wVGj3u9LrkI3OnjaY3ekVDK45pRoWzWuBr4p6ksRTYjBuieNZ/XEKLweOG+cm2EIWokd uaZQG5iR6vTpbKZFhzKZy87HXLmV593oVYe5dKPIsmiOEk3SOQowb6s60Actm8MvawY6 ZqEeBX0TJNRxhKPK5Z1XxhCwyfU0aDheNvZLqETfSRmssNiJ+hKYoR0nozDsNtFMWonJ P13w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FWZjMWG5; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d9325e9568si29039786d6.303.2024.12.11.08.37.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Dec 2024 08:37:05 -0800 (PST) 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=FWZjMWG5; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLPdm-0007Ny-1t; Wed, 11 Dec 2024 11:32:46 -0500 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 1tLPdE-0005FM-5B for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:32:15 -0500 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLPdC-0001Nx-Dq for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:32:11 -0500 Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-4678664e22fso13283691cf.2 for ; Wed, 11 Dec 2024 08:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733934729; x=1734539529; 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=r5VrSZsZ86taNiV6RjVqL+y8dhQuQVzVoICeQS9NllM=; b=FWZjMWG5sqz7hEHwvYxaBy8odmvFpt0ThFyZWoy0/jG3g3jyrV8pCsrSqW6Kt7v5ZZ YL2oP7X38wk3kRAgk6g7Gvm58nMYPeoInwhHfzWwImP2RciW4VrQBq7qKT0nFerHB8WG msrWPdZtKsI2jIYl1vTx7HMyvGJJmM/X+smPcewJnE7Qqcx1M9w2GoDXZOlTjEP8MqJn akZHjuTw+BExFq656zXVyajEd/kU7zGR+oWSENoYyq6Ibwzivph1n7sufWYNIdMZ/3hk B+QKH0kjDQh3D4T1+obqJvPYPBfk66G7hAJk9K1nvKnwIL3JoEeU349CAdeTjX5IpQoI 4F+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934729; x=1734539529; 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=r5VrSZsZ86taNiV6RjVqL+y8dhQuQVzVoICeQS9NllM=; b=fxEz361u5uFWc+zOvf4sDlEK/wEWFOz2O68F2R2eouwpeKt3hNgC8iU1khi/do5Uw0 SUTS/KjUoW1+qRhOpcD8VWzH/ABaPRf1UCJPaFMGcDWKaEibSefIs2gmgwfPNCIhf756 81TLdtsasWIchqZIIcG9eMCJ4oaOyafvFUHcNNZ0rh4d0tjHLYczDCOghNORIWDvNOev /m+xRrpeYcnU+l+sC4bgAx51lmEdLejuShFV2pNGmdxGONX0NFUOSewrfFVqusglyC0F HrP3eyjXV81mItJibjm/XmTJAOwDnZMbzeVbQ+mzOdwDESdIpnRXB/FmMd4aku5mMWyW iakg== X-Gm-Message-State: AOJu0YzyTbjDCNlrkZ8Fsc2/sSWYomTOICwuSJWjeEMRn3S2cLDO4JGR khq2DHNJNTzw49+kBT3PYfSMiOhwTcrvCnL69EU98PsjlWNdYAKQ4yUZJ9wlyPCJjfiLJNLD0Zz GjMdc49AL X-Gm-Gg: ASbGncvbhIG/KOSUHi9OzPWms4xuvNZUjkcpxaCWE7TggsNFL7qzxeNbotDywESqC0X 5YW7CkPrpLmWkmLu8c3iBrFexmyJhkpkkXM/ECiV+lzXDq830Zq6ECRBEenTy//DCwehGk+Tkt9 9pUf3gNF7EvfmnqlpPQcQNXNhy/ti0E8GKpUE3iTD6lNkIyAGCR19W8hsgzdIDK261Ic6IJ8lpu BOroL6uVi25s/fAMnqJURZRp6D9/ZaAZ4Q4XBuhaLR66q6Cc27M3IH2csdjXg== X-Received: by 2002:ac8:5a03:0:b0:467:6941:4ecc with SMTP id d75a77b69052e-4678935ec1dmr78844511cf.39.1733934729430; Wed, 11 Dec 2024 08:32:09 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46755db613csm43849381cf.70.2024.12.11.08.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:32:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 25/69] target/arm: Pass fpstatus to vfp_sqrt* Date: Wed, 11 Dec 2024 10:29:52 -0600 Message-ID: <20241211163036.2297116-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241211163036.2297116-1-richard.henderson@linaro.org> References: <20241211163036.2297116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82c.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 Pass fpstatus not env, like most other fp helpers. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 6 +++--- target/arm/tcg/translate-a64.c | 15 +++++++-------- target/arm/tcg/translate-vfp.c | 6 +++--- target/arm/vfp_helper.c | 12 ++++++------ 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 58919b670e..0a697e752b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -133,9 +133,9 @@ DEF_HELPER_3(vfp_maxnumd, f64, f64, f64, ptr) DEF_HELPER_3(vfp_minnumh, f16, f16, f16, ptr) DEF_HELPER_3(vfp_minnums, f32, f32, f32, ptr) DEF_HELPER_3(vfp_minnumd, f64, f64, f64, ptr) -DEF_HELPER_2(vfp_sqrth, f16, f16, env) -DEF_HELPER_2(vfp_sqrts, f32, f32, env) -DEF_HELPER_2(vfp_sqrtd, f64, f64, env) +DEF_HELPER_2(vfp_sqrth, f16, f16, ptr) +DEF_HELPER_2(vfp_sqrts, f32, f32, ptr) +DEF_HELPER_2(vfp_sqrtd, f64, f64, ptr) DEF_HELPER_3(vfp_cmph, void, f16, f16, env) DEF_HELPER_3(vfp_cmps, void, f32, f32, env) DEF_HELPER_3(vfp_cmpd, void, f64, f64, env) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ca2b95510e..cfc73b8506 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8401,8 +8401,8 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) switch (opcode) { case 0x3: /* FSQRT */ - gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_env); - goto done; + gen_fpst = gen_helper_vfp_sqrts; + break; case 0x6: /* BFCVT */ gen_fpst = gen_helper_bfcvt; break; @@ -8450,7 +8450,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) gen_fpst(tcg_res, tcg_op, fpst); } - done: write_fp_sreg(s, rd, tcg_res); } @@ -8467,8 +8466,8 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) switch (opcode) { case 0x3: /* FSQRT */ - gen_helper_vfp_sqrtd(tcg_res, tcg_op, tcg_env); - goto done; + gen_fpst = gen_helper_vfp_sqrtd; + break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ @@ -8513,7 +8512,6 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) gen_fpst(tcg_res, tcg_op, fpst); } - done: write_fp_dreg(s, rd, tcg_res); } @@ -9459,7 +9457,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, gen_vfp_negd(tcg_rd, tcg_rn); break; case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_env); + gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_fpstatus); break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ @@ -10402,6 +10400,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) handle_2misc_fcmp_zero(s, opcode, false, u, is_q, size, rn, rd); return; case 0x7f: /* FSQRT */ + need_fpstatus = true; if (size == 3 && !is_q) { unallocated_encoding(s); return; @@ -10631,7 +10630,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_vfp_negs(tcg_res, tcg_op); break; case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_env); + gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_fpstatus); break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c index b6fa28a7bf..c160a86e70 100644 --- a/target/arm/tcg/translate-vfp.c +++ b/target/arm/tcg/translate-vfp.c @@ -2424,17 +2424,17 @@ DO_VFP_2OP(VNEG, dp, gen_vfp_negd, aa32_fpdp_v2) static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrth(vd, vm, tcg_env); + gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16)); } static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrts(vd, vm, tcg_env); + gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_FPCR)); } static void gen_VSQRT_dp(TCGv_i64 vd, TCGv_i64 vm) { - gen_helper_vfp_sqrtd(vd, vm, tcg_env); + gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_FPCR)); } DO_VFP_2OP(VSQRT, hp, gen_VSQRT_hp, aa32_fp16_arith) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 62638d2b1f..f24992c798 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -314,19 +314,19 @@ VFP_BINOP(minnum) VFP_BINOP(maxnum) #undef VFP_BINOP -dh_ctype_f16 VFP_HELPER(sqrt, h)(dh_ctype_f16 a, CPUARMState *env) +dh_ctype_f16 VFP_HELPER(sqrt, h)(dh_ctype_f16 a, void *fpstp) { - return float16_sqrt(a, &env->vfp.fp_status_f16); + return float16_sqrt(a, fpstp); } -float32 VFP_HELPER(sqrt, s)(float32 a, CPUARMState *env) +float32 VFP_HELPER(sqrt, s)(float32 a, void *fpstp) { - return float32_sqrt(a, &env->vfp.fp_status); + return float32_sqrt(a, fpstp); } -float64 VFP_HELPER(sqrt, d)(float64 a, CPUARMState *env) +float64 VFP_HELPER(sqrt, d)(float64 a, void *fpstp) { - return float64_sqrt(a, &env->vfp.fp_status); + return float64_sqrt(a, fpstp); } static void softfloat_to_vfp_compare(CPUARMState *env, FloatRelation cmp)