From nobody Sun Nov 9 19:13:10 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 15517018671461015.9298211044122; Mon, 4 Mar 2019 04:17:47 -0800 (PST) Received: from localhost ([127.0.0.1]:52919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0mXL-0004FL-Gh for importer@patchew.org; Mon, 04 Mar 2019 07:17:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0mJJ-0000N6-Pg for qemu-devel@nongnu.org; Mon, 04 Mar 2019 07:03:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0mJI-000138-ME for qemu-devel@nongnu.org; Mon, 04 Mar 2019 07:03:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55108) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0mJI-000103-Bq; Mon, 04 Mar 2019 07:03:08 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E534307D922; Mon, 4 Mar 2019 12:03:07 +0000 (UTC) Received: from localhost (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D80F526329; Mon, 4 Mar 2019 12:02:59 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Mon, 4 Mar 2019 13:01:55 +0100 Message-Id: <20190304120210.31500-13-cohuck@redhat.com> In-Reply-To: <20190304120210.31500-1-cohuck@redhat.com> References: <20190304120210.31500-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 04 Mar 2019 12:03:07 +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] [PULL 12/27] s390x/tcg: Implement LOAD COUNT TO BLOCK BOUNDARY 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 , qemu-devel@nongnu.org, David Hildenbrand 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" From: David Hildenbrand Use a new CC helper to calculate the CC lazily if needed. While the PoP mentions that "A 32-bit unsigned binary integer" is placed into the first operand, there is no word telling that the other 32 bits (high part) are left untouched. Maybe the other 32-bit are unpredictable. So store 64 bit for now. Bit magic courtesy of Richard. Signed-off-by: David Hildenbrand Message-Id: <20190225200318.16102-8-david@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Cornelia Huck --- target/s390x/cc_helper.c | 8 ++++++++ target/s390x/helper.c | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/internal.h | 1 + target/s390x/translate.c | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+) diff --git a/target/s390x/cc_helper.c b/target/s390x/cc_helper.c index 307ad61aee3d..0e467bf2b6a2 100644 --- a/target/s390x/cc_helper.c +++ b/target/s390x/cc_helper.c @@ -397,6 +397,11 @@ static uint32_t cc_calc_flogr(uint64_t dst) return dst ? 2 : 0; } =20 +static uint32_t cc_calc_lcbb(uint64_t dst) +{ + return dst =3D=3D 16 ? 0 : 3; +} + static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, uint64_t vr) { @@ -506,6 +511,9 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t= cc_op, case CC_OP_FLOGR: r =3D cc_calc_flogr(dst); break; + case CC_OP_LCBB: + r =3D cc_calc_lcbb(dst); + break; =20 case CC_OP_NZ_F32: r =3D set_cc_nz_f32(dst); diff --git a/target/s390x/helper.c b/target/s390x/helper.c index a7edd5df7d59..8e9573221cdb 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -417,6 +417,7 @@ const char *cc_name(enum cc_op cc_op) [CC_OP_SLA_32] =3D "CC_OP_SLA_32", [CC_OP_SLA_64] =3D "CC_OP_SLA_64", [CC_OP_FLOGR] =3D "CC_OP_FLOGR", + [CC_OP_LCBB] =3D "CC_OP_LCBB", }; =20 return cc_names[cc_op]; diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index fb6ee1865057..f4f1d63ab44c 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -479,6 +479,8 @@ F(0xb313, LCDBR, RRE, Z, 0, f2, new, f1, negf64, f64, IF_BFP) F(0xb343, LCXBR, RRE, Z, x2h, x2l, new_P, x1, negf128, f128, IF_= BFP) F(0xb373, LCDFR, RRE, FPSSH, 0, f2, new, f1, negf64, 0, IF_AFP1 | = IF_AFP2) +/* LOAD COUNT TO BLOCK BOUNDARY */ + C(0xe727, LCBB, RXE, V, la2, 0, r1, 0, lcbb, 0) /* LOAD HALFWORD */ C(0xb927, LHR, RRE, EI, 0, r2_16s, 0, r1_32, mov2, 0) C(0xb907, LGHR, RRE, EI, 0, r2_16s, 0, r1, mov2, 0) diff --git a/target/s390x/internal.h b/target/s390x/internal.h index b2966a3adcb8..9d0a45d1fef7 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -236,6 +236,7 @@ enum cc_op { CC_OP_SLA_32, /* Calculate shift left signed (32bit) */ CC_OP_SLA_64, /* Calculate shift left signed (64bit) */ CC_OP_FLOGR, /* find leftmost one */ + CC_OP_LCBB, /* load count to block boundary */ CC_OP_MAX }; =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 59e71128d2bf..d9a89625c66c 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -557,6 +557,7 @@ static void gen_op_calc_cc(DisasContext *s) case CC_OP_NZ_F32: case CC_OP_NZ_F64: case CC_OP_FLOGR: + case CC_OP_LCBB: /* 1 argument */ gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, dummy, cc_dst, dum= my); break; @@ -3142,6 +3143,23 @@ static DisasJumpType op_lzrb(DisasContext *s, DisasO= ps *o) return DISAS_NEXT; } =20 +static DisasJumpType op_lcbb(DisasContext *s, DisasOps *o) +{ + const int64_t block_size =3D (1ull << (get_field(s->fields, m3) + 6)); + + if (get_field(s->fields, m3) > 6) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tcg_gen_ori_i64(o->addr1, o->addr1, -block_size); + tcg_gen_neg_i64(o->addr1, o->addr1); + tcg_gen_movi_i64(o->out, 16); + tcg_gen_umin_i64(o->out, o->out, o->addr1); + gen_op_update1_cc_i64(s, CC_OP_LCBB, o->out); + return DISAS_NEXT; +} + static DisasJumpType op_mov2(DisasContext *s, DisasOps *o) { o->out =3D o->in2; @@ -5931,6 +5949,7 @@ enum DisasInsnEnum { #define FAC_ECT S390_FEAT_EXTRACT_CPU_TIME #define FAC_PCI S390_FEAT_ZPCI /* z/PCI facility */ #define FAC_AIS S390_FEAT_ADAPTER_INT_SUPPRESSION +#define FAC_V S390_FEAT_VECTOR /* vector facility */ =20 static const DisasInsn insn_info[] =3D { #include "insn-data.def" --=20 2.17.2