qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, aurelien@aurel32.net
Subject: [Qemu-devel] [PULL 66/69] target/s390x: implement TEST DECIMAL
Date: Sun,  4 Jun 2017 10:35:06 -0700	[thread overview]
Message-ID: <20170604173509.29684-67-rth@twiddle.net> (raw)
In-Reply-To: <20170604173509.29684-1-rth@twiddle.net>

From: Aurelien Jarno <aurelien@aurel32.net>

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-28-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/s390x/helper.h      |  1 +
 target/s390x/insn-data.def |  3 +++
 target/s390x/mem_helper.c  | 23 +++++++++++++++++++++++
 target/s390x/translate.c   |  9 +++++++++
 4 files changed, 36 insertions(+)

diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index dc85a14..c043be6 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -88,6 +88,7 @@ DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i64, i32)
 DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64)
 DEF_HELPER_FLAGS_4(unpka, TCG_CALL_NO_WG, i32, env, i64, i32, i64)
 DEF_HELPER_FLAGS_4(unpku, TCG_CALL_NO_WG, i32, env, i64, i32, i64)
+DEF_HELPER_FLAGS_3(tp, TCG_CALL_NO_WG, i32, env, i64, i32)
 DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64)
 DEF_HELPER_4(tre, i64, env, i64, i64, i64)
 DEF_HELPER_4(trt, i32, env, i32, i64, i64)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 683f91b..7f554ab 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -856,6 +856,9 @@
     C(0xed11, TCDB,    RXE,   Z,   f1_o, a2, 0, 0, tcdb, 0)
     C(0xed12, TCXB,    RXE,   Z,   x1_o, a2, 0, 0, tcxb, 0)
 
+/* TEST DECIMAL */
+    C(0xebc0, TP,      RSL,   E2,  la1, 0, 0, 0, tp, 0)
+
 /* TEST UNDER MASK */
     C(0x9100, TM,      SI,    Z,   m1_8u, i2_8u, 0, 0, 0, tm32)
     C(0xeb51, TMY,     SIY,   LD,  m1_8u, i2_8u, 0, 0, 0, tm32)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 5cb1a8a..a9297c1 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -1088,6 +1088,29 @@ uint32_t HELPER(unpku)(CPUS390XState *env, uint64_t dest, uint32_t destlen,
     return do_unpkau(env, dest, destlen, 2, src, GETPC());
 }
 
