From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 09/24] target/hppa: Convert fp multiply-add
Date: Mon, 11 Feb 2019 20:57:06 -0800 [thread overview]
Message-ID: <20190212045721.28041-10-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190212045721.28041-1-richard.henderson@linaro.org>
Tested-by: Helge Deller <deller@gmx.de>
Tested-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
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);
}
-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 = 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);
return nullify_end(ctx);
}
+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)
opc = 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=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 &mpyadd
+
+fmpyadd_f 000110 ..... ..... ..... ..... 0 ..... @mpyadd
+fmpyadd_d 000110 ..... ..... ..... ..... 1 ..... @mpyadd
+fmpysub_f 100110 ..... ..... ..... ..... 0 ..... @mpyadd
+fmpysub_d 100110 ..... ..... ..... ..... 1 ..... @mpyadd
--
2.17.2
next prev parent reply other threads:[~2019-02-12 4:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 4:56 [Qemu-devel] [PULL 00/24] target/hppa patch queue Richard Henderson
2019-02-12 4:56 ` [Qemu-devel] [PULL 01/24] target/hppa: Use DisasContextBase.is_jmp Richard Henderson
2019-02-12 4:56 ` [Qemu-devel] [PULL 02/24] target/hppa: Begin using scripts/decodetree.py Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 03/24] target/hppa: Convert move to/from system registers Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 04/24] target/hppa: Convert remainder of system insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 05/24] target/hppa: Unify specializations of OR Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 06/24] target/hppa: Convert memory management insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 07/24] target/hppa: Convert arithmetic/logical insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 08/24] target/hppa: Convert indexed memory insns Richard Henderson
2019-02-12 4:57 ` Richard Henderson [this message]
2019-02-12 4:57 ` [Qemu-devel] [PULL 10/24] target/hppa: Convert conditional branches Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 11/24] target/hppa: Convert shift, extract, deposit insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 12/24] target/hppa: Convert direct and indirect branches Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 13/24] target/hppa: Convert arithmetic immediate insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 14/24] target/hppa: Convert offset memory insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 15/24] target/hppa: Convert fp indexed " Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 16/24] target/hppa: Convert halt/reset insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 17/24] target/hppa: Convert fp fused multiply-add insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 18/24] target/hppa: Convert fp operate insns Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 19/24] target/hppa: Merge translate_one into hppa_tr_translate_insn Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 20/24] target/hppa: move GETPC to HELPER() functions Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 21/24] target/hppa: Rearrange log conditions Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 22/24] target/hppa: Fix addition '</<=' conditions Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 23/24] target/hppa: fix dcor instruction Richard Henderson
2019-02-12 4:57 ` [Qemu-devel] [PULL 24/24] hw/hppa: forward requests to CPU HPA Richard Henderson
2019-02-12 13:15 ` [Qemu-devel] [PULL 00/24] target/hppa patch queue Peter Maydell
2019-02-13 18:40 ` Philippe Mathieu-Daudé
2019-02-14 10:04 ` Peter Maydell
2019-02-14 11:32 ` Philippe Mathieu-Daudé
2019-02-13 16:33 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190212045721.28041-10-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).