From patchwork Tue Jun 29 18:54:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468376 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5273065jao; Tue, 29 Jun 2021 13:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf3lnleldnHgXegFKqPGOuRIZ6Q+tuVMyrojiOYVv6t+1aluVQtK1X4JaxKxjrErJC+Bzt X-Received: by 2002:a05:6402:1345:: with SMTP id y5mr42479677edw.206.1624996932529; Tue, 29 Jun 2021 13:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624996932; cv=none; d=google.com; s=arc-20160816; b=KUDq7jcLrPxTGGeYutOmPVJzJz2VqVRiAW1rlhZaPPPrWhA6MLyRMepw89lY34tBtL d8Akm8J5h9Fv0rI0AZ7dFSNvutk6y8JssEwzMnIx0CXQvA3651WJeSnM1eBEH9xCmDzM Dka3GBHaSlGn8sFs/4BoPcS7kPnkRUe5H7QkdKaJ43wPCgVR+6ZdAXZJhG7BnKoaupAt gDoz2qlGFNk0e0JwSIC72/t+PEYCm9YQ3aRCeXHxeE6lxNWyOSyeCpxQUP7IfHhyX61L T+mKlnINvQUoUTC06LoOJEy4aWSMsDZTA3R8Jj/AjIQfd3/dAGYzXAhPy15FA429XtTy h30g== 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=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=1JrRoNHQ0ivKREvhiYYIPF2O7CQzXWR4Mui5KG9QETikW15ZddrezUCkjmUvO82XJL +I6bzSWMcnyewz+/L0Wsx/XujQ7NZ+Pnurt+2ZZo8+ZN7Jl3CkJc2tDnFJ6qrm1SMV00 HQ0odWzMRZCnOoNshrykybE+KGrLa5bIUNzRLmZCQGs+fFWNtNbtNEXSQE0ry5GK6bjc 1G7VliVf6PbIFauJgDSjmyRK+OKMxn7hF1Gm8cjrwYD7qlKwUXhkK7z6WcjrLoiD8v9m lM4h9dmoj6I9Pcln3ll0liG5c7YyB3mx4o7Bft5AymEMCcGm9DU315bbxc7Y3DKu5kie QAhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rvyU8Ojp; 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 j3si18317445ejj.448.2021.06.29.13.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 13:02:12 -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=pass header.i=@linaro.org header.s=google header.b=rvyU8Ojp; 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]:41254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJvv-00055f-Dw for patch@linaro.org; Tue, 29 Jun 2021 16:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyIwi-0004Eq-TT for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:57 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:41759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIwN-000319-4s for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:58:56 -0400 Received: by mail-pf1-x429.google.com with SMTP id c5so98436pfv.8 for ; Tue, 29 Jun 2021 11:58:34 -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=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=rvyU8OjpPX4X/aVIwFeQqNdHSgafL6hYrbmAE6RWeXr9WevwvbPyz256JA9V1MmuSs G71H33uxFPm+QayrxepfWhTPdfnHfdR8HWVCrWwK5g6MGNEfDp0TQFxRoRPwGHS+R2Z2 N8LC54CZlmc/D9KBc93ay8FUfvZorAGIySUnwc/vvBntatlxB7Ic/FEpay+6lmArqVLp wSU7PjAj7njf/dQL6qVF5T/zdBrBHYKPT3foAHkh9TYyYYtFJePhVMD0tFBl5dsfbcyU Bo6DxBPg01C2YktQuG5jMGyNrbziIMbE21XerqtFLmsJCam4mp+8tyop94+NSBeWnPWO U9Rg== 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=jZ+vu44B3MA2rQDPHlYV5+XUBqzkPAnWuZi1J6wYDao=; b=nAKYs+iQJVPOEB3iZmdG6ICgGKSyWIrWtYIL7qYOJd+BplDQebXyWTFNn+OlWKXqJj Nqb8iYErlTa2aKw/fiYyFeCdeciXZdXvGgre64TeQYcDOgiuC2fJkkT8j3aq529PM8gX AlXTsf3LD10jSe/78cOCnPFwZGwkf2AvFoObtgYcnYxTAdPENnodCxr/FhRFBtpaCe79 P9X4AlNBEWlrbrneEMygUzLGkN516zdlSAmLX5X+83CGFBo5SUMhsWsGPDKL1aCPd4/8 yrFGmmbDFhBayDkgh/yLZlxi0dgLIbY3URDNzp9uISGbWwZ5BIGIHjPP94x+FmYb2WNX XplA== X-Gm-Message-State: AOAM53244x9O2dbro2ECZTq1cqWmpviLY5Dggb2YnZlyJY5D2uWfs3PA Gep3beV8Bba93jks/+9glH36sxspedjtZw== X-Received: by 2002:a63:6781:: with SMTP id b123mr25280686pgc.397.1624993113980; Tue, 29 Jun 2021 11:58:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 21sm18002849pfh.103.2021.06.29.11.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:58:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 55/63] target/arm: Improve REV32 Date: Tue, 29 Jun 2021 11:54:47 -0700 Message-Id: <20210629185455.3131172-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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 , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For the sf version, we are performing two 32-bit bswaps in either half of the register. This is equivalent to performing one 64-bit bswap followed by a rotate. For the non-sf version, we can remove TCG_BSWAP_IZ and the preceding zero-extension. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f2641a37ba..304fd3d370 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5430,22 +5430,13 @@ static void handle_rev32(DisasContext *s, unsigned int sf, unsigned int rn, unsigned int rd) { TCGv_i64 tcg_rd = cpu_reg(s, rd); + TCGv_i64 tcg_rn = cpu_reg(s, rn); if (sf) { - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - - /* bswap32_i64 requires zero high word */ - tcg_gen_ext32u_i64(tcg_tmp, tcg_rn); - tcg_gen_bswap32_i64(tcg_rd, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 32); - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ); - tcg_gen_concat32_i64(tcg_rd, tcg_rd, tcg_tmp); - - tcg_temp_free_i64(tcg_tmp); + tcg_gen_bswap64_i64(tcg_rd, tcg_rn); + tcg_gen_rotri_i64(tcg_rd, tcg_rd, 32); } else { - tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rn)); - tcg_gen_bswap32_i64(tcg_rd, tcg_rd, TCG_BSWAP_IZ | TCG_BSWAP_OZ); + tcg_gen_bswap32_i64(tcg_rd, tcg_rn, TCG_BSWAP_OZ); } }