+uint32_t HELPER(tp)(CPUS390XState *env, uint64_t dest, uint32_t destlen)
+{
+    uintptr_t ra = GETPC();
+    uint32_t cc = 0;
+    int i;
+
+    for (i = 0; i < destlen; i++) {
+        uint8_t b = cpu_ldub_data_ra(env, dest + i, ra);
+        /* digit */
+        cc |= (b & 0xf0) > 0x90 ? 2 : 0;
+
+        if (i == (destlen - 1)) {
+            /* sign */
+            cc |= (b & 0xf) < 0xa ? 1 : 0;
+        } else {
+            /* digit */
+            cc |= (b & 0xf) > 0x9 ? 2 : 0;
+        }
+    }
+
+    return cc;
+}
+
 static uint32_t do_helper_tr(CPUS390XState *env, uint32_t len, uint64_t array,
                              uint64_t trans, uintptr_t ra)
 {
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 747d4eb..a7c564f 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -4313,6 +4313,15 @@ static ExitStatus op_tprot(DisasContext *s, DisasOps *o)
 
 #endif
 
+static ExitStatus op_tp(DisasContext *s, DisasOps *o)
+{
+    TCGv_i32 l1 = tcg_const_i32(get_field(s->fields, l1) + 1);
+    gen_helper_tp(cc_op, cpu_env, o->addr1, l1);
+    tcg_temp_free_i32(l1);
+    set_cc_static(s);
+    return NO_EXIT;
+}
+
 static ExitStatus op_tr(DisasContext *s, DisasOps *o)
 {
     TCGv_i32 l = tcg_const_i32(get_field(s->fields, l1));
-- 
2.9.4

  parent reply	other threads:[~2017-06-04 17:36 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-04 17:34 [Qemu-devel] [PULL 00/69] target/s390x tcg patches Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 01/69] target/s390x: Add support for the TEST BLOCK instruction Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 02/69] target/s390x: Use cpu_loop_exit_restore for tlb_fill Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 03/69] target/s390x: Move helper_ex to end of file Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 04/69] target/s390x: Use unwind data for helper_nc Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 05/69] target/s390x: Use unwind data for helper_oc Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 06/69] target/s390x: Use unwind data for helper_xc Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 07/69] target/s390x: Use unwind data for helper_mvc Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 08/69] target/s390x: Use unwind data for helper_clc Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 09/69] target/s390x: Use unwind data for helper_clm Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 10/69] target/s390x: Use unwind data for helper_srst Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 11/69] target/s390x: Use unwind data for helper_clst Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 12/69] target/s390x: Use unwind data for helper_mvpg Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 13/69] target/s390x: Use unwind data for helper_mvst Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 14/69] target/s390x: Use unwind data for helper_lam Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 15/69] target/s390x: Use unwind data for helper_stam Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 16/69] target/s390x: Use unwind data for helper_mvcl Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 17/69] target/s390x: Use unwind data for helper_mvcle Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 18/69] target/s390x: Use unwind data for helper_clcle Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 19/69] target/s390x: Use unwind data for helper_cksm Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 20/69] target/s390x: Use unwind data for helper_unpk Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 21/69] target/s390x: Use unwind data for helper_tr Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 22/69] target/s390x: Use unwind data for helper_tre Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 23/69] target/s390x: Use unwind data for helper_trt Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 24/69] target/s390x: Use unwind data for helper_lctlg Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 25/69] target/s390x: Use unwind data for helper_lctl Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 26/69] target/s390x: Use unwind data for helper_stctl Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 27/69] target/s390x: Use unwind data for helper_testblock Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 28/69] target/s390x: Use unwind data for helper_tprot Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 29/69] target/s390x: Use unwind data for helper_lra Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 30/69] target/s390x: Use unwind data for helper_mvcs/mvcp Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 31/69] target/s390x: Fix some helper_ex problems Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 32/69] target/s390x: Fix EXECUTE with R1==0 Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 33/69] target/s390x: Use atomic operations for COMPARE SWAP PURGE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 34/69] target/s390x: Implement CSPG Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 35/69] target/s390x: Save current ilen during translation Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 36/69] target/s390x: End the TB after EXECUTE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 37/69] target/s390x: Implement EXECUTE via new TranslationBlock Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 38/69] target/s390x: Re-implement a few EXECUTE target insns directly Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 39/69] target/s390x/cpu_models: Allow some additional feature bits for the "qemu" CPU Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 40/69] target/s390x: remove dead code in translate.c Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 41/69] target/s390x: remove some Linux assumptions from IPTE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 42/69] target/s390x: implement local-TLB-clearing in IPTE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 43/69] target/s390x: implement TEST AND SET Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 44/69] target/s390x: implement TEST ADDRESSING MODE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 45/69] target/s390x: implement PACK Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 46/69] target/s390x: implement LOAD PAIR FROM QUADWORD Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 47/69] target/s390x: implement STORE PAIR TO QUADWORD Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 48/69] target/s390x: implement COMPARE AND SIGNAL Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 49/69] target/s390x: implement MOVE INVERSE Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 50/69] target/s390x: implement MOVE NUMERICS Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 51/69] target/s390x: implement MOVE WITH OFFSET Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 52/69] target/s390x: implement MOVE ZONES Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 53/69] target/s390x: improve 24-bit and 31-bit addresses read Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 54/69] target/s390x: improve 24-bit and 31-bit addresses write Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 55/69] target/s390x: improve 24-bit and 31-bit lengths read/write Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 56/69] target/s390x: fix COMPARE LOGICAL LONG EXTENDED Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 57/69] target/s390x: implement COMPARE LOGICAL LONG Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 58/69] target/s390x: fix adj_len_to_page Richard Henderson
2017-06-04 17:34 ` [Qemu-devel] [PULL 59/69] target/s390x: improve MOVE LONG and MOVE LONG EXTENDED Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 60/69] target/s390x: implement COMPARE LOGICAL LONG UNICODE Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 61/69] target/s390x: implement MOVE " Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 62/69] target/s390x: implement PACK ASCII Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 63/69] target/s390x: implement PACK UNICODE Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 64/69] target/s390x: implement UNPACK ASCII Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 65/69] target/s390x: implement UNPACK UNICODE Richard Henderson
2017-06-04 17:35 ` Richard Henderson [this message]
2017-06-04 17:35 ` [Qemu-devel] [PULL 67/69] target/s390x: implement TRANSLATE ONE/TWO TO ONE/TWO Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 68/69] target/s390x: mark ETF2 and ETF2-ENH facilities as available Richard Henderson
2017-06-04 17:35 ` [Qemu-devel] [PULL 69/69] target/s390x: addressing exceptions are suppressing Richard Henderson
2017-06-04 18:32 ` [Qemu-devel] [PULL 00/69] target/s390x tcg patches no-reply
2017-06-04 19:54   ` Aurelien Jarno
2017-06-04 19:53 ` Aurelien Jarno

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=20170604173509.29684-67-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --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).