From nobody Fri Oct 24 09:43:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519401210024274.91806129925794; Fri, 23 Feb 2018 07:53:30 -0800 (PST) Received: from localhost ([::1]:45348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFf5-0001Ae-3k for importer@patchew.org; Fri, 23 Feb 2018 10:53:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFUi-0008T3-Q7 for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epFUh-0005lG-NT for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:44 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:42892) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epFUh-0005iY-DM for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:43 -0500 Received: by mail-wr0-x244.google.com with SMTP id k9so14528453wre.9 for ; Fri, 23 Feb 2018 07:42:43 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m187sm2924819wmg.0.2018.02.23.07.42.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 07:42:38 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id D78343E166D; Fri, 23 Feb 2018 15:36:38 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=guMVkfHdyZuWXEuI+lcvRJfyH5EnSauulh8378LLebU=; b=fWeeMQTiHG/JqZhnHI5GQlrFEqN+0fqxHIDINYn64i+ECPkMgUPdgQR0fDJBYLX79N feTZN+Ri7oNkIWiYJ/w+7U3UVLdufvCx/kqTysKvzwjR+FEr3C8kFNH6wYMe66OfTnfC OYcx7suIpdyt01nE8g9vdbKHnrHPhKQjJ2Fxg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=guMVkfHdyZuWXEuI+lcvRJfyH5EnSauulh8378LLebU=; b=HgYLgQGUAFiDDZnrEJIaygr179TQB9zkpI6Yddrj2YJ8YuwJhKuaMLm2fGyNd1UNHt iZyhI6flhMAIfPHlQOnNYdN7Tct2KjCVs7tNxU2W2Y6R040B9gmBIzDib07Rg8yYC3Zb FdPlMX1dINKWZ+kaqiAoGdFof6+Mf4YVA1AJivgH47yc0jJ/tdwD9GnqGZJLAwEaNLLz oFakgKYPRT9q1ghr989eXINlDkYUZR5kjRrd7zXDor/VrV2tMDMyVRwDS62QfHqc9YK1 X48XLnjWMP5OAtmnycZM5c521ymC0W7HZCK/dlAUiAPY09Ibn2YhKjnKJUJq66/0fTtZ AsqQ== X-Gm-Message-State: APf1xPBUZVoS/ew3XqPKV6WTx48meBh5N9YGm8JfZCEdGvaR686Rcw8B U1I4pSIhlKfYLx9qo8FA5w3c2g== X-Google-Smtp-Source: AH8x225bfotpa6TYMzFDCj8oCwn0/6KrN64D2sCdsgr1w3TpFlauFM5cEORXy8iXMrxPZgtlvej8rg== X-Received: by 10.223.178.232 with SMTP id g95mr2206153wrd.35.1519400562349; Fri, 23 Feb 2018 07:42:42 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Fri, 23 Feb 2018 15:36:36 +0000 Message-Id: <20180223153636.29809-32-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180223153636.29809-1-alex.bennee@linaro.org> References: <20180223153636.29809-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v3 31/31] arm/translate-a64: add all single op FP16 to handle_fp_1src_half X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , richard.henderson@linaro.org, qemu-devel@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This includes FMOV, FABS, FNEG, FSQRT and FRINT[NPMZAXI]. We re-use existing helpers to achieve this. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- v3 - make fabs a bitwise operation - use read_vec_element_i32 to read value - properly wire into disas_fp_1rc --- target/arm/translate-a64.c | 71 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 71 insertions(+) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 6704d66be7..be2bf50ddb 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4596,6 +4596,65 @@ static void disas_fp_csel(DisasContext *s, uint32_t = insn) tcg_temp_free_i64(t_true); } =20 +/* Floating-point data-processing (1 source) - half precision */ +static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int r= n) +{ + TCGv_ptr fpst =3D NULL; + TCGv_i32 tcg_op =3D tcg_temp_new_i32(); + TCGv_i32 tcg_res =3D tcg_temp_new_i32(); + + read_vec_element_i32(s, tcg_op, rn, 0, MO_16); + + switch (opcode) { + case 0x0: /* FMOV */ + tcg_gen_mov_i32(tcg_res, tcg_op); + break; + case 0x1: /* FABS */ + tcg_gen_andi_i32(tcg_res, tcg_op, 0x7fff); + break; + case 0x2: /* FNEG */ + tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); + break; + case 0x3: /* FSQRT */ + gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env); + break; + case 0x8: /* FRINTN */ + case 0x9: /* FRINTP */ + case 0xa: /* FRINTM */ + case 0xb: /* FRINTZ */ + case 0xc: /* FRINTA */ + { + TCGv_i32 tcg_rmode =3D tcg_const_i32(arm_rmode_to_sf(opcode & 7)); + fpst =3D get_fpstatus_ptr(true); + + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); + + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + tcg_temp_free_i32(tcg_rmode); + break; + } + case 0xe: /* FRINTX */ + fpst =3D get_fpstatus_ptr(true); + gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, fpst); + break; + case 0xf: /* FRINTI */ + fpst =3D get_fpstatus_ptr(true); + gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); + break; + default: + abort(); + } + + write_fp_sreg(s, rd, tcg_res); + + if (fpst) { + tcg_temp_free_ptr(fpst); + } + tcg_temp_free_i32(tcg_op); + tcg_temp_free_i32(tcg_res); +} + /* Floating-point data-processing (1 source) - single precision */ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int= rn) { @@ -4825,6 +4884,18 @@ static void disas_fp_1src(DisasContext *s, uint32_t = insn) =20 handle_fp_1src_double(s, opcode, rd, rn); break; + case 3: + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + + if (!fp_access_check(s)) { + return; + } + + handle_fp_1src_half(s, opcode, rd, rn); + break; default: unallocated_encoding(s); } --=20 2.15.1