qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, aurel@aurel32.net,
	Aurelien Jarno <aurelien@aurel32.net>,
	rth@twiddle.net
Subject: [Qemu-devel] [PULL 23/34] target-s390x: implement LOAD FP INTEGER instructions
Date: Fri,  5 Jun 2015 01:41:53 +0200	[thread overview]
Message-ID: <1433461324-23584-24-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1433461324-23584-1-git-send-email-agraf@suse.de>

From: Aurelien Jarno <aurelien@aurel32.net>

This is needed to pass the gcc.c-torture/execute/ieee/20010114-2.c test
in the gcc testsuite.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-s390x/fpu_helper.c  | 31 +++++++++++++++++++++++++++++++
 target-s390x/helper.h      |  3 +++
 target-s390x/insn-data.def |  4 ++++
 target-s390x/translate.c   | 25 +++++++++++++++++++++++++
 4 files changed, 63 insertions(+)

diff --git a/target-s390x/fpu_helper.c b/target-s390x/fpu_helper.c
index 96eabb6..45b7ddf 100644
--- a/target-s390x/fpu_helper.c
+++ b/target-s390x/fpu_helper.c
@@ -552,6 +552,37 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m3)
     return ret;
 }
 
+/* round to integer 32-bit */
+uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2, uint32_t m3)
+{
+    int hold = swap_round_mode(env, m3);
+    float32 ret = float32_round_to_int(f2, &env->fpu_status);
+    set_float_rounding_mode(hold, &env->fpu_status);
+    handle_exceptions(env, GETPC());
+    return ret;
+}
+
+/* round to integer 64-bit */
+uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2, uint32_t m3)
+{
+    int hold = swap_round_mode(env, m3);
+    float64 ret = float64_round_to_int(f2, &env->fpu_status);
+    set_float_rounding_mode(hold, &env->fpu_status);
+    handle_exceptions(env, GETPC());
+    return ret;
+}
+
+/* round to integer 128-bit */
+uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al, uint32_t m3)
+{
+    int hold = swap_round_mode(env, m3);
+    float128 ret = float128_round_to_int(make_float128(ah, al),
+                                         &env->fpu_status);
+    set_float_rounding_mode(hold, &env->fpu_status);
+    handle_exceptions(env, GETPC());
+    return RET128(ret);
+}
+
 /* 32-bit FP multiply and add */
 uint64_t HELPER(maeb)(CPUS390XState *env, uint64_t f1,
                       uint64_t f2, uint64_t f3)
diff --git a/target-s390x/helper.h b/target-s390x/helper.h
index e6f2afb..cb0b421 100644
--- a/target-s390x/helper.h
+++ b/target-s390x/helper.h
@@ -60,6 +60,9 @@ DEF_HELPER_FLAGS_4(clgxb, TCG_CALL_NO_WG, i64, env, i64, i64, i32)
 DEF_HELPER_FLAGS_3(clfeb, TCG_CALL_NO_WG, i64, env, i64, i32)
 DEF_HELPER_FLAGS_3(clfdb, TCG_CALL_NO_WG, i64, env, i64, i32)
 DEF_HELPER_FLAGS_4(clfxb, TCG_CALL_NO_WG, i64, env, i64, i64, i32)
+DEF_HELPER_FLAGS_3(fieb, TCG_CALL_NO_WG, i64, env, i64, i32)
+DEF_HELPER_FLAGS_3(fidb, TCG_CALL_NO_WG, i64, env, i64, i32)
+DEF_HELPER_FLAGS_4(fixb, TCG_CALL_NO_WG, i64, env, i64, i64, i32)
 DEF_HELPER_FLAGS_4(maeb, TCG_CALL_NO_WG, i64, env, i64, i64, i64)
 DEF_HELPER_FLAGS_4(madb, TCG_CALL_NO_WG, i64, env, i64, i64, i64)
 DEF_HELPER_FLAGS_4(mseb, TCG_CALL_NO_WG, i64, env, i64, i64, i64)
diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def
index 8325684..a12939d 100644
--- a/target-s390x/insn-data.def
+++ b/target-s390x/insn-data.def
@@ -479,6 +479,10 @@
     C(0xb29d, LFPC,    S,     Z,   0, m2_32u, 0, 0, sfpc, 0)
 /* LOAD FPC AND SIGNAL */
     C(0xb2bd, LFAS,    S,     IEEEE_SIM, 0, m2_32u, 0, 0, sfas, 0)
