From patchwork Tue May 14 01:11:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164093 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2084248ili; Mon, 13 May 2019 19:48:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqytJTvU+4H9W7VW4W52wRm24r/NxXoj+WVr0Cj9/r/KLozOJSM1XLMh0oXLG3491xAa5Rv/ X-Received: by 2002:a50:94a1:: with SMTP id s30mr33873242eda.4.1557802086151; Mon, 13 May 2019 19:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557802086; cv=none; d=google.com; s=arc-20160816; b=H6frF/FbFEYmjVQ+YaA9muNNkq0umaHh8esdtxkiQUPGY2Va4dHyQiZqn5LqkZa00X R+UXbDGIFf6g0riI0a8eZWl9fkCzL+dSg6J2k2mraMKz39wj8ByYSGKPGgR93hlVc4/K +2X0NK7aGM3nK+AfvCYIRGn1FgCRYvifIZH0vhKfFMqnkT677hHaSTesyENBl9SoVHJY KvxE5nU/mZa6zz3bt3x8WMJN+82NKaJh0LgQYDa3wJ7nrK8lTuvw2Pzegs78Te3T7Q3W ZqnnMT8BMzVr4aoUli0Ji74Dr5W+y9hwUtF4iPTFOzNf7fygXobFsx+LNbkEAK51Sy4Y rcBw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=UNTNcU8NTc7XelmI6QIbWOMz3/5RDKMpurk3x3KqTCI=; b=eRnK9AQdAy+tN/KnE2U/9Yq5yU9tQRhxFo9TSNfO4v4t8sv7BPhq/KfTfp4q22cZxN gS1giEQt4Q4ggIMOlTnavVgp/1tBJuFzqxNYwupwGboGsWjvMlm8ciVrnoe+n3K0KDyU Dvwy/iIGAuNDrTDyXoE+IrTq2Tt1OxuQmq67J+PQEwyHQL3dX23H5URkASuUYN7xY2Ok q1042+UHAC7Dpi3KrE9p+xCAhIWrDvf37ZzqWVItfO6RS4J8iq9IWmk3CT8mPgfoKygp NMXxCLZZoIOkbTyIRm/XVj9S7ImPyhLwFEqtsD/0QJdVqUbhqlw27OP5WnKJ3sDhp9vR zq+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wKxpzDN5; 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 o5si2173833eja.247.2019.05.13.19.48.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 May 2019 19:48:06 -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=wKxpzDN5; 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 ([127.0.0.1]:38087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQNU5-0007t8-6S for patch@linaro.org; Mon, 13 May 2019 22:48:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQNSq-0007A8-If for qemu-devel@nongnu.org; Mon, 13 May 2019 22:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQNSo-0003KU-K2 for qemu-devel@nongnu.org; Mon, 13 May 2019 22:46:48 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:40071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQLzV-0005RB-Ua for qemu-devel@nongnu.org; Mon, 13 May 2019 21:12:26 -0400 Received: by mail-pl1-x643.google.com with SMTP id b3so7336778plr.7 for ; Mon, 13 May 2019 18:11:35 -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; bh=UNTNcU8NTc7XelmI6QIbWOMz3/5RDKMpurk3x3KqTCI=; b=wKxpzDN5p9sW1US72yyS6VBUq0hOrHMBsdWkSAl75jp4y9t6QJy1TkdOJhPNC3VxVu SZXL+fNFxpJCoK+3PEBvJDRhsX+vhPHNUGaMg9Bu/205GdQc99u/AOOQN7kcYSfrKZ7Y Q6oNuLFhmLnPcXFjxH/UtFhMLFpQRutVbdob0J/fQ3GfYLVfGoUqPHuyccaUpkJTTewr mQv6AdIOM10nnXMDBYID5xL/rmu4gOX1JppvzRycx1ik9pu3SIEt/Zvc0GK+GVLPO4du U/iZw+18Sn3quedC2fGT6BWKtB9PRZou/AW9uM6NP0Ks7oNROeuMxcOoQuExnaicW+Ev FgfQ== 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; bh=UNTNcU8NTc7XelmI6QIbWOMz3/5RDKMpurk3x3KqTCI=; b=OtLJpfb/8w+/gvhKU4wXry1AssqSXwRoLF7OpnJcK6BcyMEcSd8TSMOn/Fd2fMcXz7 w7fLg3Ii5qdGfrp81tD+whgIWHsvpj0AtLYPAAFnG99V1iPLCPoNLyz+JHACTMNWzl4h wXopc8k4Zs3mJvp82V3FFxLNfeD5fN1/TgyG2Jq0m6r1tYEHIrAsmfj9goqqRnOf37x4 EDrD1VUiFpFgC8NG+poIa+wy88ge4uI3oVfqvXoBqraPlONtpv66fk8i8qiPXg4HFPZz 7CHmL/ldI8/Q//9nQmme81DZl1+P/S0/cjPMWppyKqW4mFjJAlZYYihYpHmLW85KUVOh VXlQ== X-Gm-Message-State: APjAAAUzELRmUx6fL+NLUVIDrlzge9A4I6f+3WxeSKzrgKjsnCNCnJLy 8IYY2YZdNX2egySzrjkFEzIFtjBscTI= X-Received: by 2002:a17:902:54f:: with SMTP id 73mr35148246plf.140.1557796293841; Mon, 13 May 2019 18:11:33 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id b67sm20029147pfb.150.2019.05.13.18.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 18:11:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 May 2019 18:11:28 -0700 Message-Id: <20190514011129.11330-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190514011129.11330-1-richard.henderson@linaro.org> References: <20190514011129.11330-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH 1/2] target/arm: Use extract2 for EXTR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is, after all, how we implement extract2 in tcg/aarch64. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9dcc5ff3a3..c4bee74ce5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4114,25 +4114,27 @@ static void disas_extract(DisasContext *s, uint32_t insn) } else { tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rm)); } - } else if (rm == rn) { /* ROR */ - tcg_rm = cpu_reg(s, rm); - if (sf) { - tcg_gen_rotri_i64(tcg_rd, tcg_rm, imm); - } else { - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tmp, tcg_rm); - tcg_gen_rotri_i32(tmp, tmp, imm); - tcg_gen_extu_i32_i64(tcg_rd, tmp); - tcg_temp_free_i32(tmp); - } } else { - tcg_rm = read_cpu_reg(s, rm, sf); - tcg_rn = read_cpu_reg(s, rn, sf); - tcg_gen_shri_i64(tcg_rm, tcg_rm, imm); - tcg_gen_shli_i64(tcg_rn, tcg_rn, bitsize - imm); - tcg_gen_or_i64(tcg_rd, tcg_rm, tcg_rn); - if (!sf) { - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); + tcg_rm = cpu_reg(s, rm); + tcg_rn = cpu_reg(s, rn); + + if (sf) { + /* Specialization to ROR happens in EXTRACT2. */ + tcg_gen_extract2_i64(tcg_rd, tcg_rm, tcg_rn, imm); + } else { + TCGv_i32 t0 = tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(t0, tcg_rm); + if (rm == rn) { + tcg_gen_rotri_i32(t0, t0, imm); + } else { + TCGv_i32 t1 = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(t1, tcg_rn); + tcg_gen_extract2_i32(t0, t0, t1, imm); + tcg_temp_free_i32(t1); + } + tcg_gen_extu_i32_i64(tcg_rd, t0); + tcg_temp_free_i32(t0); } } }