From patchwork Tue Mar 8 01:53:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549227 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2221855mag; Mon, 7 Mar 2022 18:09:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL0XABikL1Mi6pWUBHe9XcNa8U60wrErUaWm43AA5gHaOUIsU9LvucI0420KnZMglzukI0 X-Received: by 2002:a25:ca4d:0:b0:629:7c93:cf82 with SMTP id a74-20020a25ca4d000000b006297c93cf82mr3025162ybg.358.1646705371461; Mon, 07 Mar 2022 18:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646705371; cv=none; d=google.com; s=arc-20160816; b=d6tDtT/MsCnL5O8raO4cMbbtUJdocYgTcPvrFkeBZZndCsDgDCgrgbW5D0e6OZMdnx kIhIOgIOD34GGCyUTysxO5pn8OmybwYJI0Zcj/e8GYz9iXT2udzyKw6yrZXJIL/a0cdY 58fbLUcn9yDR6rQcy2krtuxIXh2I8Ldb8A8O3bt3/58nNtg82flju98u97koYJ9tqAcJ yjwaLTh7hKsrF3D+oBz7N9mlDVK6p5JNA5M8zKRuBFZdk/3z0ZFGfWKKwbyT086cDmt5 f0cl+BcgopXszLcIpF7YS5n8+vBiYl46nGDIQvzY59VT5bC7DNNfII3/vlnS80Q8gp8G IbGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=s4dZmbRh2Z7b/qkwNBn40zKvQk9ZYcdX9O2tzQ7T6K4=; b=q5Qb06BIR0uOnhVtnZpRojMBdPS/8yG5Z1wZHu5RWDQ/Z+MU8AKM0aVRI9rlngSS5G PF27ru4kdO2/T9j6GaWA2J7aYuGdtTNy7zip1xwIL3nfNB3lwclvQeCPEDfZ94j1r9n2 3khDHUk9STGmnjxFxrYDlhAIF5crmA+9BqBkYrG06rNIuCSsmGvJiPpYm2XgVJl3hMIB Bo+gr6Nvj0iaHAvziu0kOcF1oESsYtJzVdSC005CvihKKAskkoL9ncZX3wUz+RhSiB2o uAFAJ36iqOtOujIfohHAJITG20HXVZJ3PYTFXMiczfnNC2jofKc+e8C9WdNoNkM26Qs9 23zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iC8NwRV+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z5-20020a056902140500b00629de613bf4si1280367ybu.579.2022.03.07.18.09.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 18:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iC8NwRV+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRPI2-0007yM-VS for patch@linaro.org; Mon, 07 Mar 2022 21:09:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRP39-00064Z-6E for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:07 -0500 Received: from [2607:f8b0:4864:20::631] (port=37642 helo=mail-pl1-x631.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRP37-0007sZ-Dh for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:06 -0500 Received: by mail-pl1-x631.google.com with SMTP id n2so6196299plf.4 for ; Mon, 07 Mar 2022 17:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s4dZmbRh2Z7b/qkwNBn40zKvQk9ZYcdX9O2tzQ7T6K4=; b=iC8NwRV+KrprasLje1YnlduBkFtpcDGKHzBOlkmJLRERN/FwRAspw1Evkt3szM0JgO OPMzxzuPKqrcHfJV7jhPsOPLx8OYAltmiI2kMbIV1aZjhFvJD2FMdgjWHQI1l4f5bsU8 zN82HSyZVEp3lvUNXTi4ffqze76KgpE5G53AHsWJeKsem9FtNBjVNZNw1U6TquR4EiBs 7grlHcUMAlJoVXAyid/oCNDhC9dbKXzkrcfXSr5+1XyUEcmnQHSTREeShXumsZNwGRsP tyGppmGQXMyTh0ThFDCOSXG2qNktkIA3eFbm+4C0a53hn2HM0dwLcZNHHpQvGifLyw11 T4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s4dZmbRh2Z7b/qkwNBn40zKvQk9ZYcdX9O2tzQ7T6K4=; b=J4vjACuE/aWRyKOOO5NkyjYvC3t5yh26WLHPDezS7mUeULHD7f8hAoL/7RzAJFn7Hj snkNaJ9gtWTHNMeYPiD6PbvuQwxayekamKVw5Kfye+v2Ax6K8jHlSDq6zKomMP+1hR9z bWFgIB0XDP4vbHAxm2Nu3DsCcvpCOUAOQpe0OHcl1XwjCWq9R834k9kW4aXCwMUXP86/ QbCz9LioX88iKKvZyLn5B1I70RzAOEoVTCNoIeodTW+i6NLhXAL9TVlfAn3SCDc3LcRc +FXklVP39BlemuprJvbVeJQZg9TPBNhjGaVuXIZVK7rF9o3I6KUVBQr/Ox1ygby1xezE 6wew== X-Gm-Message-State: AOAM532xfSUbIFz4nRkRtAEKHgIICrwhha+IwALiLg4f5TwSUNJD4Ryy SWZ52xy9Whek07DilYtggrdBzWJv6t2BXA== X-Received: by 2002:a17:902:ccc1:b0:151:fbe6:4982 with SMTP id z1-20020a170902ccc100b00151fbe64982mr2265196ple.124.1646704444099; Mon, 07 Mar 2022 17:54:04 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id bh3-20020a056a02020300b00378b62df320sm12775221pgb.73.2022.03.07.17.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 17:54:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/11] target/s390x: vxeh2: vector convert short/32b Date: Mon, 7 Mar 2022 15:53:49 -1000 Message-Id: <20220308015358.188499-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308015358.188499-1-richard.henderson@linaro.org> References: <20220308015358.188499-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::631 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, dmiller423@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: David Miller Signed-off-by: David Miller Reviewed-by: Richard Henderson Message-Id: <20220307020327.3003-2-dmiller423@gmail.com> Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/helper.h | 4 +++ target/s390x/tcg/vec_fpu_helper.c | 31 ++++++++++++++++++++ target/s390x/tcg/translate_vx.c.inc | 44 ++++++++++++++++++++++++++--- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 69f69cf718..7cbcbd7f0b 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -275,6 +275,10 @@ DEF_HELPER_FLAGS_5(gvec_vfche64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32 DEF_HELPER_5(gvec_vfche64_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfche128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfche128_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vcdg32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vcdlg32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vcgd32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vclgd32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdlg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) diff --git a/target/s390x/tcg/vec_fpu_helper.c b/target/s390x/tcg/vec_fpu_helper.c index 1a77993471..6834dbc540 100644 --- a/target/s390x/tcg/vec_fpu_helper.c +++ b/target/s390x/tcg/vec_fpu_helper.c @@ -176,6 +176,30 @@ static void vop128_2(S390Vector *v1, const S390Vector *v2, CPUS390XState *env, *v1 = tmp; } +static float32 vcdg32(float32 a, float_status *s) +{ + return int32_to_float32(a, s); +} + +static float32 vcdlg32(float32 a, float_status *s) +{ + return uint32_to_float32(a, s); +} + +static float32 vcgd32(float32 a, float_status *s) +{ + const float32 tmp = float32_to_int32(a, s); + + return float32_is_any_nan(a) ? INT32_MIN : tmp; +} + +static float32 vclgd32(float32 a, float_status *s) +{ + const float32 tmp = float32_to_uint32(a, s); + + return float32_is_any_nan(a) ? 0 : tmp; +} + static float64 vcdg64(float64 a, float_status *s) { return int64_to_float64(a, s); @@ -211,6 +235,9 @@ void HELPER(gvec_##NAME##BITS)(void *v1, const void *v2, CPUS390XState *env, \ vop##BITS##_2(v1, v2, env, se, XxC, erm, FN, GETPC()); \ } +#define DEF_GVEC_VOP2_32(NAME) \ +DEF_GVEC_VOP2_FN(NAME, NAME##32, 32) + #define DEF_GVEC_VOP2_64(NAME) \ DEF_GVEC_VOP2_FN(NAME, NAME##64, 64) @@ -219,6 +246,10 @@ DEF_GVEC_VOP2_FN(NAME, float32_##OP, 32) \ DEF_GVEC_VOP2_FN(NAME, float64_##OP, 64) \ DEF_GVEC_VOP2_FN(NAME, float128_##OP, 128) +DEF_GVEC_VOP2_32(vcdg) +DEF_GVEC_VOP2_32(vcdlg) +DEF_GVEC_VOP2_32(vcgd) +DEF_GVEC_VOP2_32(vclgd) DEF_GVEC_VOP2_64(vcdg) DEF_GVEC_VOP2_64(vcdlg) DEF_GVEC_VOP2_64(vcgd) diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc index 98eb7710a4..ea28e40d4f 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -2720,23 +2720,59 @@ static DisasJumpType op_vcdg(DisasContext *s, DisasOps *o) switch (s->fields.op2) { case 0xc3: - if (fpf == FPF_LONG) { + switch (fpf) { + case FPF_LONG: fn = gen_helper_gvec_vcdg64; + break; + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH2)) { + fn = gen_helper_gvec_vcdg32; + } + break; + default: + break; } break; case 0xc1: - if (fpf == FPF_LONG) { + switch (fpf) { + case FPF_LONG: fn = gen_helper_gvec_vcdlg64; + break; + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH2)) { + fn = gen_helper_gvec_vcdlg32; + } + break; + default: + break; } break; case 0xc2: - if (fpf == FPF_LONG) { + switch (fpf) { + case FPF_LONG: fn = gen_helper_gvec_vcgd64; + break; + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH2)) { + fn = gen_helper_gvec_vcgd32; + } + break; + default: + break; } break; case 0xc0: - if (fpf == FPF_LONG) { + switch (fpf) { + case FPF_LONG: fn = gen_helper_gvec_vclgd64; + break; + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH2)) { + fn = gen_helper_gvec_vclgd32; + } + break; + default: + break; } break; case 0xc7: