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); } } } From patchwork Tue May 14 01:11:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164094 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2112105ili; Mon, 13 May 2019 20:29:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFgnjWWVZmyfgnhUFu43fEvbbIX3fFReweiLWUd7qEUSTOCno/LB0EZNIyhHlov96oayCE X-Received: by 2002:a50:e40f:: with SMTP id d15mr34117745edm.0.1557804585516; Mon, 13 May 2019 20:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557804585; cv=none; d=google.com; s=arc-20160816; b=LNK8zxj3X6rnRum3XSkLU+c2RLMZf8WyQ1U1dkOpjQD58uXmggbOwA68p6JJBytpyS lfo4RqL+9igJXF9e90jFCmZKRNU1ScQMKXAYoevz5FvMgvAuObVDF8fHvnPnhNHt6SuF mTbOtZOK7NDI5srtg2Cw7xm9Shsq80OFcGNRIu0EA3Be2JNJCWm2YeZArTmhVCOfZsE9 OKZ0/xWC1Z8qRv7yGrfwyLUSGXPbwrojgiZwG50iGkPbt1+5jgazyeqJ3JNlfeORhFpO 7AinwdN9ShV4AJFKzUdeQC8ZpmvQZbmFolzu53yEfv3r/2IlYBj5nXxskp3U6tVB5rmQ ITvA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=UDhIE0FmHFjvTg+Yc2t3Xw+YfnUzd/HuDHfr9sdMw70=; b=boEqugiwtAgHAmo2Zm0FSZ5mrnPnQ29Rvoizul6II78ypd0ManF70+fVJzNY995Xf3 kSc6vZoq76tW+yOli7fP7e6pEzZ4+DKNsvc4wW00zaiSaG2GnkyWZgPBexYQh8/Z5/ZX CN6FOwYUXM8DcL38V9FZSo9VK3Uz/AbTO5+fFuSpK1vxf8MPegpl/1fWehG5HC49l4pX gCEAd1/OqIASbx3rFErp4HsFXs9DLSVe4Md8bRwq7mZ5MhuHWtmjzRzfavcyApc5T9F9 3exFVuCoypU6vztfH79sx6d5zC4R6MnOmsV83yCwKFHqD898FZ9e3sV4FvNxRmq0ge17 BxRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XJqEkukh; 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 n11si1018424edv.199.2019.05.13.20.29.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 May 2019 20:29:45 -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=XJqEkukh; 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]:38394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQO8O-0005bE-H9 for patch@linaro.org; Mon, 13 May 2019 23:29:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQO7A-00051J-Ge for qemu-devel@nongnu.org; Mon, 13 May 2019 23:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQLz9-0005u8-Sz for qemu-devel@nongnu.org; Mon, 13 May 2019 21:12:43 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:42740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQLyw-0005Tw-Qf for qemu-devel@nongnu.org; Mon, 13 May 2019 21:11:53 -0400 Received: by mail-pl1-x641.google.com with SMTP id x15so7328868pln.9 for ; Mon, 13 May 2019 18:11:37 -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=UDhIE0FmHFjvTg+Yc2t3Xw+YfnUzd/HuDHfr9sdMw70=; b=XJqEkukhImvF+TMIP67St4SDlllZ5Gc2UsTtGWU+hJbow/M4b0GfG058/m4nUfF/oy Td0MXABa9a01ph2dNKp5E/6IjlZ2hFzeoSBo91QSWM2SIaMWRlsKp5VrV/5JsiVN/+Nl ATrVUqy+pmk3aTcF53hTGTFbRhhrjKX8s+9DnNoVsR0kh7sWrBBwxVg2BEbwbkDgH6Qp PlgT4OBPBwzAERJul400rlCdI7/2VPc0bamuk7xRrMahHOBlEWxPfZL/SvzR6tFMtAJl NIzqzADn2sWWxqxK2Sh6v2QNUUYoVKxFJpTYlmGhpLtwXvwMmiBtE6wtAvmeK2YttNUS KvLw== 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=UDhIE0FmHFjvTg+Yc2t3Xw+YfnUzd/HuDHfr9sdMw70=; b=EFGWJJOehLcuPri7Ngk5dQdCFmUGCuJX2jjc7ayISr/d1tIuvtErkdzLM6+45qXGDq kmJO93dWNFxIo+IGkWEDLw5+1PB+6UXv1c/fQT8gIKBJwyvwnnIzyWh3fX3LG+eJNye4 n4S+kmaifNg2p8mIJ4bz7YQ82XfTufUo27GWbEnlmtwORQ0iGUletvLpO15aqflKURQ1 qAIm4SbdRTKUBuCo9+5phgmmP084N84gc5gl+URxwD/g5goFgQF8rOXr96FvMvYkGYyF DwulkjKCMrjZB+LeyRBwEK/mPK0+o822zKz424nKIsaDElQ0ZmJ4JJ937DrwD0cLI58N BqSA== X-Gm-Message-State: APjAAAWocFXpLXVr2yqPTDD89aTSEszgwNBq2ZpQoyKTENupBke2xNVh htVXJ/n+n5Mo9aZ6tEPz/mkWymZoLHU= X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr35551538plz.128.1557796296078; Mon, 13 May 2019 18:11:36 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 18:11:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 May 2019 18:11:29 -0700 Message-Id: <20190514011129.11330-3-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH 2/2] target/arm: Simplify BFXIL expansion 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" The mask implied by the extract is redundant with the one implied by the deposit. Also, fix spelling of BFXIL. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c4bee74ce5..472d898096 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4043,8 +4043,8 @@ static void disas_bitfield(DisasContext *s, uint32_t insn) tcg_gen_extract_i64(tcg_rd, tcg_tmp, ri, len); return; } - /* opc == 1, BXFIL fall through to deposit */ - tcg_gen_extract_i64(tcg_tmp, tcg_tmp, ri, len); + /* opc == 1, BFXIL fall through to deposit */ + tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri); pos = 0; } else { /* Handle the ri > si case with a deposit @@ -4062,7 +4062,7 @@ static void disas_bitfield(DisasContext *s, uint32_t insn) len = ri; } - if (opc == 1) { /* BFM, BXFIL */ + if (opc == 1) { /* BFM, BFXIL */ tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len); } else { /* SBFM or UBFM: We start with zero, and we haven't modified