From nobody Wed Dec 17 05:37:10 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1603211051; cv=none; d=zohomail.com; s=zohoarc; b=LXVYU8OxkpbJldy6b+wBxWfgXLYfjkwc1evy+i3UUKgYdywuOESoEkuiTUuIntjQXy2U1QalPUjpW/rxFphD8R16r7cpk/0PtdNpeRYrCUZ/No8MyHqdTTx8IkGGww+MNwqddVYnfER0sA4aqaudyi5uda4S76iiod4YNGp+dVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603211051; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8KRcR896eTNIkcAGmEKMZi3H1fH2UuiC+mfMQfLP/y4=; b=ZSVKJIueGLjLTdMuEGmzg4zfJDptP+zJuIo2iSaDCuQ7t77Jrp4T14V/SrnQpuaMpNQ4r48cxyqdzdybdVehGH9Evr3SwyJCAXZAqBF5I6LqGTNXhHPR+PBaV3Hpaor9UpxALBQY3LpOFx+axtjuYYLHYHExDqwL3h5bztVd1Io= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1603211051527321.9958236285361; Tue, 20 Oct 2020 09:24:11 -0700 (PDT) Received: from localhost ([::1]:60242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUuQk-0008PG-PQ for importer@patchew.org; Tue, 20 Oct 2020 12:24:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUu13-0005CQ-GJ for qemu-devel@nongnu.org; Tue, 20 Oct 2020 11:57:37 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUu11-0003vi-J1 for qemu-devel@nongnu.org; Tue, 20 Oct 2020 11:57:37 -0400 Received: by mail-wm1-x334.google.com with SMTP id c77so2329457wmd.4 for ; Tue, 20 Oct 2020 08:57:35 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id v6sm3780205wrp.69.2020.10.20.08.57.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 08:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8KRcR896eTNIkcAGmEKMZi3H1fH2UuiC+mfMQfLP/y4=; b=csfqae+4soZWwe2Qt9jYbebR9/DLwOXST/hzsr5BHWWsfDxvIdaGtaiTSSU1wbr6M5 Ew0jANFUT0V4XzCjXhcegnPWj/lTjN7Mf3pPHxNOaVf8OZTJi3iGAcmThkEuDXFe4Bzb JMdI4NkddRGVrpnPAFQoqvPAnsIci3iJ71ceOwvHRl1EqGuygmcLKc3Wv8oQCWX0oPS9 wQRRtYGAZdwRpDd2RLAFZOgt7GfpjGIoYwC1exFshigrXAQwcAMVq3t5vFX2kD+4n6qo rkhEpoVo4uv+Pl0lqPrCRemfUpFFykGZPZZBp2gX57Qu+5cwoRwjXB1SEIAAV4y8xg9l 8dQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8KRcR896eTNIkcAGmEKMZi3H1fH2UuiC+mfMQfLP/y4=; b=JCGcsUYTbP8dU/WY0435yJbPGJ4ER8eIeeDc7tDHORdAA4XcRJeJboEukGiWMbAN4W Z0bFrXhMmnqk4Ru/nOVPxCnXKLcEknh5cyeCkU4L2lBJTjFVj9dBOpETfM7Nb+H2EYsh 4n78Eb6k6Nva+f0YYXffFG0gIYIHpiNcZlIAxsTXyrEdqIw5CdfsUUDygWG2iCbFtW3h f2gBzC9N72rhcLus7uEc4xm6U3kN0xUaI/WrpQPMhbTYWu1g9BUycL3SDWjrQR5mf0LN o74lGlTV+w2EGa2eZxwFOYNZiXN4y6h9txdVPYG2F3t589LOgNqLZlwZGz1SJi1BS+GA bExw== X-Gm-Message-State: AOAM531EtbxU8BXzlo/cxaVN/NBhsuyVmo8TOBvkzHJjgDPe2+K2ZFzf f9V3wDwk/3OlMvjFS3PLdgDcr9fNIFtWBA== X-Google-Smtp-Source: ABdhPJyllytvVLzUxYolgxYCwnWhCawhs+fGmLSCz5GZ+28cIjGDybUAsUnTwZffjbyPTPfwDYTjag== X-Received: by 2002:a7b:c345:: with SMTP id l5mr3586958wmj.123.1603209453793; Tue, 20 Oct 2020 08:57:33 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/41] target/arm: Implement v8.1M conditional-select insns Date: Tue, 20 Oct 2020 16:56:37 +0100 Message-Id: <20201020155656.8045-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201020155656.8045-1-peter.maydell@linaro.org> References: <20201020155656.8045-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" v8.1M brings four new insns to M-profile: * CSEL : Rd =3D cond ? Rn : Rm * CSINC : Rd =3D cond ? Rn : Rm+1 * CSINV : Rd =3D cond ? Rn : ~Rm * CSNEG : Rd =3D cond ? Rn : -Rm Implement these. Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Message-id: 20201019151301.2046-4-peter.maydell@linaro.org --- target/arm/t32.decode | 3 +++ target/arm/translate.c | 60 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 7069d821fde..d8454bd814e 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -90,6 +90,9 @@ SBC_rrri 1110101 1011 . .... 0 ... .... .... ....= @s_rrr_shi } RSB_rrri 1110101 1110 . .... 0 ... .... .... .... @s_rrr_shi =20 +# v8.1M CSEL and friends +CSEL 1110101 0010 1 rn:4 10 op:2 rd:4 fcond:4 rm:4 + # Data-processing (register-shifted register) =20 MOV_rxrr 1111 1010 0 shty:2 s:1 rm:4 1111 rd:4 0000 rs:4 \ diff --git a/target/arm/translate.c b/target/arm/translate.c index d8729e42c48..9f2201ca577 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8262,6 +8262,66 @@ static bool trans_IT(DisasContext *s, arg_IT *a) return true; } =20 +/* v8.1M CSEL/CSINC/CSNEG/CSINV */ +static bool trans_CSEL(DisasContext *s, arg_CSEL *a) +{ + TCGv_i32 rn, rm, zero; + DisasCompare c; + + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { + return false; + } + + if (a->rm =3D=3D 13) { + /* SEE "Related encodings" (MVE shifts) */ + return false; + } + + if (a->rd =3D=3D 13 || a->rd =3D=3D 15 || a->rn =3D=3D 13 || a->fcond = >=3D 14) { + /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ + return false; + } + + /* In this insn input reg fields of 0b1111 mean "zero", not "PC" */ + if (a->rn =3D=3D 15) { + rn =3D tcg_const_i32(0); + } else { + rn =3D load_reg(s, a->rn); + } + if (a->rm =3D=3D 15) { + rm =3D tcg_const_i32(0); + } else { + rm =3D load_reg(s, a->rm); + } + + switch (a->op) { + case 0: /* CSEL */ + break; + case 1: /* CSINC */ + tcg_gen_addi_i32(rm, rm, 1); + break; + case 2: /* CSINV */ + tcg_gen_not_i32(rm, rm); + break; + case 3: /* CSNEG */ + tcg_gen_neg_i32(rm, rm); + break; + default: + g_assert_not_reached(); + } + + arm_test_cc(&c, a->fcond); + zero =3D tcg_const_i32(0); + tcg_gen_movcond_i32(c.cond, rn, c.value, zero, rn, rm); + arm_free_cc(&c); + tcg_temp_free_i32(zero); + + store_reg(s, a->rd, rn); + tcg_temp_free_i32(rm); + + return true; +} + /* * Legacy decoder. */ --=20 2.20.1