From patchwork Tue Aug 22 12:40:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715745 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp235402wrp; Tue, 22 Aug 2023 05:42:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9I6Ln0Bu+tZac+4jzqJUXRqGZXmVl6vytCW2QwXKF40/U98MtuEPA0FDPcMkRcfptCTLq X-Received: by 2002:a05:6830:10ce:b0:6bc:9c9b:e787 with SMTP id z14-20020a05683010ce00b006bc9c9be787mr9575837oto.8.1692708127703; Tue, 22 Aug 2023 05:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708127; cv=none; d=google.com; s=arc-20160816; b=NMN69YTWHL82W4TMsv3+fGsYnvj/oJ2zBMh2K+0X4f9YvexQlFdTYd42t7t7W4kxUN BiByM3BLW6SMR4xOgKTMPn2uUZpPTUvF0xdpZ9XASQB37g7Sgcc8Y44mHGBL605yH6/n 2CYLlrZjD/1qTyRNnpnFyNBlDra4vUxiSwC8vj3eKZ/87bt8MgVA+qkJ636kSWLxebfK KNh8m26PScJwMC9CMhifJzUISi8CS7LFhFE2F5Mf5yFfjPgaakR5/rHjbTmP3Ii0CWjp lLRwF0k1LElD8vcNM1Y7KFFvm+hIwLo0H6cmrayFB/Va8St3QPpChd3u2dHkk+S7ENef QZrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=FMJ1pPQagpK0TSh9v/NKR2oLVoAprcpSVFmmxK4Cqak=; fh=wXqw6aajGBSP4OKAgbWKHj3BSg7Yrdz+j0I8chPJZNc=; b=vZ1r6t5brmgLDe+MaWxkpRUHXHky6+XAnkJXEAgAuabwX9xZk3vMUeS+eVC8A1Z9L6 sLz27tq6qSDjqIqcCS1nOdlSBxfI/SP4tHRygpye1Ezw0HjDjm/e3g1NX+ZBl9lHG+pf s8A0KomUGfikrWQnpO5t74VAHd2MSYJkOU+ReZUKQRFvZqU7L8E9hhEkBkUCbLD0zKPt TqygjDZcVF5jp0nZYjdzO6EBCu/p68EvWRWZlCNRnUiyfXd7/NpeAbZNpTEmmufp3pwM fdAMtFo3VFja3LISK6X2kXhvrk5fVwEE3gzRpJtBjwN7yd7ycPHE6mFgtfCBaLLzdYkB +vsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rymdns0D; 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 u1-20020a05622a010100b00403c198841esi6162637qtw.164.2023.08.22.05.42.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:42:07 -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=Rymdns0D; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQh1-0006IX-5d; Tue, 22 Aug 2023 08:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQgy-0006HS-LS for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:04 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQgt-0005VK-Fz for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:04 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fee7b7689dso26913315e9.0 for ; Tue, 22 Aug 2023 05:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708056; x=1693312856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FMJ1pPQagpK0TSh9v/NKR2oLVoAprcpSVFmmxK4Cqak=; b=Rymdns0DyULq3a5x+1rnkoVEIO4KYyWViPo3DyxG2w8P3R+vgb62qkAuzmFVfqn5lI +zP1pWohkqrMNQNtfzRF+LcfzLtUuSzC0GezfLHpEoKJHjGRVwvxbOVotPndB7eH/Sds IhqJTmBJYfI46QLJQoVtYMv6libNJjgjgrpVi+0Ohvf4hbzJuVsEs31BtMEtY0qDfYFj waHGCEnarHZ9X2ff0VWfc9UGqbP+I6pTFQs8yZI7B8odcyX9ABto9Af8d4tZhCkaDzLQ UVON3hmRueU2WBRibRP0g2IzS9stF4HF0sd5DC0mJ6QBwcZ9kk6UVedzPzHgjKHenv7d PklQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708056; x=1693312856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FMJ1pPQagpK0TSh9v/NKR2oLVoAprcpSVFmmxK4Cqak=; b=cRaoBvJbERzifVOXefquQfz+gD2PGTNp6/giDQu7nCJ0d11hxl9RyCWVyDv1+MUb0B ONsCjPgenVucAunpN8AeUlk1sNX/2afwpqZ1FTbEyTbbYVLvKBBA76ky4YEci4E2u01U pYfJmi96xz/3uZNukGClZuMBkwap0Kluhubmvz/IWSDOQb6WZ0fIK9FnEktv8b8vPyaU csLCgki7I27X1MrHDq3ZtzkdhNaFkXn4Z1vZYAv3oyL8ZZ12c0wDSOxHkgMGAHQEWuYm r67biSQVXvE2+WxXxV9qDKfWCpS+yKvWLd2qdw7GgDEDyhXcOFVMMGaNFRVKi0OTdep/ tr8g== X-Gm-Message-State: AOJu0YwKiVpIhnHAVD1IPBhCCUwvWYCJ+HJTW97mzruH+PduLvBKiQ5f Z+ogg4/de711Ghv5fGYnycUUhI3fxix7rFRHzPlIjA== X-Received: by 2002:a05:600c:255:b0:3fe:d57e:d933 with SMTP id 21-20020a05600c025500b003fed57ed933mr7346330wmj.15.1692708055863; Tue, 22 Aug 2023 05:40:55 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id u1-20020a7bcb01000000b003fefcbe7fa8sm936392wmj.28.2023.08.22.05.40.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:40:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , Peter Maydell , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH 01/12] tcg/tcg-op: Factor tcg_gen_hrev32_i32() out Date: Tue, 22 Aug 2023 14:40:31 +0200 Message-ID: <20230822124042.54739-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Byteswapping each halfword is a common operation, so extract to a new tcg_gen_hrev32_i32() generic helper. Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/tcg-ops.rst | 4 ++++ include/tcg/tcg-op-common.h | 1 + tcg/tcg-op.c | 29 +++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst index 7ea6aba502..17965faa03 100644 --- a/docs/devel/tcg-ops.rst +++ b/docs/devel/tcg-ops.rst @@ -490,6 +490,10 @@ Misc into 32-bit output *t0*. Depending on the host, this may be a simple shift, or may require additional canonicalization. + * - hrev32_i32 *t0*, *t1* + + - | Byteswap each halfword within a 32-bit value. + * - hswap_i32/i64 *t0*, *t1* - | Swap 16-bit halfwords within a 32/64-bit value. diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index be382bbf77..bb515dfd51 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -360,6 +360,7 @@ void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags); void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg); +void tcg_gen_hrev32_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_smin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); void tcg_gen_smax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); void tcg_gen_umin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index c436c5e263..b1b5d9b45b 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1073,14 +1073,9 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) } else { TCGv_i32 t0 = tcg_temp_ebb_new_i32(); TCGv_i32 t1 = tcg_temp_ebb_new_i32(); - TCGv_i32 t2 = tcg_constant_i32(0x00ff00ff); /* arg = abcd */ - tcg_gen_shri_i32(t0, arg, 8); /* t0 = .abc */ - tcg_gen_and_i32(t1, arg, t2); /* t1 = .b.d */ - tcg_gen_and_i32(t0, t0, t2); /* t0 = .a.c */ - tcg_gen_shli_i32(t1, t1, 8); /* t1 = b.d. */ - tcg_gen_or_i32(ret, t0, t1); /* ret = badc */ + tcg_gen_hrev32_i32(ret, arg); /* ret = badc */ tcg_gen_shri_i32(t0, ret, 16); /* t0 = ..ba */ tcg_gen_shli_i32(t1, ret, 16); /* t1 = dc.. */ @@ -1102,6 +1097,28 @@ void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg) tcg_gen_rotli_i32(ret, arg, 16); } +/* + * hswap_i32: Byteswap each halfword within a 32-bit value. + * + * Byte pattern: hswap_i32(abcd) -> badc + */ +void tcg_gen_hrev32_i32(TCGv_i32 ret, TCGv_i32 arg) +{ + TCGv_i32 mask = tcg_constant_i32(0x00ff00ff); + TCGv_i32 t0 = tcg_temp_ebb_new_i32(); + TCGv_i32 t1 = tcg_temp_ebb_new_i32(); + + /* arg = abcd */ + tcg_gen_shri_i32(t0, arg, 8); /* t0 = .abc */ + tcg_gen_and_i32(t1, arg, mask); /* t1 = .b.d */ + tcg_gen_and_i32(t0, t0, mask); /* t0 = .a.c */ + tcg_gen_shli_i32(t1, t1, 8); /* t1 = b.d. */ + tcg_gen_or_i32(ret, t0, t1); /* ret = badc */ + + tcg_temp_free_i32(t0); + tcg_temp_free_i32(t1); +} + void tcg_gen_smin_i32(TCGv_i32 ret, TCGv_i32 a, TCGv_i32 b) { tcg_gen_movcond_i32(TCG_COND_LT, ret, a, b, a, b); From patchwork Tue Aug 22 12:40:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715750 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp235712wrp; Tue, 22 Aug 2023 05:42:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGs5LfwdYoO+4F6KxVEBqSdckBYPDCGs1w2LuAzd0MxLy/0diRGcGYhJWJYL82ZlorUesNw X-Received: by 2002:a05:6358:63a8:b0:134:c815:f067 with SMTP id k40-20020a05635863a800b00134c815f067mr10345732rwh.11.1692708165221; Tue, 22 Aug 2023 05:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708165; cv=none; d=google.com; s=arc-20160816; b=ktTZ3kYfBMzW0o3zqKuZYCB3Obd2V1IBYaOjoMUYVrqwzBGIO4aoSs0FWMrrLZp62O QsLDjhYOzMU7RevhDO5yl+YX9W8F6lR66u7HPhqaiNPLlon5evLN6rHfQDnPgXrGu49C l/EAt2BKrh28ApEkNZW2uCphPTfqOixWCJ5MJfJBrhX/nsBt9lVfJpMxlvrBAoM/cvTI RfARf5gi0lq3l2Zt+mC+TlED7WTfsMZYtdS1mI9KaAf9BNLULI080j0IEPXuZIGj9PX4 BlPhiQ2RCFi8979z0z7cWYYxYjXzeiY2uQ+nJQ5x1I+7HxK9vM1nTowPLXOluKoup8iH mvuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=nsvUqHlFX1jn4aW9Gaw9PjawxbooLIqjbrbXDvQlkNQ=; fh=wXqw6aajGBSP4OKAgbWKHj3BSg7Yrdz+j0I8chPJZNc=; b=WhnKprYn4u27RaW7chQ9zepv9KQn7L+J+O3w/SKDYwIREHmsNcjlSbNVYCTQOZtw6X W42GwPA6Q82kEPExkwwbA/NoLPCY5neLMFbBgQ/GHtXQtS2cAut3A+A7gpONImgWiC6C xJzVJlGL7QdPsl45TM64l4cJpg77xiVvf9gdyHEacaBkRp7ZJWf2GRXy2krCoey0ZGD3 LUH5yDSSBxbUqdCsXsBIGVb+fRkghOe2KIRtDXCrBM2G0cfRSFnI0rdT9qfOt0bwbOFn CYm2SFA8zRDTxc3vHUy++vXHlPgxNqKdl/CSL6+si8ufpIbvpHdYd/YX8jSx8EtHrP8b Gc6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MojuRq3F; 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 y15-20020ac85f4f000000b004109f0847b5si1898756qta.682.2023.08.22.05.42.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:42: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=pass header.i=@linaro.org header.s=google header.b=MojuRq3F; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQh6-0006KS-5L; Tue, 22 Aug 2023 08:41:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQh2-0006Iw-5O for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:08 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQgz-0005ZQ-J9 for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:07 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-317c3ac7339so3895586f8f.0 for ; Tue, 22 Aug 2023 05:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708063; x=1693312863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nsvUqHlFX1jn4aW9Gaw9PjawxbooLIqjbrbXDvQlkNQ=; b=MojuRq3FcpEf1spcBl2fm+knldksxR4XIvwkbCZDoW/kyW6EKK2Aq2JsjcSw4SsnGS 3Ei0IW0w2y3nXhtD47WGgg5chYQMHz8JuUGVok00ftlwd2RA/AzKGgmpVRaQg/nH8mXS sfZJooNcH2Uf0albij0xzSD17WVUA+vGUOhdV3Mqt46lKc5kg2Vw+4bFsj3X97Z2qjG6 TuNu0Tr4geaYFMjoFsUbDSuQtxinxoYM0SpGzzAUoNC1n0yHJAUcPw+p4rGp0Fr722YQ DKMj+PXIbDc73wqMsAKWaCugRD0i/UjJZ32GkP6q0VWfpew4ujfPWS5Wl/NR9FDe3WVr 2GTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708063; x=1693312863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nsvUqHlFX1jn4aW9Gaw9PjawxbooLIqjbrbXDvQlkNQ=; b=Y8fUrRswKqLYN6il18in6zj0zT30GnwGpBGC204whsDurlVKQ9Oly6X51+rbUVVrd/ sRtUci/XUL8pLsU0ipbnJ0vo7Ds30aZQ0qp/6HX4jYho9+10TBJxw6HA3BPWcAmuOddy pyVUi+fASUPELQWj4F2dRAfrRaDE02uOrcASfbH8tFbVhCGp3CDnkG38511nMKXlbmgD vjWAVNWwhM/E38xq3Fg5BOhrHlXpX1Q5pJ/g7JAkZb0YQYn+Nqu6wniTs5RoMhRRWqGp 1xC6ZahYUP6jfntGcXJAoTPpcrlIX+2EJM9WzvgLl6WEVJOugx3mBPijSn9Uah4P9Gii JHzA== X-Gm-Message-State: AOJu0Yy2pwBH6QGP2dKpAXIph4x8hytexzTnfo/zisuPGbDnxUBo+wz7 lk0B/xeZi9a2iwJAnLQeBN6RDfz9bbrsLFCQR2/5Rw== X-Received: by 2002:adf:f70c:0:b0:317:5af3:caa4 with SMTP id r12-20020adff70c000000b003175af3caa4mr7256713wrp.38.1692708063580; Tue, 22 Aug 2023 05:41:03 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id r15-20020a056000014f00b0031ad5a54bedsm15923239wrx.9.2023.08.22.05.41.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:41:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , Peter Maydell , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH 02/12] target/arm: Use generic hrev32_i32() in ARM REV16 and VREV16 opcodes Date: Tue, 22 Aug 2023 14:40:32 +0200 Message-ID: <20230822124042.54739-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/arm/tcg/translate-a32.h | 1 - target/arm/tcg/translate-neon.c | 2 +- target/arm/tcg/translate.c | 14 +------------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/target/arm/tcg/translate-a32.h b/target/arm/tcg/translate-a32.h index 0c8f408eea..6cc02c83b9 100644 --- a/target/arm/tcg/translate-a32.h +++ b/target/arm/tcg/translate-a32.h @@ -45,7 +45,6 @@ void gen_lookup_tb(DisasContext *s); long vfp_reg_offset(bool dp, unsigned reg); long neon_full_reg_offset(unsigned reg); long neon_element_offset(int reg, int element, MemOp memop); -void gen_rev16(TCGv_i32 dest, TCGv_i32 var); void clear_eci_state(DisasContext *s); bool mve_eci_check(DisasContext *s); void mve_update_eci(DisasContext *s); diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 0e59b03ff9..9489dc0b3e 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3528,7 +3528,7 @@ static bool trans_VREV16(DisasContext *s, arg_2misc *a) if (a->size != 0) { return false; } - return do_2misc(s, a, gen_rev16); + return do_2misc(s, a, tcg_gen_hrev32_i32); } static bool trans_VCLS(DisasContext *s, arg_2misc *a) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 39a42611c6..4ebf04f4de 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -416,18 +416,6 @@ static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b) tcg_gen_mov_i32(a, tmp1); } -/* Byteswap each halfword. */ -void gen_rev16(TCGv_i32 dest, TCGv_i32 var) -{ - TCGv_i32 tmp = tcg_temp_new_i32(); - TCGv_i32 mask = tcg_constant_i32(0x00ff00ff); - tcg_gen_shri_i32(tmp, var, 8); - tcg_gen_and_i32(tmp, tmp, mask); - tcg_gen_and_i32(var, var, mask); - tcg_gen_shli_i32(var, var, 8); - tcg_gen_or_i32(dest, var, tmp); -} - /* Byteswap low halfword and sign extend. */ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) { @@ -7578,7 +7566,7 @@ static bool trans_REV16(DisasContext *s, arg_rr *a) if (!ENABLE_ARCH_6) { return false; } - return op_rr(s, a, gen_rev16); + return op_rr(s, a, tcg_gen_hrev32_i32); } static bool trans_REVSH(DisasContext *s, arg_rr *a) From patchwork Tue Aug 22 12:40:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715747 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp235538wrp; Tue, 22 Aug 2023 05:42:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF07U9nJK4tbD/gcYG21bNQ8ZXYS110ZR4XtZC3kmY2Xeub5Z86bkOpi1cErBZpVFN59apH X-Received: by 2002:a1f:eac3:0:b0:48d:29ef:1764 with SMTP id i186-20020a1feac3000000b0048d29ef1764mr3992800vkh.9.1692708145092; Tue, 22 Aug 2023 05:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708145; cv=none; d=google.com; s=arc-20160816; b=mvDSxz1Bi2532Ya/vuiKQkxRU+65MVXdd2cclTLl206S0+H3rBReljKPo9FlzoaWeq JzoX0G3dEywRLIpbVOBqN6nDLslzhS+h0kpMrERXJyAqyOB/ecH3otD+hyNQ8tLBC7nV Kd19M+KBLUMVl32p7Hif2tlFksvKUh8/uZ/pvCaRe/6lVjpUQW52gWplD+VQN3uvaNI6 ZX5xsuId3wzt1zRIAgLEpRuor1pV9cMcmR9mSIGM6/nbUmJ8yRgWXmewyJ9eMp32W2dO RhuU+tDfiB4YHk6r+0b+oEwlJvaji70ACHGWrduAFJPtc1yd8wSv1jqWjABiLJSOHDK8 E7bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=k+Q+413qAyohxkZfqCqkkltTwZ66XX4v/AfIWdcA3w4=; fh=wXqw6aajGBSP4OKAgbWKHj3BSg7Yrdz+j0I8chPJZNc=; b=M04lF6Z+VvsVFuCDAQdZ6jHbsweUAPSJ+LveN+yRoI7Kz5PqJpt7Y+xeZgjAGS5Bvn 9VAB4RRrejLqZjV5gpgVeVDOzEpYVdY3qaYI7C7WlmwmYX9DFM3sQ9v4F/qkFQga/nk/ vmF6fsOZHl0WH9X9RaF0xbbrdEMj/pr7gC+0cH0eEiHJKM1nN4EQv6XXutN5kzshLVhI sFPnoQ5nSriLbTvR9XFeI8koYYUnPYkzf/EawILEdlxHudf6O1trstzVIJglROIQSCet pmkN7vLyIzWApxOtsbzvDXLIYEKeIbHflc91Ap7jtyrXT1QnRTWgpUsJCnjVGhGQzyKB oUWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RHAt31Ja; 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 t9-20020a05622a148900b0040345635f05si6455061qtx.132.2023.08.22.05.42.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:42:25 -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=RHAt31Ja; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQhL-0006Qo-SN; Tue, 22 Aug 2023 08:41:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQhB-0006MC-7B for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:18 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQh8-0005fY-Ra for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:16 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fe8242fc4dso43804845e9.1 for ; Tue, 22 Aug 2023 05:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708072; x=1693312872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k+Q+413qAyohxkZfqCqkkltTwZ66XX4v/AfIWdcA3w4=; b=RHAt31JaX+enrxV2lGY1ElHMHQfUkmaCYzzh5D0NPoQO3WOwlVHcNJSyfwCJgMJdRE PRLJDtij2T3QHtANmzMg9V0JBto+2j0VV0eiggYB9uBnsvLJirOkj3JNTKO9XHqqTBBf XYuiH0hlG3aIOvrktg3GzU2oeySb805dxEBF9aEuVWhl354HLQT8K8+/qvFmRCobVRZ9 zfVBJ4KP5msX5FBwxX2dvCdD8KpTdW9aCdYoxC73kf24rOcWFzibQ5MldQ7A/fhIPLue IVcriIEhPRxJqIiHUZlmFjPXDqNUlPtctiljgrrUFYbtoleQAZ3Tpogbb40/W+UAc/ta r1AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708072; x=1693312872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k+Q+413qAyohxkZfqCqkkltTwZ66XX4v/AfIWdcA3w4=; b=Gk76pgMd5g7G1JWmL1SBDUr0hvJ9Pg3Sty8k4LRvPFwaf2GaEcwaZAiDGes01sennV WiRtMEGJfV5HW6qtWzWPsE2JUdUsq2/13J3gWgBhmUN+Ou4m146HrLM3VORbW2s45H7s o7acCaFOoqTpssVYxkEq0Mlx/wp+h1pg3lNG2CQbgTS4sulm5Z2o+D+c0bm9wBs6NEue wN/SrzlzvFig0JRhBd1RoR2pXOgdetKRD/4QEaRPQKqMWOb3Y8cmFlNP5LqXu5VUEKh6 CYaljhDHxX47lNl/hSyF+QnzAbWWt/bAwsAhnKJ81zZdMOd23h6PeCfhnxxXnhYoGbEs TJLQ== X-Gm-Message-State: AOJu0YwKUZKivhF1MuF+tijZuUVo/BGSeOC05WDJ8j+NMItQ29aR3EIK aGoFbk/QAovJf7h1HTxUBYngzmyKKFMkrsQi9+Pj+g== X-Received: by 2002:a5d:4685:0:b0:317:59c8:17bc with SMTP id u5-20020a5d4685000000b0031759c817bcmr6009480wrq.15.1692708072120; Tue, 22 Aug 2023 05:41:12 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id a14-20020adff7ce000000b0030fd03e3d25sm15856795wrq.75.2023.08.22.05.41.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:41:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , Peter Maydell , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH 03/12] target/cris: Use generic hrev32_i32() in SWAPB opcode Date: Tue, 22 Aug 2023 14:40:33 +0200 Message-ID: <20230822124042.54739-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/cris/translate.c | 20 +------------------- target/cris/translate_v10.c.inc | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index 925ed2c6f6..00bbe6c645 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -381,24 +381,6 @@ static inline void t_gen_subx_carry(DisasContext *dc, TCGv d) } } -/* Swap the two bytes within each half word of the s operand. - T0 = ((T0 << 8) & 0xff00ff00) | ((T0 >> 8) & 0x00ff00ff) */ -static inline void t_gen_swapb(TCGv d, TCGv s) -{ - TCGv t, org_s; - - t = tcg_temp_new(); - org_s = tcg_temp_new(); - - /* d and s may refer to the same object. */ - tcg_gen_mov_tl(org_s, s); - tcg_gen_shli_tl(t, org_s, 8); - tcg_gen_andi_tl(d, t, 0xff00ff00); - tcg_gen_shri_tl(t, org_s, 8); - tcg_gen_andi_tl(t, t, 0x00ff00ff); - tcg_gen_or_tl(d, d, t); -} - /* * Reverse the bits within each byte. * @@ -1666,7 +1648,7 @@ static int dec_swap_r(CPUCRISState *env, DisasContext *dc) tcg_gen_hswap_i32(t0, t0); } if (dc->op2 & 2) { - t_gen_swapb(t0, t0); + tcg_gen_hrev32_i32(t0, t0); } if (dc->op2 & 1) { t_gen_swapr(t0, t0); diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 0ff15769ec..86cc5de8ad 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -508,7 +508,7 @@ static void dec10_reg_swap(DisasContext *dc) if (dc->dst & 4) tcg_gen_hswap_i32(t0, t0); if (dc->dst & 2) - t_gen_swapb(t0, t0); + tcg_gen_hrev32_i32(t0, t0); if (dc->dst & 1) t_gen_swapr(t0, t0); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->src], cpu_R[dc->src], t0, 4); From patchwork Tue Aug 22 12:40:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715748 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp235683wrp; Tue, 22 Aug 2023 05:42:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFT3FOQ8gmr5zZMruSBpUBTTv8T16Oi+auQtaFsIMPWvuRxtuOZajrr1rOzz+TqKQskqZc X-Received: by 2002:a67:f70b:0:b0:44d:4385:1627 with SMTP id m11-20020a67f70b000000b0044d43851627mr5895731vso.14.1692708161073; Tue, 22 Aug 2023 05:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708161; cv=none; d=google.com; s=arc-20160816; b=tTCFcJL7aT3cGXOprTEjrkucE1Bj7umNtYFwAAKCr4fhxECYgH1EOfym3eUOSahQMT 1SWUPQu1cLnenPubpPODMODBJoA2kqwIGaF87GZcKviH4E+kvurNzeZyWOC1hF2vEHEP rlH3gMZ8k5qTtdpjD14tmPocvSn/yJROiyjY8Ia6+W/xwMLFRiCU2yD/LzCMwh2/H9GN 2xXfw7ee1JZx9lwiFKnufm4v71UT+aoblfQwRnev2itDIKYgt3vdzNBH1LAyI6F7m0Ns ETGOstrRyxDhfygWag5BGSYSp+tfxFBUq3I+RBEMlu1vULiy5jUToJi1WLdmvRc9azQY CzYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=9tgWMGPDbie9fGcPGgyVFDHFkfBvE8l4uEI9SosXl90=; fh=wXqw6aajGBSP4OKAgbWKHj3BSg7Yrdz+j0I8chPJZNc=; b=B3/SS46i8G0C5MonuctOyNbWqY+qh1HsdYHEX/TIHoA1N6EFfqlIEuq7QSvQhKDSw4 i8TmGlNQTWNDYU6KH/xLpI2SqpN9LIR6ILbFHWFisjl9GEhkfev7FPjmSZpG2f6iIYLc XT57P5vWwe1xQ8g9aBXyxHt/6ozwKqW672XcGvl4BAC27EoDgjqCxF1fWNTNcaxvdfnZ H+5s6qf8GHZAOF3JbQScbpQvYTIl11zqWJ6x/XSt3AtEa9KhuKbPubqpwgMHn9nF8n7Y uLGP4ma6nrsvrE9xvxCvnIT5tqmJj+lWdL1Q6kW9zLpvC9ijEnM+yVsY9cBv6y7++ZsX BMFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J2KXBdxW; 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 fi4-20020a0562141a4400b0063d57c2050asi6371495qvb.46.2023.08.22.05.42.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:42:41 -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=J2KXBdxW; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQhM-0006S9-LS; Tue, 22 Aug 2023 08:41:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQhK-0006Qf-F5 for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:26 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQhG-0005ht-47 for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:25 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5007616b756so4017058e87.3 for ; Tue, 22 Aug 2023 05:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708080; x=1693312880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9tgWMGPDbie9fGcPGgyVFDHFkfBvE8l4uEI9SosXl90=; b=J2KXBdxWDWdANzQcdikqJUwhVtE7/Nllc+n7/YFoh3p0JuFSWJQopQndpCNIwd1VoQ CI/ijojr4tMS8Q3f966G9CFxyR5PJ8nApvFVWpmf0c2LE2FYcTZDaC0h5HAlj/ti0b3L SH5oHa1fXTjiwpGjI/u0aTVSR7z5hi3SPLtdRIxtUBL468SEU9xtBL7yJadl8JHy5FI7 nHMSMGePSDsAoNbZNEE6GUZ7vUlGI0NCI1yAN9Q5ZL47THjZ7DZVPDmKc7tGxl0qNuL3 9kzSzVy8w56R6irL44cQsgJoV26s7viCHY9YLks8OZFwHPLn1Wj+0lHYOtFCQZwkwcdT 5kPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708080; x=1693312880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9tgWMGPDbie9fGcPGgyVFDHFkfBvE8l4uEI9SosXl90=; b=HjmJJlbpIOUlmhd6vs2DET0lE99K4wWwT/SxuR8eQ+cK5CW9hrqvgUZGSY00oNWMHZ 9JleykE/7LudxnSusMjCS+uW4ud99O2fx9vJyBahLDFhVzXe9x496ha5VTJuAAv3yVp+ UAjpJHQBUHqJ+kRzFy52AFEwYSd3nwNTBSp5nK/dDqmf44AZPfbXBsZWIjRR8bD0mAd+ 4Bb+AeNvH+A8pZpj1KAd+gZnPP1Ayy3nsnF7JWaAT/j3s9qH3hUXiRiHjszyyTTgPXkJ F+YZcgwPaUOUkJOvKZjOd9/IRBRPW0ejEgEpixezPSg37ROS5kvaMyB7tmi5JnT2FYJe fEnw== X-Gm-Message-State: AOJu0YyQypuDljFvcSlzbPIRrR/ZDazWt6Q4E8cgIeXzOI7O+pPevYu2 bGTobmaxlwJvKjB1ZVm8aRpPqSyLuuD7FqcKpvk5DA== X-Received: by 2002:ac2:4db9:0:b0:500:8723:e457 with SMTP id h25-20020ac24db9000000b005008723e457mr2168739lfe.30.1692708079891; Tue, 22 Aug 2023 05:41:19 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id u24-20020a05600c00d800b003fbe791a0e8sm15956575wmm.0.2023.08.22.05.41.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:41:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , Peter Maydell , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH 04/12] target/rx: Use generic hrev32_i32() in REVW opcode Date: Tue, 22 Aug 2023 14:40:34 +0200 Message-ID: <20230822124042.54739-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/rx/translate.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index f552a0319a..75590ae05e 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -1513,13 +1513,7 @@ static bool trans_REVL(DisasContext *ctx, arg_REVL *a) /* revw rs, rd */ static bool trans_REVW(DisasContext *ctx, arg_REVW *a) { - TCGv tmp; - tmp = tcg_temp_new(); - tcg_gen_andi_i32(tmp, cpu_regs[a->rs], 0x00ff00ff); - tcg_gen_shli_i32(tmp, tmp, 8); - tcg_gen_shri_i32(cpu_regs[a->rd], cpu_regs[a->rs], 8); - tcg_gen_andi_i32(cpu_regs[a->rd], cpu_regs[a->rd], 0x00ff00ff); - tcg_gen_or_i32(cpu_regs[a->rd], cpu_regs[a->rd], tmp); + tcg_gen_hrev32_i32(cpu_regs[a->rd], cpu_regs[a->rs]); return true; } From patchwork Tue Aug 22 12:40:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715749 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp235684wrp; Tue, 22 Aug 2023 05:42:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFui3GFayBYR1c+mFqmyUcz+hOSa7hGA9thViur9P9NPwKYgYKEctVVs3ztvtSDNh+oZr5/ X-Received: by 2002:a05:622a:cc:b0:406:9466:6962 with SMTP id p12-20020a05622a00cc00b0040694666962mr11852628qtw.61.1692708161186; Tue, 22 Aug 2023 05:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708161; cv=none; d=google.com; s=arc-20160816; b=aAng7pVf4LY8GRLNAh8HWLxInvmxjYGWL/zv/PjUiP/xIfsTpdXaIbJZid+82gmHpE MjYTbhyIe2RaIK3tvIWa/PAF/7EoRLYShSgM7/UxnyfuBi1kZe9zgSqnaCVZ5gPrEPuV fXQrx5kXJaWqGtsBG6hw3qsiPgPqnK4oVnLkc+j5D6hOOLCitVpVZXppU0mTHGgkHAEq P97V1saqIlds0Aiajio+YBo6J5KC33wsZXftskiS1ILLp7m2nUXdpnSUC0ym4THLNIqC QaESJrZaJrLf7nK2WE1SybxXbrrh3CveHizPDCk/aCzL763WtL/NIiqZG1BEHQq5CkHs 3kVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=xMymSiH1goSxgVN9+Y6AclUCQc+KR5ymy+nGsoSz5Is=; fh=wXqw6aajGBSP4OKAgbWKHj3BSg7Yrdz+j0I8chPJZNc=; b=PjRsn7x6gPAK7aMLwHoDf2ybzHOxqJ4pZsnTIKMN/DNhDVKI3o433at78mKajElCAx vLKt7q68zyFOjpOp2SRSvnVrsZEG8crqqZ2dJkcJSdQB+95Ym23eV14CjiIyS3J3FvRN h1X5AoD3k56fBe6vx0a1OklCCaF14KXwuS5WUySiPyIN26ZCU4t4m2NX0r8XWhK4Zcmc 37xAQuZE6M7bB1jZB679amHiskZbRPmihQqlIvm0IPgeK6utPxpU3nbaRkTQeRNd47L1 2bjxup770JahZaex7sRB9uFHfAjtkX41rKVI0Rsn8XiZEaoIJavqN3gVO8ICbmHbSFiL wjpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQGYxXdM; 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 e1-20020ac85981000000b004108a00ae11si1196664qte.553.2023.08.22.05.42.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:42:41 -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=KQGYxXdM; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQhf-0006cC-H3; Tue, 22 Aug 2023 08:41:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQhW-0006YH-8M for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:39 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQhO-0005j9-6q for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:41:34 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-317716a4622so4013273f8f.1 for ; Tue, 22 Aug 2023 05:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708088; x=1693312888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xMymSiH1goSxgVN9+Y6AclUCQc+KR5ymy+nGsoSz5Is=; b=KQGYxXdM1kqQuEKU+AccY9G/3yCzuNZWnVjm7dnZokH6MYYqG6PYW9fNF9pZt6X+c2 ZoyM4ccApJ+QnM+dKgL9vemOsLjwhfsMfj/642ApTN5fyaROVCpxWh3EslC5wOvAZSxj nLXTFy7bFW4rGgJatmUwBpkW9MQvQhHEa5SYP8QCN6e/Oo+r02ivLGkSKlLY3juH69B1 mTw8PJ66Gs5bkilPhO8nkVvQNUOvxJLuf9YfxyGkVq8ycwrOPVKtHHrvIYZtm88ELVdR 5//v+CxEZkFSVuutsbBQoDtvUob8J/9hL/9YpQiAH0PMuy5UhXcRZC48pr6pNzzTbOsI KD0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708088; x=1693312888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xMymSiH1goSxgVN9+Y6AclUCQc+KR5ymy+nGsoSz5Is=; b=LHRvi5spMOMhdvPpZkJeE3KjiwJEQbQCFz54iIPLfYcic8MiEbPmGsYgh9SIVBGYr6 9LJf9vVDA4t0UMi8V7Jy8uxLguEbp77+E7ruVxOQWdsThE884Nscvr15rLAiokI4zh8o NFFhCNWnk6PLA+/eildg7qoBc8HMZVkvyVrosQfMRkYbWKgqe1pDvm15w5j+wvZk5ScB lWla38grmLKC7laR8VOKuEem4nHsPkFl+do34ejBcR+EPC++1V5ZXUKIGV+wTWtd+WX/ VidLQrClZ/28jv6esrgUeZd+rMXNMK1y377cLZJee0A3aaxFEJJtTCMz945ek49BzsKQ /qxw== X-Gm-Message-State: AOJu0Yyx+MF5LS3bi2SsEQ8MsS3H+CPjU8qRYxfr7jOIr0v3YTUE/cIX /7ujfSPVNJvwGeZxVK/7CTspeAYqJXTVL1Qcd/9SOg== X-Received: by 2002:a5d:4691:0:b0:319:8bb3:ab8a with SMTP id u17-20020a5d4691000000b003198bb3ab8amr6663897wrq.52.1692708088283; Tue, 22 Aug 2023 05:41:28 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id 21-20020a05600c22d500b003fee777fd84sm10913972wmg.41.2023.08.22.05.41.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:41:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , Peter Maydell , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH 05/12] tcg/tcg-op: Factor tcg_gen_hrev64_i64() out Date: Tue, 22 Aug 2023 14:40:35 +0200 Message-ID: <20230822124042.54739-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Similarly to tcg_gen_hrev32_i32() for 32-bit values, extract tcg_gen_hrev64_i64() for 64-bit ones. Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/tcg-ops.rst | 4 +++- include/tcg/tcg-op-common.h | 1 + tcg/tcg-op.c | 29 +++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst index 17965faa03..e8a2f8aacc 100644 --- a/docs/devel/tcg-ops.rst +++ b/docs/devel/tcg-ops.rst @@ -492,7 +492,9 @@ Misc * - hrev32_i32 *t0*, *t1* - - | Byteswap each halfword within a 32-bit value. + hrev64_i64 *t0*, *t1* + + - | Byteswap each halfword within a 32/64-bit value. * - hswap_i32/i64 *t0*, *t1* diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index bb515dfd51..a9184caf9d 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -562,6 +562,7 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg); +void tcg_gen_hrev64_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index b1b5d9b45b..310acce410 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1876,12 +1876,7 @@ void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg) TCGv_i64 t2 = tcg_temp_ebb_new_i64(); /* arg = abcdefgh */ - tcg_gen_movi_i64(t2, 0x00ff00ff00ff00ffull); - tcg_gen_shri_i64(t0, arg, 8); /* t0 = .abcdefg */ - tcg_gen_and_i64(t1, arg, t2); /* t1 = .b.d.f.h */ - tcg_gen_and_i64(t0, t0, t2); /* t0 = .a.c.e.g */ - tcg_gen_shli_i64(t1, t1, 8); /* t1 = b.d.f.h. */ - tcg_gen_or_i64(ret, t0, t1); /* ret = badcfehg */ + tcg_gen_hrev64_i64(ret, arg); /* ret = badcfehg */ tcg_gen_movi_i64(t2, 0x0000ffff0000ffffull); tcg_gen_shri_i64(t0, ret, 16); /* t0 = ..badcfe */ @@ -1936,6 +1931,28 @@ void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_gen_rotli_i64(ret, arg, 32); } +/* + * hrev64_i64: Byteswap each halfwords within a 64-bit value. + * + * Byte pattern: hrev64_i64(abcdefgh) -> badcfehg + */ +void tcg_gen_hrev64_i64(TCGv_i64 ret, TCGv_i64 arg) +{ + TCGv_i64 mask = tcg_constant_i64(0x00ff00ff00ff00ffull); + TCGv_i64 t1 = tcg_temp_ebb_new_i64(); + TCGv_i64 t2 = tcg_temp_ebb_new_i64(); + + /* arg = abcdefgh */ + tcg_gen_shri_i64(t1, arg, 8); /* t1 = .abcdefg */ + tcg_gen_and_i64(t2, t1, mask); /* t2 = .a.c.e.g */ + tcg_gen_and_i64(t1, arg, mask); /* t1 = .b.d.f.h */ + tcg_gen_shli_i64(t1, t1, 8); /* t1 = b.d.f.h. */ + tcg_gen_or_i64(ret, t1, t2); /* ret = badcfehg */ + + tcg_temp_free_i64(t1); + tcg_temp_free_i64(t2); +} + void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg) { if (TCG_TARGET_REG_BITS == 32) { From patchwork Tue Aug 22 12:57:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715757 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp242026wrp; Tue, 22 Aug 2023 05:58:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGi9E34YLTYjPQnNNOPRsU0ojxltqWvNE3zM4TrtfwLM+V85z7iuZWyE9eBXPdzL7sWUnx X-Received: by 2002:ac8:5c83:0:b0:404:c430:6695 with SMTP id r3-20020ac85c83000000b00404c4306695mr13931645qta.53.1692709109825; Tue, 22 Aug 2023 05:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692709109; cv=none; d=google.com; s=arc-20160816; b=JFhbcNcyVt8QWzFhURzfiCagJD+rMo9Bj0z6OLkGeSYzl38zf9DaEXmS/ztJpsazi1 nK1TDNIXu9qfikZ1Jq+ANWqZc34Quz3Jmv79MWkVPXCXz/4iBss5sok4f/ORmf3v/mgl jKynt2bG8hjp7hBhRsUEVdQkL9mf/qodCrBcIKJFXTDKqHbc/8WkDQ32e3LrI0HE/hrt wHhhr8BBQP2/Tm9DGe0yWyv3QC5i99L7aQaPnfJpjEmDEtIbPR3Jm3XZWXjAb0LSnvS0 NrjYFtreisUbausFAeSDPMdLOM54r9uKda2cNYnMFhlv4LN8z8wm/7XTjZNjC0JRbFfO m2qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=pHBA30PSCUnBRne2oNj9oNGhYXtpgOXc/MJu68ppsA8=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=R69hkmyL3R/MHZ3XwX70aDIwd1MWBZoxvbO6/+PuH8qb3CbMAhQKvYkZrQFHLSM+SB Wvohwxh8xL4anAPk+5ksk07eZwjDWBboqIJf7EIfOqCluZlvyicZvYG8kY9o68OjC+/t K2mK4GtfvhXyWXiBkU46A6TLGU+cXkt4/w9du+mvg/mrivXVjS1lUTB2zvqiShUS/wdh Iv1Pja648n41oJD2MKPmBRlSaUs4gquxyO87zYXS4cyhdJljjY2SWYdZaOlZb1fmIlfP R9HWOBHgW0ODjZxVVlcZyHJK/3F4/zh78S6vZg/uCY+sPgfSROwyn/2qwtqQa1wvDcRF 7/YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G2Gy0yMo; 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 o6-20020a05622a044600b00403affc6ad2si1224710qtx.469.2023.08.22.05.58.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:58:29 -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=G2Gy0yMo; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQxT-0004Lj-93; Tue, 22 Aug 2023 08:58:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQxQ-0004HS-No for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:58:04 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQxM-0003Rt-Qb for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:58:04 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe4cdb72b9so42516835e9.0 for ; Tue, 22 Aug 2023 05:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692709079; x=1693313879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pHBA30PSCUnBRne2oNj9oNGhYXtpgOXc/MJu68ppsA8=; b=G2Gy0yMoT0DkNP8xD2JzjgaNH0X8wtgfafL8lDh8T8kPEJCV7eHDS7VB3wcI8EKff1 gy6y9Q2By7tDkMlfZH/SjypJchmOuOAqYvCEUklIAzpKoTmHDEk9wGt0vVrBHOueEFFV 8F/zEUyR/LE6r2xc7D/vNkfmbSrjGYA2gEmYPfbXAyp2abQqrEXfXscIOMD21v8XnyW4 Ga8zcTnxn1iSNkfz3hhWaMd3mTOSfgoA5HN7BB72qTknto4wupucc2aqdu2GzDuUyPTv XtWeJNSPkuMD1gfB/yYOQk4rB2ZPKKZBSDkWCdVcvzFyrp2NEY+hyQ3DPN3MVcdF+Cam cPOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692709079; x=1693313879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pHBA30PSCUnBRne2oNj9oNGhYXtpgOXc/MJu68ppsA8=; b=eCo8KJAn/9WJsBzlJbxRiv+OC4GZjWIV45m2PLxry+Fa/Pl+AqFpYQANTPSr04a4N9 E5D2Q8HuSu09jjiSUmTfAjaxS1RpZvAnEzEcLEI9DtpZlQbr3IRy0wr8HLhPk+6MJnir ro9d18nfW4ptvWzjgZmg7Mlpltlic0qpa/gsevb0DAm1ZIh1ty+WGRCR2QcqeHrM7lOz CX5bOYJCHjSpu/FBNOPnA4NGnZ+r87wzLWUVbRU81bLNrDndFf8Zvf2lljgm8qBRDyrx 4UNerpD63KuMT3gFBHesNVC7WNkPAiGW2nm2HLG6zrVGwt2DMniGUg42dZUIOYpQ03gG zavQ== X-Gm-Message-State: AOJu0YxnU2iQhbnBTy6l5S+TPyWhnk+GOvhukdxpQPUbn3OdZgSMeVvP yHXGyfwLm5quSvl417W2ezBpWjpQQORda5xGDoBO0Q== X-Received: by 2002:a7b:cb41:0:b0:3fe:1f93:8cf4 with SMTP id v1-20020a7bcb41000000b003fe1f938cf4mr7508972wmj.8.1692709078966; Tue, 22 Aug 2023 05:57:58 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id z9-20020a7bc7c9000000b003fef57e64c4sm3780056wmk.25.2023.08.22.05.57.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:57:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 06/12] target/mips: Use generic hrev64_i64() in DSBH opcode Date: Tue, 22 Aug 2023 14:57:51 +0200 Message-ID: <20230822125752.55328-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 4f34ea9b6a..08ee745a6d 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -4936,16 +4936,7 @@ static void gen_bshfl(DisasContext *ctx, uint32_t op2, int rt, int rd) break; #if defined(TARGET_MIPS64) case OPC_DSBH: - { - TCGv t1 = tcg_temp_new(); - TCGv t2 = tcg_constant_tl(0x00FF00FF00FF00FFULL); - - tcg_gen_shri_tl(t1, t0, 8); - tcg_gen_and_tl(t1, t1, t2); - tcg_gen_and_tl(t0, t0, t2); - tcg_gen_shli_tl(t0, t0, 8); - tcg_gen_or_tl(cpu_gpr[rd], t0, t1); - } + tcg_gen_hrev64_i64(cpu_gpr[rd], t0); break; case OPC_DSHD: tcg_gen_hswap_i64(cpu_gpr[rd], t0); From patchwork Tue Aug 22 12:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715755 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp240394wrp; Tue, 22 Aug 2023 05:54:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZ74j0jNWJbDY3IRDwK8xUMI09luWqkZNOaKGZlSx1xwRAgw6uBxAnydsOqkihgualTPoo X-Received: by 2002:a05:620a:1a8e:b0:76d:ad36:555c with SMTP id bl14-20020a05620a1a8e00b0076dad36555cmr4255692qkb.43.1692708852695; Tue, 22 Aug 2023 05:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708852; cv=none; d=google.com; s=arc-20160816; b=d2bgrGf9p3u/hOQTNL8cwYnmM4t8yguXw6x38fodu+wMmQ8BvlU/4fT3bvugl48v3D KrNtyHc/YfF2UB9upA3tV9N9koEImenvJhna0LUnRukLo8Pusyb5au6Lx0YOm/JTHLy5 w7qP5RhYt5PJNAQiCTPYJQDeg5c4hxU6vugk8bKaIAbHfBy2wxhLLoH110jtH2jw+gj9 /hzAHc/SteSx+yhLWSTJHNuAwfNsE7TRLqR5d3GVOIBvF2yEdjfLLXbnVaTP4uFXcVP3 xDPGJS3MQ+J3igA1Agn6A0DmBztBNG1JjEqcw9VY0WTBZ82i5Y0YlIFVmbG0GDepPG3y hsNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=Icl2oC8GOqjO24t8EWhlRVld/KcOgjsSN5YvmxZ62js=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=k24znK2Oy4iYq0OQ3xWKVJf1fzVO1lB+tkoAeEmEb90Zj8n1xnxjWfer0EpyKHiIgg aj/UU1xwY7P/IY1ltb3jEUZtr3jEawZJylPXl32I5qR9jeit1QOky4zVvbGeXuTNFrPE kbm6u5VsakiH7lSf7zD6imyZEuanG0tGFJQAOdyXjm2zaMirfrUjnQVJvxAXnKY3L3xq qlJkmlmAsjBHp0XmKPuG3Y45+H3KrDwEN4/0jEWexhHis6aGS6hRbVuK/UND1kLeEjvE bISBPohMpvJMchkc2zrR/MjliD2pvFb1od54BpWJob6iDP1DVJCcmOmBIBKs9K3CEKbt xb9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gp9lX3VD; 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 rj3-20020a05620a8fc300b007673d260cabsi1154378qkn.731.2023.08.22.05.54.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:54: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=Gp9lX3VD; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQtF-0002aM-Jc; Tue, 22 Aug 2023 08:53:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQtE-0002Zb-0k for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:53:44 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQtA-0001x7-AA for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:53:43 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe4cdb72b9so42477025e9.0 for ; Tue, 22 Aug 2023 05:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708818; x=1693313618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Icl2oC8GOqjO24t8EWhlRVld/KcOgjsSN5YvmxZ62js=; b=Gp9lX3VDoXX35GM5xyhu2PCd9ow6FOVUajl8oZz8OU/Dsya/BMC4kUvSTeAE/VS5II ftoxjDg2l5GvP0Va7K9DJefDdfD3F0TVxt+BN9Jx+qf4lUi0KrZQIzognPu81wg9docv uBwmQb2BWFweD+vKAWBxftuv1CJaWRE/cMxeb/Xk2r7els4pEa+xOdcifHReIgDqQEhk rrvx89ojQyr0UxWmm5XSUQIIZLPI0huQMYJw6AREQDC6oF0U6jn3MnK2pH4myMbn2RFm /IkqfVm3etK8Y/p2xgBsGU7jKJGbditWvzQvjWlALqayN+dooyUGYG7dEOVdsSztUPr7 KKvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708818; x=1693313618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Icl2oC8GOqjO24t8EWhlRVld/KcOgjsSN5YvmxZ62js=; b=Ls0H7yfY89vdlhxvgy4VPgKShPBZLqRMXRyoK76JCdEvxV4+RrRiAyLhEY7jW2KbQA EA+SUXeDqbLBfQX2OsxKlVKvR3o1QhEjG9EPAeeTX5xIPWc5VpNYs2XhtoVfNTkZR8lc d9ZwG2etOHVywfhE/WZKOFE8GXEMkOAyrl3Op+m7t7aF+JoHBBO8kC0Kp+77hrx1IU68 PIujTGHQS6vf2aIVOV0vnEoXhi7sPKvDTV6qzEX5mPtWlKzSQY1H8GMjqXd4aJTOC5Ux u/hBmDn2Lx/pIuexrU0GLfH+PCNu61IcS/2Uq1suA4tqo4jew2hBYTm23fj0cagm2jxp oeAQ== X-Gm-Message-State: AOJu0Ywr1jPcTUYZ6V3UtFGKSMcoLds0kFqQNEMzCaOtKGYoH2D/y3sg OkLhQl/nyknyn/iypIzb4a18iuzPc+D/FAyeReluzA== X-Received: by 2002:a05:600c:20a:b0:3fe:603e:7fd2 with SMTP id 10-20020a05600c020a00b003fe603e7fd2mr7165320wmi.0.1692708818329; Tue, 22 Aug 2023 05:53:38 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id x20-20020a05600c2a5400b003fef60005b5sm3426261wme.9.2023.08.22.05.53.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:53:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 07/12] target/ppc: Use generic hrev64_i64() in BRH / BSWAP16x8 opcodes Date: Tue, 22 Aug 2023 14:53:31 +0200 Message-ID: <20230822125332.55086-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nicholas Piggin --- target/ppc/translate.c | 10 +--------- target/ppc/translate/vsx-impl.c.inc | 19 ++----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 74796ec7ba..91a9ec2d1c 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6435,15 +6435,7 @@ static void gen_brw(DisasContext *ctx) /* brh */ static void gen_brh(DisasContext *ctx) { - TCGv_i64 mask = tcg_constant_i64(0x00ff00ff00ff00ffull); - TCGv_i64 t1 = tcg_temp_new_i64(); - TCGv_i64 t2 = tcg_temp_new_i64(); - - tcg_gen_shri_i64(t1, cpu_gpr[rS(ctx->opcode)], 8); - tcg_gen_and_i64(t2, t1, mask); - tcg_gen_and_i64(t1, cpu_gpr[rS(ctx->opcode)], mask); - tcg_gen_shli_i64(t1, t1, 8); - tcg_gen_or_i64(cpu_gpr[rA(ctx->opcode)], t1, t2); + tcg_gen_hrev64_i64(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); } #endif diff --git a/target/ppc/translate/vsx-impl.c.inc b/target/ppc/translate/vsx-impl.c.inc index 0f5b0056f1..639ab7f1bc 100644 --- a/target/ppc/translate/vsx-impl.c.inc +++ b/target/ppc/translate/vsx-impl.c.inc @@ -154,23 +154,8 @@ static void gen_lxvdsx(DisasContext *ctx) static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl, TCGv_i64 inh, TCGv_i64 inl) { - TCGv_i64 mask = tcg_constant_i64(0x00FF00FF00FF00FF); - TCGv_i64 t0 = tcg_temp_new_i64(); - TCGv_i64 t1 = tcg_temp_new_i64(); - - /* outh = ((inh & mask) << 8) | ((inh >> 8) & mask) */ - tcg_gen_and_i64(t0, inh, mask); - tcg_gen_shli_i64(t0, t0, 8); - tcg_gen_shri_i64(t1, inh, 8); - tcg_gen_and_i64(t1, t1, mask); - tcg_gen_or_i64(outh, t0, t1); - - /* outl = ((inl & mask) << 8) | ((inl >> 8) & mask) */ - tcg_gen_and_i64(t0, inl, mask); - tcg_gen_shli_i64(t0, t0, 8); - tcg_gen_shri_i64(t1, inl, 8); - tcg_gen_and_i64(t1, t1, mask); - tcg_gen_or_i64(outl, t0, t1); + tcg_gen_hrev64_i64(outh, inh); + tcg_gen_hrev64_i64(outl, inl); } static void gen_bswap32x4(TCGv_i64 outh, TCGv_i64 outl, From patchwork Tue Aug 22 12:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715753 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp239615wrp; Tue, 22 Aug 2023 05:52:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYmXVjX6ez+6cQkncLkrEmaatRJ3XW97UbHwEF8SFRAQ9oGi/iW+6zEFfpytYAw3wRC9q4 X-Received: by 2002:a05:622a:14d3:b0:403:a7a0:c85f with SMTP id u19-20020a05622a14d300b00403a7a0c85fmr15601201qtx.26.1692708729547; Tue, 22 Aug 2023 05:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708729; cv=none; d=google.com; s=arc-20160816; b=pgy59jIIpAsZFjtXmnpvASZsPC2ofBkY1VcnGoGInzQ9yB1DCieMTGGlMJwKfhlXTX ZXaHKMyrju4ukRMLnMRD76usxUVSEImCYapcNgUNxD/qCG3EsDBP5acTuRmTDNxWwXpz Nuhcf0o6CXfqJeC5SC6JwBF3fyCMCd/Ca1edvwDpjFwth4wNlPhlS2f5zDJO8RcJoTNZ Mdp9RdrVwb5BrO8gXkuqaZkQ+liv/QV7xns55k09K8FeMgTfa5aRHJf6taGzMgW8leQ9 W8rlAQPfN+h3lzdKOBH3oGMRS8kG0FGmIY4GVyeY1hZ9RtgbFtjWXbcik7TmuV6NK8Qf dwDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=I2L/xuYIR23wVFda3pdpuHsob8xvGwoQ3f9U0j6VhpA=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=ZqcLktwQZ4mojk7olB4gsfRdj/QknoZNbYJr1Xti1Q/hTl7pmyIqKhngzGTlk/K7q+ BqT2j/eIDN/hNTZNQrtxghFwD1w2Px9e8C0yJVOl58iiHSF1CQBjyvr/V5XLBSkDR8B1 FqGu/8pkuxRf4yDs0270LWp1z6PKQyZ+OmWbLr5uPwr8MYI/WdO1wSEGj4eT8/jXo26U FTQNy4uCZ45+/2UOut6gsehDMMZdNTR5hveP/rnxCx31DUBghGN9w2hFKfRzRd0tg2wL tTW1pOJBEHsW0J/1ew1EYUcYWwQ7mKeCzPNQjJgF8COqc60qiTcVp6DFSpZ4xRcCWHQl e40w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eQHgsXn4; 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 r19-20020ac85c93000000b004032cbfb5absi6135569qta.603.2023.08.22.05.52.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:52:09 -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=eQHgsXn4; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQrE-0000uv-S5; Tue, 22 Aug 2023 08:51:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQrD-0000uj-9T for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:51:39 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQr9-0001cb-6L for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:51:39 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31969580797so3990411f8f.3 for ; Tue, 22 Aug 2023 05:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708693; x=1693313493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I2L/xuYIR23wVFda3pdpuHsob8xvGwoQ3f9U0j6VhpA=; b=eQHgsXn4UsdTo7sq5zoFj37UGH/8dagKt8G98lQFpIZs7yQZAuTUQT6VxUvghoMwPM JQiPF1gHx9xJRYZ+NaDUJZrO0JxKx21gRJAfPRBRnehYtsLMO/sqGU3ZFGjilwnZrTGu jL8wff9FGjXqbjsjyvC+nsHJnywPPsd27XYaLgdgneKlpEGbvfjAhloBPQuLmECrjzTy WDIBrTTtB+bxuj3VECnr5xyEWfzPQHhh48E7NQKuA42E1moURCBLLeUqrzXuUeO6SjIL BII9HjpISVeAiZy2pH8BokxmHwYcco38+hWu5tvG4FG5yzGaYX1+ov3x1EDvfwNlxUCC LvUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708693; x=1693313493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I2L/xuYIR23wVFda3pdpuHsob8xvGwoQ3f9U0j6VhpA=; b=TGr6r9GI2EQhGkPehrol4N6aAPNeM4jJUs6l6+LcAPpBp++oXVlLl7yw9IZUvF2eUY rdhcN2qFU6YEkvx1ffI1E9t1o9BqR/SKEPpKrixhNZywYccTL0Ak+3Utc1TYOftKJSzV VcT7yRKXjsBarzLtEuKGgNsazRfjgTRojctp+FoA6OLnGwXxrB5X6lrhizrycNJ6q2pr O6X3V2NefN+bbksdspcpzfToxndnBbNxl7hXPw4I1iMt39RCbZ/GcFpOzzcQJyLVIlAJ /exrXgZhCz33JoGK4gNrrq/Wn5phN2bmn9ouauhAP2o6FO/j/8rifLr6NQ29GIfWDnXv Tpew== X-Gm-Message-State: AOJu0Yy6TO5hWaS+qlTFzEp0e3pPz2UM5JgHAw6AaX1E1EclpZCXBycG HS0uGrfK6n4FkgFo1YiimJnpoy1LkDd7+rSGubDCrQ== X-Received: by 2002:adf:e6c9:0:b0:313:dee2:e052 with SMTP id y9-20020adfe6c9000000b00313dee2e052mr7242354wrm.26.1692708693255; Tue, 22 Aug 2023 05:51:33 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id y21-20020a05600c365500b003fef19bb55csm6331542wmq.34.2023.08.22.05.51.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:51:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 08/12] target/loongarch: Use generic hrev64_i64() in REVB.4H opcode Date: Tue, 22 Aug 2023 14:51:22 +0200 Message-ID: <20230822125122.54991-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/insn_trans/trans_bit.c.inc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/target/loongarch/insn_trans/trans_bit.c.inc b/target/loongarch/insn_trans/trans_bit.c.inc index 95b4ee5bc8..c04806dc21 100644 --- a/target/loongarch/insn_trans/trans_bit.c.inc +++ b/target/loongarch/insn_trans/trans_bit.c.inc @@ -124,19 +124,6 @@ static void gen_revb_2h(TCGv dest, TCGv src1) tcg_gen_or_tl(dest, t0, t1); } -static void gen_revb_4h(TCGv dest, TCGv src1) -{ - TCGv mask = tcg_constant_tl(0x00FF00FF00FF00FFULL); - TCGv t0 = tcg_temp_new(); - TCGv t1 = tcg_temp_new(); - - tcg_gen_shri_tl(t0, src1, 8); - tcg_gen_and_tl(t0, t0, mask); - tcg_gen_and_tl(t1, src1, mask); - tcg_gen_shli_tl(t1, t1, 8); - tcg_gen_or_tl(dest, t0, t1); -} - static void gen_revh_2w(TCGv dest, TCGv src1) { TCGv_i64 t0 = tcg_temp_new_i64(); @@ -175,7 +162,7 @@ TRANS(clz_d, gen_rr, EXT_NONE, EXT_NONE, gen_clz_d) TRANS(cto_d, gen_rr, EXT_NONE, EXT_NONE, gen_cto_d) TRANS(ctz_d, gen_rr, EXT_NONE, EXT_NONE, gen_ctz_d) TRANS(revb_2h, gen_rr, EXT_NONE, EXT_SIGN, gen_revb_2h) -TRANS(revb_4h, gen_rr, EXT_NONE, EXT_NONE, gen_revb_4h) +TRANS(revb_4h, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_hrev64_i64) TRANS(revb_2w, gen_rr, EXT_NONE, EXT_NONE, gen_revb_2w) TRANS(revb_d, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_bswap64_i64) TRANS(revh_2w, gen_rr, EXT_NONE, EXT_NONE, gen_revh_2w) From patchwork Tue Aug 22 12:47:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715752 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp238145wrp; Tue, 22 Aug 2023 05:48:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFvJWDa2RbZxSlUZJJQbCPY6KyUqcPtvKqtTbO2cyTO0yy9N/qnBuSBFWq1rDYYUYO5IDE X-Received: by 2002:ac8:5b03:0:b0:410:8d50:ea98 with SMTP id m3-20020ac85b03000000b004108d50ea98mr11104443qtw.10.1692708515286; Tue, 22 Aug 2023 05:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708515; cv=none; d=google.com; s=arc-20160816; b=VNFe/dom2tqVP9EZkKUUbzR4N+KT4/sBjCf8rAtjRfg8UeiYe0P8Hein6SEoNyFGWt adxQNQ0yH7Xd+CqVg4WmW2h8QDgx5NUhAb6rMqF0ns2W2y7SJ9c0SfdyByfScXc/l1fS qiuU2mAA+VIzPFjIuzsb8svW0EwqIwWiEVq1oA+sVHXfQ3Ws1DioYKkOTFVeghvRTxhM eKV420MIdrkpRqKRhblizRzt4NmKIrdOOWQT3CsBi07l37kBagqdKDE7ZFHJWvGddI+D 0D9PdT21ja9doPGPmIlKMsCkWzK8MmggOUvY6DFH1HaQDeoBlLVRUw7EncQ1Xx4hTOqq pRiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=jBpzt013+vp8Kmg/CJj+CKt+5qMLkjaonY59s06tes8=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=Lmz/oOtaKcCIyBYe8gBg1Y5UL2HpIf5kZnR8qZATgFQiuJPUVx5hGQpbKkSSzXC3Xc 5wDEIkxGeo73+dxA3en/bFao2UmIeW1/YSG4w8NiTtzNom1ZsG2chmmImpg86ZEW+cCA Pt/WSWRk4Y/RmjHV8ISRWeY+9QtC36MbnhlSrxhnDGYh+NV7r5voRrP56Tc0ExBswrDy csz9L/k6ns8UalENhlON8kWIr0NWVpyzygIS3KPD/z63fFiKK/BtMIBFHQUt0dtVLZxF qnDfQttUCnBF4ErYiULuIYcJBpyBVcnjYOY5Yzqx/Xmqf8veJkBDXiC75ZVXov3o0QWx iRsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yRNqcUCa; 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 k6-20020a05622a03c600b004054348657dsi1248129qtx.618.2023.08.22.05.48.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:48:35 -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=yRNqcUCa; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQnb-0006I5-TI; Tue, 22 Aug 2023 08:47:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQnY-00068I-Mz for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:47:52 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQnI-0007oY-Ms for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:47:40 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31c479ede21so1920238f8f.2 for ; Tue, 22 Aug 2023 05:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708454; x=1693313254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jBpzt013+vp8Kmg/CJj+CKt+5qMLkjaonY59s06tes8=; b=yRNqcUCa7AkrXPdM2BolYheuqrp6sp9ldEw8W7xk21yT1ELqMcYf92yArcOmD+Hr7R 4KTFBCue9V2r3qvte8E81INaZ1BGM3zcv3bR0GVRh30XAupzkChsuUQcocho0aBZ8sWh xc4GVKUXRl50UBYrFN/pyoqOiIb47EN+FEMTVWUggrS/nhD9Jge853ky3l7A0b5SFXX5 noP2yE3Mt/goOUIHzObBtYu4307qQiA5UB8Gvm8hDB8RgdErj9MXP8lZPsY5aA/ZPQg8 fe5aSZydJZxE95FjDgUb3EYZb1cK9EZFRo/g/b1GcYU8QERjhD2eCgOuqA2lvFjDdWuw Zjlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708454; x=1693313254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jBpzt013+vp8Kmg/CJj+CKt+5qMLkjaonY59s06tes8=; b=l1GrxrikDF+YQvev2H5Do1vXVZuTWOz0pkNU9Jdqr0NA+5J5EJwCS4Wx5sc7RkrZAM 3zf/d461+SXzv4IuLRJ6u1ACkJX9wMLn8y0ePa+tSvzWFz0xwXuGaKwdgNZxOCfVbUoY cT4l57pv17A1UmNvGCNemvyb1iG9+OcdhSnlmW/CSwAtCMf1rJfvqUTXwcu/ID3sA+Th daLx85ZCfWvW3jdKu1I4bnoAXFWWrMLcmcprQNA+ZUIDZAsq92pMUvMuFB3WuLR/d1pl ACeHliMAHdsNP+UtgjmQ11MJ0ktauzksoCNv/9LPv+l/DdFL9hTzkLgYULBHZVIZ9lxm hVsg== X-Gm-Message-State: AOJu0Yz19EQgVLqMUvUZ6qsj1BPvAUsx/XTB2Ki5VZq78yfzv9WEWYGK p7LxyNuumle0oS1gFD0+iCtCHH7XC3dRpo2ylQ6nug== X-Received: by 2002:adf:ce82:0:b0:319:a24:8d6b with SMTP id r2-20020adfce82000000b003190a248d6bmr7119059wrn.14.1692708454656; Tue, 22 Aug 2023 05:47:34 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id v2-20020a5d4b02000000b0031aca6cc69csm15865908wrq.2.2023.08.22.05.47.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:47:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 09/12] tcg/tcg-op: Add tcg_gen_hrev32_i64() and tcg_gen_hrev_i64() Date: Tue, 22 Aug 2023 14:47:28 +0200 Message-ID: <20230822124728.54935-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org tcg_gen_hrev32_i64() is similar to tcg_gen_hrev64_i64() but only modifies the lower 32-bit of a 64-bit value. tcg_gen_hrev_i64() can be used when we don't know at build time whether to clear the 32 high bits of the value or not. Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/tcg-ops.rst | 4 +++ include/tcg/tcg-op-common.h | 2 ++ include/tcg/tcg-op.h | 2 ++ tcg/tcg-op.c | 49 +++++++++++++++++++++++++++---------- 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst index e8a2f8aacc..3a8104929c 100644 --- a/docs/devel/tcg-ops.rst +++ b/docs/devel/tcg-ops.rst @@ -496,6 +496,10 @@ Misc - | Byteswap each halfword within a 32/64-bit value. + * - hrev32_i64 *t0*, *t1* + + - | Byteswap each halfword on the low bits of a 64-bit value. + * - hswap_i32/i64 *t0*, *t1* - | Swap 16-bit halfwords within a 32/64-bit value. diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index a9184caf9d..eb327ed964 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -562,7 +562,9 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg); +void tcg_gen_hrev32_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_hrev64_i64(TCGv_i64 ret, TCGv_i64 arg); +void tcg_gen_hrev_i64(TCGv_i64 ret, TCGv_i64 arg, int is64); void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index d63683c47b..3ac1d13b19 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -225,6 +225,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_bswap_tl tcg_gen_bswap64_i64 #define tcg_gen_hswap_tl tcg_gen_hswap_i64 #define tcg_gen_wswap_tl tcg_gen_wswap_i64 +#define tcg_gen_hrev32_tl tcg_gen_hrev32_i64 #define tcg_gen_concat_tl_i64 tcg_gen_concat32_i64 #define tcg_gen_extr_i64_tl tcg_gen_extr32_i64 #define tcg_gen_andc_tl tcg_gen_andc_i64 @@ -340,6 +341,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_bswap32_tl(D, S, F) tcg_gen_bswap32_i32(D, S) #define tcg_gen_bswap_tl tcg_gen_bswap32_i32 #define tcg_gen_hswap_tl tcg_gen_hswap_i32 +#define tcg_gen_hrev32_tl tcg_gen_hrev32_i32 #define tcg_gen_concat_tl_i64 tcg_gen_concat_i32_i64 #define tcg_gen_extr_i64_tl tcg_gen_extr_i64_i32 #define tcg_gen_andc_tl tcg_gen_andc_i32 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 310acce410..75892e91ef 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1931,6 +1931,41 @@ void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_gen_rotli_i64(ret, arg, 32); } +/* + * hrev_i64: Byteswap each halfwords within a 64-bit value. + * If %is64 is not set, the 32 high bits are zeroed. + * + * Byte pattern: hrev_i64(xxxxabcd, 0) -> ....badc + * hrev_i64(abcdefgh, 1) -> badcfehg + */ +void tcg_gen_hrev_i64(TCGv_i64 ret, TCGv_i64 arg, int is64) +{ + TCGv_i64 mask = tcg_constant_i64(is64 ? 0x00ff00ff00ff00ffull : 0x00ff00ff); + TCGv_i64 t1 = tcg_temp_ebb_new_i64(); + TCGv_i64 t2 = tcg_temp_ebb_new_i64(); + + /* is64=0 is64=1 */ + /* arg = xxxxabcd abcdefgh */ + tcg_gen_shri_i64(t1, arg, 8); /* t1 = .xxxxabc .abcdefg */ + tcg_gen_and_i64(t2, t1, mask); /* t2 = .....a.c .a.c.e.g */ + tcg_gen_and_i64(t1, arg, mask); /* t1 = .....b.d .b.d.f.h */ + tcg_gen_shli_i64(t1, t1, 8); /* t1 = ....b.d. b.d.f.h. */ + tcg_gen_or_i64(ret, t1, t2); /* ret = ....badc badcfehg */ + + tcg_temp_free_i64(t1); + tcg_temp_free_i64(t2); +} + +/* + * hrev32_i64: Byteswap each halfword on the low bits of a 64-bit value. + * + * Byte pattern: hrev32_i64(xxxxabcd) -> ....badc + */ +void tcg_gen_hrev32_i64(TCGv_i64 ret, TCGv_i64 arg) +{ + tcg_gen_hrev_i64(ret, arg, false); +} + /* * hrev64_i64: Byteswap each halfwords within a 64-bit value. * @@ -1938,19 +1973,7 @@ void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg) */ void tcg_gen_hrev64_i64(TCGv_i64 ret, TCGv_i64 arg) { - TCGv_i64 mask = tcg_constant_i64(0x00ff00ff00ff00ffull); - TCGv_i64 t1 = tcg_temp_ebb_new_i64(); - TCGv_i64 t2 = tcg_temp_ebb_new_i64(); - - /* arg = abcdefgh */ - tcg_gen_shri_i64(t1, arg, 8); /* t1 = .abcdefg */ - tcg_gen_and_i64(t2, t1, mask); /* t2 = .a.c.e.g */ - tcg_gen_and_i64(t1, arg, mask); /* t1 = .b.d.f.h */ - tcg_gen_shli_i64(t1, t1, 8); /* t1 = b.d.f.h. */ - tcg_gen_or_i64(ret, t1, t2); /* ret = badcfehg */ - - tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); + tcg_gen_hrev_i64(ret, arg, true); } void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg) From patchwork Tue Aug 22 12:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715751 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp237752wrp; Tue, 22 Aug 2023 05:47:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvR6CIiV1IDDXHZ4Jabtq9I3a6+kfs/YUdVLJrOT7s/I3fJT2VSt0yvOReJWpFp6TCCLOK X-Received: by 2002:a05:6830:2042:b0:6b9:742a:750e with SMTP id f2-20020a056830204200b006b9742a750emr11751289otp.2.1692708458544; Tue, 22 Aug 2023 05:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708458; cv=none; d=google.com; s=arc-20160816; b=XaV+ZuA8kX0Pztnm0Ag9Ucr9QQe5/mxlqmilK/0yK/ANDaGpctwfU60FMVG+Lxy6xo kKNsWFkyLxQ+wR25wjkN9E8avLrNvKW2mBnY59oX4RdkBm5UCKmBG7Az/81Sg0h9bdcP nyjckfYVj/PEPukVvPPy39MKVGvWG1rdZXEyaGrSt5mx5xGKnFysBIOeQaeEfcrYo//c 7iAwHt8Vi5/21UnHAG027xGC9RT7CN+arxEmtr8FCs/J+Aq/sL50Wx2NcE0TPgStxsbW GGT+T5zVzteM/fiZYs//ASrowG3AZObjtfMFs4nXh5asn13Rbk9b72A+zsplPgHKaXpg CHeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=3CvejP1SPWKY/vo0PkTSUlRcOk/R6PHI3gbd8lW0JWk=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=o3ISBwU2zEbkPnZSurrbEUmpDh9UlmdBTr4SgF+eGvqZn+pNuMRJku/Zovge5zPASa SXTSPZbOH8QgDMT8FnKMX2iQm6el2M96exxtEMEOTw98JVz0TUWiZDCxpuL3mo6KKsw1 r+H/ZM5Iy1rUKUYT/Z5Z2aPeK3RryFRfOzw3OfZqBSN73uff+9PY57eRi+J0RIlhEi6e 5zbYlhhMDZg3Lx4ylqE4VCVQMYEPm/5yQ36UVgqqyFoygrp3Mp2VQD1+Vfq4/kwYKvDT tKxvschM8ZqeGCr0fNsM72zSE4vqennccVC8BqQdTuJ5SNWpfKVOexqa9O30h0OGupQO 2kbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9aGn+Mc; 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 d8-20020ac85d88000000b0040cb20e8fd3si6306779qtx.768.2023.08.22.05.47.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:47:38 -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=F9aGn+Mc; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQmP-0005O9-2f; Tue, 22 Aug 2023 08:46:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQmN-0005Nl-0H for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:46:39 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQmI-0007JB-SY for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:46:37 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5007f3d3235so3481413e87.2 for ; Tue, 22 Aug 2023 05:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708386; x=1693313186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3CvejP1SPWKY/vo0PkTSUlRcOk/R6PHI3gbd8lW0JWk=; b=F9aGn+McmTleL0Oc26hFNmWY8lYtYrL/tLJ3J8c2prORtmV7052GRh0OnHCKIy3XpF f+V/8ibJ6xAXPhSUKA0y746fcWfpRdYvm1et+zDXrgcGSDqANDYOKgKY7bXHN9c6cqRN tNo/uHuqGPsyJ7tvvlck9rBH/t1Zw450N+phEbF9SMfSuRTxesJDRS9jTMmpxbBXEUwh 6i8S2yMa+U8t4rEr4LWm9q2tBQ+6gJ2qB1Z8OUV+Otoj74Z/5jZ5R9jF+zlJBnyBH5N4 vcQk42X9Z9L34SyPQjiv2fyL0rbCnuDyUx0tdf9CwN/K3uqE93EBh+l/5YequWE8OGBH GFBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708386; x=1693313186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3CvejP1SPWKY/vo0PkTSUlRcOk/R6PHI3gbd8lW0JWk=; b=XGaPagZYHprJoHr6zwUrNLK2WrAtMCXvNTeZmALXDe0DvY0PyuQy6/VcZbI5VTU0n4 lhrvBn/UB6smPf/ugiZDxd1h108828cVr9yIYHf0oOrLWvheG07KBYvhQzxvDWaDaTSZ MoT2sK6Wp0GeVkP5zQNfWmUYm8N0/TFxaKfDuK8zOTL3mln03hLhanPPax0MmBXkxBEo 5QJaci3yRTicT8CTUWjXcEJD01wu6qEZTXuOlAWVrap+ObP9apXVX76F6Whp8+9YXnPQ /8bG7TZK8YSpcODMNNNKpv27gRCdJUTRb8LHgGNlddwi9UZUkY73jXKpVfaYOgr3H5ho SfbQ== X-Gm-Message-State: AOJu0YwifFLp7OvId4lBXuNTvKGnKiAW3NBIyitbPnhZMG1Y6OM/Kik2 rLrYlxIC/FvDCEjCnhQkRltbeeYl7Hkmnej+ZrQ/1Q== X-Received: by 2002:a05:6512:340c:b0:4fb:7592:7e03 with SMTP id i12-20020a056512340c00b004fb75927e03mr7569000lfr.20.1692708385982; Tue, 22 Aug 2023 05:46:25 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id z10-20020a1c4c0a000000b003fef5402d2dsm3982597wmf.8.2023.08.22.05.46.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:46:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 10/12] target/arm: Use generic hrev_i64() in Aarch64 REV16 opcode Date: Tue, 22 Aug 2023 14:46:18 +0200 Message-ID: <20230822124618.54873-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/arm/tcg/translate-a64.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5fa1257d32..2973831b38 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5040,16 +5040,7 @@ static void handle_rev32(DisasContext *s, unsigned int sf, static void handle_rev16(DisasContext *s, unsigned int sf, unsigned int rn, unsigned int rd) { - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - TCGv_i64 mask = tcg_constant_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); - - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); - tcg_gen_and_i64(tcg_rd, tcg_rn, mask); - tcg_gen_and_i64(tcg_tmp, tcg_tmp, mask); - tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); - tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); + tcg_gen_hrev_i64(cpu_reg(s, rd), read_cpu_reg(s, rn, sf), sf); } /* Data-processing (1 source) From patchwork Tue Aug 22 12:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715754 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp239858wrp; Tue, 22 Aug 2023 05:52:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+oyPBELGQsqGRXz5A9mDIi57x84IivbwwmemJl5h8Epwu12XRnKQwUoJlvBkTrkAnnX1o X-Received: by 2002:a05:620a:c43:b0:765:6524:8441 with SMTP id u3-20020a05620a0c4300b0076565248441mr14324811qki.22.1692708768029; Tue, 22 Aug 2023 05:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692708768; cv=none; d=google.com; s=arc-20160816; b=KBAKjY0PO1A8bULeNoJAOJx23kCvKTDnhtEdZgGKGPCuqktq/Q3cym2Og2p6HAIXQU 1DTdXiKILCJQvOoKFRg+5pjFW8tP7Lx8VaCAXnHu8j47cOnVd5C5uj2qN2OA7SGLLHeD uQxjWkOj0Hk8narhrcruFVU6jN18JqHCJHrfCLfEfqJCIQEV+Cnrqy71drY4sT3dOQl5 E/nV2S3XqO/0ZP4Di/qwIeR5w4HjAqONqYiIvtTW0x4W4KBAclZsuhZ0C/b74zxZhhXU n0DpTs44YusNhqiaAjEp/Obm/peGu4Bcdd/g+XUocgGf9ikS+wst74i+vMR6YU5QzMC4 H6zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=rmGI6gsRX9IuSQ5oYPSIuzI0cu3lm8s84HSXfMSE4z4=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=zjqU9TWsCT9aPkeoCiQ+cOTHBRSDKoTbg7QeHLHOn6iCn72n9KN0lqg/5u4CTtKN9x 60vS6EVYpu4tBsSTsWCtKuRio/NP0tcNNpGGHJo++Pme2fHP2K95ISg8031XS1aSj71/ YRduGwWHjfIuSOAvHW/cE0ZzVtGrccegAqAZhAKCOdOlpXY1/4FqnS49H6HlrWmAYL3r n4LTdG1/mJ8B9WrOIpgaFg2SOkt3rxtIuQF5Zr7z/YyJeEt708vPVzjDGaD4hlGkJkfL L7WqTN/hKMDFAfSdulY8uMnDTyNGKlT1Re5g6ons7lUkRCK9ICXXCqBxBNTCY7aJ5Gb8 3rKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TQDUo4DC; 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 w22-20020a05620a445600b0076da4734528si3209343qkp.357.2023.08.22.05.52.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:52:48 -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=TQDUo4DC; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQs6-0001Ke-H1; Tue, 22 Aug 2023 08:52:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQs4-0001HV-KN for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:52:32 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQs1-0001nX-VR for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:52:32 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fe4a89e8c4so43062505e9.3 for ; Tue, 22 Aug 2023 05:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692708748; x=1693313548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rmGI6gsRX9IuSQ5oYPSIuzI0cu3lm8s84HSXfMSE4z4=; b=TQDUo4DCoTIY73flQk21bftZrkdZvdX5YMCdthWNjOojiyre6lssNZwcuQRgQY9P4e E+TMpMX2SlFXuapk4Ya1Ca9RKHDNNUpE8GngRPidvxDBwVdEycz1+RLJVHPmk1sloP4w 1qffMrDvRuzvIbHVXVUYdXNxGq9dZJ7qdEnDT5ydHnmsLXGLsGSbvP1N6q3MdZFoL5Rk FVOkY/GuvteZc+NCD70Ys4ZTF/NurV9QqOytbq8iWiobyaBmGmCe6rQXUl2kTtDPcfPv dNHgAHvazDbN2wpAdyvfDMDdymHAx4V65CmBQqWz0Eq/4WXwHJU1rM5AyWYYqEB6oxu5 q7Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692708748; x=1693313548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rmGI6gsRX9IuSQ5oYPSIuzI0cu3lm8s84HSXfMSE4z4=; b=EkVlZQ6v3qI7JWW59ts/7yPnB8qksrbLWSjGG4dK825THcyBfp0AQFw9b06Omzu7CO lgZC3+Db9DdZgay5eu7/yCiBVhO+M19LqQ//pyotgf/65yW09Y/9IctjeoluOCiQIUb3 7JYJp6K/+JCatvNo4X+zfTUimdVCi1WsZKEAIiELaMvTrFBVgHnn/yTEy6uM1SvZHnug IevwXf7e/Fh/AOmuxetVgyo7410+OI/UsldcCWcs463Hca1AD95oDKI+TvvXlfLxb15X v8N3dJmRiV9E6Tj0VB8tV8tYrtb+cH6V/jLUIjis7x5RUZHzZqXg66QbSlpAaBS7lPVy IdFA== X-Gm-Message-State: AOJu0YxAJ76QbBn/phH/ngrLZLq4UQ2/kFlKWtd4iQ1zJEEstcpenhJX GXPO/3ycHA4e5INLXItcWwP9fntYVrHc9GBFPF6gaw== X-Received: by 2002:a05:6000:889:b0:319:8333:a2cb with SMTP id cs9-20020a056000088900b003198333a2cbmr6916814wrb.13.1692708747936; Tue, 22 Aug 2023 05:52:27 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id y12-20020adfee0c000000b0031aeca90e1fsm11908722wrn.70.2023.08.22.05.52.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:52:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 11/12] target/loongarch: Use generic hrev64_i32() in REVB.2H opcode Date: Tue, 22 Aug 2023 14:52:21 +0200 Message-ID: <20230822125221.55046-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/insn_trans/trans_bit.c.inc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/target/loongarch/insn_trans/trans_bit.c.inc b/target/loongarch/insn_trans/trans_bit.c.inc index c04806dc21..9d564a0999 100644 --- a/target/loongarch/insn_trans/trans_bit.c.inc +++ b/target/loongarch/insn_trans/trans_bit.c.inc @@ -111,19 +111,6 @@ static void gen_revb_2w(TCGv dest, TCGv src1) tcg_gen_rotri_i64(dest, dest, 32); } -static void gen_revb_2h(TCGv dest, TCGv src1) -{ - TCGv mask = tcg_constant_tl(0x00FF00FF); - TCGv t0 = tcg_temp_new(); - TCGv t1 = tcg_temp_new(); - - tcg_gen_shri_tl(t0, src1, 8); - tcg_gen_and_tl(t0, t0, mask); - tcg_gen_and_tl(t1, src1, mask); - tcg_gen_shli_tl(t1, t1, 8); - tcg_gen_or_tl(dest, t0, t1); -} - static void gen_revh_2w(TCGv dest, TCGv src1) { TCGv_i64 t0 = tcg_temp_new_i64(); @@ -161,7 +148,7 @@ TRANS(clo_d, gen_rr, EXT_NONE, EXT_NONE, gen_clo_d) TRANS(clz_d, gen_rr, EXT_NONE, EXT_NONE, gen_clz_d) TRANS(cto_d, gen_rr, EXT_NONE, EXT_NONE, gen_cto_d) TRANS(ctz_d, gen_rr, EXT_NONE, EXT_NONE, gen_ctz_d) -TRANS(revb_2h, gen_rr, EXT_NONE, EXT_SIGN, gen_revb_2h) +TRANS(revb_2h, gen_rr, EXT_NONE, EXT_SIGN, tcg_gen_hrev32_i64) TRANS(revb_4h, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_hrev64_i64) TRANS(revb_2w, gen_rr, EXT_NONE, EXT_NONE, gen_revb_2w) TRANS(revb_d, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_bswap64_i64) From patchwork Tue Aug 22 12:57:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 715758 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp242107wrp; Tue, 22 Aug 2023 05:58:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH62spYyOc9sT1X4c3JYy9oTdQwYQgLA5326zMNKMxn1DyrLyjiFKZu6rglfLWjanVGy0UI X-Received: by 2002:a0c:f041:0:b0:64d:22b6:e2e9 with SMTP id b1-20020a0cf041000000b0064d22b6e2e9mr8536145qvl.61.1692709119310; Tue, 22 Aug 2023 05:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692709119; cv=none; d=google.com; s=arc-20160816; b=YgibmRcbC9Yi9p9ZddhBjrzsfQNMuK3zKAfH72qTWq2Bo0fZ1gPgNor6QCPg3k66qL H3Hglk/o+rcAd/VuY92ZM/NxaoaTQSwXxxP1r8tZQHYRH3AnVju8vVIx6LgFG8HVFkVz +FiFTu9y3SNFj8sKorOSLRgQ93KF4sEti0zv/KQRaSa3y0VlpWBlai9vT3b6VRWgnDpI jMag+WjTcFI6pdY4O4x/LI8jHJgtkxxyEK9cx/Tjrc6ybB+E/vQQ/3LlFkjD0ur385rg G/h92d2hlfNCLVcnoH1pay/BVQWyIVsG8tInDGhcfmAHj2pWYMDBKatXpHsav9xmzpXg 6Mfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=HoqVbo91wPVgF5r48rM5Dy0YT51miWRNDAkstIMzJy4=; fh=WTNzBzBWhI6YyLjiFd1Gx/+Ggetq/7tfVgf3EfLcLKA=; b=UHKJHtsjiwBYfLDw4h5B+2R7c/jq0Z8xQ3zRI6t4dq9yvbzaeH6P9IWeW7Dq8jkcyu OHlDhayM5+jvAfc9CHt51APdet9yRxt/Csp8yrj6ueUgu2+CB+HIC2hJ7znkOLW+hVPY Gl+CbXp8puxT1DEIym7XBI1vfFUsdQHnE3n7E8xpygmpTnDfPm5BCuyqIgn5J901cUiZ D6YsnIGiYhmxohbY3gpLDlSGoY+cmzewhg/kS3uB5e0UtdeTGby66cTTe+qbL9YNWh2C ARNoy9xGIxHMm5yLOhbABGSc4U61koNkO7qiyNuMI6Q2YHWgQGOKMs3z3z2g3LeWXApc KjfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x84rpRuU; 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 t6-20020a0cc446000000b006471273cd8esi6182836qvi.84.2023.08.22.05.58.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 05:58:39 -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=x84rpRuU; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYQxa-0004ZH-BR; Tue, 22 Aug 2023 08:58:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYQxY-0004Ww-Qf for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:58:12 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYQxV-0003Ti-Be for qemu-devel@nongnu.org; Tue, 22 Aug 2023 08:58:12 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31c4d5bd69cso1892528f8f.3 for ; Tue, 22 Aug 2023 05:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692709087; x=1693313887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HoqVbo91wPVgF5r48rM5Dy0YT51miWRNDAkstIMzJy4=; b=x84rpRuUKtihEm90d8RKSO3l2JCiyV88QdRZioX4EdIG1VliKN3Se4EAiebdlsOnUx uTJc8j8TYNpzC4CPse1uxEF82ygg7nI8KTAJKfviHBRDntg54AQPgah3HBDOcNqvH5Rs HLU9zSSL7oiI74ft2yihnnwZEYRpLaLOtWSLSm9/qBwnONXostSNNeWXrVd2i2SU6FKI hTFftd2RoNSr1wVj8YU/SSSGyvc9OKyZ+W7G2xpWaggDzTFsFPYE23TViB2uV25It298 Xifcelv/XLziQqYDKyfEffmKcjj1sHcA0xaVnFDPRtLKtr9a6Hfm3cm0J6xXorruT6AE h9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692709087; x=1693313887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HoqVbo91wPVgF5r48rM5Dy0YT51miWRNDAkstIMzJy4=; b=Ccoukn17+qD39w0Ft1HIdCkL85osjPBpLTUG+Z2ad1kzX/9lJ/Bni7Bt2fJw5cPcg9 BI6bNRK6NhGCbBnW2auf+P/GpZo8d1xyAe8ry9jTlM4jNgrT6Vi3lxzRioB+FjEdKEy1 5PMS1sw/VJ6udQx8j64tIFD3Zm9J8SASx1eHQU/mrNCDtCkybaz4P1tya+oSVsJwNT+P M1umM+Fnnf00jDbemhBYugZDcMmyDojRwNQv67jc4UBlW0F0shcUGT6p9QkpM8tk70bX uCoMmmv+y5DwADqHt1f2GKOUuixhr6M/PMLFT6GvslRhgdB0EI/njfeysEtRzppZZ58T DsHw== X-Gm-Message-State: AOJu0YxYB13jfg77GuWHXpUVqdbD1LFAQ1vVPAUNDXtoz7Va1wcL7zDQ OJz0GQFD/dGbq90xDzwA9WKW15GB2gHZShPHcUco7A== X-Received: by 2002:a5d:4586:0:b0:31a:dbe0:ca7d with SMTP id p6-20020a5d4586000000b0031adbe0ca7dmr6637694wrq.8.1692709087351; Tue, 22 Aug 2023 05:58:07 -0700 (PDT) Received: from localhost.localdomain ([37.19.214.4]) by smtp.gmail.com with ESMTPSA id 19-20020a05600c249300b003fe2f3a89d4sm15855430wms.7.2023.08.22.05.58.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Aug 2023 05:58:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , "Edgar E. Iglesias" , Richard Henderson , Greg Kurz , Aurelien Jarno , qemu-ppc@nongnu.org, Peter Maydell , Daniel Henrique Barboza , Aleksandar Rikalo , Paolo Bonzini , David Gibson , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Yoshinori Sato , Nicholas Piggin , Xiaojuan Yang , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 12/12] target/mips: Use generic hrev32_tl() in WSBH opcode Date: Tue, 22 Aug 2023 14:57:52 +0200 Message-ID: <20230822125752.55328-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822124042.54739-1-philmd@linaro.org> References: <20230822124042.54739-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 08ee745a6d..822b932262 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -4916,17 +4916,8 @@ static void gen_bshfl(DisasContext *ctx, uint32_t op2, int rt, int rd) gen_load_gpr(t0, rt); switch (op2) { case OPC_WSBH: - { - TCGv t1 = tcg_temp_new(); - TCGv t2 = tcg_constant_tl(0x00FF00FF); - - tcg_gen_shri_tl(t1, t0, 8); - tcg_gen_and_tl(t1, t1, t2); - tcg_gen_and_tl(t0, t0, t2); - tcg_gen_shli_tl(t0, t0, 8); - tcg_gen_or_tl(t0, t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], t0); - } + tcg_gen_hrev32_tl(t0, t0); + tcg_gen_ext32s_tl(cpu_gpr[rd], t0); break; case OPC_SEB: tcg_gen_ext8s_tl(cpu_gpr[rd], t0);