+/* LOAD FP INTEGER */
+    C(0xb357, FIEBR,   RRF_e, Z,   0, e2, new, e1, fieb, 0)
+    C(0xb35f, FIDBR,   RRF_e, Z,   0, f2_o, f1, 0, fidb, 0)
+    C(0xb347, FIXBR,   RRF_e, Z,   0, x2_o, x1, 0, fixb, 0)
 
 /* LOAD LENGTHENED */
     C(0xb304, LDEBR,   RRE,   Z,   0, e2, f1, 0, ldeb, 0)
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index c7ebd21..b0dbfe8 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -2116,6 +2116,31 @@ static ExitStatus op_ex(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_fieb(DisasContext *s, DisasOps *o)
+{
+    TCGv_i32 m3 = tcg_const_i32(get_field(s->fields, m3));
+    gen_helper_fieb(o->out, cpu_env, o->in2, m3);
+    tcg_temp_free_i32(m3);
+    return NO_EXIT;
+}
+
+static ExitStatus op_fidb(DisasContext *s, DisasOps *o)
+{
+    TCGv_i32 m3 = tcg_const_i32(get_field(s->fields, m3));
+    gen_helper_fidb(o->out, cpu_env, o->in2, m3);
+    tcg_temp_free_i32(m3);
+    return NO_EXIT;
+}
+
+static ExitStatus op_fixb(DisasContext *s, DisasOps *o)
+{
+    TCGv_i32 m3 = tcg_const_i32(get_field(s->fields, m3));
+    gen_helper_fixb(o->out, cpu_env, o->in1, o->in2, m3);
+    return_low128(o->out2);
+    tcg_temp_free_i32(m3);
+    return NO_EXIT;
+}
+
 static ExitStatus op_flogr(DisasContext *s, DisasOps *o)
 {
     /* We'll use the original input for cc computation, since we get to
-- 
1.7.12.4

  parent reply	other threads:[~2015-06-04 23:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 23:41 [Qemu-devel] [PULL 00/34] s390 patch queue 2015-06-05 Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 01/34] target-s390x: fix CC computation for EX instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 02/34] target-s390x: fix CC computation for LOAD POSITIVE instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 03/34] target-s390x: optimize (negative-) abs computation Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 04/34] target-s390x: remove unused helpers Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 05/34] target-s390x: add a tod2time function Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 06/34] target-s390x: simplify SCKC helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 07/34] target-s390x: streamline STCK helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 08/34] target-s390x: implement STCKC helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 09/34] target-s390x: implement STPT helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 10/34] target-s390x: fix LOAD MULTIPLE instruction on page boundary Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 11/34] target-s390x: fix PSW value on dynamical exception from helpers Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 12/34] target-s390x: fix MMU index computation Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 13/34] target-s390x: define default NaN values Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 14/34] target-s390x: silence NaNs for LOAD LENGTHENED and LOAD ROUNDED Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 15/34] target-s390x: detect tininess before rounding for FP operations Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 16/34] target-s390x: move a few instructions to the correct facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 17/34] target-s390x: implement LAY and LAEY instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 18/34] target-s390x: fix exception for invalid operation code Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 19/34] target-s390x: fix CLGIT instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 20/34] target-s390x: change CHRL and CGHRL format to RIL-b Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 21/34] target-s390x: move STORE CLOCK FAST to the correct facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 22/34] target-s390x: move SET DFP ROUNDING MODE " Alexander Graf
2015-06-04 23:41 ` Alexander Graf [this message]
2015-06-04 23:41 ` [Qemu-devel] [PULL 24/34] target-s390x: implement TRANSLATE AND TEST instruction Alexander Graf
2015-06-20 21:06   ` Paolo Bonzini
2015-06-21 14:24     ` Aurelien Jarno
2015-06-04 23:41 ` [Qemu-devel] [PULL 25/34] target-s390x: implement TRANSLATE EXTENDED instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 26/34] target-s390x: implement LPDFR and LNDFR instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 27/34] target-s390x: implement miscellaneous-instruction-extensions facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 28/34] target-s390x: implement load-and-trap facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 29/34] target-s390x: implement high-word facility Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 30/34] target-s390x: add a cpu_mmu_idx_to_asc function Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 31/34] target-s390x: support non current ASC in s390_cpu_handle_mmu_fault Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 32/34] target-s390x: use softmmu functions for mvcp/mvcs Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 33/34] target-s390x: fix MVC instruction when areas overlap Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 34/34] target-s390x: Only access allocated storage keys Alexander Graf
2015-06-05 12:01 ` [Qemu-devel] [PULL 00/34] s390 patch queue 2015-06-05 Peter Maydell

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=1433461324-23584-24-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=aurel@aurel32.net \
    --cc=aurelien@aurel32.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).