From patchwork Fri Apr 30 20:25:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 429906 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp810246jao; Fri, 30 Apr 2021 14:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiZt4AssXo7hGz5QR9RNpIMefUxRJY8X5KKPToyYC+rg0nv1vp+scnL2RRCT9JcnSqopz4 X-Received: by 2002:a05:6808:7cc:: with SMTP id f12mr2958656oij.131.1619818216947; Fri, 30 Apr 2021 14:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619818216; cv=none; d=google.com; s=arc-20160816; b=thRWTaqD/pCBKUrupyh8GJ4YWn0MbDR3BOy+FJ+BV3Z3i7pjeHZ/H1m4HTseD8djVr 4gKdQP9Txwh9XjK0gyxCjXC3evLMLbgupV2KNqNDacsvDN7dj8QhjTAOm1YKf5ltKKuc fuLOE27g3A4AuARVTE+g2+/Qkwl3/sJVwzieKwxD45OJB76KX2rwx1GrvBr172ZkOQJd idcvdt20x/22/ThY43xvyytIhF10IRyiCMB/4q2S6oB/g03cFA8OD1nhJoNwvXY+i3iN Ll0nc5pD0043yH1jsMwpMaCvvS/mPRRQHoTpd32Qke+hQRq842+VnDfOoJerKS3Qk5eN u5Cg== 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=I+TBcwieytkPS2OYIsYtt2Bc7+CxcGyhXME8l9tBoxY=; b=XYyNpXVJ2MchoZYUSAYEarelrhoSTgpJ1ESnFoVewdxRVKnsI58omghuCznHbWQ8QW 5cjjgdUbie3Q5pFT9c4RtwwRk6X9ktgq6+M6QnzFxKPLgs1FIMou/OHF/Doxlgaz97/e 8FQti4damLixc3gWxiJyq5+jRtMYeVToCCStE34BUIrBqXf7WrS8HI8B7yoEfM9/8CBq dnEup7dtFMKpndTdh8tk1ZGMmQrNN3dRlSak4TlDVFjagLm8RFw7SFMBDHKz2MnoQOQd TFJEzD6xRbsWTZwB3OvRd3X9xUhwIZYw6tr+tXXuMGLOjIIdLVqJEzFdSxzdFPzWBMhC a1cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=turO+97E; 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=pass (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 t14si4522117otk.319.2021.04.30.14.30.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Apr 2021 14:30:16 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=turO+97E; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcaiG-0000Bl-3i for patch@linaro.org; Fri, 30 Apr 2021 17:30:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcZml-00051y-HF for qemu-devel@nongnu.org; Fri, 30 Apr 2021 16:30:51 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:45596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcZlx-0007nj-2y for qemu-devel@nongnu.org; Fri, 30 Apr 2021 16:30:51 -0400 Received: by mail-pj1-x1033.google.com with SMTP id gc22-20020a17090b3116b02901558435aec1so2375243pjb.4 for ; Fri, 30 Apr 2021 13:29:55 -0700 (PDT) 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=I+TBcwieytkPS2OYIsYtt2Bc7+CxcGyhXME8l9tBoxY=; b=turO+97EA0Uxp80NQc82rF2bja7TdY8v5e1KWIEUYF6qbzkt+a9vCsEDl5FrfqRPbp ILT883tYcTn6+1mCqE2rG6LAgF9vMHUX/eaby+Pgfd97g/ZGlZtuDqJ9dnfUTpJrGJHL NBcXTzdNJuHN7M1u+dHfVip4xpGXYPcH+SXV3WPAF2YO1KSgxjgS4rS4NvcFnkoq+py4 4AueR3Gz2kWKnaxYmuhp0nGMjdy8G9a3WFxfBUNLIduKwaY2mGOC16mYhKf96/SV+daB JjZbTsXpJ/VTukLr15jjuLl9R9h1jjKzJn3OgVuwH/kVJKE21c9DCtLyolNWNAK1X/lD kCow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I+TBcwieytkPS2OYIsYtt2Bc7+CxcGyhXME8l9tBoxY=; b=ctZxolPRidE4+ym1FWY284uzC8M7bIJFQX0YpZPVfoNx2Bt7HYZhw/YABkjVJmm9Qo YdQQgL7p8yrSmydwv4GpDizmtJ9r8xTgrqewCPFWauWiRVwazBQDLjSDh35s9deVO3cs 9t0Ph5pyYLkgZ8Q5oVkhtyU9FyjlN/C4voGdq2uVGudNn3dBqDIl5vFG9tC5YfdaDG0e Eq9WAZVTXwZc6JA5swX344k/6Bz/R8FxlyfsRJDV7tflHbwryyCFQP5pwdS+xOa9yrmW e/MmEPca1ltFcK6nlNeWY+KRMszkTCC5vhgtQgWdkn0yOmi7GCObi7ZMM/MdSzp9SANy BvGQ== X-Gm-Message-State: AOAM531fz5ENh2k+R1+vtgOgG7EeUyVJmrK/qeE6BitAhfs/EMzSWBD5 r7WkNGMs4SfJSnjWXgL7OVOIOY/Mw07+Xg== X-Received: by 2002:a17:903:3106:b029:e9:15e8:250e with SMTP id w6-20020a1709033106b02900e915e8250emr6933921plc.33.1619814594579; Fri, 30 Apr 2021 13:29:54 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id q23sm3788781pgt.42.2021.04.30.13.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 13:29:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 70/82] target/arm: Implement SVE2 LD1RO Date: Fri, 30 Apr 2021 13:25:58 -0700 Message-Id: <20210430202610.1136687-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430202610.1136687-1-richard.henderson@linaro.org> References: <20210430202610.1136687-1-richard.henderson@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/sve.decode | 4 ++ target/arm/translate-sve.c | 97 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 17adb393ff..df870ce23b 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1077,11 +1077,15 @@ LD_zpri 1010010 .. nreg:2 0.... 111 ... ..... ..... @rpri_load_msz # SVE load and broadcast quadword (scalar plus scalar) LD1RQ_zprr 1010010 .. 00 ..... 000 ... ..... ..... \ @rprr_load_msz nreg=0 +LD1RO_zprr 1010010 .. 01 ..... 000 ... ..... ..... \ + @rprr_load_msz nreg=0 # SVE load and broadcast quadword (scalar plus immediate) # LD1RQB, LD1RQH, LD1RQS, LD1RQD LD1RQ_zpri 1010010 .. 00 0.... 001 ... ..... ..... \ @rpri_load_msz nreg=0 +LD1RO_zpri 1010010 .. 01 0.... 001 ... ..... ..... \ + @rpri_load_msz nreg=0 # SVE 32-bit gather prefetch (scalar plus 32-bit scaled offsets) PRF 1000010 00 -1 ----- 0-- --- ----- 0 ---- diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index ca393164bc..8a4eb8542f 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5586,6 +5586,103 @@ static bool trans_LD1RQ_zpri(DisasContext *s, arg_rpri_load *a) return true; } +static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) +{ + unsigned vsz = vec_full_reg_size(s); + unsigned vsz_r32; + TCGv_ptr t_pg; + TCGv_i32 t_desc; + int desc, poff, doff; + + if (vsz < 32) { + /* + * Note that this UNDEFINED check comes after CheckSVEEnabled() + * in the ARM pseudocode, which is the sve_access_check() done + * in our caller. We should not now return false from the caller. + */ + unallocated_encoding(s); + return; + } + + /* Load the first octaword using the normal predicated load helpers. */ + + poff = pred_full_reg_offset(s, pg); + if (vsz > 32) { + /* + * Zero-extend the first 32 bits of the predicate into a temporary. + * This avoids triggering an assert making sure we don't have bits + * set within a predicate beyond VQ, but we have lowered VQ to 2 + * for this load operation. + */ + TCGv_i64 tmp = tcg_temp_new_i64(); +#ifdef HOST_WORDS_BIGENDIAN + poff += 4; +#endif + tcg_gen_ld32u_i64(tmp, cpu_env, poff); + + poff = offsetof(CPUARMState, vfp.preg_tmp); + tcg_gen_st_i64(tmp, cpu_env, poff); + tcg_temp_free_i64(tmp); + } + + t_pg = tcg_temp_new_ptr(); + tcg_gen_addi_ptr(t_pg, cpu_env, poff); + + desc = simd_desc(32, 32, zt); + t_desc = tcg_const_i32(desc); + + gen_helper_gvec_mem *fn + = ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0]; + fn(cpu_env, t_pg, addr, t_desc); + + tcg_temp_free_ptr(t_pg); + tcg_temp_free_i32(t_desc); + + /* + * Replicate that first octaword. + * The replication happens in units of 32; if the full vector size + * is not a multiple of 32, the final bits are zeroed. + */ + doff = vec_full_reg_offset(s, zt); + vsz_r32 = QEMU_ALIGN_DOWN(vsz, 32); + if (vsz >= 64) { + tcg_gen_gvec_dup_mem(5, doff + 32, doff, vsz_r32 - 32, vsz - 32); + } else if (vsz > vsz_r32) { + /* Nop move, with side effect of clearing the tail. */ + tcg_gen_gvec_mov(MO_64, doff, doff, vsz_r32, vsz); + } +} + +static bool trans_LD1RO_zprr(DisasContext *s, arg_rprr_load *a) +{ + if (!dc_isar_feature(aa64_sve_f64mm, s)) { + return false; + } + if (a->rm == 31) { + return false; + } + if (sve_access_check(s)) { + TCGv_i64 addr = new_tmp_a64(s); + tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype)); + tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); + do_ldro(s, a->rd, a->pg, addr, a->dtype); + } + return true; +} + +static bool trans_LD1RO_zpri(DisasContext *s, arg_rpri_load *a) +{ + if (!dc_isar_feature(aa64_sve_f64mm, s)) { + return false; + } + if (sve_access_check(s)) { + TCGv_i64 addr = new_tmp_a64(s); + tcg_gen_addi_i64(addr, cpu_reg_sp(s, a->rn), a->imm * 32); + do_ldro(s, a->rd, a->pg, addr, a->dtype); + } + return true; +} + /* Load and broadcast element. */ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a) {