From patchwork Thu Feb 8 17:31:57 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: 127714 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1740190ljc; Thu, 8 Feb 2018 10:15:54 -0800 (PST) X-Google-Smtp-Source: AH8x224vyRGrGdKZ7nxVztvAHAH6bFTVPmY5UcIGKu5XDlJsZo2Kg64sZBRk3EuekZlW5QGepT0l X-Received: by 10.13.200.67 with SMTP id k64mr95555ywd.122.1518113754238; Thu, 08 Feb 2018 10:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518113754; cv=none; d=google.com; s=arc-20160816; b=QqS/SS8vR+pu8USVhDBRXtA2KvP7GTT6dlCDb3UoZlCuIEXVIxXQX0A6DlyNv19ADg d2XHqWiUnvnnJLyj6GeJlPDGXgceBaShrwihrGX97t5AWHbbcxC8tEWC8UibDxzj9xIb R5cWOfhLV4oH7FOHRuMEPdrwBfgtbN+PBTdNLCj6WB4PZPX92G/xIUO69FjYCUizjfZ5 Y3wo0hULawkkpukAkOV23dkUddewayZGhdoWIhGS68msOFWnaxzaOA7FFqIzQwA1/xjx MoeIUMVLqt6fM9Zzxirq0zEoqnHa2VQPYfOo/8UR3apegH5tX0stw026pyJeFLGNYetx pKRg== 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=V/AZ3dI2Ie/rHDrDKopgswQEg9PpflRbUC6AacZ6Sxk=; b=dyLDkdDQefzW/1we1KtLTrzKpzPzFYsGNOCIL1EQexJ0JJkgXJpxPGGSRAShYPxg9y c6E5ZwWyvpERlqCDJ+MWIAurFeVm5jJ0751lYPZfd0DUU/p/TevPjwPrccm2MmhC8dmu n+Sf2KLluodWjve1oj1zBnXe9lPfB2KljtgkttE5tpKPM/ePSx9i7y/09gtmSWAWUUmJ TxZpEJ/pjhEJ/F7EY7tUYW61QkUgv+cjWeXiuyh4Y/hD2NevJAMTZkpptrzcRPI3wwhG adRG2Qrf/1Rlm3/+ryj/LQUSmFJSGFMGrlkqbcG3ck45D9hXlw4uFEJk3uQ5RUmbI5uD PyjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=f/sIBSxo; 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 j136si88772ywb.274.2018.02.08.10.15.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Feb 2018 10:15:54 -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=f/sIBSxo; 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]:59010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejqjh-0007Le-B5 for patch@linaro.org; Thu, 08 Feb 2018 13:15:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejqBS-0002w0-UN for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:40:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejqBP-0000Pz-Kw for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:40:30 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:53305) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejqBP-0000PT-Dh for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:40:27 -0500 Received: by mail-wm0-x241.google.com with SMTP id t74so10991860wme.3 for ; Thu, 08 Feb 2018 09:40:27 -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=V/AZ3dI2Ie/rHDrDKopgswQEg9PpflRbUC6AacZ6Sxk=; b=f/sIBSxoFffwo3h0MOJdIw9uiLjSm7AnWWEIhOCrsn8/IFadBMGfUxfs/491xuA71/ n8DZqKFDABgxobv05TprL5+kQNiO21d6BB26U/5/3l7JKXMPps+JphXUsaa//VBNI/K2 u78lo5ifj+jTaDIPmPS2KDV5aXRoZUFF08bYQ= 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=V/AZ3dI2Ie/rHDrDKopgswQEg9PpflRbUC6AacZ6Sxk=; b=cl5fdmR06AYVoFgtZwZPHlBuZdcfettCyL1WKPdVKg8+lgpu8rpWyI8DA8Rpt0YHIh /8DhnaB+gXvgu+Uvepxzi8XHRmYIQ41sBRxw31+o7+1w2r9itbxD/3H9b+GrIloyLkhZ xJ7Yu09KMPJCyJBiYnaUzqJ4+v22GjdNQ1jH4BGfmhcGMAGE8OwREUAMQVdAIeB3If5/ 5PyKtaIqTrF1pCmXZxdDR6eyilCb/khBdqxToR0cRdgJHyvGJYRybpf9e8A9oVVX+9cN IOmPU31YeHqM7w6q9Q0uEor42JB4Pv0qi3O4vrGD+ABgMbUNEnmitkUrdjbTp3cHJqO5 X7Cg== X-Gm-Message-State: APf1xPAopDSI8CcDtJxw06o5dNOhVIv878excIS0Cj3C1VOhclV1G8jg u1wT0FI8rWvGlaie3r/b34IUQw== X-Received: by 10.28.157.139 with SMTP id g133mr60651wme.114.1518111626281; Thu, 08 Feb 2018 09:40:26 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b72sm485073wmf.2.2018.02.08.09.40.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 09:40:25 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 202A23E1066; Thu, 8 Feb 2018 17:32:00 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Thu, 8 Feb 2018 17:31:57 +0000 Message-Id: <20180208173157.24705-33-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180208173157.24705-1-alex.bennee@linaro.org> References: <20180208173157.24705-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:c09::241 Subject: [Qemu-devel] [PATCH v2 32/32] 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: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org 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 --- target/arm/translate-a64.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) -- 2.15.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 92adf43a89..265bfb14d0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4508,6 +4508,66 @@ 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; + TCGv_i32 tcg_res; + + tcg_op = read_fp_sreg(s, rn); + tcg_res = tcg_temp_new_i32(); + + switch (opcode) { + case 0x0: /* FMOV */ + tcg_gen_mov_i32(tcg_res, tcg_op); + break; + case 0x1: /* FABS */ + gen_helper_advsimd_absh(tcg_res, tcg_op); + 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) { @@ -4734,6 +4794,18 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) handle_fp_1src_double(s, opcode, rd, rn); break; + case 2: + 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); }