From patchwork Tue Mar 8 01:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549229 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2224631mag; Mon, 7 Mar 2022 18:14:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeGuIkcMGWHR3ZsA+alA6mlgC+n+TpQWEQpUCLU2YsDhcgjrIUBJn6b8c/uVPRGWvsaTLu X-Received: by 2002:a25:c686:0:b0:628:c9fa:9598 with SMTP id k128-20020a25c686000000b00628c9fa9598mr10897456ybf.410.1646705660572; Mon, 07 Mar 2022 18:14:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646705660; cv=none; d=google.com; s=arc-20160816; b=P2GnoRr8Ysak5EqGhICrB/OWFbN9TyBVGJTCWiqV8JJJbh/nBzl2P1GsSS6bqkG11M Xx8NN9OnGJst9BXrk2LIGPQUq2OqPcH/EWBnzEdM450ISqb5Rr++40HGU7bRgpUPDB9U hUkUC4hry35PcZTEAQ36HMfMnPe7oynd/3Du4DNikR5rlslQ97+TkmW/u4rUHxJn0jOU i4SzpEI3leK5Io31OJKtIDY/U3mSU2SvLff+Fa8Ikdg27jWU0vkd1xRpbLP85mo+GDjv r/JhNvpnVkOqogTeu0BesFrv0mrseabUE2CyZxYvkX8Z2fkhc2onD8BcI9cymM0Xvxdq edKQ== 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=RNzI9aMOcfsxb8P+d0xcuiRoCIwW/RkDBsYD1oyUds8=; b=vspBcc5QI1kSBzwJ03bxXV4wNexagd6Nm8Kh930cl2wcWQorTbLc2CxIc4mNFHDwXD 2yPgg2fQmGBsMfiM5iXrZN/+D4tPALLCcTNBjBNP7vs9r+NiUQbZ/d49lDjR/qa+pmbe uE58wZe8KJWQay57yorVjrdh+HIMeuzNPdrJtNcosk+CON4azo169MlfIakMBP9CbB6D ojnOSAJm15QFM+Hl6OAz2QRB4Kqi9IsICI3asO9BswtFSS7FdPk819DkMwmIk8aAwZO5 F4WkLhXD6hsxhmUkaJ4IPIMYqMGQAsm7WulKr3j8rWfLjDq1AAst4JMGXm1IavggeJfF AboA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Eodjgai5; 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 i16-20020a056902069000b006294c2ba22asi2491442ybt.567.2022.03.07.18.14.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 18:14:20 -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=Eodjgai5; 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]:58396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRPMi-0005zE-2d for patch@linaro.org; Mon, 07 Mar 2022 21:14:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRP3F-0006S6-1l for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:13 -0500 Received: from [2607:f8b0:4864:20::102d] (port=46005 helo=mail-pj1-x102d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRP3D-0007vt-5N for qemu-devel@nongnu.org; Mon, 07 Mar 2022 20:54:12 -0500 Received: by mail-pj1-x102d.google.com with SMTP id m11-20020a17090a7f8b00b001beef6143a8so966441pjl.4 for ; Mon, 07 Mar 2022 17:54:10 -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=RNzI9aMOcfsxb8P+d0xcuiRoCIwW/RkDBsYD1oyUds8=; b=Eodjgai5jR7PQhzDIV6FiCjpz6XqrQ/6U2OyWFl53Y5BEDXiXWk64ObcHJrvn+u+za THaMonAevkr5pUdF+G8FQw3cjsZoY+Tcnw8opXizaQ+SXSYWX2hsc4wZVLdjT4NiYj/8 4FQ/qzCL3PRpQfqfHANtA8KW0j7oWKn4mZh+A1TjOThEF5iTWWUPOo77NCFo2yx+Vl5g 6M1tg12olmQnHEG1XQO+n0p9fOw+ujauqEG+4bKFa4/0deqHZF0fWq0CrbSXj3I+2A8r ada9KwQd3TBOdWntpko2MC0vJRUbDLVCvC66a21hJLkEW+sVbpa4PLzL6SKTLfThqusa u8ww== 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=RNzI9aMOcfsxb8P+d0xcuiRoCIwW/RkDBsYD1oyUds8=; b=bHBtk2WyAPrSgXPypQH0kzDXTTw+2l6aAvbh/NwDvo5pH3K7HgGZnCa3+IH6nB89bc wYMU92O7opScvJn358Fny6bQpjaH81u30pDLFWxwHkjF4AMtpHIeyn0A4aDwaOqNSoys aHsJNFes83E5fZu5ooTew9M61ffjGXoy97S5rO4eJOawnc3RQVWSnccd96KgD9vV2k+z YarwtJagisxyKGr8rfWhIDK1aIv8Iac2NSPUn/F2nVBHnyMbiJTYksBNc6+6LH90wu/L PWpXbKrQL6H4WF0oSZD8rC5F4ljUIr4YovI3qijUAVD2ZH4lrWb5AQCN+I1wteUDJi7T EXfQ== X-Gm-Message-State: AOAM530nAh/DzW3oeFHYlUbsRUtMBogtpknlTEGhsB1zGOune5F+F0dq XoAguKS1zVxozx1n4YGhIpSWcoOjCxZx/Q== X-Received: by 2002:a17:90b:33d2:b0:1bf:3b3f:cb60 with SMTP id lk18-20020a17090b33d200b001bf3b3fcb60mr2101544pjb.109.1646704449848; Mon, 07 Mar 2022 17:54:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 17:54:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/11] target/s390x: vxeh2: vector {load, store} elements reversed Date: Mon, 7 Mar 2022 15:53:53 -1000 Message-Id: <20220308015358.188499-7-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::102d (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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-5-dmiller423@gmail.com> [rth: Use new hswap and wswap tcg expanders.] Signed-off-by: Richard Henderson --- target/s390x/tcg/translate_vx.c.inc | 84 +++++++++++++++++++++++++++++ target/s390x/tcg/insn-data.def | 4 ++ 2 files changed, 88 insertions(+) diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc index a5283ef2f8..ac807122a3 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -492,6 +492,46 @@ static DisasJumpType op_vlei(DisasContext *s, DisasOps *o) return DISAS_NEXT; } +static DisasJumpType op_vler(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s, m3); + + if (es < ES_16 || es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + /* Begin with the two doublewords swapped... */ + tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEUQ); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + tcg_gen_qemu_ld_i64(t0, o->addr1, get_mem_index(s), MO_TEUQ); + + /* ... then swap smaller elements within the doublewords as required. */ + switch (es) { + case MO_16: + tcg_gen_hswap_i64(t1, t1); + tcg_gen_hswap_i64(t0, t0); + break; + case MO_32: + tcg_gen_wswap_i64(t1, t1); + tcg_gen_wswap_i64(t0, t0); + break; + case MO_64: + break; + default: + g_assert_not_reached(); + } + + 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); + return DISAS_NEXT; +} + static DisasJumpType op_vlgv(DisasContext *s, DisasOps *o) { const uint8_t es = get_field(s, m4); @@ -976,6 +1016,50 @@ static DisasJumpType op_vste(DisasContext *s, DisasOps *o) return DISAS_NEXT; } +static DisasJumpType op_vster(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s, m3); + TCGv_i64 t0, t1; + + if (es < ES_16 || es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* Probe write access before actually modifying memory */ + gen_helper_probe_write_access(cpu_env, o->addr1, tcg_constant_i64(16)); + + /* Begin with the two doublewords swapped... */ + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + read_vec_element_i64(t1, get_field(s, v1), 0, ES_64); + read_vec_element_i64(t0, get_field(s, v1), 1, ES_64); + + /* ... then swap smaller elements within the doublewords as required. */ + switch (es) { + case MO_16: + tcg_gen_hswap_i64(t1, t1); + tcg_gen_hswap_i64(t0, t0); + break; + case MO_32: + tcg_gen_wswap_i64(t1, t1); + tcg_gen_wswap_i64(t0, t0); + break; + case MO_64: + break; + default: + g_assert_not_reached(); + } + + tcg_gen_qemu_st_i64(t0, o->addr1, get_mem_index(s), MO_TEUQ); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + tcg_gen_qemu_st_i64(t1, o->addr1, get_mem_index(s), MO_TEUQ); + + tcg_temp_free(t0); + tcg_temp_free(t1); + return DISAS_NEXT; +} + static DisasJumpType op_vstm(DisasContext *s, DisasOps *o) { const uint8_t v3 = get_field(s, v3); diff --git a/target/s390x/tcg/insn-data.def b/target/s390x/tcg/insn-data.def index 98a31a557d..b524541a7d 100644 --- a/target/s390x/tcg/insn-data.def +++ b/target/s390x/tcg/insn-data.def @@ -1037,6 +1037,8 @@ E(0xe741, VLEIH, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_16, IF_VEC) E(0xe743, VLEIF, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_32, IF_VEC) E(0xe742, VLEIG, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_64, IF_VEC) +/* VECTOR LOAD ELEMENTS REVERSED */ + F(0xe607, VLER, VRX, VE2, la2, 0, 0, 0, vler, 0, IF_VEC) /* VECTOR LOAD GR FROM VR ELEMENT */ F(0xe721, VLGV, VRS_c, V, la2, 0, r1, 0, vlgv, 0, IF_VEC) /* VECTOR LOAD LOGICAL ELEMENT AND ZERO */ @@ -1082,6 +1084,8 @@ E(0xe709, VSTEH, VRX, V, la2, 0, 0, 0, vste, 0, ES_16, IF_VEC) E(0xe70b, VSTEF, VRX, V, la2, 0, 0, 0, vste, 0, ES_32, IF_VEC) E(0xe70a, VSTEG, VRX, V, la2, 0, 0, 0, vste, 0, ES_64, IF_VEC) +/* VECTOR STORE ELEMENTS REVERSED */ + F(0xe60f, VSTER, VRX, VE2, la2, 0, 0, 0, vster, 0, IF_VEC) /* VECTOR STORE MULTIPLE */ F(0xe73e, VSTM, VRS_a, V, la2, 0, 0, 0, vstm, 0, IF_VEC) /* VECTOR STORE WITH LENGTH */