From patchwork Thu Aug 6 10:44:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 247480 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1353920ilo; Thu, 6 Aug 2020 03:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOu7+BRdoOqMVo9YpL9y8N45Gntdj90V/59nXMyIUCJ3pwb/Co+ykyNkyutfNL3YeRA4Sv X-Received: by 2002:a25:d0c2:: with SMTP id h185mr11597419ybg.73.1596710871339; Thu, 06 Aug 2020 03:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596710871; cv=none; d=google.com; s=arc-20160816; b=qb5szpLtPegl+wV9JQAaMb8g8yms0zrdym//jWD/zBTT/nTjT26wdv8Y9lYs5DAldX 9d5PcuoW8FZCQOES+LQkvLhW2CD95d845DeidZ1s+Me10g6tvuZ7Y5qBJbAWQBoalYlC lX9lCa4v5uoaBtqy2KAbo1UwmEPdN41Ea+NL7ctxJOq//qFNZV9ARzcR80CwvM5owadv dgj9GF+Yg0YpG0SRjbkS376Ak6upIaaO0VIkOay25DljEo+XFttE03FrMt3Md+htParD jUk/ooxr7WVQvo5BUuosYEa3ygSGY5Pd/hrH40OCZr2S90rN/r/+xAVYHcnd98B6hKiK D/dQ== 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:to:from :dkim-signature; bh=EBNgN0Ja5rLk0wiwhZEL7X9U+oNVZQP7Ug0lGIXEnsw=; b=Tcnj+iDHqaredKrg2B3Hn287QWzabCuiLPnkl4sfrmaPxhF2zCUwAYb3iFDozL5Roa RsWOD3ixDkqYX7Y0H9+7FZZp+BC3SCSmV72o5vwdRI7Kh9Mxy/+M1f2QAc1lCFUEddJi 0GNusIRW03dv31lGjsLl/ixgyooBXKDEtpNahnxJ8wj608u9AVGR5p7jQAet8rylM3c4 NPGk6kNNbRyH/qAxAZUY6EeE0ixmJv0KtqPtC2dGBq8vid5UBPP3hX830O8XHID0YjMq vCeQpMnuT467cDRghOSQvrZA/3dUY9XarR4hL/UgQcbNj+NrQ11wl8XqN6AeG7OozUii idqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qAgic/E0"; 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 a10si5311093ybi.117.2020.08.06.03.47.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 03:47:51 -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="qAgic/E0"; 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]:53862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dR8-0008LF-Mz for patch@linaro.org; Thu, 06 Aug 2020 06:47:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dOV-0005RC-K3 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:07 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:36294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3dON-0007IC-6R for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:07 -0400 Received: by mail-wm1-x344.google.com with SMTP id 3so9208907wmi.1 for ; Thu, 06 Aug 2020 03:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EBNgN0Ja5rLk0wiwhZEL7X9U+oNVZQP7Ug0lGIXEnsw=; b=qAgic/E0PzHMgdaHqUsev9rZXzmrTXo+0CO0tOYkhIqaucdtEJyTzeD7Q40Q6B2J03 akfrZp4+sbgQ4RsHFfvuqM6tafQiXaPDCJVqSbx+u7nP+hwPfHejVlcTX3wFVajYRKEZ /nEWgc+c8g4/hHfopfV7ezOd0759rNSI35Rs7j4/6sE2sZGlCnDnNCh552GMPeBqvQ1P LPvxINerOQmotf8RicScKy0czPmN44uBlDiGB15TwM+0I7VAw/PUPasqc5MuItSB5iSb CAWEhzwe0DaqIuHSxqfzgS78I11mv0v8/oEUNvW10k9nuLThFnxGXJ3t/XSR6tdUTNbE engA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EBNgN0Ja5rLk0wiwhZEL7X9U+oNVZQP7Ug0lGIXEnsw=; b=MszmI7jq4Yr07idjfEqEUsQwyRLD01aDvAt9OVh6mUK1RbL0tfxFRojHG2zfy9PaT7 hdH692Je7LOGj2i2mvHZxKRx7+ra6QYFogmAfDxefXgYUx1k2fLdU7vfxCErDXhuhk/U eARZqwFfOgrBuETfwCkmTVfkITrLJLD7caTyk+gZziqBiHRGTSzlghwZtUFkwFDA94XT tCtDeuI+5+6cx7U6du3OBSpfdNhpWt/QOYD33DAAjCMsBCKuM3BEPkbqEZi6ecuU1PBq Qh878tTmyvYiPtYEWpfjFVy7/l6KqISsjtez+T5SE7QdnBPvaWko+pIKqf4pksGGLHDc X9/Q== X-Gm-Message-State: AOAM530sn/p0idMxw+kCramPit72LebOJac8Y3+yVdTibl3Cpr09I3eX AHo42LwNw+Vr6nW33791DifEgeF/ffKngQ== X-Received: by 2002:a1c:f204:: with SMTP id s4mr7811325wmc.9.1596710697109; Thu, 06 Aug 2020 03:44:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a10sm6042189wrx.15.2020.08.06.03.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 03:44:56 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/4] target/arm: Replace A64 get_fpstatus_ptr() with generic fpstatus_ptr() Date: Thu, 6 Aug 2020 11:44:50 +0100 Message-Id: <20200806104453.30393-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806104453.30393-1-peter.maydell@linaro.org> References: <20200806104453.30393-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 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" We currently have two versions of get_fpstatus_ptr(), which both take an effectively boolean argument: * the one for A64 takes "bool is_f16" to distinguish fp16 from other ops * the one for A32/T32 takes "int neon" to distinguish Neon from other ops This is confusing, and to implement ARMv8.2-FP16 the A32/T32 one will need to make a four-way distinction between "non-Neon, FP16", "non-Neon, single/double", "Neon, FP16" and "Neon, single/double". The A64 version will then be a strict subset of the A32/T32 version. To clean this all up, we want to go to a single implementation which takes an enum argument with values FPST_FPCR, FPST_STD, FPST_FPCR_F16, and FPST_STD_F16. We rename the function to fpstatus_ptr() so that unconverted code gets a compilation error rather than silently passing the wrong thing to the new function. This commit implements that new API, and converts A64 to use it: get_fpstatus_ptr(false) -> fpstatus_ptr(FPST_FPCR) get_fpstatus_ptr(true) -> fpstatus_ptr(FPST_FPCR_F16) Signed-off-by: Peter Maydell --- This patch has a handful of 83-character lines; I felt they were better than the ugly linewrap that would be needed. All the callsite changes were done with editor search-and-replace. --- target/arm/translate-a64.h | 1 - target/arm/translate.h | 51 ++++++++++++++++++++++ target/arm/translate-a64.c | 89 +++++++++++++++----------------------- target/arm/translate-sve.c | 34 +++++++-------- 4 files changed, 103 insertions(+), 72 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 647f0c74f62..2e0d16da259 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -37,7 +37,6 @@ TCGv_i64 cpu_reg_sp(DisasContext *s, int reg); TCGv_i64 read_cpu_reg(DisasContext *s, int reg, int sf); TCGv_i64 read_cpu_reg_sp(DisasContext *s, int reg, int sf); void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v); -TCGv_ptr get_fpstatus_ptr(bool); bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn, unsigned int imms, unsigned int immr); bool sve_access_check(DisasContext *s); diff --git a/target/arm/translate.h b/target/arm/translate.h index 16f2699ad72..e3680e65479 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -393,4 +393,55 @@ typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); +/* + * Enum for argument to fpstatus_ptr(). + */ +typedef enum ARMFPStatusFlavour { + FPST_FPCR, + FPST_FPCR_F16, + FPST_STD, + FPST_STD_F16, +} ARMFPStatusFlavour; + +/** + * fpstatus_ptr: return TCGv_ptr to the specified fp_status field + * + * We have multiple softfloat float_status fields in the Arm CPU state struct + * (see the comment in cpu.h for details). Return a TCGv_ptr which has + * been set up to point to the requested field in the CPU state struct. + * The options are: + * + * FPST_FPCR + * for non-FP16 operations controlled by the FPCR + * FPST_FPCR_F16 + * for operations controlled by the FPCR where FPCR.FZ16 is to be used + * FPST_STD + * for A32/T32 Neon operations using the "standard FPSCR value" + * FPST_STD_F16 + * as FPST_STD, but where FPCR.FZ16 is to be used + */ +static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) +{ + TCGv_ptr statusptr = tcg_temp_new_ptr(); + int offset; + + switch (flavour) { + case FPST_FPCR: + offset = offsetof(CPUARMState, vfp.fp_status); + break; + case FPST_FPCR_F16: + offset = offsetof(CPUARMState, vfp.fp_status_f16); + break; + case FPST_STD: + offset = offsetof(CPUARMState, vfp.standard_fp_status); + break; + case FPST_STD_F16: + /* Not yet used or implemented: fall through to assert */ + default: + g_assert_not_reached(); + } + tcg_gen_addi_ptr(statusptr, cpu_env, offset); + return statusptr; +} + #endif /* TARGET_ARM_TRANSLATE_H */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 8c0764957c8..676fbd90e08 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -609,25 +609,6 @@ static void write_fp_sreg(DisasContext *s, int reg, TCGv_i32 v) tcg_temp_free_i64(tmp); } -TCGv_ptr get_fpstatus_ptr(bool is_f16) -{ - TCGv_ptr statusptr = tcg_temp_new_ptr(); - int offset; - - /* In A64 all instructions (both FP and Neon) use the FPCR; there - * is no equivalent of the A32 Neon "standard FPSCR value". - * However half-precision operations operate under a different - * FZ16 flag and use vfp.fp_status_f16 instead of vfp.fp_status. - */ - if (is_f16) { - offset = offsetof(CPUARMState, vfp.fp_status_f16); - } else { - offset = offsetof(CPUARMState, vfp.fp_status); - } - tcg_gen_addi_ptr(statusptr, cpu_env, offset); - return statusptr; -} - /* Expand a 2-operand AdvSIMD vector operation using an expander function. */ static void gen_gvec_fn2(DisasContext *s, bool is_q, int rd, int rn, GVecGen2Fn *gvec_fn, int vece) @@ -689,7 +670,7 @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn, int rm, bool is_fp16, int data, gen_helper_gvec_3_ptr *fn) { - TCGv_ptr fpst = get_fpstatus_ptr(is_fp16); + TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), fpst, @@ -5896,7 +5877,7 @@ static void handle_fp_compare(DisasContext *s, int size, bool cmp_with_zero, bool signal_all_nans) { TCGv_i64 tcg_flags = tcg_temp_new_i64(); - TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16); + TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); if (size == MO_64) { TCGv_i64 tcg_vn, tcg_vm; @@ -6155,7 +6136,7 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); break; case 0x3: /* FSQRT */ - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); gen_helper_sqrt_f16(tcg_res, tcg_op, fpst); break; case 0x8: /* FRINTN */ @@ -6165,7 +6146,7 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) case 0xc: /* FRINTA */ { TCGv_i32 tcg_rmode = tcg_const_i32(arm_rmode_to_sf(opcode & 7)); - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); @@ -6175,11 +6156,11 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) break; } case 0xe: /* FRINTX */ - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, fpst); break; case 0xf: /* FRINTI */ - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); break; default: @@ -6251,7 +6232,7 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) g_assert_not_reached(); } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); if (rmode >= 0) { TCGv_i32 tcg_rmode = tcg_const_i32(rmode); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -6328,7 +6309,7 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) g_assert_not_reached(); } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); if (rmode >= 0) { TCGv_i32 tcg_rmode = tcg_const_i32(rmode); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -6363,7 +6344,7 @@ static void handle_fp_fcvt(DisasContext *s, int opcode, /* Single to half */ TCGv_i32 tcg_rd = tcg_temp_new_i32(); TCGv_i32 ahp = get_ahp_flag(); - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); gen_helper_vfp_fcvt_f32_to_f16(tcg_rd, tcg_rn, fpst, ahp); /* write_fp_sreg is OK here because top half of tcg_rd is zero */ @@ -6383,7 +6364,7 @@ static void handle_fp_fcvt(DisasContext *s, int opcode, /* Double to single */ gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, cpu_env); } else { - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); TCGv_i32 ahp = get_ahp_flag(); /* Double to half */ gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp); @@ -6399,7 +6380,7 @@ static void handle_fp_fcvt(DisasContext *s, int opcode, case 0x3: { TCGv_i32 tcg_rn = read_fp_sreg(s, rn); - TCGv_ptr tcg_fpst = get_fpstatus_ptr(false); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); TCGv_i32 tcg_ahp = get_ahp_flag(); tcg_gen_ext16u_i32(tcg_rn, tcg_rn); if (dtype == 0) { @@ -6516,7 +6497,7 @@ static void handle_fp_2src_single(DisasContext *s, int opcode, TCGv_ptr fpst; tcg_res = tcg_temp_new_i32(); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); tcg_op1 = read_fp_sreg(s, rn); tcg_op2 = read_fp_sreg(s, rm); @@ -6569,7 +6550,7 @@ static void handle_fp_2src_double(DisasContext *s, int opcode, TCGv_ptr fpst; tcg_res = tcg_temp_new_i64(); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); tcg_op1 = read_fp_dreg(s, rn); tcg_op2 = read_fp_dreg(s, rm); @@ -6622,7 +6603,7 @@ static void handle_fp_2src_half(DisasContext *s, int opcode, TCGv_ptr fpst; tcg_res = tcg_temp_new_i32(); - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); tcg_op1 = read_fp_hreg(s, rn); tcg_op2 = read_fp_hreg(s, rm); @@ -6721,7 +6702,7 @@ static void handle_fp_3src_single(DisasContext *s, bool o0, bool o1, { TCGv_i32 tcg_op1, tcg_op2, tcg_op3; TCGv_i32 tcg_res = tcg_temp_new_i32(); - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); tcg_op1 = read_fp_sreg(s, rn); tcg_op2 = read_fp_sreg(s, rm); @@ -6759,7 +6740,7 @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1, { TCGv_i64 tcg_op1, tcg_op2, tcg_op3; TCGv_i64 tcg_res = tcg_temp_new_i64(); - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); tcg_op1 = read_fp_dreg(s, rn); tcg_op2 = read_fp_dreg(s, rm); @@ -6797,7 +6778,7 @@ static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1, { TCGv_i32 tcg_op1, tcg_op2, tcg_op3; TCGv_i32 tcg_res = tcg_temp_new_i32(); - TCGv_ptr fpst = get_fpstatus_ptr(true); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_F16); tcg_op1 = read_fp_hreg(s, rn); tcg_op2 = read_fp_hreg(s, rm); @@ -6943,7 +6924,7 @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, TCGv_i32 tcg_shift, tcg_single; TCGv_i64 tcg_double; - tcg_fpstatus = get_fpstatus_ptr(type == 3); + tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR); tcg_shift = tcg_const_i32(64 - scale); @@ -7231,7 +7212,7 @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) static void handle_fjcvtzs(DisasContext *s, int rd, int rn) { TCGv_i64 t = read_fp_dreg(s, rn); - TCGv_ptr fpstatus = get_fpstatus_ptr(false); + TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR); gen_helper_fjcvtzs(t, t, fpstatus); @@ -7845,7 +7826,7 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) * Note that correct NaN propagation requires that we do these * operations in exactly the order specified by the pseudocode. */ - TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16); + TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); int fpopcode = opcode | is_min << 4 | is_u << 5; int vmap = (1 << elements) - 1; TCGv_i32 tcg_res32 = do_reduction_op(s, fpopcode, rn, esize, @@ -8357,7 +8338,7 @@ static void disas_simd_scalar_pairwise(DisasContext *s, uint32_t insn) return; } - fpst = get_fpstatus_ptr(size == MO_16); + fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); break; default: unallocated_encoding(s); @@ -8870,7 +8851,7 @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, int fracbits, int size) { - TCGv_ptr tcg_fpst = get_fpstatus_ptr(size == MO_16); + TCGv_ptr tcg_fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); TCGv_i32 tcg_shift = NULL; MemOp mop = size | (is_signed ? MO_SIGN : 0); @@ -9051,7 +9032,7 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, assert(!(is_scalar && is_q)); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(FPROUNDING_ZERO)); - tcg_fpstatus = get_fpstatus_ptr(size == MO_16); + tcg_fpstatus = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); fracbits = (16 << size) - immhb; tcg_shift = tcg_const_i32(fracbits); @@ -9390,7 +9371,7 @@ static void handle_3same_float(DisasContext *s, int size, int elements, int fpopcode, int rd, int rn, int rm) { int pass; - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); for (pass = 0; pass < elements; pass++) { if (size) { @@ -9783,7 +9764,7 @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s, return; } - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); tcg_op1 = read_fp_hreg(s, rn); tcg_op2 = read_fp_hreg(s, rm); @@ -10036,7 +10017,7 @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, return; } - fpst = get_fpstatus_ptr(size == MO_16); + fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); @@ -10166,7 +10147,7 @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode, int size, int rn, int rd) { bool is_double = (size == 3); - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); @@ -10307,7 +10288,7 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, } else { TCGv_i32 tcg_lo = tcg_temp_new_i32(); TCGv_i32 tcg_hi = tcg_temp_new_i32(); - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); TCGv_i32 ahp = get_ahp_flag(); tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, tcg_op); @@ -10569,7 +10550,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) if (is_fcvt) { tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); - tcg_fpstatus = get_fpstatus_ptr(false); + tcg_fpstatus = fpstatus_ptr(FPST_FPCR); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); } else { tcg_rmode = NULL; @@ -11394,7 +11375,7 @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode, /* Floating point operations need fpst */ if (opcode >= 0x58) { - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); } else { fpst = NULL; } @@ -11992,7 +11973,7 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) break; } - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_FPCR_F16); if (pairwise) { int maxpass = is_q ? 8 : 4; @@ -12285,7 +12266,7 @@ static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, /* 16 -> 32 bit fp conversion */ int srcelt = is_q ? 4 : 0; TCGv_i32 tcg_res[4]; - TCGv_ptr fpst = get_fpstatus_ptr(false); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); TCGv_i32 ahp = get_ahp_flag(); for (pass = 0; pass < 4; pass++) { @@ -12757,7 +12738,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } if (need_fpstatus || need_rmode) { - tcg_fpstatus = get_fpstatus_ptr(false); + tcg_fpstatus = fpstatus_ptr(FPST_FPCR); } else { tcg_fpstatus = NULL; } @@ -13147,7 +13128,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) } if (need_rmode || need_fpst) { - tcg_fpstatus = get_fpstatus_ptr(true); + tcg_fpstatus = fpstatus_ptr(FPST_FPCR_F16); } if (need_rmode) { @@ -13456,7 +13437,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) } if (is_fp) { - fpst = get_fpstatus_ptr(is_fp16); + fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); } else { fpst = NULL; } diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 88a2fb271d1..ef0671bbdaa 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3470,7 +3470,7 @@ static bool trans_FMLA_zzxz(DisasContext *s, arg_FMLA_zzxz *a) if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3496,7 +3496,7 @@ static bool trans_FMUL_zzx(DisasContext *s, arg_FMUL_zzx *a) if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3528,7 +3528,7 @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, tcg_gen_addi_ptr(t_zn, cpu_env, vec_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->pg)); - status = get_fpstatus_ptr(a->esz == MO_16); + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); fn(temp, t_zn, t_pg, status, t_desc); tcg_temp_free_ptr(t_zn); @@ -3570,7 +3570,7 @@ DO_VPZ(FMAXV, fmaxv) static void do_zz_fp(DisasContext *s, arg_rr_esz *a, gen_helper_gvec_2_ptr *fn) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), @@ -3618,7 +3618,7 @@ static void do_ppz_fp(DisasContext *s, arg_rpr_esz *a, gen_helper_gvec_3_ptr *fn) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), @@ -3670,7 +3670,7 @@ static bool trans_FTMAD(DisasContext *s, arg_FTMAD *a) } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3710,7 +3710,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) t_pg = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_rm, cpu_env, vec_full_reg_offset(s, a->rm)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->pg)); - t_fpst = get_fpstatus_ptr(a->esz == MO_16); + t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); t_desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc); @@ -3737,7 +3737,7 @@ static bool do_zzz_fp(DisasContext *s, arg_rrr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3779,7 +3779,7 @@ static bool do_zpzz_fp(DisasContext *s, arg_rprr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3831,7 +3831,7 @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, tcg_gen_addi_ptr(t_zn, cpu_env, vec_full_reg_offset(s, zn)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); - status = get_fpstatus_ptr(is_fp16); + status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); fn(t_zd, t_zn, t_pg, scalar, status, desc); @@ -3895,7 +3895,7 @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_4_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3939,7 +3939,7 @@ static bool trans_FCADD(DisasContext *s, arg_FCADD *a) } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3958,7 +3958,7 @@ static bool do_fmla(DisasContext *s, arg_rprrr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_5_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -4001,7 +4001,7 @@ static bool trans_FCMLA_zpzzz(DisasContext *s, arg_FCMLA_zpzzz *a) } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_5_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -4024,7 +4024,7 @@ static bool trans_FCMLA_zzxz(DisasContext *s, arg_FCMLA_zzxz *a) tcg_debug_assert(a->rd == a->ra); if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -4045,7 +4045,7 @@ static bool do_zpz_ptr(DisasContext *s, int rd, int rn, int pg, { if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = get_fpstatus_ptr(is_fp16); + TCGv_ptr status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), pred_full_reg_offset(s, pg), @@ -4191,7 +4191,7 @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, int mode) if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); TCGv_i32 tmode = tcg_const_i32(mode); - TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); gen_helper_set_rmode(tmode, tmode, status); From patchwork Thu Aug 6 10:44:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 247479 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1353643ilo; Thu, 6 Aug 2020 03:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygD29wHtw/Pjf6eR8wYvI0tFAZfQf0E7eacq6FXlt2Nm6yYS8dZxMVvF/PFYt8bQUTJaNC X-Received: by 2002:a25:e74f:: with SMTP id e76mr12089209ybh.337.1596710847405; Thu, 06 Aug 2020 03:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596710847; cv=none; d=google.com; s=arc-20160816; b=RDozMYghCibBpqGFVAxhC2UlHp1ghF5kuhnKCmIf9t2EoKUWaucSRgdqYSL62mn+/2 l9aLvC4H/6KWwiiQ+2cuzz31nkSM6EEgBCQFeeZFjvRZN+wmofqGTrFif5YryPM/GYTI cRMAEsUTnKtY/JrZ3uAiR4K/La70q7BbdTpHFO0okXM+/oVEYKER5gtOXSu+Czp5vCXY 1vhkG00mNO/rDqGbWuJm2DAL0gLmbyOBgpMsWm6s/kkpE4Zra5dnmOG1oEWDh5NQBEaQ uA36tRNyzdAuywfEG7/z3XN8YceUs5tplGMgZDk/WJhgBkVLl8MrQwhEOK0618tfcdXg vq2w== 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:to:from :dkim-signature; bh=UFF5f+eJ9S3MOWSlwF3nLC25z1jwDMEdd5QQVZv2OZA=; b=VfEhKXGYHl5fr4nVih1MBaY+ZnJszTDxvXAZ68lQqWKWiMypcPPlvp8Px9zUi1p2ym qRyV8WvpV5BUSjHj+UYATgdGMYGaNdbui3a+QSaYrB+xrBv6oJlm4Uc8UmKsyAm2Kb5C E+GKIcszdBjjv6vZ1DZqyj4VAeoujsk+vl59lhgif871b9y/N/DQKIuNX+URNjR9zPQC nj4z6ViN5BwPnp1GqRB1qt/QdpxEJg/MfXZo26eMZr6iFqhX0ZQgJgLS0kqgX32KB6CN 05G0zq5Yz48T3WTCI9PWVgCjaK3i/h1v8IM8mijOrnLH74Fy8VqU+7Vfk0Xt8V7f1ujQ RtRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WyAihLEv; 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 l6si4541225ybl.274.2020.08.06.03.47.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 03:47:27 -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=WyAihLEv; 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]:54658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dQk-0000DM-R0 for patch@linaro.org; Thu, 06 Aug 2020 06:47:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dOX-0005UO-LV for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:09 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3dOQ-0007IQ-O8 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:09 -0400 Received: by mail-wm1-x333.google.com with SMTP id 3so9208974wmi.1 for ; Thu, 06 Aug 2020 03:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UFF5f+eJ9S3MOWSlwF3nLC25z1jwDMEdd5QQVZv2OZA=; b=WyAihLEv0ZTl0tyI2mlk9FZFJ7wWDH3S4Qw3KcoEOYAxo07nlRIOxuXOgZvDmnaVXL gorDr7M1ofsi9VPFTUswEuTgr+TGvgKzNPCff9NdGwqM/UbRe5bxrIfxVIjqwZf4P7pp ZLE1YfMnFg2euqLg2K7rnp4k/wBa5Ytaz8UR681yRUV2oKRJn7zwJZ009pqI4iWXXcDG UjfBnbeCV32B85YoGPtFxneBZwmxoYFOSjZIqWs9Tw+sFkHpAMY6YFKBdIhzGs0kLIht 9xcgANQaG7BZ7eB/roPvgei50c4M0857twdxgVhExLxRVCP4c1XwKUeGaOb/GQbCvsmX ZPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UFF5f+eJ9S3MOWSlwF3nLC25z1jwDMEdd5QQVZv2OZA=; b=ZuEw9ilPmeWjV8tj8QJVlxcf9OFlSKa0Es5PIRuqAeRv/ysgyJX0UAwLZuJVbS9Fqy GgLOrBtq62iRcNE9PKdDh0f349Uhc0T9YoaStWMvMeAxaXuOIVeqs/ggpg2VCLcUsmbF m6cAKk60dD1RtNnTre+qEfZnBmYgQeG5h4M1EyJNIWziSjYaaLpAohG6BDOL7o+leAUT jO1SmA7IvRyO491/lFBzwdwKBl7/xb3LG4fngwH8XOagj7/kxU+VKiUUBHL03LULlwX+ NFQ2IVTpCM4p/G/NwNsO98nUC5KMYtNTo2KUEmhb4waVEgX4aPIzkE/gjIyDxEX13aGG GrOQ== X-Gm-Message-State: AOAM530LmAarWWURpDA8i85ZnM8icJUfnXM2q6nUNwb5tDUnwkxawn5x MTPm77gb7DX+UKV6rY8iTjiBZw== X-Received: by 2002:a1c:1d2:: with SMTP id 201mr6917750wmb.132.1596710698919; Thu, 06 Aug 2020 03:44:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a10sm6042189wrx.15.2020.08.06.03.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 03:44:57 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/4] target/arm: Make A32/T32 use new fpstatus_ptr() API Date: Thu, 6 Aug 2020 11:44:51 +0100 Message-Id: <20200806104453.30393-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806104453.30393-1-peter.maydell@linaro.org> References: <20200806104453.30393-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Make A32/T32 code use the new fpstatus_ptr() API: get_fpstatus_ptr(0) -> fpstatus_ptr(FPST_FPCR) get_fpstatus_ptr(1) -> fpstatus_ptr(FPST_STD) Signed-off-by: Peter Maydell --- target/arm/translate-neon.inc.c | 28 ++++++++++----------- target/arm/translate-vfp.inc.c | 44 ++++++++++++++++----------------- target/arm/translate.c | 13 ---------- 3 files changed, 36 insertions(+), 49 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c index f6cb9215739..5158dd14ad2 100644 --- a/target/arm/translate-neon.inc.c +++ b/target/arm/translate-neon.inc.c @@ -181,7 +181,7 @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) } opr_sz = (1 + a->q) * 8; - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), @@ -218,7 +218,7 @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) } opr_sz = (1 + a->q) * 8; - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), @@ -322,7 +322,7 @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx : gen_helper_gvec_fcmlah_idx); opr_sz = (1 + a->q) * 8; - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), vfp_reg_offset(1, a->vm), @@ -358,7 +358,7 @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; opr_sz = (1 + a->q) * 8; - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), vfp_reg_offset(1, a->rm), @@ -1063,7 +1063,7 @@ static bool do_3same_fp(DisasContext *s, arg_3same *a, VFPGen3OpSPFn *fn, return true; } - TCGv_ptr fpstatus = get_fpstatus_ptr(1); + TCGv_ptr fpstatus = fpstatus_ptr(FPST_STD); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { tmp = neon_load_reg(a->vn, pass); tmp2 = neon_load_reg(a->vm, pass); @@ -1091,7 +1091,7 @@ static bool do_3same_fp(DisasContext *s, arg_3same *a, VFPGen3OpSPFn *fn, uint32_t rn_ofs, uint32_t rm_ofs, \ uint32_t oprsz, uint32_t maxsz) \ { \ - TCGv_ptr fpst = get_fpstatus_ptr(1); \ + TCGv_ptr fpst = fpstatus_ptr(FPST_STD); \ tcg_gen_gvec_3_ptr(rd_ofs, rn_ofs, rm_ofs, fpst, \ oprsz, maxsz, 0, FUNC); \ tcg_temp_free_ptr(fpst); \ @@ -1287,7 +1287,7 @@ static bool do_3same_fp_pair(DisasContext *s, arg_3same *a, VFPGen3OpSPFn *fn) * early. Since Q is 0 there are always just two passes, so instead * of a complicated loop over each pass we just unroll. */ - fpstatus = get_fpstatus_ptr(1); + fpstatus = fpstatus_ptr(FPST_STD); tmp = neon_load_reg(a->vn, 0); tmp2 = neon_load_reg(a->vn, 1); fn(tmp, tmp, tmp2, fpstatus); @@ -1790,7 +1790,7 @@ static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a, return true; } - fpstatus = get_fpstatus_ptr(1); + fpstatus = fpstatus_ptr(FPST_STD); shiftv = tcg_const_i32(a->shift); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { tmp = neon_load_reg(a->vm, pass); @@ -2591,7 +2591,7 @@ static bool trans_VMLS_2sc(DisasContext *s, arg_2scalar *a) #define WRAP_FP_FN(WRAPNAME, FUNC) \ static void WRAPNAME(TCGv_i32 rd, TCGv_i32 rn, TCGv_i32 rm) \ { \ - TCGv_ptr fpstatus = get_fpstatus_ptr(1); \ + TCGv_ptr fpstatus = fpstatus_ptr(FPST_STD); \ FUNC(rd, rn, rm, fpstatus); \ tcg_temp_free_ptr(fpstatus); \ } @@ -3480,7 +3480,7 @@ static bool trans_VCVT_F16_F32(DisasContext *s, arg_2misc *a) return true; } - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_STD); ahp = get_ahp_flag(); tmp = neon_load_reg(a->vm, 0); gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); @@ -3528,7 +3528,7 @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) return true; } - fpst = get_fpstatus_ptr(true); + fpst = fpstatus_ptr(FPST_STD); ahp = get_ahp_flag(); tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(a->vm, 0); @@ -3838,7 +3838,7 @@ static bool do_2misc_fp(DisasContext *s, arg_2misc *a, return true; } - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { TCGv_i32 tmp = neon_load_reg(a->vm, pass); fn(tmp, tmp, fpst); @@ -3932,7 +3932,7 @@ static bool do_vrint(DisasContext *s, arg_2misc *a, int rmode) return true; } - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { @@ -3993,7 +3993,7 @@ static bool do_vcvt(DisasContext *s, arg_2misc *a, int rmode, bool is_signed) return true; } - fpst = get_fpstatus_ptr(1); + fpst = fpstatus_ptr(FPST_STD); tcg_shift = tcg_const_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 463253de90b..4e0458e4206 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -359,7 +359,7 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) return true; } - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -422,7 +422,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) return true; } - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); tcg_shift = tcg_const_i32(0); @@ -1231,7 +1231,7 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, f0 = tcg_temp_new_i32(); f1 = tcg_temp_new_i32(); fd = tcg_temp_new_i32(); - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); neon_load_reg32(f0, vn); neon_load_reg32(f1, vm); @@ -1314,7 +1314,7 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, f0 = tcg_temp_new_i64(); f1 = tcg_temp_new_i64(); fd = tcg_temp_new_i64(); - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); neon_load_reg64(f0, vn); neon_load_reg64(f1, vm); @@ -1796,7 +1796,7 @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) /* VFNMA, VFNMS */ gen_helper_vfp_negs(vd, vd); } - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_vfp_muladds(vd, vn, vm, vd, fpst); neon_store_reg32(vd, a->vd); @@ -1887,7 +1887,7 @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) /* VFNMA, VFNMS */ gen_helper_vfp_negd(vd, vd); } - fpst = get_fpstatus_ptr(0); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst); neon_store_reg64(vd, a->vd); @@ -2171,7 +2171,7 @@ static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); /* The T bit tells us if we want the low or high 16 bits of Vm */ @@ -2208,7 +2208,7 @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); /* The T bit tells us if we want the low or high 16 bits of Vm */ @@ -2237,7 +2237,7 @@ static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); @@ -2274,7 +2274,7 @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); vm = tcg_temp_new_i64(); @@ -2304,7 +2304,7 @@ static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a) tmp = tcg_temp_new_i32(); neon_load_reg32(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_rints(tmp, tmp, fpst); neon_store_reg32(tmp, a->vd); tcg_temp_free_ptr(fpst); @@ -2336,7 +2336,7 @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) tmp = tcg_temp_new_i64(); neon_load_reg64(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_rintd(tmp, tmp, fpst); neon_store_reg64(tmp, a->vd); tcg_temp_free_ptr(fpst); @@ -2360,7 +2360,7 @@ static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a) tmp = tcg_temp_new_i32(); neon_load_reg32(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); tcg_rmode = tcg_const_i32(float_round_to_zero); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); gen_helper_rints(tmp, tmp, fpst); @@ -2397,7 +2397,7 @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) tmp = tcg_temp_new_i64(); neon_load_reg64(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); tcg_rmode = tcg_const_i32(float_round_to_zero); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); gen_helper_rintd(tmp, tmp, fpst); @@ -2424,7 +2424,7 @@ static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a) tmp = tcg_temp_new_i32(); neon_load_reg32(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_rints_exact(tmp, tmp, fpst); neon_store_reg32(tmp, a->vd); tcg_temp_free_ptr(fpst); @@ -2456,7 +2456,7 @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) tmp = tcg_temp_new_i64(); neon_load_reg64(tmp, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); gen_helper_rintd_exact(tmp, tmp, fpst); neon_store_reg64(tmp, a->vd); tcg_temp_free_ptr(fpst); @@ -2535,7 +2535,7 @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) vm = tcg_temp_new_i32(); neon_load_reg32(vm, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); if (a->s) { /* i32 -> f32 */ gen_helper_vfp_sitos(vm, vm, fpst); @@ -2571,7 +2571,7 @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) vm = tcg_temp_new_i32(); vd = tcg_temp_new_i64(); neon_load_reg32(vm, a->vm); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); if (a->s) { /* i32 -> f64 */ gen_helper_vfp_sitod(vd, vm, fpst); @@ -2637,7 +2637,7 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vd = tcg_temp_new_i32(); neon_load_reg32(vd, a->vd); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); shift = tcg_const_i32(frac_bits); /* Switch on op:U:sx bits */ @@ -2702,7 +2702,7 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vd = tcg_temp_new_i64(); neon_load_reg64(vd, a->vd); - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); shift = tcg_const_i32(frac_bits); /* Switch on op:U:sx bits */ @@ -2755,7 +2755,7 @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); vm = tcg_temp_new_i32(); neon_load_reg32(vm, a->vm); @@ -2797,7 +2797,7 @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) return true; } - fpst = get_fpstatus_ptr(false); + fpst = fpstatus_ptr(FPST_FPCR); vm = tcg_temp_new_i64(); vd = tcg_temp_new_i32(); neon_load_reg64(vm, a->vm); diff --git a/target/arm/translate.c b/target/arm/translate.c index e1f5357c367..3bce39c953a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1094,19 +1094,6 @@ static inline void gen_hlt(DisasContext *s, int imm) unallocated_encoding(s); } -static TCGv_ptr get_fpstatus_ptr(int neon) -{ - TCGv_ptr statusptr = tcg_temp_new_ptr(); - int offset; - if (neon) { - offset = offsetof(CPUARMState, vfp.standard_fp_status); - } else { - offset = offsetof(CPUARMState, vfp.fp_status); - } - tcg_gen_addi_ptr(statusptr, cpu_env, offset); - return statusptr; -} - static inline long vfp_reg_offset(bool dp, unsigned reg) { if (dp) { From patchwork Thu Aug 6 10:44:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 247478 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1352803ilo; Thu, 6 Aug 2020 03:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyte85/wDKSl1iWCVvo0dHMwxVxrDJ16TjhIdfaXvPhoLOe9X7SMTftbmjdl6jjtpMNlKf8 X-Received: by 2002:a25:48c7:: with SMTP id v190mr11088434yba.432.1596710765666; Thu, 06 Aug 2020 03:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596710765; cv=none; d=google.com; s=arc-20160816; b=qctpcOZGE5gAC7q+Ve765GJZUwEFXce8UTuTUdFSNor1VFWqAkLkR/qnRt0hPI6p5K wCBrZtrrsMHxNG9pPwNDPcxK2ZB8asS5ngR6sAWcLpEAyVTgyBpw1LK/J//rksVx6avv vWTugbNRi0GeMrqvBHIo99FiPCmfqh+ppu/K82vonNCGC3YakJuk2HSuBR6yDaH8wHgQ jTOWGCsk1GTW3uHHCMuBnZ3saGDsVI4NZhLQZubFEzGPxL09uxSZKSJyG9ph6qzCdqkg p0Ka97H7nBacvyKQKKsC/uL1R7qu909DTDSA5oJ0Wfaiz2gzuBxn+FR3Y/pcgpoPIExj N9BA== 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:to:from :dkim-signature; bh=RHA41MBQAdtJ8xHpnLFhE8L/40GSEPE/TJljdWuXLT4=; b=mA7FEG1jXQGpphNkcFKCcmkWBUxciAe3mMYAy3BghNnQGk675hV3PDTJCQlpSbCX7X KhMemwxfkZK8RxvrxEHmxcRsi6l++pzBE1SKTHwFYajkuMQbj88ZeYPljNusUYy0eRxP frGKzM3vpUD7/CSrXJzseH8euRVc0dMI+68T9Vbr8vMDneexVNFy/YPVsLrdLiW8uYHh p74sWNoMglNQU6rhiw97Okd7FWPMy0uHirKQI9FUyv2DxxomkPnpfNyf0H3+u7CcToCj d6YzQHQU8zVpQnCo9tDtwkC87IIkvscCQ1XzC5pXMZrh0vFrogRZWcqQNPgVUgVorPUx JtTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VI6liApF; 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 x2si5662633ybt.235.2020.08.06.03.46.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 03:46:05 -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=VI6liApF; 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]:47242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dPR-0005Wg-2X for patch@linaro.org; Thu, 06 Aug 2020 06:46:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dOX-0005Ts-Ar for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:09 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:56008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3dOQ-0007Id-Lm for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:08 -0400 Received: by mail-wm1-x341.google.com with SMTP id 9so8387467wmj.5 for ; Thu, 06 Aug 2020 03:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RHA41MBQAdtJ8xHpnLFhE8L/40GSEPE/TJljdWuXLT4=; b=VI6liApFjvKSdhPzwoAd7qUP+OKHV72ZEeIo4aIvF6+Bs7RhyETeBCM3ei3N9pmzZF ku+ahaUKlSbe1p0u8DFkMJUNVgws+QYTyGZZ6zvAhoRjRu32pCj7WjyEbM/sfPuorOTe a1ZdIlLAS49eLo5uZdS7Zt7RabM6/w6ULew2hG/d3cdAPogSAdbo1ZUp9+BhvPnS+9q7 CITE58bR7nY3fdlZOqYLxd6l9fnTpy7HPIu4d1kdYaRQqs4/wJMcffasvp5CIWTjuKlU PrhVcQdE7R4KmSGpWq4utU5cccNwKxw5ziizOMVJ6CgNq5WmBXexCEbst3TkpePQ+yAC k0SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RHA41MBQAdtJ8xHpnLFhE8L/40GSEPE/TJljdWuXLT4=; b=JY3ZSHa+mdSnXmtehkM9uxTH9gl2L9fkis6Dn+hzNC4WG9oRqmmrvjw/QRLEZx1KTC EvWcoeCWx0uyym5Yk7UuZe6ypbyjlZjgtGLZnF+s7AES9m7I4HpnjQsLbxuAF5+xGtox GHBGZz85UTGxWicid6bfxihGm67j+q9E+JXqAy7zEBT+aPgIBapeHsow0QFqy1Yj91EU d/xn1YYD/02LBAJdwob79ZDsejuDtPrQwd7k6/uAzIb4mjb6TcAEFEZhxnG8yMRoNrFG vsXqBlJa2w42hweY5QfdoHRwF24ZZetx8bVu6Gzce7t5Q0ei3AXvjt2e1HNjUyZElG6Z wFLw== X-Gm-Message-State: AOAM531M2gA0IugBun0pybU8zeWrxNf66HSZivQIugXKYCQecrXbXRTT kfR0ZNGMeUZe/Pa6RzK6e8MiBB4H4ngdJg== X-Received: by 2002:a05:600c:2184:: with SMTP id e4mr7145859wme.24.1596710700256; Thu, 06 Aug 2020 03:45:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a10sm6042189wrx.15.2020.08.06.03.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 03:44:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 3/4] target/arm: Implement FPST_STD_F16 fpstatus Date: Thu, 6 Aug 2020 11:44:52 +0100 Message-Id: <20200806104453.30393-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806104453.30393-1-peter.maydell@linaro.org> References: <20200806104453.30393-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Architecturally, Neon FP16 operations use the "standard FPSCR" like all other Neon operations. However, this is defined in the Arm ARM pseudocode as "a fixed value, except that FZ16 (and AHP) follow the FPSCR bits". In QEMU, the softfloat float_status doesn't include separate flush-to-zero for FP16 operations, so we must keep separate fp_status for "Neon non-FP16" and "Neon fp16" operations, in the same way we do already for the non-Neon "fp_status" vs "fp_status_f16". Add the extra float_status field to the CPU state structure, ensure it is correctly initialized and updated on FPSCR writes, and make fpstatus_ptr(FPST_STD_F16) return a pointer to it. Signed-off-by: Peter Maydell --- target/arm/cpu.h | 9 ++++++++- target/arm/translate.h | 3 ++- target/arm/cpu.c | 3 +++ target/arm/vfp_helper.c | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9e8ed423ea1..e2b989e3f1a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -609,6 +609,8 @@ typedef struct CPUARMState { * fp_status: is the "normal" fp status. * fp_status_fp16: used for half-precision calculations * standard_fp_status : the ARM "Standard FPSCR Value" + * standard_fp_status_fp16 : used for half-precision + * calculations with the ARM "Standard FPSCR Value" * * Half-precision operations are governed by a separate * flush-to-zero control bit in FPSCR:FZ16. We pass a separate @@ -619,15 +621,20 @@ typedef struct CPUARMState { * Neon) which the architecture defines as controlled by the * standard FPSCR value rather than the FPSCR. * + * The "standard FPSCR but for fp16 ops" is needed because + * the "standard FPSCR" tracks the FPSCR.FZ16 bit rather than + * using a fixed value for it. + * * To avoid having to transfer exception bits around, we simply * say that the FPSCR cumulative exception flags are the logical - * OR of the flags in the three fp statuses. This relies on the + * OR of the flags in the four fp statuses. This relies on the * only thing which needs to read the exception flags being * an explicit FPSCR read. */ float_status fp_status; float_status fp_status_f16; float_status standard_fp_status; + float_status standard_fp_status_f16; /* ZCR_EL[1-3] */ uint64_t zcr_el[4]; diff --git a/target/arm/translate.h b/target/arm/translate.h index e3680e65479..6d6d4c0f425 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -436,7 +436,8 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) offset = offsetof(CPUARMState, vfp.standard_fp_status); break; case FPST_STD_F16: - /* Not yet used or implemented: fall through to assert */ + offset = offsetof(CPUARMState, vfp.standard_fp_status_f16); + break; default: g_assert_not_reached(); } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 111579554fb..6b382fcd60e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -391,12 +391,15 @@ static void arm_cpu_reset(DeviceState *dev) set_flush_to_zero(1, &env->vfp.standard_fp_status); set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status); + set_default_nan_mode(1, &env->vfp.standard_fp_status_f16); set_float_detect_tininess(float_tininess_before_rounding, &env->vfp.fp_status); set_float_detect_tininess(float_tininess_before_rounding, &env->vfp.standard_fp_status); set_float_detect_tininess(float_tininess_before_rounding, &env->vfp.fp_status_f16); + set_float_detect_tininess(float_tininess_before_rounding, + &env->vfp.standard_fp_status_f16); #ifndef CONFIG_USER_ONLY if (kvm_enabled()) { kvm_arm_reset_vcpu(cpu); diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 60dcd4bf145..64266ece620 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -93,6 +93,8 @@ static uint32_t vfp_get_fpscr_from_host(CPUARMState *env) /* FZ16 does not generate an input denormal exception. */ i |= (get_float_exception_flags(&env->vfp.fp_status_f16) & ~float_flag_input_denormal); + i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16) + & ~float_flag_input_denormal); return vfp_exceptbits_from_host(i); } @@ -124,7 +126,9 @@ static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val) if (changed & FPCR_FZ16) { bool ftz_enabled = val & FPCR_FZ16; set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16); + set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); } if (changed & FPCR_FZ) { bool ftz_enabled = val & FPCR_FZ; @@ -146,6 +150,7 @@ static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val) set_float_exception_flags(i, &env->vfp.fp_status); set_float_exception_flags(0, &env->vfp.fp_status_f16); set_float_exception_flags(0, &env->vfp.standard_fp_status); + set_float_exception_flags(0, &env->vfp.standard_fp_status_f16); } #else From patchwork Thu Aug 6 10:44:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 247481 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1355564ilo; Thu, 6 Aug 2020 03:50:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBKKMSdum1UGY3bQwusZV7SnBNqueceU+q0ViWmDVMEnZaG6/dF4gfEKUaL3tsm49ewen3 X-Received: by 2002:a25:d812:: with SMTP id p18mr2723338ybg.460.1596711025674; Thu, 06 Aug 2020 03:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596711025; cv=none; d=google.com; s=arc-20160816; b=nJ4HWnaXJegTBXcmFHK6NxwoIm+NXvIC/mwFBDKbYFKp3ZGfT3Zn/Rv7dlxSeYpLYF m3p4QcdpqFoUVgP4zrnoo2ZAWH7fn8oxN7pKUdZLgdFI+5dTZZ5VVOlkNwPWyxnfp+Uh xNWM8kFUV0t/9XAm/l95BdWDKlzEBoeP1xySgHta1DVD7E1dsSmBhlIqzoLmwgHoRqJz JQbhfh7xwXEOtyBA0/DHcUy+bRYkUjpu3EmiTfyhUqaMDGhAzaEmN+gsztNijhrqazFM ueWHe4wCjg9FqcgYO9wrQBtOIn+l1UsXExzOHadnKtCLQ5bzJZHsd655bkhYXafLxEs2 Y8AQ== 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:to:from :dkim-signature; bh=oVvqKqlUGUYnxjk1oIPFfZzk4tyrvTEr7tv+ZDt5Avo=; b=KSu8PW00oO/ruFOcqyfUAZ7dRj4hsl3eUIKZzzlZXiP/qDdDSUA7mRZy05/JoJM6hi lWUBhIuKM5xs2BJnxzSJPm3D+OkKkUNq07wXABbtGOp0iFasneruHmFfcU5PlyA/IyYy 5AdbG4Gee6XFGi3+PyOFOBwEh4C6KG0Hq1t0VCXk88eiSCRklxrgmyWaJLnv8NmzRNV3 f0ifmIG+BXr3pOlLcby+4IPHcf8LuKHuzwCVl4ku1xd9uIR/SC14l0WIfz3a+SRYGeYt DQYCyBABTQJENPo0pCw23aR4vM0vc/BuT5ISeI625yPkB1n8HKJs71cqFx1uscFYYP4R +p0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bcpn54wM; 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 7si4648279ybn.139.2020.08.06.03.50.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 03:50:25 -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=bcpn54wM; 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]:34386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dTd-0003lw-4D for patch@linaro.org; Thu, 06 Aug 2020 06:50:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dOX-0005UH-JQ for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:09 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:50678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3dOR-0007Ip-6k for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:45:09 -0400 Received: by mail-wm1-x344.google.com with SMTP id c80so8415564wme.0 for ; Thu, 06 Aug 2020 03:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oVvqKqlUGUYnxjk1oIPFfZzk4tyrvTEr7tv+ZDt5Avo=; b=bcpn54wMF6GymuKOsDDLoxwwiEsFleU/5z/m5wJq+ndG+040IDN1YSAwPjlcBZAlM1 UN1d0f12Img+8uKgcN+VvlgSG+e04JyPU2KoiZsxPGuJHppTFAIyFIOEMC4qHeXJqgXc XxHf8YyxMpQBrXzm+7WqWu9la0vFrCmIdl0G5hZJXwnz5iS/lKQ8ZgROtOV4EAwbc4VI mtSA/+fnD9YfkTUFzKwGcxu1jJ4eH9Ur+rDZBYX3B6yzutnEaINQmYgpE2FTf90iAYM+ sdbMC4yA9bD3m5Lu5t4eAhGrhxDBVgKyTjjAiWI3lC+/mwMsRVY/zXyAwDyiOAbAtHcZ SS7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oVvqKqlUGUYnxjk1oIPFfZzk4tyrvTEr7tv+ZDt5Avo=; b=QmHn57RyhujZoZ+HSAxQ3CDOzjh99FTeR4CPYCMwsiHBOq3vFPozUBPSSImV/pQ3Yp MfTvqfmEdZzoK6g+RiyvqbZMrxUWKPv+1k919KZy4M2ZhwKwRKKl9uedLrUJEwn0qxXV BZYv/b7c5HiXu88EWywR2kk1twbwYCLL2yES7M3CSZL+m5LkOFaFBjEdqbOjzIxOU8Am Y9QqN9wnBgpQoeoyk8XNu5VTqEH0eoOgOomBE+gIC+GaS9B8i2rYKvXGKuxiBxY59QwT lgoy12HUUUlcpWaweqnIZrmaoMJFhSJ8nT4dBobITsMryWYelDAevLOz9IqpNOjNsGPP Lzmg== X-Gm-Message-State: AOAM5308SpDEAIj6jGs2QIuRK8o6x+xev2gb7Q0AG++4uKzt2X44oM7V eP/0nbAiEXQkh3Td7jwkzPLY0aeeTA3sKg== X-Received: by 2002:a1c:c90d:: with SMTP id f13mr7586788wmb.25.1596710701609; Thu, 06 Aug 2020 03:45:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a10sm6042189wrx.15.2020.08.06.03.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 03:45:00 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 4/4] target/arm: Use correct FPST for VCMLA, VCADD on fp16 Date: Thu, 6 Aug 2020 11:44:53 +0100 Message-Id: <20200806104453.30393-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806104453.30393-1-peter.maydell@linaro.org> References: <20200806104453.30393-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 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" When we implemented the VCMLA and VCADD insns we put in the code to handle fp16, but left it using the standard fp status flags. Correct them to use FPST_STD_F16 for fp16 operations. Signed-off-by: Peter Maydell --- target/arm/translate-neon.inc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c index 5158dd14ad2..96e27e28009 100644 --- a/target/arm/translate-neon.inc.c +++ b/target/arm/translate-neon.inc.c @@ -181,7 +181,7 @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) } opr_sz = (1 + a->q) * 8; - fpst = fpstatus_ptr(FPST_STD); + fpst = fpstatus_ptr(a->size == 0 ? FPST_STD_F16 : FPST_STD); fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), @@ -218,7 +218,7 @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) } opr_sz = (1 + a->q) * 8; - fpst = fpstatus_ptr(FPST_STD); + fpst = fpstatus_ptr(a->size == 0 ? FPST_STD_F16 : FPST_STD); fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), @@ -322,7 +322,7 @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx : gen_helper_gvec_fcmlah_idx); opr_sz = (1 + a->q) * 8; - fpst = fpstatus_ptr(FPST_STD); + fpst = fpstatus_ptr(a->size == 0 ? FPST_STD_F16 : FPST_STD); tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), vfp_reg_offset(1, a->vn), vfp_reg_offset(1, a->vm),