From nobody Sun Nov 9 16:23:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551181933669546.5414303318285; Tue, 26 Feb 2019 03:52:13 -0800 (PST) Received: from localhost ([127.0.0.1]:53558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gybHK-00053o-QY for importer@patchew.org; Tue, 26 Feb 2019 06:52:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyb5j-0004rW-Qs for qemu-devel@nongnu.org; Tue, 26 Feb 2019 06:40:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyb5i-000775-7N for qemu-devel@nongnu.org; Tue, 26 Feb 2019 06:40:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyb5i-00075d-1I; Tue, 26 Feb 2019 06:40:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CAD680F9A; Tue, 26 Feb 2019 11:40:05 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-93.ams2.redhat.com [10.36.117.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BE346012C; Tue, 26 Feb 2019 11:40:01 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Feb 2019 12:39:02 +0100 Message-Id: <20190226113915.20150-21-david@redhat.com> In-Reply-To: <20190226113915.20150-1-david@redhat.com> References: <20190226113915.20150-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Feb 2019 11:40:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 20/33] s390x/tcg: Implement VECTOR PACK 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: qemu-s390x@nongnu.org, Cornelia Huck , David Hildenbrand , Thomas Huth , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We cannot use gvex expansion as the element size of source and destination differs. So expand manually. Luckily, VECTOR PACK does not care about saturation or setting the CC, so it can be implemented without a helper. We have to watch out for overlapping source and destination registers and use a temporary register in this case. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.inc.c | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 51003cf917..8374a663bd 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1014,6 +1014,8 @@ F(0xe761, VMRH, VRR_c, V, 0, 0, 0, 0, vmr, 0, IF_VEC) /* VECTOR MERGE LOW */ F(0xe760, VMRL, VRR_c, V, 0, 0, 0, 0, vmr, 0, IF_VEC) +/* VECTOR PACK */ + F(0xe794, VPK, VRR_c, V, 0, 0, 0, 0, vpk, 0, IF_VEC) =20 #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.in= c.c index 64a5ee55ca..842ff6a02f 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -524,3 +524,44 @@ static DisasJumpType op_vmr(DisasContext *s, DisasOps = *o) } return DISAS_NEXT; } + +static DisasJumpType op_vpk(DisasContext *s, DisasOps *o) +{ + const uint8_t v1 =3D get_field(s->fields, v1); + const uint8_t v2 =3D get_field(s->fields, v2); + const uint8_t v3 =3D get_field(s->fields, v3); + const uint8_t src_es =3D get_field(s->fields, m4); + const uint8_t dst_es =3D src_es - 1; + uint8_t dst_v =3D v1; + int dst_idx, src_idx; + TCGv_i64 tmp; + + if (src_es =3D=3D MO_8 || src_es > MO_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* Source and destination overlap -> use a temporary register */ + if (v1 =3D=3D v2 || v1 =3D=3D v3) { + dst_v =3D TMP_VREG_0; + } + + tmp =3D tcg_temp_new_i64(); + for (dst_idx =3D 0; dst_idx < NUM_VEC_ELEMENTS(dst_es); dst_idx++) { + src_idx =3D dst_idx; + if (src_idx < NUM_VEC_ELEMENTS(src_es)) { + read_vec_element_i64(tmp, v2, src_idx, src_es); + } else { + src_idx -=3D NUM_VEC_ELEMENTS(src_es); + read_vec_element_i64(tmp, v3, src_idx, src_es); + } + write_vec_element_i64(tmp, dst_v, dst_idx, dst_es); + } + tcg_temp_free_i64(tmp); + + /* move the temporary to the destination */ + if (dst_v !=3D v1) { + gen_gvec_mov(v1, dst_v); + } + return DISAS_NEXT; +} --=20 2.17.2