From patchwork Mon Jul 23 20:17:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 142662 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6520920ljj; Mon, 23 Jul 2018 14:36:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeny4vroclIjuC1De5mTDThq7QjcpmZ/UeJe+bB4d71AehwIMJB3+7VpyzdwOjpfWwi2u3y X-Received: by 2002:a0c:ba0f:: with SMTP id w15-v6mr12806549qvf.9.1532381810937; Mon, 23 Jul 2018 14:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532381810; cv=none; d=google.com; s=arc-20160816; b=ompS8moZ2duQDhQhgLqY/NdcrvfOfzJ7xWLGDmAINnNv1fLbEk1Rc7PVLhWlRpLtf1 B2ZZ+vds7ctabGsZnLqfzGjLJx0R34vXXbP3OvVLBSVJUMyAIEucXIjLN8BMPY6ynSWN PCePECJZV8DEAWT7ZGBfoBkK887bemNGYdsHV//ZsayBT6V+VDMAWsvU/Z4YH+v42dUA I1CVx/Sg5Kp+CdqIkpaZkvFQ5HGGo1evURJQaFUS9yx9ZHxJDkcGRza2urjefD/7+zR5 P8XEdCnOeG6viNeSJ/XPb0VQp+8CYi3eOG8yZ8DArzyL4XNK9iJh1ABKvXVU2/NCjJ20 s92A== 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=GU6mHHNnptLNGjZsRkDztjlgUH/p7DOB0aYBTtKmDOg=; b=DrKIr+8JabIqouDBQvBDYe1LkUDejlmSuGwhJlH5O1F57wGwmwOXa5yoJDwKNMSb4v VhhAGR32bZNNcRm9u1XcXxnJe+qwHvrpbFflHjX9JrLjVcBz4VLc5pt2gu5Y/JrHQUPP IPkStT3CR5UUPfyDPVV2OlebDRXSPIPbnWMLia/AVE5ZXUujzTn6JPSxHbuH4fPEPlMA QRk3TESWVa/mjUTOXU2lPJS1mXHpQJJNr/G4fmBXWPNWfkhkTs49RDnO+dpvBxXJSW95 Y+QEEA2tCfBCt+ijLdZknSOP2PbRpJeFAQNdku94bSE33qZir85NIOBDIv3UNTGbWDJl FIsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=d3Xi68jk; 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=ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 135-v6si428375qkm.148.2018.07.23.14.36.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 Jul 2018 14:36:50 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=d3Xi68jk; 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=ibm.com Received: from localhost ([::1]:36830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiVe-0004Fg-8u for patch@linaro.org; Mon, 23 Jul 2018 17:36:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhKq-00043L-I0 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhKp-0005Sc-CL for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:36 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:43131) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhKp-0005SM-6J; Mon, 23 Jul 2018 16:21:35 -0400 Received: by mail-oi0-x22c.google.com with SMTP id b15-v6so3471524oib.10; Mon, 23 Jul 2018 13:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GU6mHHNnptLNGjZsRkDztjlgUH/p7DOB0aYBTtKmDOg=; b=d3Xi68jk72gPmKGcWrSdOBaE6uwg7hT6Iy4FXfh6ZScF57mByU7gHcVG7ObyTZQ/mk +yrAi6b3elXc7mejH/lfDbCCzUdxMJW/IGzsJPUfcsvWM43z+WksSKFnctWvZpeyPHGk GOQoaci9Geo5RQZUQ4dvKBZ89D1sjnyr0btW9PBIEPn1G6EC6YZUX5duTnOuyA6EYmDV f11t5ZQS4/IBA9f4clMOAklnDC1C3fptxG8PszFb4URmUfQ1k6F/Vh2Hx/d8XJ+6iLlm RQIcnwYQOIqb1WihBV8wEXEkTnmDhBnTI/EUxNLms1dNetI6o7aT0JHdI0DzGKppSf3Q yQ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GU6mHHNnptLNGjZsRkDztjlgUH/p7DOB0aYBTtKmDOg=; b=Ibr6wrig6MPvNRTSPvtqwLQDcNyM3SkEQkKhWQkMar16y0Ghxr/DTs+bUjiFOUfusB 6fznCaRKmnF5rYTtamsxB/r0HnlTQL2oVnGMvptdfrhPMhCFYwsoCseXJJdm8vE4f71z n8jfful2hrGf9uBetWQDnymhclLODjAlzmKleZKN1GDdl3s7lSn/QGeGV6RnZPModKRc VUbF+O/Uj2TADotYqPwhodpxiIjMqa9RIl1Fd5lAC7E2ZBDr+Yh08BwrwnPdJzU8M2Ix X51HUD6ZfkcdP+kzZNTdL7lGBzAorXCgHDph/s0rXvRKpJw+j9xcvN2Ld75wJ775EVkY q2hA== X-Gm-Message-State: AOUpUlFSVjV8k1SegC6d6jEZ/VNt46HfawZZQUO8RqOVDts9WzYwQhAl B6kFjHcZDVT9FSsdIwtgmiCciWJlvsRIRA== X-Received: by 2002:aca:4d0a:: with SMTP id a10-v6mr295998oib.175.1532377293857; Mon, 23 Jul 2018 13:21:33 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id i204-v6sm19824135oia.41.2018.07.23.13.21.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:32 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:30 -0500 Message-Id: <20180723201748.25573-82-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22c Subject: [Qemu-devel] [PATCH 81/99] target/arm: Implement FP data-processing (3 source) for fp16 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 , Richard Henderson , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We missed all of the scalar fp16 fma operations. Cc: qemu-stable@nongnu.org Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Tested-by: Alex Bennée Message-id: 20180512003217.9105-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell (cherry picked from commit 95f9864fde6078e2d2c036a07cc4fe44f199be96) Signed-off-by: Michael Roth --- target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) -- 2.17.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 5260849f03..9880a5d047 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5234,6 +5234,44 @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1, tcg_temp_free_i64(tcg_res); } +/* Floating-point data-processing (3 source) - half precision */ +static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1, + int rd, int rn, int rm, int ra) +{ + TCGv_i32 tcg_op1, tcg_op2, tcg_op3; + TCGv_i32 tcg_res = tcg_temp_new_i32(); + TCGv_ptr fpst = get_fpstatus_ptr(true); + + tcg_op1 = read_fp_hreg(s, rn); + tcg_op2 = read_fp_hreg(s, rm); + tcg_op3 = read_fp_hreg(s, ra); + + /* These are fused multiply-add, and must be done as one + * floating point operation with no rounding between the + * multiplication and addition steps. + * NB that doing the negations here as separate steps is + * correct : an input NaN should come out with its sign bit + * flipped if it is a negated-input. + */ + if (o1 == true) { + tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000); + } + + if (o0 != o1) { + tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000); + } + + gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst); + + write_fp_sreg(s, rd, tcg_res); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tcg_op1); + tcg_temp_free_i32(tcg_op2); + tcg_temp_free_i32(tcg_op3); + tcg_temp_free_i32(tcg_res); +} + /* Floating point data-processing (3 source) * 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0 * +---+---+---+-----------+------+----+------+----+------+------+------+ @@ -5263,6 +5301,16 @@ static void disas_fp_3src(DisasContext *s, uint32_t insn) } handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra); break; + case 3: + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + if (!fp_access_check(s)) { + return; + } + handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra); + break; default: unallocated_encoding(s); }