From patchwork Tue May 25 01:02:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 447098 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp3824679jac; Mon, 24 May 2021 18:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1Ziu96IokPoLVnSKeiKg5p9v+HHXiLqMX0Ss6SS8bO3TUbxt5ovZ7CHfgBSeed7olWfu5 X-Received: by 2002:a92:d18a:: with SMTP id z10mr18273725ilz.70.1621906331213; Mon, 24 May 2021 18:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621906331; cv=none; d=google.com; s=arc-20160816; b=zjbLZKBAn5KwACVMyXmo9QpssNjW7w8py9tJhOvHkRvKAwLi4lOyeiy+7wQOY9vNjo YDsbgUcJHHEOIfBTI85c6j+KoLNhEDjWCT8yjYp4Wq4KmTiYKNosLzbaTL4U9hTkWtz0 wkxKEudy4u0RmYf//1M5LTYRrVS2ddwFBLdJG81LcLvK416qi/JtBYVSnsSRjMvHQYkB 9mu8FiNs9GIja5IeRtJMKW4Vzmipf3KIdN6Z6OlHl1WVFBaeVUjHpda9ozCggbWuyddF CSszY9r9P6/7AjNWG476UGfikzZrHWvN7P5twrd2NKSd0sWjEPrbmeSFMOD/CDDvN/o9 5U7Q== 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=/gvD7a8f2BNOsA9JJLwFLYTrDJciHubXEtbSMNmmysw=; b=W+DDmwoSonwQG5Q+vLl+fIZsLtutcBy4MgWWTCy7MRTQYQQGEUQ8K1veXSN9y64Jua rorCdv0i+2XSjpyRFoq3KDVb2WdlaBS9qalGfhQNfL9jjjLWmWfLTJPC7kL0C12Teku3 uoYjd+1C07AFSdPghpY0J1Y3F3/sCEHeDv1PFSMnzu22nuPn2jI4ofjhumTePHOFFXvq SW7GE/TKJZUyg/usgkP2Zn8TuHkxpj/rnm02kQYkiOMbs+dznd1VoUQ0KWPlISVuLsV4 a3Z7KmzePs1LA3Pf+mQ4wSoMFBTKYXGDKkHgndG1aqPkJwBvEhkb/YJQwsmcF6muJZ/G if5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="oXCiNl0/"; 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 u15si18365236iot.55.2021.05.24.18.32.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 May 2021 18:32:11 -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=fail header.i=@linaro.org header.s=google header.b="oXCiNl0/"; 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]:51170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llLvW-00009d-Ku for patch@linaro.org; Mon, 24 May 2021 21:32:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llLV7-0002Gi-9Y for qemu-devel@nongnu.org; Mon, 24 May 2021 21:04:53 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:44798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llLUZ-0001ry-Sq for qemu-devel@nongnu.org; Mon, 24 May 2021 21:04:52 -0400 Received: by mail-pg1-x534.google.com with SMTP id 29so10300276pgu.11 for ; Mon, 24 May 2021 18:04:19 -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=/gvD7a8f2BNOsA9JJLwFLYTrDJciHubXEtbSMNmmysw=; b=oXCiNl0/8NVueEswb4jgV0nkBTcU0a3QmZ4pibtx/uvEUD2rMtN7Z2o4AYQ1biBQlH 87rlWrQTww9+I0RD9J8nYxHpQwmtp9nz0fce1KXNZzptZ5nEKeXrb7WU+98AvjoEzWEf Q0d3Krx/lU/Az+IVbiYoL6KfsONJqRj6cRj1YkqtB3dDDWnxp8CrWf1d3tGGe7iFErav aNSQxRmIZQFg1nP5NYHHvQNY8K1QjzzlZXHaKrecxW5tI476qPF/0eJu0IFSsmU4sp8m XHEz0jM539gL91TSsR1Aq9WKkkYmD+nebESGppli7lKd/7FGoTZoVn97LiThZiPODlL+ lAEQ== 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=/gvD7a8f2BNOsA9JJLwFLYTrDJciHubXEtbSMNmmysw=; b=cTjXKMid7jQjwj6Pdg0pPGHaEvg19FTDvYVcnNBbJVOqzkP6mVC4qWf6Ss9QI2NBBK P3t8gYGAp5HsQj3taoXjrKHPYV27qncUrucxBRTOgEE5luWMC6sh5YFwC+9dWfVfWQzT 8li0pplWSifq1S6BPcmzNMUactcGLOcEJLD3j2OT+a5nLaZEaDIiQ22W+6huyS8R1lQF vfN1+be79gUZazvsPq4skueaE0n1bqz2J0F3aqDIatpG7cmtLgiqvM3UCYiFBj3Atd2F wEFbp/Ypw5D20uuVfNbSDUuX4RC953mSBBZoUtASMpRCcC73xEZPRukrKXczygWmfrZs SHLQ== X-Gm-Message-State: AOAM530u4kCNrgguki96/YJ9Rh6091uzDB2BTcgq/NK8Sy7KuS+PYumH vVyQTWQFPR8t864YDH7EmFPZpaXRvFqhkg== X-Received: by 2002:a63:104a:: with SMTP id 10mr16326557pgq.66.1621904658524; Mon, 24 May 2021 18:04:18 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id b1sm13742645pgf.84.2021.05.24.18.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 18:04:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 31/92] target/arm: Implement SVE2 WHILERW, WHILEWR Date: Mon, 24 May 2021 18:02:57 -0700 Message-Id: <20210525010358.152808-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525010358.152808-1-richard.henderson@linaro.org> References: <20210525010358.152808-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Fix decodetree typo v3: Fix iteration counts (zhiwei). v4: Update for PREDDESC. --- target/arm/sve.decode | 3 ++ target/arm/translate-sve.c | 67 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) -- 2.25.1 diff --git a/target/arm/sve.decode b/target/arm/sve.decode index ae853d21f2..f365907518 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -702,6 +702,9 @@ CTERM 00100101 1 sf:1 1 rm:5 001000 rn:5 ne:1 0000 # SVE integer compare scalar count and limit WHILE 00100101 esz:2 1 rm:5 000 sf:1 u:1 lt:1 rn:5 eq:1 rd:4 +# SVE2 pointer conflict compare +WHILE_ptr 00100101 esz:2 1 rm:5 001 100 rn:5 rw:1 rd:4 + ### SVE Integer Wide Immediate - Unpredicated Group # SVE broadcast floating-point immediate (unpredicated) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index a55e747514..64aecc2db4 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3218,6 +3218,73 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) return true; } +static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) +{ + TCGv_i64 op0, op1, diff, t1, tmax; + TCGv_i32 t2, t3; + TCGv_ptr ptr; + unsigned vsz = vec_full_reg_size(s); + unsigned desc = 0; + + if (!dc_isar_feature(aa64_sve2, s)) { + return false; + } + if (!sve_access_check(s)) { + return true; + } + + op0 = read_cpu_reg(s, a->rn, 1); + op1 = read_cpu_reg(s, a->rm, 1); + + tmax = tcg_const_i64(vsz); + diff = tcg_temp_new_i64(); + + if (a->rw) { + /* WHILERW */ + /* diff = abs(op1 - op0), noting that op0/1 are unsigned. */ + t1 = tcg_temp_new_i64(); + tcg_gen_sub_i64(diff, op0, op1); + tcg_gen_sub_i64(t1, op1, op0); + tcg_gen_movcond_i64(TCG_COND_GEU, diff, op0, op1, diff, t1); + tcg_temp_free_i64(t1); + /* Round down to a multiple of ESIZE. */ + tcg_gen_andi_i64(diff, diff, -1 << a->esz); + /* If op1 == op0, diff == 0, and the condition is always true. */ + tcg_gen_movcond_i64(TCG_COND_EQ, diff, op0, op1, tmax, diff); + } else { + /* WHILEWR */ + tcg_gen_sub_i64(diff, op1, op0); + /* Round down to a multiple of ESIZE. */ + tcg_gen_andi_i64(diff, diff, -1 << a->esz); + /* If op0 >= op1, diff <= 0, the condition is always true. */ + tcg_gen_movcond_i64(TCG_COND_GEU, diff, op0, op1, tmax, diff); + } + + /* Bound to the maximum. */ + tcg_gen_umin_i64(diff, diff, tmax); + tcg_temp_free_i64(tmax); + + /* Since we're bounded, pass as a 32-bit type. */ + t2 = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(t2, diff); + tcg_temp_free_i64(diff); + + desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz / 8); + desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); + t3 = tcg_const_i32(desc); + + ptr = tcg_temp_new_ptr(); + tcg_gen_addi_ptr(ptr, cpu_env, pred_full_reg_offset(s, a->rd)); + + gen_helper_sve_whilel(t2, ptr, t2, t3); + do_pred_flags(t2); + + tcg_temp_free_ptr(ptr); + tcg_temp_free_i32(t2); + tcg_temp_free_i32(t3); + return true; +} + /* *** SVE Integer Wide Immediate - Unpredicated Group */