From nobody Wed Nov 5 18:24:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496600521113924.925323955993; Sun, 4 Jun 2017 11:22:01 -0700 (PDT) Received: from localhost ([::1]:58039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHaA3-0008Sa-Lk for importer@patchew.org; Sun, 04 Jun 2017 14:21:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZSC-0008L5-31 for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZSA-00046K-Pw for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:39 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:35076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHZSA-00045s-KB for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:38 -0400 Received: by mail-pf0-x241.google.com with SMTP id u26so18119815pfd.2 for ; Sun, 04 Jun 2017 10:36:38 -0700 (PDT) Received: from bigtime.ASUS (cpe-98-155-27-246.hawaii.res.rr.com. [98.155.27.246]) by smtp.gmail.com with ESMTPSA id j191sm52854419pgc.53.2017.06.04.10.36.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 10:36:36 -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=tDSKjNwhuI6WkSqim5FMhuHuzowk+rQzFAm5ZCcD43Y=; b=htEVcG0pw1u/K2O7Mj3DjDwzTBpo8tsiFvv1Q1RvD1Me/e29bY0srCGnmzAoWYhjD3 ZG2qK5zcFoLB3JnWvK6fDtiLZrQR4iV0P9C26FEX+AJuGWoAcssUeRLp99isQke5olSN uJMBVamZFQH4h9d0r5SxurVN0cOXGYVBNmP03zjOOflr3Nx2PkAqUEOYh1RncJcF2Fqd iu8g/0Maua5NgaFQnczyV+shlfQhHFdAMryynQY8o+BvVPA/7XHQGBlo3MyhAu+OIlV8 GJr0D8p8Z9JFSd4uMBkFfhkUUrJ8TzJtw8VaxD51OkIsud64r82EYFVLkh/wQn5cMhPD MTQg== 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=tDSKjNwhuI6WkSqim5FMhuHuzowk+rQzFAm5ZCcD43Y=; b=MnWsnHCu2ogzEP04N4SnU/51v74VRHLlD4Okjm64tnSwc5kCABycmozTzzxV9Xh4z/ oyaSptBfcp8nr2oziUmB7kvvarjoy1ILhmYJaA7Zc9P0nnFuVqOK+FgAgLAs/+T0H58Q 0pK5D8PhDVOsiAudodovdHX/TX4hrbdimE8RUyjgy9D/hfRzgAX5inI1adItJisEutaH 90loFV2owWe0YvuTkLJlhtfOjGGj8N7w/jzskbmsg/3UT5V4hNNPTqzkSEjV+/Q54MYe cc1spu9N0moh/ujxyAI1c+Bi9d3YkqImLjYE0K+UvzWFJkI945WhYd3OpeTpQ0DyKFqS dK4A== X-Gm-Message-State: AODbwcAkmHeSmnFl6mhTGU+yQ1tF+V5wRjmV9epUNPQipf42owg3RoMl lF4F5AeWx8U25bvPltI= X-Received: by 10.84.139.3 with SMTP id 3mr10391373plq.79.1496597797561; Sun, 04 Jun 2017 10:36:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 4 Jun 2017 10:35:02 -0700 Message-Id: <20170604173509.29684-63-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170604173509.29684-1-rth@twiddle.net> References: <20170604173509.29684-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 62/69] target/s390x: implement PACK ASCII 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aurelien Jarno Reviewed-by: Richard Henderson Signed-off-by: Aurelien Jarno Message-Id: <20170531220129.27724-24-aurelien@aurel32.net> Signed-off-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 35 +++++++++++++++++++++++++++++++++++ target/s390x/translate.c | 16 ++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 5811911..7898064 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -83,6 +83,7 @@ DEF_HELPER_FLAGS_2(sqdb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_FLAGS_4(pka, 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(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index e3b7b78..41431af 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -667,6 +667,8 @@ /* Really format SS_b, but we pack both lengths into one argument for the helper call, so we might as well leave one 8-bit field. */ C(0xf200, PACK, SS_a, Z, la1, a2, 0, 0, pack, 0) +/* PACK ASCII */ + C(0xe900, PKA, SS_f, E2, la1, a2, 0, 0, pka, 0) =20 /* PREFETCH */ /* Implemented as nops of course. */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index a2d65cf..425d4b6 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -914,6 +914,41 @@ void HELPER(pack)(CPUS390XState *env, uint32_t len, ui= nt64_t dest, uint64_t src) } } =20 +void HELPER(pka)(CPUS390XState *env, uint64_t dest, uint64_t src, + uint32_t srclen) +{ + uintptr_t ra =3D GETPC(); + int i; + /* The destination operand is always 16 bytes long. */ + const int destlen =3D 16; + + /* The operands are processed from right to left. */ + src +=3D srclen - 1; + dest +=3D destlen - 1; + + for (i =3D 0; i < destlen; i++) { + uint8_t b =3D 0; + + /* Start with a positive sign */ + if (i =3D=3D 0) { + b =3D 0xc; + } else if (srclen > 1) { + b =3D cpu_ldub_data_ra(env, src, ra) & 0x0f; + src--; + srclen--; + } + + if (srclen > 1) { + b |=3D cpu_ldub_data_ra(env, src, ra) << 4; + src--; + srclen--; + } + + cpu_stb_data_ra(env, dest, b, ra); + dest--; + } +} + void HELPER(unpk)(CPUS390XState *env, uint32_t len, uint64_t dest, uint64_t src) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index b160a0c..5093995 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3301,6 +3301,22 @@ static ExitStatus op_pack(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_pka(DisasContext *s, DisasOps *o) +{ + int l2 =3D get_field(s->fields, l2) + 1; + TCGv_i32 l; + + /* The length must not exceed 32 bytes. */ + if (l2 > 32) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + l =3D tcg_const_i32(l2); + gen_helper_pka(cpu_env, o->addr1, o->in2, l); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_popcnt(DisasContext *s, DisasOps *o) { gen_helper_popcnt(o->out, o->in2); --=20 2.9.4