From patchwork Tue Feb 27 14:38:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 129821 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp380499edc; Tue, 27 Feb 2018 07:03:26 -0800 (PST) X-Google-Smtp-Source: AG47ELuSYfpGd68kO5T7qgwoZbVIyB2qwSOR3p7lg1rvZGxbHgpgjvqELich6A+6tqpzUIgAtf4k X-Received: by 10.13.255.66 with SMTP id p63mr4999917ywf.482.1519743806735; Tue, 27 Feb 2018 07:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519743806; cv=none; d=google.com; s=arc-20160816; b=H9NO0a13cm6rGOmtZBvd3nrpjUkw4DtDasf2CnQzX3yAiacFsKz4FliXzJ3BllqiGp j3IJCUQ9Phs0Dcq6NbzMeRIf8nkZ9IUImFN51yJkkTlgE7yQJA4l9+6PRG6oLwEBKQ2i tmXTgdG6jshpm9C4sHFUOgo12akG6X93kOL157SXPqhK6eGTSLsnq4WiGYefCfFl9wa+ tGYNE1QV+t2fb0Vhzj8mjBtuzMmAvrsblj1QIfR2SnJaZICjzZEH+xcSj4Bcpi8NQijU CJKAZDlzCG7Fw//2w/0tI4OnqiWwDbL0cMWn51k2VbRk+GBrg0aakaVj+3lLj90oodRz 1j3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=oxx9u+IEwToSdmXpm0bYBlGbAQ1z4CJjskjDfSb+4XU=; b=Hs1ltL5vcgPqjpa3EnT+NoCALraSKXNac4e4H+74kZND2Z8bQxPEVGYHrGoCVzEJ6s 2CBr4uspYLvBiBED3NscaoqIuw5CwN+7U3oMh547rKP1Fng4lMFxXcE0o8yGFiXSIR6E alNDCJ/GJ/pQml35VbbXLS7L6dn1r0vTNzL/6ZWunQzhfp5B8A1S2FklCYzcRl5xCSPy 4okgjozFAN6+xkjZYU/Potb/2mpREJQJOzVXtAneOxYRDr9CuzZO0jALqA3PFu1qIEwe sdIFAKUkInUnvqQKI0j8uolXSOfk7gTpUWz1G1X+VYOLp0FOBpniHhoLge3M8iD+K25E 19JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jRiewoda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w11si1933141ywc.476.2018.02.27.07.03.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Feb 2018 07:03:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jRiewoda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgms-0008HR-5M for patch@linaro.org; Tue, 27 Feb 2018 10:03:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgYA-0003bg-91 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgY7-0001fL-I0 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:14 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgY7-0001b5-55 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:11 -0500 Received: by mail-wr0-x244.google.com with SMTP id u49so25115733wrc.10 for ; Tue, 27 Feb 2018 06:48:10 -0800 (PST) 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=oxx9u+IEwToSdmXpm0bYBlGbAQ1z4CJjskjDfSb+4XU=; b=jRiewodapsjzPdInX21yxwO/SQNeadfBzUdDEsFXuS4Q1GMOHH59R5/bBibs0fDghH kG0YqzlOj2D3B/pxA3AMdXjT47b0VtzYMAkpIHDGYZGUKJeglMDu/+SJ4cJ7frSWEJBW 6o6oJ04yjTNfVbc+p62tl25RXNJVMKRXbrm64= 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=oxx9u+IEwToSdmXpm0bYBlGbAQ1z4CJjskjDfSb+4XU=; b=PlX1JD2y0NrxsTvHd0D80mQoxFd0HmhjpMaIsfVWY3bSKTCWKDFdf4Svfps4v8qL8F yPOWnzpHoiuQCKPKzLzV00QEK32kS2tJkn2ns+Cwoss20Cr7L6skfdU8Qlt9ZRrYgTqS R08QHAE90ONsDbdJwS8uyUabnyIlMTjTYX2nQejaFWYoJ89Jj9mAqpCdM8afEnLo3fsQ dpuy+ItWwgwkyxJ0C4Tt0dNlYH/hIv+UfaSbTR3Zcgh0Z4vP02e/2kouHD4gZ6xx4D86 sPLS5I5SLz+joYEhTV9sqjVIcK7U7M9oa6bvxyRxyK3Eii/zeQfnGhGHCfeSycn78TMA udfQ== X-Gm-Message-State: APf1xPBERT6FAqwwP4nzAkmJd4Q3e1qpctL599Rldm3Ipr8QeHTGn/Jf PYb1auZcPuWn3Un+iG/E1BmTxQ== X-Received: by 10.223.170.211 with SMTP id i19mr13469682wrc.261.1519742889980; Tue, 27 Feb 2018 06:48:09 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 69sm9102555wmp.36.2018.02.27.06.48.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 06:48:05 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3FC1E3E166D; Tue, 27 Feb 2018 14:38:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Tue, 27 Feb 2018 14:38:52 +0000 Message-Id: <20180227143852.11175-32-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180227143852.11175-1-alex.bennee@linaro.org> References: <20180227143852.11175-1-alex.bennee@linaro.org> MIME-Version: 1.0 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 v4 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_Benn=C3=A9e?= , richard.henderson@linaro.org, qemu-devel@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This includes FMOV, FABS, FNEG, FSQRT and FRINT[NPMZAXI]. We re-use existing helpers to achieve this. Signed-off-by: Alex Bennée 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(+) -- 2.15.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 52cecae047..32811dc8b0 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); } +/* Floating-point data-processing (1 source) - half precision */ +static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) +{ + TCGv_ptr fpst = NULL; + TCGv_i32 tcg_op = tcg_temp_new_i32(); + TCGv_i32 tcg_res = 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 = tcg_const_i32(arm_rmode_to_sf(opcode & 7)); + fpst = 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 = get_fpstatus_ptr(true); + gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, fpst); + break; + case 0xf: /* FRINTI */ + fpst = 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) 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); }