From patchwork Tue Mar 9 16:19:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 396051 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp2803927jai; Tue, 9 Mar 2021 10:07:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRfLcDuFQrpdIK8c9bZUfdykR/90xier/eIfSokLhCeb9g66PdNdA0MgQoUJk5Kfy8hfKW X-Received: by 2002:a05:6e02:1c83:: with SMTP id w3mr26526795ill.216.1615313246752; Tue, 09 Mar 2021 10:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615313246; cv=none; d=google.com; s=arc-20160816; b=NPRXgtXi5RjwmVoATxIBm99PDSyxcIuBYQkaZgi5eOC8kdIAQucPOGmMQic9osLM7P F9XQe1dnmE25gefyGDYxoCYfqlr4UuxmFlCzlULFbotBIMh9tpMjerrukMZCp8sofWWi 3GoegT9FmvjaaWDB/Qa3RQRc7ZW6rgmcuW4NJSFZ0URv8iF+e55pSIyij22AtqF98u1Q C/3b8rhDC4pIqUK2CqANp8IAMu2cohhcawcQojKGz4KUGk95++JO4aTqS8xE9iVv6xzE c3HvEhQtILrlVk9l73N6Lqsar7JZlNKWj8wa1IL4jYwCcdC6RZg0N3whTCO4RnzdLrb2 mZtw== 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=OMON+uvzPOXYOLaXkReV00C37gevE1AfAAGsidJktiM=; b=xHebg7IlgbMpYEsWsiWlS0G5ZmG12hpgynpVitKYzkACawwJHglFMcQRxPb2EcYsbC F63HdZQwcyl4EZVtDougjGNvre1KpniiOPkiNG4yvZhvjO4bJnjDWQowc+fY8c8KWqjU K0nPWi/m659mmlvmxCbU8KdnO6wcaXsrcEP9T6EsGDbtFcq1UEXIsYaSWd0pSO5ZhgM+ eH6/w96XQ0LyMqX2TjrPqU/DaSTnhKi8zsDHaJwKME79SF6XOfvgo28zj/WAAi5FD0CU YcVRsF9dcRsubjTjfDWKRdwI3HsxHlbPvFUt0+98jQgXVE11PD8bAgwpYeP3AjJhScky KgCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APWEuaf+; 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 b5si14595921jat.99.2021.03.09.10.07.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Mar 2021 10:07:26 -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=pass header.i=@linaro.org header.s=google header.b=APWEuaf+; 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]:40540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJglS-0001fs-17 for patch@linaro.org; Tue, 09 Mar 2021 13:07:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJf7A-0007eR-Mk for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:21:44 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:34744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJf6l-0002WJ-U5 for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:21:44 -0500 Received: by mail-ot1-x32a.google.com with SMTP id n23so7728988otq.1 for ; Tue, 09 Mar 2021 08:21:18 -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=OMON+uvzPOXYOLaXkReV00C37gevE1AfAAGsidJktiM=; b=APWEuaf++rtiRyvVmr4jLO5CzwnWiKJxuezQBul9sXUTx1yjAcqT6o0CcKbL7+5e7O noDWRUy4F0MAW2rI8oAyYqcKctodTzCnPHef9ktQZ1hmpUw7QsW7QBeB/Bpfsia2fJZj DDUA2U0eCuuvsjhNS+1Glknksdk+GMuvBsDCa7amx20yY/a3b1/GDU61uiCvuyicIDyw AgdI3ULAkCJ9DYb/vN8uUw8d5VO9sGGVEMbsxH5YB8o4+8oq3ctiRpc5o1gTc8RhdnaZ G1Cmug+umZWbN4Gj8qFBNVp+rYAztJ7ztEXmeBhxN0WQSe00MWpStzctjt3l4si/ah50 H5Gw== 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=OMON+uvzPOXYOLaXkReV00C37gevE1AfAAGsidJktiM=; b=Pt5hu0m/CJMiszplb0BcguPKRNfAQovGKo9PXnsMwQ2RkVDVtyRsuZs/rjlYgSk2Nu KZYmWWYvqV/Oagy8KIobdEf9rETdEVr3UMh59wsXGoa5fzeTW37TyBNUvhW0GVYMftOs veNC8uS1owJArNTjTIIbWkYEHF5zniXiPYaoSi+Ezb4Fr1v1D7ZSICH/m+YpCga/Fx07 mEBtZGTryOHzQd4HosaJ3rMAHdyWmCtW3Vq8wAEAUjEIo2wk2i0fxaY/j2jypHx1DBxX Ci4H+eCGXt4IZu15TlUf/mSl5BKrKzpw51oF7V3Ri6Xgor0xlealhVE5d8tm1mT86FlN OXbQ== X-Gm-Message-State: AOAM531ActL/xwwxZDYHuwwuCohGumLhoQ2Po1UD5mHLdt3sd7Ej538y WEpayrr+WY8rFDZrdvjl1ffshBOa1E+RwBau X-Received: by 2002:a05:6830:4109:: with SMTP id w9mr24886152ott.176.1615306878286; Tue, 09 Mar 2021 08:21:18 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id v23sm2516474ots.63.2021.03.09.08.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 08:21:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 31/78] target/arm: Implement SVE2 WHILERW, WHILEWR Date: Tue, 9 Mar 2021 08:19:54 -0800 Message-Id: <20210309162041.23124-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210309162041.23124-1-richard.henderson@linaro.org> References: <20210309162041.23124-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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=unavailable 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@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 f833bd5e33..9e93223e62 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 */