From nobody Sat Nov 8 05:42:27 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 1550068572858966.1630353820397; Wed, 13 Feb 2019 06:36:12 -0800 (PST) Received: from localhost ([127.0.0.1]:57745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvds-0001FU-MU for importer@patchew.org; Wed, 13 Feb 2019 09:36:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbY-0008Hn-9h for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbR-00024k-0M for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41090) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbP-000230-Iu; Wed, 13 Feb 2019 09:33:32 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 3A532C0C9A9F; Wed, 13 Feb 2019 14:33:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22DF25D707; Wed, 13 Feb 2019 14:33:25 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:08 +0100 Message-Id: <20190213143322.31371-2-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 13 Feb 2019 14:33:29 +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 v2 01/15] s390x/tcg: Fix TEST DATA CLASS instructions 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" Let's detect normal and denormal ("subnormal") numbers reliably. Also test for quiet NaN's. As only one class is possible, test common cases first. While at it, use a better check to test for the mask bits in the data class mask. The data class mask has 12 bits, whereby bit 0 is the leftmost bit and bit 11 the rightmost bit. In the PoP an easy to read table with the numbers is provided for the VECTOR FP TEST DATA CLASS IMMEDIATE instruction, the table for TEST DATA CLASS is more confusing as it is based on 64 bit values. Factor the checks out into separate functions, as they will also be needed for floating point vector instructions. We can use a makro to generate the functions. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/fpu_helper.c | 85 ++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index e921172bc4..0e9247bf7e 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -645,67 +645,52 @@ uint64_t HELPER(msdb)(CPUS390XState *env, uint64_t f1, return ret; } =20 +/* The rightmost bit has the number 11. */ +static inline uint16_t dcmask(int bit, bool neg) +{ + return 1 << (11 - bit - neg); +} + +#define DEF_FLOAT_DCMASK(_TYPE) \ +static uint16_t _TYPE##_dcmask(CPUS390XState *env, _TYPE f1) \ +{ \ + const bool neg =3D _TYPE##_is_neg(f1); \ + \ + /* Sorted by most common cases - only one class is possible */ \ + if (_TYPE##_is_normal(f1)) { \ + return dcmask(2, neg); \ + } else if (_TYPE##_is_zero(f1)) { \ + return dcmask(0, neg); \ + } else if (_TYPE##_is_denormal(f1)) { \ + return dcmask(4, neg); \ + } else if (_TYPE##_is_infinity(f1)) { \ + return dcmask(6, neg); \ + } else if (_TYPE##_is_quiet_nan(f1, &env->fpu_status)) { \ + return dcmask(8, neg); \ + } \ + /* signaling nan, as last remaining case */ \ + return dcmask(10, neg); \ +} +DEF_FLOAT_DCMASK(float32) +DEF_FLOAT_DCMASK(float64) +DEF_FLOAT_DCMASK(float128) + /* test data class 32-bit */ uint32_t HELPER(tceb)(CPUS390XState *env, uint64_t f1, uint64_t m2) { - float32 v1 =3D f1; - int neg =3D float32_is_neg(v1); - uint32_t cc =3D 0; - - if ((float32_is_zero(v1) && (m2 & (1 << (11-neg)))) || - (float32_is_infinity(v1) && (m2 & (1 << (5-neg)))) || - (float32_is_any_nan(v1) && (m2 & (1 << (3-neg)))) || - (float32_is_signaling_nan(v1, &env->fpu_status) && - (m2 & (1 << (1-neg))))) { - cc =3D 1; - } else if (m2 & (1 << (9-neg))) { - /* assume normalized number */ - cc =3D 1; - } - /* FIXME: denormalized? */ - return cc; + return (m2 & float32_dcmask(env, f1)) !=3D 0; } =20 /* test data class 64-bit */ uint32_t HELPER(tcdb)(CPUS390XState *env, uint64_t v1, uint64_t m2) { - int neg =3D float64_is_neg(v1); - uint32_t cc =3D 0; - - if ((float64_is_zero(v1) && (m2 & (1 << (11-neg)))) || - (float64_is_infinity(v1) && (m2 & (1 << (5-neg)))) || - (float64_is_any_nan(v1) && (m2 & (1 << (3-neg)))) || - (float64_is_signaling_nan(v1, &env->fpu_status) && - (m2 & (1 << (1-neg))))) { - cc =3D 1; - } else if (m2 & (1 << (9-neg))) { - /* assume normalized number */ - cc =3D 1; - } - /* FIXME: denormalized? */ - return cc; + return (m2 & float64_dcmask(env, v1)) !=3D 0; } =20 /* test data class 128-bit */ -uint32_t HELPER(tcxb)(CPUS390XState *env, uint64_t ah, - uint64_t al, uint64_t m2) -{ - float128 v1 =3D make_float128(ah, al); - int neg =3D float128_is_neg(v1); - uint32_t cc =3D 0; - - if ((float128_is_zero(v1) && (m2 & (1 << (11-neg)))) || - (float128_is_infinity(v1) && (m2 & (1 << (5-neg)))) || - (float128_is_any_nan(v1) && (m2 & (1 << (3-neg)))) || - (float128_is_signaling_nan(v1, &env->fpu_status) && - (m2 & (1 << (1-neg))))) { - cc =3D 1; - } else if (m2 & (1 << (9-neg))) { - /* assume normalized number */ - cc =3D 1; - } - /* FIXME: denormalized? */ - return cc; +uint32_t HELPER(tcxb)(CPUS390XState *env, uint64_t ah, uint64_t al, uint64= _t m2) +{ + return (m2 & float128_dcmask(env, make_float128(ah, al))) !=3D 0; } =20 /* square root 32-bit */ --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068572358341.7952971302494; Wed, 13 Feb 2019 06:36:12 -0800 (PST) Received: from localhost ([127.0.0.1]:57747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvds-0001Fb-Nf for importer@patchew.org; Wed, 13 Feb 2019 09:36:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbY-0008Hw-Gq for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbS-00025c-IW for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35172) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbQ-00024B-Vz; Wed, 13 Feb 2019 09:33:33 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 5A2E9E1F02; Wed, 13 Feb 2019 14:33:31 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F1AF5D704; Wed, 13 Feb 2019 14:33:29 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:09 +0100 Message-Id: <20190213143322.31371-3-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Feb 2019 14:33:31 +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 v2 02/15] s390x/tcg: Fix rounding from float128 to uint64_t/uin32_t 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" Let's use the proper conversion functions now that we have them. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 0e9247bf7e..21236caed8 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -509,9 +509,7 @@ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) { int hold =3D swap_round_mode(env, m3); - float128 v2 =3D make_float128(h, l); - /* ??? Not 100% correct. */ - uint64_t ret =3D float128_to_int64(v2, &env->fpu_status); + uint64_t ret =3D float128_to_uint64(make_float128(h, l), &env->fpu_sta= tus); set_float_rounding_mode(hold, &env->fpu_status); handle_exceptions(env, GETPC()); return ret; @@ -541,9 +539,7 @@ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) { int hold =3D swap_round_mode(env, m3); - float128 v2 =3D make_float128(h, l); - /* Not 100% correct. */ - uint32_t ret =3D float128_to_int64(v2, &env->fpu_status); + uint32_t ret =3D float128_to_uint32(make_float128(h, l), &env->fpu_sta= tus); set_float_rounding_mode(hold, &env->fpu_status); handle_exceptions(env, GETPC()); return ret; --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068743529951.533315290376; Wed, 13 Feb 2019 06:39:03 -0800 (PST) Received: from localhost ([127.0.0.1]:57784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvgf-0003aZ-EB for importer@patchew.org; Wed, 13 Feb 2019 09:38:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbZ-0008Ic-HV for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbY-00028x-JQ for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbW-000258-AQ; Wed, 13 Feb 2019 09:33:40 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 76751C0D0863; Wed, 13 Feb 2019 14:33:33 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EF265D6AA; Wed, 13 Feb 2019 14:33:31 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:10 +0100 Message-Id: <20190213143322.31371-4-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 13 Feb 2019 14:33:33 +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 v2 03/15] s390x/tcg: Factor out conversion of softfloat exceptions 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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 want to reuse that function in vector instruction context. While at it, cleanup the code, using defines for magic values and avoiding the handcrafted bit conversion. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 25 +++++++++++++------------ target/s390x/internal.h | 7 +++++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 21236caed8..de02cf792d 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -36,10 +36,18 @@ =20 #define RET128(F) (env->retxl =3D F.low, F.high) =20 -#define convert_bit(mask, from, to) \ - (to < from \ - ? (mask / (from / to)) & to \ - : (mask & from) * (to / from)) +uint8_t s390_softfloat_exc_to_ieee(unsigned int exc) +{ + uint8_t s390_exc =3D 0; + + s390_exc |=3D (exc & float_flag_invalid) ? S390_IEEE_MASK_INVALID : 0; + s390_exc |=3D (exc & float_flag_divbyzero) ? S390_IEEE_MASK_DIVBYZERO = : 0; + s390_exc |=3D (exc & float_flag_overflow) ? S390_IEEE_MASK_OVERFLOW : = 0; + s390_exc |=3D (exc & float_flag_underflow) ? S390_IEEE_MASK_UNDERFLOW = : 0; + s390_exc |=3D (exc & float_flag_inexact) ? S390_IEEE_MASK_INEXACT : 0; + + return s390_exc; +} =20 /* Should be called after any operation that may raise IEEE exceptions. */ static void handle_exceptions(CPUS390XState *env, uintptr_t retaddr) @@ -53,14 +61,7 @@ static void handle_exceptions(CPUS390XState *env, uintpt= r_t retaddr) return; } env->fpu_status.float_exception_flags =3D 0; - - /* Convert softfloat exception bits to s390 exception bits. */ - s390_exc =3D 0; - s390_exc |=3D convert_bit(qemu_exc, float_flag_invalid, 0x80); - s390_exc |=3D convert_bit(qemu_exc, float_flag_divbyzero, 0x40); - s390_exc |=3D convert_bit(qemu_exc, float_flag_overflow, 0x20); - s390_exc |=3D convert_bit(qemu_exc, float_flag_underflow, 0x10); - s390_exc |=3D convert_bit(qemu_exc, float_flag_inexact, 0x08); + s390_exc =3D s390_softfloat_exc_to_ieee(qemu_exc); =20 /* Install the exceptions that we raised. */ env->fpc |=3D s390_exc << 16; diff --git a/target/s390x/internal.h b/target/s390x/internal.h index f2a771e2b4..e1c0b1bd3b 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -308,6 +308,13 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr= addr, uint32_t set_cc_nz_f32(float32 v); uint32_t set_cc_nz_f64(float64 v); uint32_t set_cc_nz_f128(float128 v); +#define S390_IEEE_MASK_INVALID 0x80 +#define S390_IEEE_MASK_DIVBYZERO 0x40 +#define S390_IEEE_MASK_OVERFLOW 0x20 +#define S390_IEEE_MASK_UNDERFLOW 0x10 +#define S390_IEEE_MASK_INEXACT 0x08 +#define S390_IEEE_MASK_QUANTUM 0x04 +uint8_t s390_softfloat_exc_to_ieee(unsigned int exc); =20 =20 /* gdbstub.c */ --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 1550068809952979.4042951080932; Wed, 13 Feb 2019 06:40:09 -0800 (PST) Received: from localhost ([127.0.0.1]:57789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvhm-0004Z8-Tf for importer@patchew.org; Wed, 13 Feb 2019 09:40:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbZ-0008J1-PN for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbY-00029F-SL for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbY-00026J-JM; Wed, 13 Feb 2019 09:33:40 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id A05A48BD23; Wed, 13 Feb 2019 14:33:35 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE2125D6AA; Wed, 13 Feb 2019 14:33:33 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:11 +0100 Message-Id: <20190213143322.31371-5-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Feb 2019 14:33:35 +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 v2 04/15] s390x/tcg: Fix parts of IEEE exception handling 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" Many things are wrong and some parts cannot be fixed yet. Fix what we can fix easily and add two FIXMEs: The fpc flags are not updated in case an exception is actually injected. Inexact exceptions have to be handled separately, as they are the only exceptions that can coexist with underflows and overflows. I reread the horribly complicated chapters in the PoP at least 5 times and hope I got it right. For references: - z14 PoP, 9-18, "IEEE Exceptions" - z14 PoP, 19-9, Figure 19-8 Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index de02cf792d..dcad9c367a 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -63,13 +63,39 @@ static void handle_exceptions(CPUS390XState *env, uintp= tr_t retaddr) env->fpu_status.float_exception_flags =3D 0; s390_exc =3D s390_softfloat_exc_to_ieee(qemu_exc); =20 - /* Install the exceptions that we raised. */ - env->fpc |=3D s390_exc << 16; + /* + * FIXME: + * 1. Right now, all inexact conditions are inidicated as + * "truncated" (0) and never as "incremented" (1) in the DXC. + * 2. Only traps due to invalid/divbyzero are suppressing. Other traps + * are completing, meaning the target register has to be written! + * This, however will mean that we have to write the register before + * triggering the trap - impossible right now. + */ + + /* + * invalid/divbyzero cannot coexist with other conditions. + * overflow/underflow however can coexist with inexact, we have to + * handle it separatly. + */ + if (s390_exc & ~S390_IEEE_MASK_INEXACT) { + if (s390_exc & ~S390_IEEE_MASK_INEXACT & env->fpc >> 24) { + /* trap condition - inexact reported along */ + tcg_s390_data_exception(env, s390_exc, retaddr); + } + /* nontrap condition - inexact handled differently */ + env->fpc |=3D (s390_exc & ~S390_IEEE_MASK_INEXACT) << 16; + } =20 - /* Send signals for enabled exceptions. */ - s390_exc &=3D env->fpc >> 24; - if (s390_exc) { - tcg_s390_data_exception(env, s390_exc, retaddr); + /* inexact handling */ + if (s390_exc & S390_IEEE_MASK_INEXACT) { + /* trap condition - overflow/underflow _not_ reported along */ + if (s390_exc & S390_IEEE_MASK_INEXACT & env->fpc >> 24) { + tcg_s390_data_exception(env, s390_exc & S390_IEEE_MASK_INEXACT, + retaddr); + } + /* nontrap condition */ + env->fpc |=3D (s390_exc & S390_IEEE_MASK_INEXACT) << 16; } } =20 --=20 2.17.2 From nobody Sat Nov 8 05:42:27 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068914714569.264152535931; Wed, 13 Feb 2019 06:41:54 -0800 (PST) Received: from localhost ([127.0.0.1]:57839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvjL-0005yG-Dw for importer@patchew.org; Wed, 13 Feb 2019 09:41:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbZ-0008Ij-LA for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbY-000299-Qi for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41492) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbY-00027W-JY; Wed, 13 Feb 2019 09:33:40 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id C9F52C0D18AA; Wed, 13 Feb 2019 14:33:37 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7A135D6B6; Wed, 13 Feb 2019 14:33:35 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:12 +0100 Message-Id: <20190213143322.31371-6-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 13 Feb 2019 14:33:37 +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 v2 05/15] s390x/tcg: Hide IEEE underflows in some scenarios 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" IEEE underflows are not reported when the mask bit is off and we don't also have an inexact exception. z14 PoP, 9-20, "IEEE Underflow": An IEEE-underflow exception is recognized for an IEEE target when the tininess condition exists and either: (1) the IEEE-underflow mask bit in the FPC register is zero and the result value is inexact, or (2) the IEEE-underflow mask bit in the FPC register is one. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index dcad9c367a..64efab72a4 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -63,6 +63,19 @@ static void handle_exceptions(CPUS390XState *env, uintpt= r_t retaddr) env->fpu_status.float_exception_flags =3D 0; s390_exc =3D s390_softfloat_exc_to_ieee(qemu_exc); =20 + /* + * IEEE-Underflow exception recognition exists if a tininess condition + * (underflow) exists and + * - The mask bit in the FPC is zero and the result is inexact + * - The mask bit in the FPC is one + * So tininess conditions that are not inexact don't trigger any + * underflow action in case the mask bit is not one. + */ + if (!(s390_exc & S390_IEEE_MASK_INEXACT) && + !((env->fpc >> 24) & S390_IEEE_MASK_UNDERFLOW)) { + s390_exc &=3D ~S390_IEEE_MASK_UNDERFLOW; + } + /* * FIXME: * 1. Right now, all inexact conditions are inidicated as --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068979407297.02304888660694; Wed, 13 Feb 2019 06:42:59 -0800 (PST) Received: from localhost ([127.0.0.1]:57847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvkT-0006ut-DC for importer@patchew.org; Wed, 13 Feb 2019 09:42:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvba-0008Jj-Mz for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbZ-0002AG-Rv for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbZ-00029S-LZ; Wed, 13 Feb 2019 09:33:41 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id C9DE83D978; Wed, 13 Feb 2019 14:33:40 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DFD55D6B3; Wed, 13 Feb 2019 14:33:37 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:13 +0100 Message-Id: <20190213143322.31371-7-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 13 Feb 2019 14:33:40 +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 v2 06/15] s390x/tcg: Refactor SET FPC AND SIGNAL handling 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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 can directly work on the uint64_t value, no need for a temporary uint32_t value. Also cleanup and shorten the comments. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 64efab72a4..ea5a37ac5e 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -771,21 +771,23 @@ void HELPER(sfpc)(CPUS390XState *env, uint64_t fpc) } =20 /* set fpc and signal */ -void HELPER(sfas)(CPUS390XState *env, uint64_t val) +void HELPER(sfas)(CPUS390XState *env, uint64_t fpc) { uint32_t signalling =3D env->fpc; - uint32_t source =3D val; uint32_t s390_exc; =20 - /* The contents of the source operand are placed in the FPC register; - then the flags in the FPC register are set to the logical OR of the - signalling flags and the source flags. */ - env->fpc =3D source | (signalling & 0x00ff0000); - set_float_rounding_mode(fpc_to_rnd[source & 3], &env->fpu_status); + /* + * FPC is set to the FPC operand with a bitwise OR of the signalling + * flags. + */ + env->fpc =3D fpc | (signalling & 0x00ff0000); + set_float_rounding_mode(fpc_to_rnd[fpc & 3], &env->fpu_status); =20 - /* If any signalling flag is 1 and the corresponding source mask - is also 1, a simulated-iee-exception trap occurs. */ - s390_exc =3D (signalling >> 16) & (source >> 24); + /* + * If any signaling flag is enabled in the new FPC mask, a + * simulated-iee-exception exception occurs. + */ + s390_exc =3D (signalling >> 16) & (fpc >> 24); if (s390_exc) { tcg_s390_data_exception(env, s390_exc | 3, GETPC()); } --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550069057998400.8554102069987; Wed, 13 Feb 2019 06:44:17 -0800 (PST) Received: from localhost ([127.0.0.1]:57878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvlk-00083d-1m for importer@patchew.org; Wed, 13 Feb 2019 09:44:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbc-0008KJ-OU for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbc-0002CR-1D for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51018) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbb-0002Bh-RV; Wed, 13 Feb 2019 09:33:43 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 091B0C0AD1C1; Wed, 13 Feb 2019 14:33:43 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 178015D6AA; Wed, 13 Feb 2019 14:33:40 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:14 +0100 Message-Id: <20190213143322.31371-8-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Feb 2019 14:33:43 +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 v2 07/15] s390x/tcg: Fix simulated-IEEE exceptions 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" The trap is triggered based on priority of the enabled signaling flags. Only overflow and underflow allow a concurrent inexact exception. z14 PoP, 9-33, Figure 9-21 Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index ea5a37ac5e..7508c0748e 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -789,6 +789,19 @@ void HELPER(sfas)(CPUS390XState *env, uint64_t fpc) */ s390_exc =3D (signalling >> 16) & (fpc >> 24); if (s390_exc) { + if (s390_exc & S390_IEEE_MASK_INVALID) { + s390_exc =3D S390_IEEE_MASK_INVALID; + } else if (s390_exc & S390_IEEE_MASK_DIVBYZERO) { + s390_exc =3D S390_IEEE_MASK_DIVBYZERO; + } else if (s390_exc & S390_IEEE_MASK_OVERFLOW) { + s390_exc &=3D (S390_IEEE_MASK_OVERFLOW | S390_IEEE_MASK_INEXAC= T); + } else if (s390_exc & S390_IEEE_MASK_UNDERFLOW) { + s390_exc &=3D (S390_IEEE_MASK_UNDERFLOW | S390_IEEE_MASK_INEXA= CT); + } else if (s390_exc & S390_IEEE_MASK_INEXACT) { + s390_exc =3D S390_IEEE_MASK_INEXACT; + } else if (s390_exc & S390_IEEE_MASK_QUANTUM) { + s390_exc =3D S390_IEEE_MASK_QUANTUM; + } tcg_s390_data_exception(env, s390_exc | 3, GETPC()); } } --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 1550068576177356.7676506750212; Wed, 13 Feb 2019 06:36:16 -0800 (PST) Received: from localhost ([127.0.0.1]:57749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtve1-0001KY-Ej for importer@patchew.org; Wed, 13 Feb 2019 09:36:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbg-0008Mw-63 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbf-0002Es-4i for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbe-0002Dy-SF; Wed, 13 Feb 2019 09:33:47 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 1234261D07; Wed, 13 Feb 2019 14:33:46 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41ED65D6AA; Wed, 13 Feb 2019 14:33:43 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:15 +0100 Message-Id: <20190213143322.31371-9-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 13 Feb 2019 14:33:46 +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 v2 08/15] s390x/tcg: Handle SET FPC AND LOAD FPC 3-bit BFP rounding modes 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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 already forward the 3 bits correctly in the translation functions. We also have to handle them properly and check for specification exceptions. Setting an invalid rounding mode (BFP only, all DFP rounding modes) results in a specification exception. Setting unassigned bits in the fpc, results in a specification exception. This fixes LOAD FPC (AND SIGNAL), SET FPC (AND SIGNAL). Also for, SET BFP ROUNDING MODE, 3-bit rounding mode is now explicitly checked. Notes: 1. Use "float_round_to_zero" for now to handle "Round to prepare for shorter precision". Looking at the PoP "Summary of Rounding and Range Actions" for BFP. They differ when it comes to tiny values. 2. TCG_CALL_NO_WG is required for sfpc handler, as we now inject exceptions. We won't be modeling abscence of the "floating-point extension facility" for now, not necessary as most take the facility for granted without checking. z14 PoP, 9-23, "LOAD FPC" When the floating-point extension facility is installed, bits 29-31 of the second operand must specify a valid BFP rounding mode and bits 6-7, 14-15, 24, and 28 must be zero; otherwise, a specification exception is recognized. Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 26 ++++++++++++++++++++++---- target/s390x/helper.h | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 7508c0748e..a779cfada6 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -753,21 +753,34 @@ uint64_t HELPER(sqxb)(CPUS390XState *env, uint64_t ah= , uint64_t al) return RET128(ret); } =20 -static const int fpc_to_rnd[4] =3D { +static const int fpc_to_rnd[8] =3D { float_round_nearest_even, float_round_to_zero, float_round_up, - float_round_down + float_round_down, + -1, + -1, + -1, + /* + * FIXME: we actually want something like round_to_odd, but that does = not + * support all data types yet. + */ + float_round_to_zero, }; =20 /* set fpc */ void HELPER(sfpc)(CPUS390XState *env, uint64_t fpc) { + if (fpc_to_rnd[fpc & 0x7] =3D=3D -1 || fpc & 0x03030088u || + (!s390_has_feat(S390_FEAT_FLOATING_POINT_EXT) && fpc & 0x4)) { + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, GETPC()); + } + /* Install everything in the main FPC. */ env->fpc =3D fpc; =20 /* Install the rounding mode in the shadow fpu_status. */ - set_float_rounding_mode(fpc_to_rnd[fpc & 3], &env->fpu_status); + set_float_rounding_mode(fpc_to_rnd[fpc & 0x7], &env->fpu_status); } =20 /* set fpc and signal */ @@ -776,12 +789,17 @@ void HELPER(sfas)(CPUS390XState *env, uint64_t fpc) uint32_t signalling =3D env->fpc; uint32_t s390_exc; =20 + if (fpc_to_rnd[fpc & 0x7] =3D=3D -1 || fpc & 0x03030088u || + (!s390_has_feat(S390_FEAT_FLOATING_POINT_EXT) && fpc & 0x4)) { + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, GETPC()); + } + /* * FPC is set to the FPC operand with a bitwise OR of the signalling * flags. */ env->fpc =3D fpc | (signalling & 0x00ff0000); - set_float_rounding_mode(fpc_to_rnd[fpc & 3], &env->fpu_status); + set_float_rounding_mode(fpc_to_rnd[fpc & 0x7], &env->fpu_status); =20 /* * If any signaling flag is enabled in the new FPC mask, a diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 6260b50496..a99b067c9c 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -104,7 +104,7 @@ DEF_HELPER_4(trtr, i32, env, i32, i64, i64) DEF_HELPER_5(trXX, i32, env, i32, i32, i32, i32) DEF_HELPER_4(cksm, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i= 64) -DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_RWG, void, env, i64) +DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_2(sfas, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_1(popcnt, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_2(stfle, i32, env, i64) --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 1550069175853391.7462835078686; Wed, 13 Feb 2019 06:46:15 -0800 (PST) Received: from localhost ([127.0.0.1]:57934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvng-0001MR-VR for importer@patchew.org; Wed, 13 Feb 2019 09:46:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbi-0008Oe-Lp for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbh-0002G8-ME for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64627) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbh-0002Fe-D1; Wed, 13 Feb 2019 09:33:49 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 403321387; Wed, 13 Feb 2019 14:33:48 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A737546E3; Wed, 13 Feb 2019 14:33:46 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:16 +0100 Message-Id: <20190213143322.31371-10-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Feb 2019 14:33:48 +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 v2 09/15] s390x/tcg: Check for exceptions in SET BFP ROUNDING MODE 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" Let's split handling of BFP/DFP rounding mode configuration. Also, let's not reuse the sfpc handler, use a separate handler so we can properly check for specification exceptions for SRNMB. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 11 ++++++++ target/s390x/helper.h | 1 + target/s390x/insn-data.def | 6 ++-- target/s390x/translate.c | 56 ++++++++++++++++---------------------- 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index a779cfada6..70fa053e8d 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -823,3 +823,14 @@ void HELPER(sfas)(CPUS390XState *env, uint64_t fpc) tcg_s390_data_exception(env, s390_exc | 3, GETPC()); } } + +/* set bfp rounding mode */ +void HELPER(srnm)(CPUS390XState *env, uint64_t rnd) +{ + if (rnd > 0x7 || fpc_to_rnd[rnd & 0x7] =3D=3D -1) { + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, GETPC()); + } + + env->fpc =3D deposit32(env->fpc, 0, 3, rnd); + set_float_rounding_mode(fpc_to_rnd[rnd & 0x7], &env->fpu_status); +} diff --git a/target/s390x/helper.h b/target/s390x/helper.h index a99b067c9c..d287d5dac0 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -106,6 +106,7 @@ DEF_HELPER_4(cksm, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i= 64) DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_2(sfas, TCG_CALL_NO_WG, void, env, i64) +DEF_HELPER_FLAGS_2(srnm, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_1(popcnt, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_2(stfle, i32, env, i64) DEF_HELPER_FLAGS_2(lpq, TCG_CALL_NO_WG, i64, env, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 61582372ab..2c9ae503c5 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -759,10 +759,10 @@ /* SET FPC AND SIGNAL */ F(0xb385, SFASR, RRE, IEEEE_SIM, 0, r1_o, 0, 0, sfas, 0, IF_DFP) /* SET BFP ROUNDING MODE */ - F(0xb299, SRNM, S, Z, 0, 0, 0, 0, srnm, 0, IF_BFP) - F(0xb2b8, SRNMB, S, FPE, 0, 0, 0, 0, srnm, 0, IF_BFP) + F(0xb299, SRNM, S, Z, la2, 0, 0, 0, srnm, 0, IF_BFP) + F(0xb2b8, SRNMB, S, FPE, la2, 0, 0, 0, srnmb, 0, IF_BFP) /* SET DFP ROUNDING MODE */ - F(0xb2b9, SRNMT, S, DFPR, 0, 0, 0, 0, srnm, 0, IF_DFP) + F(0xb2b9, SRNMT, S, DFPR, la2, 0, 0, 0, srnmt, 0, IF_DFP) /* SET PROGRAM MASK */ C(0x0400, SPM, RR_a, Z, r1, 0, 0, 0, spm, 0) =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 19072efec6..c2645891e8 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3955,41 +3955,33 @@ static DisasJumpType op_sfas(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_srnm(DisasContext *s, DisasOps *o) { - int b2 =3D get_field(s->fields, b2); - int d2 =3D get_field(s->fields, d2); - TCGv_i64 t1 =3D tcg_temp_new_i64(); - TCGv_i64 t2 =3D tcg_temp_new_i64(); - int mask, pos, len; + /* Bits other than 62 and 63 are ignored. Bit 29 is set to zero. */ + tcg_gen_andi_i64(o->addr1, o->addr1, 0x3ull); + gen_helper_srnm(cpu_env, o->addr1); + return DISAS_NEXT; +} =20 - switch (s->fields->op2) { - case 0x99: /* SRNM */ - pos =3D 0, len =3D 2; - break; - case 0xb8: /* SRNMB */ - pos =3D 0, len =3D 3; - break; - case 0xb9: /* SRNMT */ - pos =3D 4, len =3D 3; - break; - default: - tcg_abort(); - } - mask =3D (1 << len) - 1; +static DisasJumpType op_srnmb(DisasContext *s, DisasOps *o) +{ + /* Bits 0-55 are are ignored. */ + tcg_gen_andi_i64(o->addr1, o->addr1, 0xffull); + gen_helper_srnm(cpu_env, o->addr1); + return DISAS_NEXT; +} =20 - /* Insert the value into the appropriate field of the FPC. */ - if (b2 =3D=3D 0) { - tcg_gen_movi_i64(t1, d2 & mask); - } else { - tcg_gen_addi_i64(t1, regs[b2], d2); - tcg_gen_andi_i64(t1, t1, mask); - } - tcg_gen_ld32u_i64(t2, cpu_env, offsetof(CPUS390XState, fpc)); - tcg_gen_deposit_i64(t2, t2, t1, pos, len); - tcg_temp_free_i64(t1); +static DisasJumpType op_srnmt(DisasContext *s, DisasOps *o) +{ + TCGv_i64 tmp =3D tcg_temp_new_i64(); =20 - /* Then install the new FPC to set the rounding mode in fpu_status. */ - gen_helper_sfpc(cpu_env, t2); - tcg_temp_free_i64(t2); + /* Bits other than 61-63 are ignored. */ + tcg_gen_andi_i64(o->addr1, o->addr1, 0x7ull); + + /* No need to call a helper, we don't implement dfp */ + tcg_gen_ld32u_i64(tmp, cpu_env, offsetof(CPUS390XState, fpc)); + tcg_gen_deposit_i64(tmp, tmp, o->addr1, 4, 3); + tcg_gen_st32_i64(tmp, cpu_env, offsetof(CPUS390XState, fpc)); + + tcg_temp_free_i64(tmp); return DISAS_NEXT; } =20 --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 1550068749957965.4755557450356; Wed, 13 Feb 2019 06:39:09 -0800 (PST) Received: from localhost ([127.0.0.1]:57787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvgo-0003gR-Rd for importer@patchew.org; Wed, 13 Feb 2019 09:39:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbp-000055-Bi for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbn-0002KK-Fa for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:33:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59902) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbl-0002HN-Ih; Wed, 13 Feb 2019 09:33:53 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 8B14C8AE4A; Wed, 13 Feb 2019 14:33:51 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8597B5D6AA; Wed, 13 Feb 2019 14:33:48 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:17 +0100 Message-Id: <20190213143322.31371-11-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Feb 2019 14:33:51 +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 v2 10/15] s390x/tcg: Refactor saving/restoring the bfp rounding mode 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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 want to reuse this in the context of vector instructions. So use better matching names and introduce s390_restore_bfp_rounding_mode(). While at it, add proper newlines. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 112 +++++++++++++++++++++++--------------- target/s390x/internal.h | 2 + 2 files changed, 71 insertions(+), 43 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 70fa053e8d..0cd6e19ce8 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -372,7 +372,7 @@ uint32_t HELPER(cxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, return float_comp_to_cc(env, cmp); } =20 -static int swap_round_mode(CPUS390XState *env, int m3) +int s390_swap_bfp_rounding_mode(CPUS390XState *env, int m3) { int ret =3D env->fpu_status.float_rounding_mode; switch (m3) { @@ -401,12 +401,18 @@ static int swap_round_mode(CPUS390XState *env, int m3) return ret; } =20 +void s390_restore_bfp_rounding_mode(CPUS390XState *env, int old_mode) +{ + set_float_rounding_mode(old_mode, &env->fpu_status); +} + /* convert 64-bit int to 32-bit float */ uint64_t HELPER(cegb)(CPUS390XState *env, int64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float32 ret =3D int64_to_float32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -414,9 +420,10 @@ uint64_t HELPER(cegb)(CPUS390XState *env, int64_t v2, = uint32_t m3) /* convert 64-bit int to 64-bit float */ uint64_t HELPER(cdgb)(CPUS390XState *env, int64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float64 ret =3D int64_to_float64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -424,9 +431,10 @@ uint64_t HELPER(cdgb)(CPUS390XState *env, int64_t v2, = uint32_t m3) /* convert 64-bit int to 128-bit float */ uint64_t HELPER(cxgb)(CPUS390XState *env, int64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float128 ret =3D int64_to_float128(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return RET128(ret); } @@ -434,9 +442,10 @@ uint64_t HELPER(cxgb)(CPUS390XState *env, int64_t v2, = uint32_t m3) /* convert 64-bit uint to 32-bit float */ uint64_t HELPER(celgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float32 ret =3D uint64_to_float32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -444,9 +453,10 @@ uint64_t HELPER(celgb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 64-bit uint to 64-bit float */ uint64_t HELPER(cdlgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float64 ret =3D uint64_to_float64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -454,9 +464,10 @@ uint64_t HELPER(cdlgb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 64-bit uint to 128-bit float */ uint64_t HELPER(cxlgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float128 ret =3D uint64_to_float128(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return RET128(ret); } @@ -464,9 +475,10 @@ uint64_t HELPER(cxlgb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 32-bit float to 64-bit int */ uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); int64_t ret =3D float32_to_int64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -474,9 +486,10 @@ uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) /* convert 64-bit float to 64-bit int */ uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); int64_t ret =3D float64_to_int64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -484,10 +497,11 @@ uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 128-bit float to 64-bit int */ uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float128 v2 =3D make_float128(h, l); int64_t ret =3D float128_to_int64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -495,9 +509,10 @@ uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, = uint64_t l, uint32_t m3) /* convert 32-bit float to 32-bit int */ uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); int32_t ret =3D float32_to_int32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -505,9 +520,10 @@ uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) /* convert 64-bit float to 32-bit int */ uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); int32_t ret =3D float64_to_int32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -515,10 +531,11 @@ uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 128-bit float to 32-bit int */ uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float128 v2 =3D make_float128(h, l); int32_t ret =3D float128_to_int32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -526,11 +543,12 @@ uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h,= uint64_t l, uint32_t m3) /* convert 32-bit float to 64-bit uint */ uint64_t HELPER(clgeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint64_t ret; + v2 =3D float32_to_float64(v2, &env->fpu_status); ret =3D float64_to_uint64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -538,9 +556,10 @@ uint64_t HELPER(clgeb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 64-bit float to 64-bit uint */ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint64_t ret =3D float64_to_uint64(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -548,9 +567,10 @@ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 128-bit float to 64-bit uint */ uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint64_t ret =3D float128_to_uint64(make_float128(h, l), &env->fpu_sta= tus); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -558,9 +578,10 @@ uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h,= uint64_t l, uint32_t m3) /* convert 32-bit float to 32-bit uint */ uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint32_t ret =3D float32_to_uint32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -568,9 +589,10 @@ uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 64-bit float to 32-bit uint */ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint32_t ret =3D float64_to_uint32(v2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -578,9 +600,10 @@ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2= , uint32_t m3) /* convert 128-bit float to 32-bit uint */ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); uint32_t ret =3D float128_to_uint32(make_float128(h, l), &env->fpu_sta= tus); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -588,9 +611,10 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h,= uint64_t l, uint32_t m3) /* round to integer 32-bit */ uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float32 ret =3D float32_round_to_int(f2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -598,9 +622,10 @@ uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2,= uint32_t m3) /* round to integer 64-bit */ uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2, uint32_t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); float64 ret =3D float64_round_to_int(f2, &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return ret; } @@ -608,10 +633,11 @@ uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2= , uint32_t m3) /* round to integer 128-bit */ uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al, uint32= _t m3) { - int hold =3D swap_round_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + float128 ret =3D float128_round_to_int(make_float128(ah, al), &env->fpu_status); - set_float_rounding_mode(hold, &env->fpu_status); + s390_restore_bfp_rounding_mode(env, old_mode); handle_exceptions(env, GETPC()); return RET128(ret); } diff --git a/target/s390x/internal.h b/target/s390x/internal.h index e1c0b1bd3b..122fe037bc 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -315,6 +315,8 @@ uint32_t set_cc_nz_f128(float128 v); #define S390_IEEE_MASK_INEXACT 0x08 #define S390_IEEE_MASK_QUANTUM 0x04 uint8_t s390_softfloat_exc_to_ieee(unsigned int exc); +int s390_swap_bfp_rounding_mode(CPUS390XState *env, int m3); +void s390_restore_bfp_rounding_mode(CPUS390XState *env, int old_mode); =20 =20 /* gdbstub.c */ --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068998893486.6098732248133; Wed, 13 Feb 2019 06:43:18 -0800 (PST) Received: from localhost ([127.0.0.1]:57853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvkn-0007Bn-RK for importer@patchew.org; Wed, 13 Feb 2019 09:43:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbu-00007K-Vq for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbr-0002MK-7W for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbp-0002Jl-8s; Wed, 13 Feb 2019 09:33:58 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id BDED512B6; Wed, 13 Feb 2019 14:33:53 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB2685D6B3; Wed, 13 Feb 2019 14:33:51 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:18 +0100 Message-Id: <20190213143322.31371-12-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Feb 2019 14:33:53 +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 v2 11/15] s390x/tcg: Prepare for IEEE-inexact-exception control (XxC) 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" Some instructions allow to suppress IEEE inexact exceptions. z14 PoP, 9-23, "Suppression of Certain IEEE Exceptions" IEEE-inexact-exception control (XxC): Bit 1 of the M4 field is the XxC bit. If XxC is zero, recogni- tion of IEEE-inexact exception is not suppressed; if XxC is one, recognition of IEEE-inexact excep- tion is suppressed. Especially, handling for overflow/unerflow remains as is, inexact is reported along z14 PoP, 9-23, "Suppression of Certain IEEE Exceptions" For example, the IEEE-inexact-exception control (XxC) has no effect on the DXC; that is, the DXC for IEEE- overflow or IEEE-underflow exceptions along with the detail for exact, inexact and truncated, or inexact and incremented, is reported according to the actual con- dition. Follow up patches will wire it correctly up for the applicable instructions. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 114 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 0cd6e19ce8..f6f010ae35 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -50,7 +50,7 @@ uint8_t s390_softfloat_exc_to_ieee(unsigned int exc) } =20 /* Should be called after any operation that may raise IEEE exceptions. */ -static void handle_exceptions(CPUS390XState *env, uintptr_t retaddr) +static void handle_exceptions(CPUS390XState *env, bool XxC, uintptr_t reta= ddr) { unsigned s390_exc, qemu_exc; =20 @@ -101,7 +101,7 @@ static void handle_exceptions(CPUS390XState *env, uintp= tr_t retaddr) } =20 /* inexact handling */ - if (s390_exc & S390_IEEE_MASK_INEXACT) { + if (s390_exc & S390_IEEE_MASK_INEXACT && !XxC) { /* trap condition - overflow/underflow _not_ reported along */ if (s390_exc & S390_IEEE_MASK_INEXACT & env->fpc >> 24) { tcg_s390_data_exception(env, s390_exc & S390_IEEE_MASK_INEXACT, @@ -174,7 +174,7 @@ uint32_t set_cc_nz_f128(float128 v) uint64_t HELPER(aeb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float32 ret =3D float32_add(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -182,7 +182,7 @@ uint64_t HELPER(aeb)(CPUS390XState *env, uint64_t f1, u= int64_t f2) uint64_t HELPER(adb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float64 ret =3D float64_add(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -193,7 +193,7 @@ uint64_t HELPER(axb)(CPUS390XState *env, uint64_t ah, u= int64_t al, float128 ret =3D float128_add(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -201,7 +201,7 @@ uint64_t HELPER(axb)(CPUS390XState *env, uint64_t ah, u= int64_t al, uint64_t HELPER(seb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float32 ret =3D float32_sub(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -209,7 +209,7 @@ uint64_t HELPER(seb)(CPUS390XState *env, uint64_t f1, u= int64_t f2) uint64_t HELPER(sdb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float64 ret =3D float64_sub(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -220,7 +220,7 @@ uint64_t HELPER(sxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, float128 ret =3D float128_sub(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -228,7 +228,7 @@ uint64_t HELPER(sxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, uint64_t HELPER(deb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float32 ret =3D float32_div(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -236,7 +236,7 @@ uint64_t HELPER(deb)(CPUS390XState *env, uint64_t f1, u= int64_t f2) uint64_t HELPER(ddb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float64 ret =3D float64_div(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -247,7 +247,7 @@ uint64_t HELPER(dxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, float128 ret =3D float128_div(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -255,7 +255,7 @@ uint64_t HELPER(dxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, uint64_t HELPER(meeb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float32 ret =3D float32_mul(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -263,7 +263,7 @@ uint64_t HELPER(meeb)(CPUS390XState *env, uint64_t f1, = uint64_t f2) uint64_t HELPER(mdb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { float64 ret =3D float64_mul(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -272,7 +272,7 @@ uint64_t HELPER(mdeb)(CPUS390XState *env, uint64_t f1, = uint64_t f2) { float64 ret =3D float32_to_float64(f2, &env->fpu_status); ret =3D float64_mul(f1, ret, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -283,7 +283,7 @@ uint64_t HELPER(mxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, float128 ret =3D float128_mul(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -293,7 +293,7 @@ uint64_t HELPER(mxdb)(CPUS390XState *env, uint64_t ah, = uint64_t al, { float128 ret =3D float64_to_float128(f2, &env->fpu_status); ret =3D float128_mul(make_float128(ah, al), ret, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -301,7 +301,7 @@ uint64_t HELPER(mxdb)(CPUS390XState *env, uint64_t ah, = uint64_t al, uint64_t HELPER(ldeb)(CPUS390XState *env, uint64_t f2) { float64 ret =3D float32_to_float64(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -309,7 +309,7 @@ uint64_t HELPER(ldeb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, uint64_t al) { float64 ret =3D float128_to_float64(make_float128(ah, al), &env->fpu_s= tatus); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -317,7 +317,7 @@ uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, = uint64_t al) uint64_t HELPER(lxdb)(CPUS390XState *env, uint64_t f2) { float128 ret =3D float64_to_float128(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -325,7 +325,7 @@ uint64_t HELPER(lxdb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(lxeb)(CPUS390XState *env, uint64_t f2) { float128 ret =3D float32_to_float128(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -333,7 +333,7 @@ uint64_t HELPER(lxeb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2) { float32 ret =3D float64_to_float32(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -341,7 +341,7 @@ uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al) { float32 ret =3D float128_to_float32(make_float128(ah, al), &env->fpu_s= tatus); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -349,7 +349,7 @@ uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, = uint64_t al) uint32_t HELPER(ceb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { int cmp =3D float32_compare_quiet(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -357,7 +357,7 @@ uint32_t HELPER(ceb)(CPUS390XState *env, uint64_t f1, u= int64_t f2) uint32_t HELPER(cdb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { int cmp =3D float64_compare_quiet(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -368,7 +368,7 @@ uint32_t HELPER(cxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, int cmp =3D float128_compare_quiet(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -413,7 +413,7 @@ uint64_t HELPER(cegb)(CPUS390XState *env, int64_t v2, u= int32_t m3) float32 ret =3D int64_to_float32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -424,7 +424,7 @@ uint64_t HELPER(cdgb)(CPUS390XState *env, int64_t v2, u= int32_t m3) float64 ret =3D int64_to_float64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -435,7 +435,7 @@ uint64_t HELPER(cxgb)(CPUS390XState *env, int64_t v2, u= int32_t m3) float128 ret =3D int64_to_float128(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -446,7 +446,7 @@ uint64_t HELPER(celgb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) float32 ret =3D uint64_to_float32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -457,7 +457,7 @@ uint64_t HELPER(cdlgb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) float64 ret =3D uint64_to_float64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -468,7 +468,7 @@ uint64_t HELPER(cxlgb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) float128 ret =3D uint64_to_float128(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -479,7 +479,7 @@ uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2, = uint32_t m3) int64_t ret =3D float32_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -490,7 +490,7 @@ uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2, = uint32_t m3) int64_t ret =3D float64_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -502,7 +502,7 @@ uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, u= int64_t l, uint32_t m3) int64_t ret =3D float128_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -513,7 +513,7 @@ uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2, = uint32_t m3) int32_t ret =3D float32_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -524,7 +524,7 @@ uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2, = uint32_t m3) int32_t ret =3D float64_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -536,7 +536,7 @@ uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, u= int64_t l, uint32_t m3) int32_t ret =3D float128_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -549,7 +549,7 @@ uint64_t HELPER(clgeb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) v2 =3D float32_to_float64(v2, &env->fpu_status); ret =3D float64_to_uint64(v2, &env->fpu_status); s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -560,7 +560,7 @@ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) uint64_t ret =3D float64_to_uint64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -571,7 +571,7 @@ uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, = uint64_t l, uint32_t m3) uint64_t ret =3D float128_to_uint64(make_float128(h, l), &env->fpu_sta= tus); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -582,7 +582,7 @@ uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) uint32_t ret =3D float32_to_uint32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -593,7 +593,7 @@ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2,= uint32_t m3) uint32_t ret =3D float64_to_uint32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -604,7 +604,7 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, = uint64_t l, uint32_t m3) uint32_t ret =3D float128_to_uint32(make_float128(h, l), &env->fpu_sta= tus); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -615,7 +615,7 @@ uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2, = uint32_t m3) float32 ret =3D float32_round_to_int(f2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -626,7 +626,7 @@ uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2, = uint32_t m3) float64 ret =3D float64_round_to_int(f2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -634,11 +634,11 @@ uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2= , uint32_t m3) uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al, uint32= _t m3) { int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); - float128 ret =3D float128_round_to_int(make_float128(ah, al), &env->fpu_status); + s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 @@ -646,7 +646,7 @@ uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, = uint64_t al, uint32_t m3) uint32_t HELPER(keb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { int cmp =3D float32_compare(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -654,7 +654,7 @@ uint32_t HELPER(keb)(CPUS390XState *env, uint64_t f1, u= int64_t f2) uint32_t HELPER(kdb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { int cmp =3D float64_compare(f1, f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -665,7 +665,7 @@ uint32_t HELPER(kxb)(CPUS390XState *env, uint64_t ah, u= int64_t al, int cmp =3D float128_compare(make_float128(ah, al), make_float128(bh, bl), &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return float_comp_to_cc(env, cmp); } =20 @@ -674,7 +674,7 @@ uint64_t HELPER(maeb)(CPUS390XState *env, uint64_t f1, uint64_t f2, uint64_t f3) { float32 ret =3D float32_muladd(f2, f3, f1, 0, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -683,7 +683,7 @@ uint64_t HELPER(madb)(CPUS390XState *env, uint64_t f1, uint64_t f2, uint64_t f3) { float64 ret =3D float64_muladd(f2, f3, f1, 0, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -693,7 +693,7 @@ uint64_t HELPER(mseb)(CPUS390XState *env, uint64_t f1, { float32 ret =3D float32_muladd(f2, f3, f1, float_muladd_negate_c, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -703,7 +703,7 @@ uint64_t HELPER(msdb)(CPUS390XState *env, uint64_t f1, { float64 ret =3D float64_muladd(f2, f3, f1, float_muladd_negate_c, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -759,7 +759,7 @@ uint32_t HELPER(tcxb)(CPUS390XState *env, uint64_t ah, = uint64_t al, uint64_t m2) uint64_t HELPER(sqeb)(CPUS390XState *env, uint64_t f2) { float32 ret =3D float32_sqrt(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -767,7 +767,7 @@ uint64_t HELPER(sqeb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(sqdb)(CPUS390XState *env, uint64_t f2) { float64 ret =3D float64_sqrt(f2, &env->fpu_status); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return ret; } =20 @@ -775,7 +775,7 @@ uint64_t HELPER(sqdb)(CPUS390XState *env, uint64_t f2) uint64_t HELPER(sqxb)(CPUS390XState *env, uint64_t ah, uint64_t al) { float128 ret =3D float128_sqrt(make_float128(ah, al), &env->fpu_status= ); - handle_exceptions(env, GETPC()); + handle_exceptions(env, false, GETPC()); return RET128(ret); } =20 --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 15500688316591008.4805584829386; Wed, 13 Feb 2019 06:40:31 -0800 (PST) Received: from localhost ([127.0.0.1]:57795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvi5-0004o4-EP for importer@patchew.org; Wed, 13 Feb 2019 09:40:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbu-00007L-W7 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbr-0002MT-7v for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbp-0002Kl-B9; Wed, 13 Feb 2019 09:33:59 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id E076CCA1FC; Wed, 13 Feb 2019 14:33:55 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 078E35D6B6; Wed, 13 Feb 2019 14:33:53 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:19 +0100 Message-Id: <20190213143322.31371-13-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Feb 2019 14:33:56 +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 v2 12/15] s390x/tcg: Implement XxC and checks for most FP instructions 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" With the floating-point extension facility - CONVERT FROM LOGICAL - CONVERT TO LOGICAL - CONVERT TO FIXED - CONVERT FROM FIXED - LOAD FP INTEGER have both, a rounding mode specification and the inexact-exception control (XxC). Other instructions will be handled separatly. Check for valid rounding modes and forward also the XxC (via m4). To avoid a lot of boilerplate code and changes to the helpers, combine both, the m3 and m4 field in a combined 32 bit TCG variable. Perform checks at a central place, taking in account if the m3 or m4 field was ignore before the floating-point extension facility was introduced. Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 138 ++++++++++++---------- target/s390x/translate.c | 235 ++++++++++++++++++++++++++++---------- 2 files changed, 247 insertions(+), 126 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index f6f010ae35..a9fad6b3cd 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -170,6 +170,17 @@ uint32_t set_cc_nz_f128(float128 v) } } =20 +static inline uint8_t round_from_m34(uint32_t m34) +{ + return extract32(m34, 0, 4); +} + +static inline bool xxc_from_m34(uint32_t m34) +{ + /* XxC is bit 1 of m4 */ + return (extract32(m34, 4, 4) & 0x4) !=3D 0; +} + /* 32-bit FP addition */ uint64_t HELPER(aeb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { @@ -407,238 +418,239 @@ void s390_restore_bfp_rounding_mode(CPUS390XState *= env, int old_mode) } =20 /* convert 64-bit int to 32-bit float */ -uint64_t HELPER(cegb)(CPUS390XState *env, int64_t v2, uint32_t m3) +uint64_t HELPER(cegb)(CPUS390XState *env, int64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float32 ret =3D int64_to_float32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit int to 64-bit float */ -uint64_t HELPER(cdgb)(CPUS390XState *env, int64_t v2, uint32_t m3) +uint64_t HELPER(cdgb)(CPUS390XState *env, int64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float64 ret =3D int64_to_float64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit int to 128-bit float */ -uint64_t HELPER(cxgb)(CPUS390XState *env, int64_t v2, uint32_t m3) +uint64_t HELPER(cxgb)(CPUS390XState *env, int64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float128 ret =3D int64_to_float128(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return RET128(ret); } =20 /* convert 64-bit uint to 32-bit float */ -uint64_t HELPER(celgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(celgb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float32 ret =3D uint64_to_float32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit uint to 64-bit float */ -uint64_t HELPER(cdlgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cdlgb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float64 ret =3D uint64_to_float64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit uint to 128-bit float */ -uint64_t HELPER(cxlgb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cxlgb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float128 ret =3D uint64_to_float128(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return RET128(ret); } =20 /* convert 32-bit float to 64-bit int */ -uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); int64_t ret =3D float32_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit float to 64-bit int */ -uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); int64_t ret =3D float64_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 128-bit float to 64-bit int */ -uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m3) +uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float128 v2 =3D make_float128(h, l); int64_t ret =3D float128_to_int64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 32-bit float to 32-bit int */ -uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); int32_t ret =3D float32_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit float to 32-bit int */ -uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); int32_t ret =3D float64_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 128-bit float to 32-bit int */ -uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m3) +uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t= m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float128 v2 =3D make_float128(h, l); int32_t ret =3D float128_to_int32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 32-bit float to 64-bit uint */ -uint64_t HELPER(clgeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(clgeb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint64_t ret; =20 v2 =3D float32_to_float64(v2, &env->fpu_status); ret =3D float64_to_uint64(v2, &env->fpu_status); s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit float to 64-bit uint */ -uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint64_t ret =3D float64_to_uint64(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 128-bit float to 64-bit uint */ -uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) +uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint64_t ret =3D float128_to_uint64(make_float128(h, l), &env->fpu_sta= tus); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 32-bit float to 32-bit uint */ -uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint32_t ret =3D float32_to_uint32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 64-bit float to 32-bit uint */ -uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) +uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint32_t ret =3D float64_to_uint32(v2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 128-bit float to 32-bit uint */ -uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m3) +uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_= t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); uint32_t ret =3D float128_to_uint32(make_float128(h, l), &env->fpu_sta= tus); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* round to integer 32-bit */ -uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2, uint32_t m3) +uint64_t HELPER(fieb)(CPUS390XState *env, uint64_t f2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float32 ret =3D float32_round_to_int(f2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* round to integer 64-bit */ -uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2, uint32_t m3) +uint64_t HELPER(fidb)(CPUS390XState *env, uint64_t f2, uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float64 ret =3D float64_round_to_int(f2, &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* round to integer 128-bit */ -uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al, uint32= _t m3) +uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al, + uint32_t m34) { - int old_mode =3D s390_swap_bfp_rounding_mode(env, m3); + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float128 ret =3D float128_round_to_int(make_float128(ah, al), &env->fpu_status); =20 s390_restore_bfp_rounding_mode(env, old_mode); - handle_exceptions(env, false, GETPC()); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return RET128(ret); } =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index c2645891e8..e252ba375c 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1758,160 +1758,257 @@ static DisasJumpType op_cxb(DisasContext *s, Disa= sOps *o) return DISAS_NEXT; } =20 +static TCGv_i32 fpinst_extract_m34(DisasContext *s, bool m3_with_fpe, + bool m4_with_fpe) +{ + const bool fpe =3D s390_has_feat(S390_FEAT_FLOATING_POINT_EXT); + uint8_t m3 =3D get_field(s->fields, m3); + uint8_t m4 =3D get_field(s->fields, m4); + + /* m3 field was introduced with FPE */ + if (!fpe && m3_with_fpe) { + m3 =3D 0; + } + /* m4 field was introduced with FPE */ + if (!fpe && m4_with_fpe) { + m4 =3D 0; + } + + /* Check for valid rounding modes. Mode 3 was introduced later. */ + if (m3 =3D=3D 2 || m3 > 7 || (!fpe && m3 =3D=3D 3)) { + gen_program_exception(s, PGM_SPECIFICATION); + return NULL; + } + + return tcg_const_i32(deposit32(m3, 4, 4, m4)); +} + static DisasJumpType op_cfeb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cfeb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cfeb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f32(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cfdb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cfdb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cfdb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f64(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cfxb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cfxb(o->out, cpu_env, o->in1, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cfxb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f128(s, o->in1, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cgeb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cgeb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cgeb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f32(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cgdb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cgdb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cgdb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f64(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cgxb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cgxb(o->out, cpu_env, o->in1, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cgxb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f128(s, o->in1, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clfeb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clfeb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clfeb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f32(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clfdb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clfdb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clfdb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f64(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clfxb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clfxb(o->out, cpu_env, o->in1, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clfxb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f128(s, o->in1, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clgeb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clgeb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clgeb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f32(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clgdb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clgdb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clgdb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f64(s, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_clgxb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_clgxb(o->out, cpu_env, o->in1, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_clgxb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); gen_set_cc_nz_f128(s, o->in1, o->in2); return DISAS_NEXT; } =20 static DisasJumpType op_cegb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cegb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cegb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_cdgb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cdgb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cdgb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_cxgb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cxgb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cxgb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return_low128(o->out2); return DISAS_NEXT; } =20 static DisasJumpType op_celgb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_celgb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_celgb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_cdlgb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cdlgb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cdlgb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_cxlgb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_cxlgb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, false); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_cxlgb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return_low128(o->out2); return DISAS_NEXT; } @@ -2390,26 +2487,38 @@ static DisasJumpType op_ex(DisasContext *s, DisasOp= s *o) =20 static DisasJumpType op_fieb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_fieb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_fieb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_fidb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_fidb(o->out, cpu_env, o->in2, m3); - tcg_temp_free_i32(m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_fidb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_fixb(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); - gen_helper_fixb(o->out, cpu_env, o->in1, o->in2, m3); + TCGv_i32 m34 =3D fpinst_extract_m34(s, false, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_fixb(o->out, cpu_env, o->in1, o->in2, m34); return_low128(o->out2); - tcg_temp_free_i32(m3); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550068929223140.47094648380516; Wed, 13 Feb 2019 06:42:09 -0800 (PST) Received: from localhost ([127.0.0.1]:57845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvjY-00069b-Qh for importer@patchew.org; Wed, 13 Feb 2019 09:41:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbv-00007M-09 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbt-0002Ng-27 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58620) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbr-0002Lp-Bx; Wed, 13 Feb 2019 09:34:00 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 49EBA57021; Wed, 13 Feb 2019 14:33:58 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CCAA5D6B6; Wed, 13 Feb 2019 14:33:56 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:20 +0100 Message-Id: <20190213143322.31371-14-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Feb 2019 14:33:58 +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 v2 13/15] s390x/tcg: Implement rounding mode and XxC for LOAD ROUNDED 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" With the floating-point extension facility, LOAD ROUNDED has a rounding mode specification and the inexact-exception control (XxC). Handle them just like e.g. LOAD FP INTEGER. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 23 +++++++++++++++++------ target/s390x/helper.h | 6 +++--- target/s390x/insn-data.def | 6 +++--- target/s390x/translate.c | 24 +++++++++++++++++++++--- 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index a9fad6b3cd..5e4b76f4aa 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -317,10 +317,14 @@ uint64_t HELPER(ldeb)(CPUS390XState *env, uint64_t f2) } =20 /* convert 128-bit float to 64-bit float */ -uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, uint64_t al) +uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, uint64_t al, + uint32_t m34) { + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float64 ret =3D float128_to_float64(make_float128(ah, al), &env->fpu_s= tatus); - handle_exceptions(env, false, GETPC()); + + s390_restore_bfp_rounding_mode(env, old_mode); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 @@ -341,18 +345,25 @@ uint64_t HELPER(lxeb)(CPUS390XState *env, uint64_t f2) } =20 /* convert 64-bit float to 32-bit float */ -uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2) +uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2, uint32_t m34) { + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float32 ret =3D float64_to_float32(f2, &env->fpu_status); - handle_exceptions(env, false, GETPC()); + + s390_restore_bfp_rounding_mode(env, old_mode); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 /* convert 128-bit float to 32-bit float */ -uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al) +uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al, + uint32_t m34) { + int old_mode =3D s390_swap_bfp_rounding_mode(env, round_from_m34(m34)); float32 ret =3D float128_to_float32(make_float128(ah, al), &env->fpu_s= tatus); - handle_exceptions(env, false, GETPC()); + + s390_restore_bfp_rounding_mode(env, old_mode); + handle_exceptions(env, xxc_from_m34(m34), GETPC()); return ret; } =20 diff --git a/target/s390x/helper.h b/target/s390x/helper.h index d287d5dac0..bb659257f6 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -53,11 +53,11 @@ DEF_HELPER_FLAGS_3(mdb, TCG_CALL_NO_WG, i64, env, i64, = i64) DEF_HELPER_FLAGS_5(mxb, TCG_CALL_NO_WG, i64, env, i64, i64, i64, i64) DEF_HELPER_FLAGS_4(mxdb, TCG_CALL_NO_WG, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_2(ldeb, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_3(ldxb, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_4(ldxb, TCG_CALL_NO_WG, i64, env, i64, i64, i32) DEF_HELPER_FLAGS_2(lxdb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_2(lxeb, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(ledb, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_3(lexb, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(ledb, TCG_CALL_NO_WG, i64, env, i64, i32) +DEF_HELPER_FLAGS_4(lexb, TCG_CALL_NO_WG, i64, env, i64, i64, i32) DEF_HELPER_FLAGS_3(ceb, TCG_CALL_NO_WG_SE, i32, env, i64, i64) DEF_HELPER_FLAGS_3(cdb, TCG_CALL_NO_WG_SE, i32, env, i64, i64) DEF_HELPER_FLAGS_5(cxb, TCG_CALL_NO_WG_SE, i32, env, i64, i64, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 2c9ae503c5..3a8d4f6804 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -599,9 +599,9 @@ F(0xed05, LXDB, RXE, Z, 0, m2_64, new_P, x1, lxdb, 0, IF_BFP) F(0xed06, LXEB, RXE, Z, 0, m2_32u, new_P, x1, lxeb, 0, IF_BFP) /* LOAD ROUNDED */ - F(0xb344, LEDBR, RRE, Z, 0, f2, new, e1, ledb, 0, IF_BFP) - F(0xb345, LDXBR, RRE, Z, x2h, x2l, new, f1, ldxb, 0, IF_BFP) - F(0xb346, LEXBR, RRE, Z, x2h, x2l, new, e1, lexb, 0, IF_BFP) + F(0xb344, LEDBR, RRF_e, Z, 0, f2, new, e1, ledb, 0, IF_BFP) + F(0xb345, LDXBR, RRF_e, Z, x2h, x2l, new, f1, ldxb, 0, IF_BFP) + F(0xb346, LEXBR, RRF_e, Z, x2h, x2l, new, e1, lexb, 0, IF_BFP) =20 /* LOAD MULTIPLE */ C(0x9800, LM, RS_a, Z, 0, a2, 0, 0, lm32, 0) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index e252ba375c..02a4bb6ac2 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2787,19 +2787,37 @@ static DisasJumpType op_ldeb(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_ledb(DisasContext *s, DisasOps *o) { - gen_helper_ledb(o->out, cpu_env, o->in2); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_ledb(o->out, cpu_env, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_ldxb(DisasContext *s, DisasOps *o) { - gen_helper_ldxb(o->out, cpu_env, o->in1, o->in2); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_ldxb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 static DisasJumpType op_lexb(DisasContext *s, DisasOps *o) { - gen_helper_lexb(o->out, cpu_env, o->in1, o->in2); + TCGv_i32 m34 =3D fpinst_extract_m34(s, true, true); + + if (!m34) { + return DISAS_NORETURN; + } + gen_helper_lexb(o->out, cpu_env, o->in1, o->in2, m34); + tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 1550069127991511.38471993727273; Wed, 13 Feb 2019 06:45:27 -0800 (PST) Received: from localhost ([127.0.0.1]:57897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvmv-0000gq-2P for importer@patchew.org; Wed, 13 Feb 2019 09:45:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvc1-0000Bs-3P for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbv-0002PR-7W for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37062) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbu-0002NY-Vs; Wed, 13 Feb 2019 09:34:03 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 8669D1214B; Wed, 13 Feb 2019 14:34:00 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 677715D6AA; Wed, 13 Feb 2019 14:33:58 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:21 +0100 Message-Id: <20190213143322.31371-15-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Feb 2019 14:34:00 +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 v2 14/15] s390x/tcg: Handle all rounding modes overwritten by BFP instructions 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 , Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" PoP describes "Round to nearest with ties away from 0" as "The candidate nearest to the input value is selected. In case of a tie, the candidate selected is the one that is larger in magnitude." While float_round_ties_away is according to the introducing commit f9288a76f181 ("softfloat: Add support for ties-away rounding") "roundTiesToAway: the floating-point number nearest to the infinitely precise result shall be delivered; if the two nearest floating-point numbers bracketing an unrepresentable infinitely precise result are equally near, the one with larger magnitude shall be delivered." So this could be it if we're lucky ;) Handle "round to prepare for shorter precision" just as when setting it via SET FLOATING POINT and friends. As all instructions properly check for valid rounding modes in translate.c we can add an assert. Fix one missing empty line. Cc: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 5e4b76f4aa..f790ec0c8e 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -397,14 +397,26 @@ uint32_t HELPER(cxb)(CPUS390XState *env, uint64_t ah,= uint64_t al, int s390_swap_bfp_rounding_mode(CPUS390XState *env, int m3) { int ret =3D env->fpu_status.float_rounding_mode; + switch (m3) { case 0: /* current mode */ break; case 1: - /* biased round no nearest */ + /* round to nearest with ties away from 0 */ + set_float_rounding_mode(float_round_ties_away, &env->fpu_status); + break; + case 3: + /* + * round to prepare for shorter precision + * + * FIXME: we actually want something like round_to_odd, but that + * does not support all data types yet. + */ + set_float_rounding_mode(float_round_to_zero, &env->fpu_status); + break; case 4: - /* round to nearest */ + /* round to nearest with ties to even */ set_float_rounding_mode(float_round_nearest_even, &env->fpu_status= ); break; case 5: @@ -419,6 +431,8 @@ int s390_swap_bfp_rounding_mode(CPUS390XState *env, int= m3) /* round to -inf */ set_float_rounding_mode(float_round_down, &env->fpu_status); break; + default: + g_assert_not_reached(); } return ret; } --=20 2.17.2 From nobody Sat Nov 8 05:42:27 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550069344873897.1522162804725; Wed, 13 Feb 2019 06:49:04 -0800 (PST) Received: from localhost ([127.0.0.1]:57954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvqK-0002aC-J1 for importer@patchew.org; Wed, 13 Feb 2019 09:48:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtvbx-000085-SE for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtvbx-0002RD-0Y for qemu-devel@nongnu.org; Wed, 13 Feb 2019 09:34:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtvbv-0002On-Nr; Wed, 13 Feb 2019 09:34:04 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 90273C074EFF; Wed, 13 Feb 2019 14:34:02 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1FA15D704; Wed, 13 Feb 2019 14:34:00 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 15:33:22 +0100 Message-Id: <20190213143322.31371-16-david@redhat.com> In-Reply-To: <20190213143322.31371-1-david@redhat.com> References: <20190213143322.31371-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Feb 2019 14:34:02 +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 v2 15/15] s390x: Add floating-point extension facility to "qemu" cpu model 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: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, 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" The floating-point extension facility implemented certain changes to BFP, HFP and DFP instructions. As we don't implement HFP/DFP, we can ignore those completely. Related to BFP, the changes include - SET BFP ROUNDING MODE (SRNMB) instruction - BFP-rounding-mode field in the FPC register is changed to 3 bits - CONVERT FROM LOGICAL instructions - CONVERT TO LOGICAL instructions - Changes (rounding mode + XxC) added to -- CONVERT TO FIXED -- CONVERT FROM FIXED -- LOAD FP INTEGER -- LOAD ROUNDED -- DIVIDE TO INTEGER For TCG, we don't implement DIVIDE TO INTEGER, and it is harder to implement, so skip that. Also, as we don't implement PFPO, we can skip changes to that as well. The other parts are now implemented, we can indicate the facility. z14 PoP mentiones that "The floating-point extension facility is installed in the z/Architecture architectural mode. When bit 37 is one, bit 42 is also one.", meaning that the DFP (decimal-floating-point) facility also has to be inidicated. We can ignore that for now. Signed-off-by: David Hildenbrand --- target/s390x/gen-features.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 44eca45474..e4739a6b9f 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -601,6 +601,11 @@ static uint16_t qemu_V3_1[] =3D { }; =20 static uint16_t qemu_LATEST[] =3D { + /* + * Only BFP bits are implemented (HFP, DFP, PFPO and DIVIDE TO INTEGER= not + * implemented yet). + */ + S390_FEAT_FLOATING_POINT_EXT, S390_FEAT_ZPCI, }; =20 --=20 2.17.2