From patchwork Tue Mar 8 01:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549225 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2219541mag; Mon, 7 Mar 2022 18:05:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKo+D/kEPZDmQkxfv0+SqZPNgakO+IBmmt4qdcsb73JFVHfyW13zM2mRrbJhCcU3m2JYln X-Received: by 2002:a05:6902:4e6:b0:629:15c5:9554 with SMTP id w6-20020a05690204e600b0062915c59554mr10410375ybs.557.1646705137726; Mon, 07 Mar 2022 18:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646705137; cv=none; d=google.com; s=arc-20160816; b=azx4boxEHUhSoObO+FmwX/EvC0g3B+RpE4yPhue0ZoLW3YNxqWaRxV0Zp2MPlFp54K eIMz7UPaIX2k8oJ9KvmFzpri5nv41pgxem0mBHBdW6oDVSv2JNn2/QxeHfFxewoyFtov SPimi4iWVoKO/NDLo7w3dz0BhUfCfXmfZSlCVW5F9vgvVxxWFu3XQqX0UoCzfG9UCQJF Q31A36B8pje/wAaj7A0S86A7bwAFMTRTDcuWSb22w2MnBTRs2Nk3wMODKf26q+CJecfK PpHmPqgfv6TDR9JRA9gcJtodZqrpFkLiFWhZUdLkofijF8QFksiVqmzHWhOU5fBChNt8 XJAw== 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=MCV0xYW3eH4D4MBbJdJ88nG5hPy3ZDKg9ma6dHXWn/o=; b=DlXOcK7KmrveCaTy77KYlrtsW78emgLs+1rYpDu/NiWOktHJoUlH8VTCXma934dj3B owTKVX7hur4s2ymdj+FAq2k5QSBw8jr8V/6wW3cYLmdzzLudFZZNs4Z/g4fULxPrYDV5 CB1Z9RbZyb8XnB9bPpyRm/5QUeeIPf23ClOFvD28C9gaHrCaP0n2al/UTENL2HPsK8TJ utKciAyUu8elHOOAe2GmsxdarMhJrb253aLv7xlAxprQUMZtH57iC/rMNnCsemyfgbY3 h3uR1Ne5Gv9dKd06WntMrM3tqj3OPiz8HcueT35z+fjxZCXqWTCuH034k829zXeabln3 4a+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fx5yDYVr; 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 h20-20020a81b654000000b002dbc3590913si9249029ywk.532.2022.03.07.18.05.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 18:05:37 -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=fx5yDYVr; 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]:38050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRPEH-0000Se-7g for patch@linaro.org; Mon, 07 Mar 2022 21:05:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRP3D-0006Ks-Bs for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:11 -0500 Received: from [2607:f8b0:4864:20::1033] (port=42760 helo=mail-pj1-x1033.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRP3B-0007ui-Jr for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:11 -0500 Received: by mail-pj1-x1033.google.com with SMTP id c16-20020a17090aa61000b001befad2bfaaso981685pjq.1 for ; Mon, 07 Mar 2022 17:54:09 -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=MCV0xYW3eH4D4MBbJdJ88nG5hPy3ZDKg9ma6dHXWn/o=; b=fx5yDYVrRfCfq3zZQQJANhspkBOyX1eLmHcJzwiPdHoR0vEvvDvkX/5iMd/G6mIEf7 YAGF4+fUIDwgU88Xo25m5c+cYjk5itiUzTyggMcmYDQpkVpQ3omMtsGDX/ny0FCz7NK+ 5ey25W9PM7i6Rkyq/CbM9X5NTJWDooKLxDAQKfkPbNx4Inpav+LLEmuf6m7uPCbPmXnu +GtlAnb9bUeznHYEiLkgNyz03oIIQT8ibPXUZdubFVktyhS01GU8YKpOr/70El86g95/ h1MM7JY1dICW0+7oAju8bA7ifn57MfkwScauFgRfeGyjKSIWaTKo1GaQeVNlDre1lzj+ 1maA== 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=MCV0xYW3eH4D4MBbJdJ88nG5hPy3ZDKg9ma6dHXWn/o=; b=ndEBPPm6WNuxE0iS96y7eNA0jJFlHjrSY2QrP6B4+6Nwklh+atRibc0Mqq69XK4jQL C5e4nrfzE7gf7uf1+32gRnfXmf74/V1FM9Tg9OB7mOtv0GcRqWNmxzk/mxc8eDhiCbX3 g4D5lygO+T0oeZtW46TZ406wrJa2mK8VAxECk90wVs+i20qaadwcJnEc3AbJUhpk1YsL JbONsCjD3202Ds75xcWMuFc0a+KVCRmwmFKIrPMvvvGZqG7ztcRrL+D7IoxwVZWdB+LV edXMm+om0SGOhFTaMlxkdHCBn34qKgXP2vMqfeujI34SMICTz7pKrFmCA4v7Xna+lchy fdzg== X-Gm-Message-State: AOAM5317lz1dFuNptldVnpJmVBy1kUARGAwKHQ5rPZyaBLQq3xX45Vpp USjSXNvCAyRoyFVdKNRaKFzx2LIS5kO79A== X-Received: by 2002:a17:902:ecd2:b0:151:d4b6:34ed with SMTP id a18-20020a170902ecd200b00151d4b634edmr13168887plh.7.1646704448348; Mon, 07 Mar 2022 17:54:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 17:54:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/11] target/s390x: vxeh2: vector shift double by bit Date: Mon, 7 Mar 2022 15:53:52 -1000 Message-Id: <20220308015358.188499-6-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::1033 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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 Message-Id: <20220307020327.3003-4-dmiller423@gmail.com> [rth: Split out of larger patch.] Signed-off-by: Richard Henderson --- target/s390x/tcg/translate_vx.c.inc | 47 ++++++++++++++++++++++++++--- target/s390x/tcg/insn-data.def | 6 +++- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc index 967f6213d8..a5283ef2f8 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -2056,11 +2056,19 @@ static DisasJumpType op_vsrl(DisasContext *s, DisasOps *o) gen_helper_gvec_vsrl_ve2); } -static DisasJumpType op_vsldb(DisasContext *s, DisasOps *o) +static DisasJumpType op_vsld(DisasContext *s, DisasOps *o) { - const uint8_t i4 = get_field(s, i4) & 0xf; - const int left_shift = (i4 & 7) * 8; - const int right_shift = 64 - left_shift; + const bool byte = s->insn->data; + const uint8_t mask = byte ? 15 : 7; + const uint8_t mul = byte ? 8 : 1; + const uint8_t i4 = get_field(s, i4); + const int right_shift = 64 - (i4 & 7) * mul; + + if (i4 & ~mask) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2 = tcg_temp_new_i64(); @@ -2074,8 +2082,39 @@ static DisasJumpType op_vsldb(DisasContext *s, DisasOps *o) read_vec_element_i64(t1, get_field(s, v3), 0, ES_64); read_vec_element_i64(t2, get_field(s, v3), 1, ES_64); } + tcg_gen_extract2_i64(t0, t1, t0, right_shift); tcg_gen_extract2_i64(t1, t2, t1, right_shift); + + write_vec_element_i64(t0, get_field(s, v1), 0, ES_64); + write_vec_element_i64(t1, get_field(s, v1), 1, ES_64); + + tcg_temp_free(t0); + tcg_temp_free(t1); + tcg_temp_free(t2); + return DISAS_NEXT; +} + +static DisasJumpType op_vsrd(DisasContext *s, DisasOps *o) +{ + const uint8_t i4 = get_field(s, i4); + + if (i4 & ~7) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + TCGv_i64 t2 = tcg_temp_new_i64(); + + read_vec_element_i64(t0, get_field(s, v2), 1, ES_64); + read_vec_element_i64(t1, get_field(s, v3), 0, ES_64); + read_vec_element_i64(t2, get_field(s, v3), 1, ES_64); + + tcg_gen_extract2_i64(t0, t1, t0, i4); + tcg_gen_extract2_i64(t1, t2, t1, i4); + write_vec_element_i64(t0, get_field(s, v1), 0, ES_64); write_vec_element_i64(t1, get_field(s, v1), 1, ES_64); diff --git a/target/s390x/tcg/insn-data.def b/target/s390x/tcg/insn-data.def index f487a64abf..98a31a557d 100644 --- a/target/s390x/tcg/insn-data.def +++ b/target/s390x/tcg/insn-data.def @@ -1207,12 +1207,16 @@ E(0xe774, VSL, VRR_c, V, 0, 0, 0, 0, vsl, 0, 0, IF_VEC) /* VECTOR SHIFT LEFT BY BYTE */ E(0xe775, VSLB, VRR_c, V, 0, 0, 0, 0, vsl, 0, 1, IF_VEC) +/* VECTOR SHIFT LEFT DOUBLE BY BIT */ + E(0xe786, VSLD, VRI_d, VE2, 0, 0, 0, 0, vsld, 0, 0, IF_VEC) /* VECTOR SHIFT LEFT DOUBLE BY BYTE */ - F(0xe777, VSLDB, VRI_d, V, 0, 0, 0, 0, vsldb, 0, IF_VEC) + E(0xe777, VSLDB, VRI_d, V, 0, 0, 0, 0, vsld, 0, 1, IF_VEC) /* VECTOR SHIFT RIGHT ARITHMETIC */ E(0xe77e, VSRA, VRR_c, V, 0, 0, 0, 0, vsra, 0, 0, IF_VEC) /* VECTOR SHIFT RIGHT ARITHMETIC BY BYTE */ E(0xe77f, VSRAB, VRR_c, V, 0, 0, 0, 0, vsra, 0, 1, IF_VEC) +/* VECTOR SHIFT RIGHT DOUBLE BY BIT */ + F(0xe787, VSRD, VRI_d, VE2, 0, 0, 0, 0, vsrd, 0, IF_VEC) /* VECTOR SHIFT RIGHT LOGICAL */ E(0xe77c, VSRL, VRR_c, V, 0, 0, 0, 0, vsrl, 0, 0, IF_VEC) /* VECTOR SHIFT RIGHT LOGICAL BY BYTE */