From patchwork Wed Jun 7 00:31:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9770415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31C5460234 for ; Wed, 7 Jun 2017 01:19:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 125862654B for ; Wed, 7 Jun 2017 01:19:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05D622847B; Wed, 7 Jun 2017 01:19:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C17E2654B for ; Wed, 7 Jun 2017 01:19:36 +0000 (UTC) Received: from localhost ([::1]:40768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIPdH-000562-FV for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 21:19:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIOu2-0003m0-Fq for qemu-devel@nongnu.org; Tue, 06 Jun 2017 20:32:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIOu0-0002QF-T4 for qemu-devel@nongnu.org; Tue, 06 Jun 2017 20:32:50 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:33845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIOu0-0002Pl-On for qemu-devel@nongnu.org; Tue, 06 Jun 2017 20:32:48 -0400 Received: by mail-qk0-x242.google.com with SMTP id d14so12249464qkb.1 for ; Tue, 06 Jun 2017 17:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=habpC/VxxbDFJQmfltvQRfBZqB3sFkVJAWolRP+yIDc=; b=fE7FN0gKGOfuDQxMQLy17NliOmYS8OhOgLoyS4Yvgx3YBjaouPlmNhF1qIcJI+vyTh 1IB13D6v0E7o0ExzX/Qy/cfxbaXHyMd914QrJ1eIJ0QxMfEOz+HyafAJBS2aFCCDDSNx X6kB9CAfx1uGjOCiCdWIT/QkCBOBcc8ZKtzI3vi39kXZMb+nULcCqfdwaTlptDWvTql2 8AQIwxPu22l0NKpwvhJiDMccDNPxuSY0R9T3j0/Fy2YVLVoBGG1NvYc7auOttjL8s83G cJEmlVcA5KH7d6ieJPyah+/W+KnNGyrj0JgfZ94Mn7o6fteIh45oeZ8yVgfnN2frg++p Uuhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=habpC/VxxbDFJQmfltvQRfBZqB3sFkVJAWolRP+yIDc=; b=Zfxx+QUYBcgmvsNIIgHoxsp11PlRjxD6pgELQmiOjx/FoyPRSWUd1Vh3bpOMtCutvV ABIhzYlE1tNbwZBNLSav9JUbVEDIBrJamK2c8zYtLogmamEN0waHtI4/e8y1WhBax3B6 H1uMb7EJXPXvw+TdgSfDob5SryPRiRC1e+3jfomnaGLxedQM6B1hS5jfYpcXYbH8nTEZ OAAoi+8kFggqpVToWfB3rddfgqbo6HDycRyy2wIIEr1wplZ0OKaRYdDSG6v1imeYDG96 Yp4S/qKqvLg0NlpUqpobdacdsGjMORi+ay1DtQQvSCIgFkXbc9yi0QQn9BAaM7JNF4RE PToQ== X-Gm-Message-State: AKS2vOxVNSwrMLCH/C7mF5y320N0R5rNg8FgubVuXMrIdz8IxXYtUMY8 YOer90LHu/KpXCB2jLE= X-Received: by 10.55.64.133 with SMTP id n127mr31913897qka.145.1496795568047; Tue, 06 Jun 2017 17:32:48 -0700 (PDT) Received: from bigtime.twiddle.net.com (71-217-91-69.tukw.qwest.net. [71.217.91.69]) by smtp.gmail.com with ESMTPSA id m47sm29286qtc.36.2017.06.06.17.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 17:32:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 17:31:13 -0700 Message-Id: <20170607003119.14778-65-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170607003119.14778-1-rth@twiddle.net> References: <20170607003119.14778-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PULL v2 64/70] target/s390x: implement TEST DECIMAL 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, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Aurelien Jarno Reviewed-by: Richard Henderson Signed-off-by: Aurelien Jarno Message-Id: <20170531220129.27724-28-aurelien@aurel32.net> Signed-off-by: Richard Henderson --- 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 9d4bf64..5871568 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -91,6 +91,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 6aa0221..7db5133 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -852,6 +852,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 402147e..fa2bfbb 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 bba9ce8..2253ce6 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4305,6 +4305,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));