From patchwork Sat Feb 17 20:31:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128753 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1902583ljc; Sat, 17 Feb 2018 12:40:57 -0800 (PST) X-Google-Smtp-Source: AH8x226gN8q6WRsD1U5N72uFzUp+yMNIHVWGWXOSFYDCN6c9teD0a3S6vJUOmxYXaO9/5SC4+VOe X-Received: by 10.37.9.78 with SMTP id u14mr7300137ybm.144.1518900057782; Sat, 17 Feb 2018 12:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518900057; cv=none; d=google.com; s=arc-20160816; b=D00Xx21IzqBe0rhncEHExoDGRpH6sgXfkAhtxxtte2lzTTP/uxqdmmW++ViTmHSMMd RH8eE6QxoC8Cu2wUjAE7Rf2ovYosuUDVd3F2H4nclsNh0Xy1n/8gnioUWW5HrnEpcHJg JvRKB1KuJAoSaPcKeon2Ma+J+XaRt7/ctw7c8rchH/i2rd/g3R3eQ9JAVsFgHIrxYOE8 IxXKffcrebqHkR6vzXPHkiMAbhKTScj8rHCKiZr0/t+KBPzm1/oviub/MitJ+h0jOfB+ t7AjDG+o39tho9JBKCEMWZiQPDVeigeSbOVc/ZLrkwg4AtFuEoN/I4fK6Kj9CzUX9kys Vzqg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=heZAH0jHpdxypJps56s6bKeGwatpjwJ00S4q9ncSLjE=; b=qmkZMB0o+4OrT6bKd2j/KiY8rydXXx+JiXwk2780Sug7isGlSyPQhgm4LslUkIyilS ZMsOyu9ZxVRkN8beB6hFG81ZiwJuZCnfGnwX+GbrGHDx1+Ytm0RMQIxapjpxRPM2alhO DhrAfGVrLAqzVvbV2gkFFSXpuRlh+wj6qjOZW2/9Tqil5D10eYHry1Sw9tCpl6k8gQ/v 2m47V2Omgu3WOj1wJKeWiq9jW91vhisJto/8unUWfQe+3INLP371okIWgeYReJsLdq8K OUj4suV+6IPg7zIg2+XgZP4360fYUpPE2IXjgl8B5CvER+8UcP3av8miQcqCbBcTO0jJ CJXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PnjpFiUr; 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 m130si862201ywm.121.2018.02.17.12.40.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 12:40:57 -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=PnjpFiUr; 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]:60450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en9I1-000809-33 for patch@linaro.org; Sat, 17 Feb 2018 15:40:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en99G-0000At-5N for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en99E-0000nN-TP for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:54 -0500 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:42859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en99E-0000nC-Nm for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:52 -0500 Received: by mail-pl0-x241.google.com with SMTP id 31so3527952ple.9 for ; Sat, 17 Feb 2018 12:31:52 -0800 (PST) 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; bh=heZAH0jHpdxypJps56s6bKeGwatpjwJ00S4q9ncSLjE=; b=PnjpFiUrDLvwiumd6XVR+m50IrkEqP5gaA4W2h6Uh5r1h5p0YMaRLWnpRg4nRjNY2/ j9DrZjw9SINEgYIlKkh5oNWW/Za+666oYtEYoU0lQVj88iw4eqasklU4PyQY5wpdwWM2 LvbInIW0kh61wNyiKGrYyA6McCzjZ1QMKp+sw= 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; bh=heZAH0jHpdxypJps56s6bKeGwatpjwJ00S4q9ncSLjE=; b=kPbqb1E4yAFiPDrgxOjZt8Fx0hGWx4vKXcPzmP051jk+avjPO6wmK3KpXpNJDf9Mnt FspeXdnzVCWN+PG1YpNFyjJBQFG9cUjljzthhRTruqHdckSGQ6SJ84lzewtW5H/o5XkL DZVYaKw49PVscrNR1YwaSXk8M+yr0DSmjaNKAvcTa2rGNwG6QYMSkEMRgvXNSiB1x+Bg /r4IVdrSHdZnQoxLvfYJ2A1vlIFgEDZwLrAeMCNP/vAu55qNovnIJHou9Z1fBcnZ+64f SV+sCNVJ5y/D1fMOuf8WDiH0pQdmxhitQbinC7fcV2KUwzzJLme9tEw5vcpfNpoLr1cr +7GA== X-Gm-Message-State: APf1xPBOf8HglByVQ0b08T/7wE6uAl9ISfQE0Ds4w+tMS8zAJ3EEiwxQ ofOKBH3iutTFNF8X1z7pCdg0NyHUfv4= X-Received: by 2002:a17:902:7290:: with SMTP id d16-v6mr9864882pll.303.1518899511316; Sat, 17 Feb 2018 12:31:51 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id y7sm48203797pfe.26.2018.02.17.12.31.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 12:31:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 12:31:22 -0800 Message-Id: <20180217203132.31780-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180217203132.31780-1-richard.henderson@linaro.org> References: <20180217203132.31780-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH 09/19] target/hppa: Convert fp multiply-add 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/hppa/translate.c | 69 ++++++++++++++++++++++++++++-------------------- target/hppa/insns.decode | 12 +++++++++ 2 files changed, 52 insertions(+), 29 deletions(-) -- 2.14.3 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 792e838849..1cfdbf6296 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4234,37 +4234,54 @@ static inline int fmpyadd_s_reg(unsigned r) return (r & 16) * 2 + 16 + (r & 15); } -static void trans_fmpyadd(DisasContext *ctx, uint32_t insn, bool is_sub) +static void do_fmpyadd_s(DisasContext *ctx, arg_mpyadd *a, bool is_sub) { - unsigned tm = extract32(insn, 0, 5); - unsigned f = extract32(insn, 5, 1); - unsigned ra = extract32(insn, 6, 5); - unsigned ta = extract32(insn, 11, 5); - unsigned rm2 = extract32(insn, 16, 5); - unsigned rm1 = extract32(insn, 21, 5); + int tm = fmpyadd_s_reg(a->tm); + int ra = fmpyadd_s_reg(a->ra); + int ta = fmpyadd_s_reg(a->ta); + int rm2 = fmpyadd_s_reg(a->rm2); + int rm1 = fmpyadd_s_reg(a->rm1); nullify_over(ctx); - /* Independent multiply & add/sub, with undefined behaviour - if outputs overlap inputs. */ - if (f == 0) { - tm = fmpyadd_s_reg(tm); - ra = fmpyadd_s_reg(ra); - ta = fmpyadd_s_reg(ta); - rm2 = fmpyadd_s_reg(rm2); - rm1 = fmpyadd_s_reg(rm1); - do_fop_weww(ctx, tm, rm1, rm2, gen_helper_fmpy_s); - do_fop_weww(ctx, ta, ta, ra, - is_sub ? gen_helper_fsub_s : gen_helper_fadd_s); - } else { - do_fop_dedd(ctx, tm, rm1, rm2, gen_helper_fmpy_d); - do_fop_dedd(ctx, ta, ta, ra, - is_sub ? gen_helper_fsub_d : gen_helper_fadd_d); - } + do_fop_weww(ctx, tm, rm1, rm2, gen_helper_fmpy_s); + do_fop_weww(ctx, ta, ta, ra, + is_sub ? gen_helper_fsub_s : gen_helper_fadd_s); nullify_end(ctx); } +static void trans_fmpyadd_f(DisasContext *ctx, arg_mpyadd *a, uint32_t insn) +{ + do_fmpyadd_s(ctx, a, false); +} + +static void trans_fmpysub_f(DisasContext *ctx, arg_mpyadd *a, uint32_t insn) +{ + do_fmpyadd_s(ctx, a, true); +} + +static void do_fmpyadd_d(DisasContext *ctx, arg_mpyadd *a, bool is_sub) +{ + nullify_over(ctx); + + do_fop_dedd(ctx, a->tm, a->rm1, a->rm2, gen_helper_fmpy_d); + do_fop_dedd(ctx, a->ta, a->ta, a->ra, + is_sub ? gen_helper_fsub_d : gen_helper_fadd_d); + + nullify_end(ctx); +} + +static void trans_fmpyadd_d(DisasContext *ctx, arg_mpyadd *a, uint32_t insn) +{ + do_fmpyadd_d(ctx, a, false); +} + +static void trans_fmpysub_d(DisasContext *ctx, arg_mpyadd *a, uint32_t insn) +{ + do_fmpyadd_d(ctx, a, true); +} + static void trans_fmpyfadd_s(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { @@ -4355,9 +4372,6 @@ static void translate_one(DisasContext *ctx, uint32_t insn) opc = extract32(insn, 26, 6); switch (opc) { - case 0x06: - trans_fmpyadd(ctx, insn, false); - return; case 0x08: trans_ldil(ctx, insn); return; @@ -4435,9 +4449,6 @@ static void translate_one(DisasContext *ctx, uint32_t insn) case 0x25: trans_subi(ctx, insn); return; - case 0x26: - trans_fmpyadd(ctx, insn, true); - return; case 0x27: trans_cmpb(ctx, insn, true, false, true); return; diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 212d12a9c9..5393d30f43 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -151,3 +151,15 @@ lda 000011 ..... ..... .. . 1 -- 0110 ...... @ldim5 size=2 lda 000011 ..... ..... .. . 0 -- 0110 ...... @ldstx size=2 sta 000011 ..... ..... .. . 1 -- 1110 ...... @stim5 size=2 stby 000011 b:5 r:5 sp:2 a:1 1 -- 1100 m:1 ..... disp=%im5_0 + +#### +# Floating-point Multiply Add +#### + +&mpyadd rm1 rm2 ta ra tm +@mpyadd ...... rm1:5 rm2:5 ta:5 ra:5 . tm:5 + +fmpyadd_f 000110 ..... ..... ..... ..... 0 ..... @mpyadd +fmpyadd_d 000110 ..... ..... ..... ..... 1 ..... @mpyadd +fmpysub_f 100110 ..... ..... ..... ..... 0 ..... @mpyadd +fmpysub_d 100110 ..... ..... ..... ..... 1 ..... @mpyadd