From patchwork Tue Dec 10 16:16:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848837 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418301wrn; Tue, 10 Dec 2024 08:23:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX86Uui2LSTEJ7FrPufHUckUv4TpJaqykgJsrX38uY1jfuSMb+YfbDf2J112I4nlfeC14ovKA==@linaro.org X-Google-Smtp-Source: AGHT+IG73esmfHwmtfNsSTW+m6YKNdlsnmUo6OAvyjZbaT5XtDI8nCjIWsN6YC8nUKlXzJVSJHej X-Received: by 2002:a05:620a:8904:b0:79f:67b:4fdc with SMTP id af79cd13be357-7b6dcdc845fmr712649885a.2.1733847816625; Tue, 10 Dec 2024 08:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847816; cv=none; d=google.com; s=arc-20240605; b=Ppqj+b3+sxdYncLB9SZaYtLycpmKV6o/918gKkQEFdZjKtddoSoTP/7oz+92wcltRp +bd7DWdhheEbq40Hbz6CL6UH5xIEuS1N/CYsiQhT9rw+Ng7uBBcT9VR3ZW+eizWMVYwg 2lvxkI9zngZ0pZ1U/Ouxso/XwNZfLaYfJLJfDsHnz7dBm8tqMboqo7Vf79JPIFR73xc/ TxOJJTIyDd+lbRoQRI329dM/TKrttES03yJsPtYdgu7ILv8xq+KPUiewe5ZspHdseva4 aaxj3PNRo7jFRPF+WXKps9nd151ype0BoxSO84uZPjt2CwsZ6nzXb3ZfFa535jl6kpqM Z+sA== 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=B/1wEp3EF4DAmAZGVdeg0LuJl9fOPxzK8h1rKj+XBubp0UqHvhNT9Lw+2ekVyb0vwZ vOLDvvUQ0QkSbWN9ekJIKfQeF06fuBcZ2M0K2vKV/6cXIHoxg0NHmWHJ7gnuTtuDQ6B5 hetqeEvMTeOwdwpmcdqUCgVG5DIM+iBv0h/LioaADO29bXszhaB9KsQU68+QMcc1C8HQ CSFL2gQjTrtsqiKVwzm3e6D/GvuKNDHj9H0D3/VClhPU9AnP7bEZSylfDDKgAUE3wL3/ TyzGp/wberx6iH52aBYTPHX9zERhIjoOL6/2f6v5efnukHamP8PO67A16g4nWDE1UrpV 2y1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mZpsuu2J; 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 af79cd13be357-7b6e5ca6afesi124909085a.323.2024.12.10.08.23.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23:36 -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=mZpsuu2J; 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 1tL2xa-0004Ve-7p; Tue, 10 Dec 2024 11:19:42 -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 1tL2xJ-0003Ft-Ia for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:25 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xH-0006VE-Kp for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:25 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53ffaaeeb76so3063501e87.0 for ; Tue, 10 Dec 2024 08:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847562; x=1734452362; 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; b=mZpsuu2J1gQLgEskcJVYIE1EtR/TvcLPHhlQ10LJlaqFONViw4R1mf72LGuAlIH1ab i90zgBj9o2U7zRMqphpZoIiirVm2OHv8T7n0INJBN5WVQP9S/AAHi+9NhkzeBRhD9YR/ dvIP9VwdlGl/fN3caZCj9owK6PouUBmP8Tq5p/1E5ggAETarKIU5p59dYz+ky7jP3Oaf 5lbW2551SV4QfGEl4fH+8fldVpvHKkbdNCRcYFiLIMjlchZQQ+/HT1DTlD/KlQw9sK5g bn5i0c8YEYCYak1GLOq8rA450WbwRymh1VUJujOEQYMgX3TAk7ikGvA8ZPp9US39cA15 jZ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847562; x=1734452362; 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; b=LG6SxmBnS1Jw/UfciCwKkqD7KuN2+DH/BHUPaanPJt1czkHGJl9Azrt3Io+pnP2TuP 8+Hw7GSR0LwokZEu+YEBYECXTvTc5qRhAo2YZmFzQ5tScC73c39EUmEKiJjiSDKwN0ze ROXtgy27yY2PTkOdLcCcDts0nVKbAD9Kc8ZpJKU1UucPYILE0B1iX6c93DB85RPQEjbd ljkA1Y2kOCC5JM+NAoiUG1hin/9npUvzTnpMlZsviuckiiSDXYyJLqZVB37EJVWBR4xN Nh3gtmvzWs3rAjmXkbGHmU6lKFLumifgTvbmFkkYxBkWtQ8F4vnMRFQRsNp8J1qonH3/ C5pA== X-Gm-Message-State: AOJu0YxydgsJ4EMZXKWwslYgDPFd+HfyDEYzF5rR+kaFd/xUIVHiCtVk gc7tdhwQz6EbJoLGvFaQVsrYun9tNitrVvhG+wv/LEmogSZO2DQnO96GGOWRNpLSeHzZEC7yEBM aasjiCFfj X-Gm-Gg: ASbGncsPGNV4lELBTFQennP1lzscrdfpVWeuv65Xk17DnmIPO3X0TQBPyaUA/0qNn9C XLaz19Jk+tU8RghDAuuR1L5w94UF/7gwMxZQLm7uvTjP//oYUljIRJ3BbRw3TYaBvBWjRq4WgD4 A5GqhHimpqvYonQNIraToG0M7IlMAMVBsoS0DNXfOkFDwmzPDKirPG6e7tXgwxBCEUU7n0Ihw5e 98EENw8WpPTi+VS5WDqvOocrON1TIbpohX9HwMwYHuUGTwA7kbZt7gCIj0= X-Received: by 2002:a05:6512:3d21:b0:540:1d2b:c47f with SMTP id 2adb3069b0e04-5401d2bc4e4mr3481034e87.49.1733847561954; Tue, 10 Dec 2024 08:19:21 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 25/69] target/arm: Pass fpstatus to vfp_sqrt* Date: Tue, 10 Dec 2024 10:16:49 -0600 Message-ID: <20241210161733.1830573-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12d.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 383ee7f3f0..e278c0d87b 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)