From nobody Mon Feb 9 17:37:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1624271027321718.145871099222; Mon, 21 Jun 2021 03:23:47 -0700 (PDT) Received: from localhost ([::1]:49108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvH5m-0008GB-3o for importer@patchew.org; Mon, 21 Jun 2021 06:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvGiK-0007Iu-GK for qemu-devel@nongnu.org; Mon, 21 Jun 2021 05:59:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvGiI-0006wE-LW for qemu-devel@nongnu.org; Mon, 21 Jun 2021 05:59:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-rJloDLw_MwakdTQKHzEO9Q-1; Mon, 21 Jun 2021 05:59:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EC4D100C662; Mon, 21 Jun 2021 09:59:25 +0000 (UTC) Received: from gondolin.fritz.box (ovpn-113-141.ams2.redhat.com [10.36.113.141]) by smtp.corp.redhat.com (Postfix) with ESMTP id F33B23A47; Mon, 21 Jun 2021 09:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624269570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jP19NTwyq7EJprHh5KvrhVnj5MIk7utgPJf2ufO7vlo=; b=NtndgzD0Xs/2s4BL5E/sjvubgg9BZDl/cfqxaUcizJ390nl16mIpwITnsfJ3JgKfvjrPnw 9K2A988fxpX7Cy+SLe8ZxxrO0zO4m64IOS9jwVsqdjJnfUBd+WGrefy3N6o3DwpPrNJ7J3 BRfdnRAIklarrmegB2u0X0PcxfmZmdA= X-MC-Unique: rJloDLw_MwakdTQKHzEO9Q-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 17/37] s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE (AND SIGNAL) SCALAR Date: Mon, 21 Jun 2021 11:58:22 +0200 Message-Id: <20210621095842.335162-18-cohuck@redhat.com> In-Reply-To: <20210621095842.335162-1-cohuck@redhat.com> References: <20210621095842.335162-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.299, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand Message-Id: <20210608092337.12221-17-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/helper.h | 4 +++ target/s390x/translate_vx.c.inc | 38 ++++++++++++++++++++++------ target/s390x/vec_fpu_helper.c | 44 ++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 146836126c4c..dca436f710cd 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -250,8 +250,12 @@ DEF_HELPER_6(gvec_vstrc_cc_rt32, void, ptr, cptr, cptr= , cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env,= i32) DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env,= i32) DEF_HELPER_FLAGS_5(gvec_vfa128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env= , i32) +DEF_HELPER_4(gvec_wfc32, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfk32, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfc128, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfk128, void, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfce32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env= , i32) DEF_HELPER_5(gvec_vfce32_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfce64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env= , i32) diff --git a/target/s390x/translate_vx.c.inc b/target/s390x/translate_vx.c.= inc index 6f6ef6b6b84d..822a9d05134b 100644 --- a/target/s390x/translate_vx.c.inc +++ b/target/s390x/translate_vx.c.inc @@ -2598,19 +2598,41 @@ static DisasJumpType op_wfc(DisasContext *s, DisasO= ps *o) { const uint8_t fpf =3D get_field(s, m3); const uint8_t m4 =3D get_field(s, m4); + gen_helper_gvec_2_ptr *fn =3D NULL; =20 - if (fpf !=3D FPF_LONG || m4) { + switch (fpf) { + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn =3D gen_helper_gvec_wfk32; + if (s->fields.op2 =3D=3D 0xcb) { + fn =3D gen_helper_gvec_wfc32; + } + } + break; + case FPF_LONG: + fn =3D gen_helper_gvec_wfk64; + if (s->fields.op2 =3D=3D 0xcb) { + fn =3D gen_helper_gvec_wfc64; + } + break; + case FPF_EXT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn =3D gen_helper_gvec_wfk128; + if (s->fields.op2 =3D=3D 0xcb) { + fn =3D gen_helper_gvec_wfc128; + } + } + break; + default: + break; + }; + + if (!fn || m4) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } =20 - if (s->fields.op2 =3D=3D 0xcb) { - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), - cpu_env, 0, gen_helper_gvec_wfc64); - } else { - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), - cpu_env, 0, gen_helper_gvec_wfk64); - } + gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, 0, fn); set_cc_static(s); return DISAS_NEXT; } diff --git a/target/s390x/vec_fpu_helper.c b/target/s390x/vec_fpu_helper.c index 67dcd8b50af0..fba5261ac4c1 100644 --- a/target/s390x/vec_fpu_helper.c +++ b/target/s390x/vec_fpu_helper.c @@ -307,6 +307,26 @@ DEF_GVEC_VOP3(vfs, sub) DEF_GVEC_VOP3(vfd, div) DEF_GVEC_VOP3(vfm, mul) =20 +static int wfc32(const S390Vector *v1, const S390Vector *v2, + CPUS390XState *env, bool signal, uintptr_t retaddr) +{ + /* only the zero-indexed elements are compared */ + const float32 a =3D s390_vec_read_float32(v1, 0); + const float32 b =3D s390_vec_read_float32(v2, 0); + uint8_t vxc, vec_exc =3D 0; + int cmp; + + if (signal) { + cmp =3D float32_compare(a, b, &env->fpu_status); + } else { + cmp =3D float32_compare_quiet(a, b, &env->fpu_status); + } + vxc =3D check_ieee_exc(env, 0, false, &vec_exc); + handle_ieee_exc(env, vxc, vec_exc, retaddr); + + return float_comp_to_cc(env, cmp); +} + static int wfc64(const S390Vector *v1, const S390Vector *v2, CPUS390XState *env, bool signal, uintptr_t retaddr) { @@ -327,6 +347,26 @@ static int wfc64(const S390Vector *v1, const S390Vecto= r *v2, return float_comp_to_cc(env, cmp); } =20 +static int wfc128(const S390Vector *v1, const S390Vector *v2, + CPUS390XState *env, bool signal, uintptr_t retaddr) +{ + /* only the zero-indexed elements are compared */ + const float128 a =3D s390_vec_read_float128(v1); + const float128 b =3D s390_vec_read_float128(v2); + uint8_t vxc, vec_exc =3D 0; + int cmp; + + if (signal) { + cmp =3D float128_compare(a, b, &env->fpu_status); + } else { + cmp =3D float128_compare_quiet(a, b, &env->fpu_status); + } + vxc =3D check_ieee_exc(env, 0, false, &vec_exc); + handle_ieee_exc(env, vxc, vec_exc, retaddr); + + return float_comp_to_cc(env, cmp); +} + #define DEF_GVEC_WFC_B(NAME, SIGNAL, BITS) = \ void HELPER(gvec_##NAME##BITS)(const void *v1, const void *v2, = \ CPUS390XState *env, uint32_t desc) = \ @@ -335,7 +375,9 @@ void HELPER(gvec_##NAME##BITS)(const void *v1, const vo= id *v2, \ } =20 #define DEF_GVEC_WFC(NAME, SIGNAL) = \ - DEF_GVEC_WFC_B(NAME, SIGNAL, 64) + DEF_GVEC_WFC_B(NAME, SIGNAL, 32) = \ + DEF_GVEC_WFC_B(NAME, SIGNAL, 64) = \ + DEF_GVEC_WFC_B(NAME, SIGNAL, 128) =20 DEF_GVEC_WFC(wfc, false) DEF_GVEC_WFC(wfk, true) --=20 2.31.1