From nobody Tue Feb 10 06:43:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549947782362771.9984366761842; Mon, 11 Feb 2019 21:03:02 -0800 (PST) Received: from localhost ([127.0.0.1]:33154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtQDj-0006D6-8u for importer@patchew.org; Tue, 12 Feb 2019 00:02:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtQ8n-0002Xy-AA for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtQ8l-0001mD-37 for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:52 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:38694) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtQ8e-0001bf-Cw for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:46 -0500 Received: by mail-pl1-x635.google.com with SMTP id e5so690842plb.5 for ; Mon, 11 Feb 2019 20:57:36 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id a90sm22088923pfj.109.2019.02.11.20.57.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 20:57:33 -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; bh=6tbhahyqg98K1x+3k/hxRj80Xkv0C+uJ9sa5cUUmxjM=; b=wSMTzZ2fifLAKTru9Ef0Nc7J9Kg6ebOrjpZhsNZMKfzsp38vPFFX0uzlGyHj+0h3SG ycatbMKuozzR9cfen3yDvMEvN4KhXoTxUncglE0gLvRlA97olDwKkSsr+1VEkVRBavGD LzCYdQdxS2cA15TKgyl0kt4iAefpRxYltBillge0bVLc2WfN0sadrVF6gXxlcpDMFKun 5OIIulUlRzsmpFcI5fY1l+dIScJA9MtQ2oIju6VlRMqvGFaG37yqS7kfmVi+rnbEFFvz UzKheDxhuxW6+uTRvsHedA1e9/khmT/nI6/iWMRdhu0FXZ8+fUfo7sACs8J6fpSV1g78 5Q9g== 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; bh=6tbhahyqg98K1x+3k/hxRj80Xkv0C+uJ9sa5cUUmxjM=; b=I/oaqIdRNjarkrVALWXsOGx8OwpCdP05tuix8KgVc5QqS4dGRniQkWlmkE9sdaUNw4 K1pf/hPSRcOyhgDdCxJ2JMpQQQB1yJKq8kqLz0PBOjZaRqR7FGyGGG6ysCUtc5pEZCaM 5t7RHWJtQk6NF1SYuUURc6y/Pp5WHnqyOJNHkV0UFcEaEwtsnt5GPWrGvjtQLy/BClHo teBC7pwnxzoBJAk/GDP+4GpvZppCIJ3ofyxrJJOg2xmpiTJ692vMbC0Hw2sUWRPO/e0k hzwsO+0zqMsAtl6dNwKwrRVTIp3tyb5TEsIx0scUvHVxcY+d2Z8T9/3dzsIbrCYOW47L mYzg== X-Gm-Message-State: AHQUAuYCyl0ZnGFsm0xWhM2N9uBXtNIyNB3ozS4vG5TvqHQeEetbMBHm B7XQgIYpeM+Pc92XsrPg0lJ4YyF68EU= X-Google-Smtp-Source: AHgI3IYBoOStD93Ka5lQDiQMqB9tFmYa7+r1NuSQ52NDLIv73hUYFwmctYfOKc3X5bX0iZYMtzXKfg== X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr2078242pla.216.1549947454851; Mon, 11 Feb 2019 20:57:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 20:57:06 -0800 Message-Id: <20190212045721.28041-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190212045721.28041-1-richard.henderson@linaro.org> References: <20190212045721.28041-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::635 Subject: [Qemu-devel] [PULL 09/24] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Tested-by: Helge Deller Tested-by: Sven Schnelle Signed-off-by: Richard Henderson --- target/hppa/translate.c | 69 +++++++++++++++++++++++----------------- target/hppa/insns.decode | 12 +++++++ 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 822d93fb23..2f4a50e113 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4255,37 +4255,54 @@ static inline int fmpyadd_s_reg(unsigned r) return (r & 16) * 2 + 16 + (r & 15); } =20 -static bool trans_fmpyadd(DisasContext *ctx, uint32_t insn, bool is_sub) +static bool do_fmpyadd_s(DisasContext *ctx, arg_mpyadd *a, bool is_sub) { - unsigned tm =3D extract32(insn, 0, 5); - unsigned f =3D extract32(insn, 5, 1); - unsigned ra =3D extract32(insn, 6, 5); - unsigned ta =3D extract32(insn, 11, 5); - unsigned rm2 =3D extract32(insn, 16, 5); - unsigned rm1 =3D extract32(insn, 21, 5); + int tm =3D fmpyadd_s_reg(a->tm); + int ra =3D fmpyadd_s_reg(a->ra); + int ta =3D fmpyadd_s_reg(a->ta); + int rm2 =3D fmpyadd_s_reg(a->rm2); + int rm1 =3D fmpyadd_s_reg(a->rm1); =20 nullify_over(ctx); =20 - /* Independent multiply & add/sub, with undefined behaviour - if outputs overlap inputs. */ - if (f =3D=3D 0) { - tm =3D fmpyadd_s_reg(tm); - ra =3D fmpyadd_s_reg(ra); - ta =3D fmpyadd_s_reg(ta); - rm2 =3D fmpyadd_s_reg(rm2); - rm1 =3D 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); =20 return nullify_end(ctx); } =20 +static bool trans_fmpyadd_f(DisasContext *ctx, arg_mpyadd *a) +{ + return do_fmpyadd_s(ctx, a, false); +} + +static bool trans_fmpysub_f(DisasContext *ctx, arg_mpyadd *a) +{ + return do_fmpyadd_s(ctx, a, true); +} + +static bool 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); + + return nullify_end(ctx); +} + +static bool trans_fmpyadd_d(DisasContext *ctx, arg_mpyadd *a) +{ + return do_fmpyadd_d(ctx, a, false); +} + +static bool trans_fmpysub_d(DisasContext *ctx, arg_mpyadd *a) +{ + return do_fmpyadd_d(ctx, a, true); +} + static bool trans_fmpyfadd_s(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { @@ -4376,9 +4393,6 @@ static void translate_one(DisasContext *ctx, uint32_t= insn) =20 opc =3D extract32(insn, 26, 6); switch (opc) { - case 0x06: - trans_fmpyadd(ctx, insn, false); - return; case 0x08: trans_ldil(ctx, insn); return; @@ -4456,9 +4470,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 38f5fb6be2..16a999b05f 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -153,3 +153,15 @@ lda 000011 ..... ..... .. . 1 -- 0110 = ...... @ldim5 size=3D2 lda 000011 ..... ..... .. . 0 -- 0110 ...... @ldstx siz= e=3D2 sta 000011 ..... ..... .. . 1 -- 1110 ...... @stim5 siz= e=3D2 stby 000011 b:5 r:5 sp:2 a:1 1 -- 1100 m:1 ..... disp=3D%im= 5_0 + +#### +# Floating-point Multiply Add +#### + +&mpyadd rm1 rm2 ta ra tm +@mpyadd ...... rm1:5 rm2:5 ta:5 ra:5 . tm:5 &mpyadd + +fmpyadd_f 000110 ..... ..... ..... ..... 0 ..... @mpyadd +fmpyadd_d 000110 ..... ..... ..... ..... 1 ..... @mpyadd +fmpysub_f 100110 ..... ..... ..... ..... 0 ..... @mpyadd +fmpysub_d 100110 ..... ..... ..... ..... 1 ..... @mpyadd --=20 2.17.2