Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DD14CA0EE6 for ; Tue, 19 Aug 2025 22:32:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uoUse-0004Mc-D3; Tue, 19 Aug 2025 18:32:36 -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 1uoUsd-0004Lq-09 for qemu-arm@nongnu.org; Tue, 19 Aug 2025 18:32:35 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uoUsb-0006rA-8O for qemu-arm@nongnu.org; Tue, 19 Aug 2025 18:32:34 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-76e1ff326bbso272978b3a.1 for ; Tue, 19 Aug 2025 15:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755642751; x=1756247551; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0UG8bHYH9qhHIRwV5i1DVVt3dqKwyCbwf3bPUxBc7V4=; b=Sr+z+4DNRelgDAZxhKgC0b46IkK6VOYDL3NpCizoNalzcq6HYL3T/odUB5ijwTxaPH 8nOn2rEzT0yhaOBBFz/dMCbzFohdZP8jA19tXE9MgOJK2dlFEZzScYEvlNOvk/vtdHAM +JZMAFkn/agtj5gSYogoMHGd2ceFkJmrcUXmIluGnTR3ql/jkOAAF0b9x+j4z2WM7QPm IrEWMdjJ93UKHbRELEiBOiGNTejKA8rRHahm6ayBPoHU0hO46/RY6N2S7AxVo58Rxava YnuJ1A9rd8N4qrFCxIDHphVN09FzweN+Uf5yQ40AGXmin3ZiJlZCpdy/B1SmXWJ9NLw/ jNJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755642751; x=1756247551; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0UG8bHYH9qhHIRwV5i1DVVt3dqKwyCbwf3bPUxBc7V4=; b=ElIo67J+DSymVNUEQY3O1bAtz1ovrddPiaqmcu4Z92k90H+NRmeXjox4J6B/FJihR2 3Uz3pUlGkLnu3aKOJYeGaW+gR8i8YLpNLoaxKI6OO+NdoqIFMgxcsyX7X+Yu1WCxKcV0 Nb20ELUy2GbYcWP4mO1lQ3BhKajjJC8OeMFkJzVUvdXbdHDkCQuClwAmBfm4eg3A1oHp 7GHY2Jt25joh+TBE3mJWewdueSL3UnYvvIpL/M19Kr0Rq946AhZNBgzRvKee2PjLnVMv HuRw7v0aRQ2wQZzoScRHaO9GEGU/ZdQyB2IXPTh70iK3koBlkSg1hpRhYz3TAfAnX6i9 h72Q== X-Forwarded-Encrypted: i=1; AJvYcCWaakcBxWq5ozOZd4/VzLsVsNPqDlF6vqG+5LJ4bq31thDbAsomJSubmJBtD1FktOHlifRqr8cW3g==@nongnu.org X-Gm-Message-State: AOJu0Yy99FA+sWTfifx1S5Tfie5uI7jVUc4G6hBReRsB4zUGrJABFL6s EVwGWBqGaZ5hB4Y6JFj7wGljA2DXJNWSEsbNgd30oJq6Q2Xiyp1E0PBI3s2EYC6HU60= X-Gm-Gg: ASbGncuWW9pH8fTpeFV3z7Jm8BfiqQ4/7auj2CIp2ZPI7v9APynCxLTMYDYWEj14WmN KQUQcd/jqurDw8uUQQDmdNgjIptvqtwbg5OMQHf2wqMY69QKeOwdN8HK5k4OpN8rQtiDX4jzLTF mVPfjX3KrgddYlfnJ/4RLe26PGfb15CCybPR7LtePbueSLOvlHsHubdr2FB750u3kDZ3dAIlKoe ZKAR6yqPGQLc8phZiHyHX7wuABZQxGT0pe7Ww1OWdQ1Cc4bFd+3WrDvx/Y1bRoVzkTSEdyqC68i 8MRWGfPTmdKrI0XrMAlxVKsm8o8i9YjKGLrefZZn5k6McdhPlluiIK1Wqa9h6Cedc2b2P4uvFjn LfgbO/0UYuTmhXrwN0Z6cfrl26Bd8NLgtKg== X-Google-Smtp-Source: AGHT+IHp8VTKG9Vpn6FAHdmy+mSnJ5GgTEl0qI+uay+ssgl1frq/JCQo7z7Y3bdVkLlZC9I8Uw3G3Q== X-Received: by 2002:a17:903:41c2:b0:23f:fa47:f933 with SMTP id d9443c01a7336-245e0930050mr46957165ad.8.1755642751182; Tue, 19 Aug 2025 15:32:31 -0700 (PDT) Received: from [10.0.0.90] ([120.159.20.238]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-324e251e891sm233987a91.5.2025.08.19.15.32.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Aug 2025 15:32:30 -0700 (PDT) Message-ID: Date: Wed, 20 Aug 2025 08:32:21 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 18/35] tcg/wasm: Add bswap instructions To: Kohei Tokunaga , qemu-devel@nongnu.org Cc: =?UTF-8?Q?Alex_Benn=C3=A9e?= , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Paolo Bonzini , =?UTF-8?Q?Marc-Andr=C3=A9_Lureau?= , =?UTF-8?Q?Daniel_P_=2E_Berrang=C3=A9?= , WANG Xuerui , Aurelien Jarno , Huacai Chen , Jiaxun Yang , Aleksandar Rikalo , Palmer Dabbelt , Alistair Francis , Stefan Weil , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Stefan Hajnoczi , Pierrick Bouvier References: From: Richard Henderson Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org On 8/20/25 04:21, Kohei Tokunaga wrote: > +static void tcg_wasm_out_bswap64( > + TCGContext *s, TCGReg dest, TCGReg src) > +{ > + tcg_wasm_out_op_idx(s, OPC_GLOBAL_GET, REG_IDX(src)); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 32); > + tcg_wasm_out_op(s, OPC_I64_ROTR); > + tcg_wasm_out_op_idx(s, OPC_LOCAL_SET, TMP64_LOCAL_0_IDX); > + > + tcg_wasm_out_op_idx(s, OPC_LOCAL_GET, TMP64_LOCAL_0_IDX); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 0xff000000ff000000); > + tcg_wasm_out_op(s, OPC_I64_AND); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 24); > + tcg_wasm_out_op(s, OPC_I64_SHR_U); > + > + tcg_wasm_out_op_idx(s, OPC_LOCAL_GET, TMP64_LOCAL_0_IDX); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 0x00ff000000ff0000); > + tcg_wasm_out_op(s, OPC_I64_AND); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 8); > + tcg_wasm_out_op(s, OPC_I64_SHR_U); > + > + tcg_wasm_out_op(s, OPC_I64_OR); > + > + tcg_wasm_out_op_idx(s, OPC_LOCAL_GET, TMP64_LOCAL_0_IDX); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 0x0000ff000000ff00); > + tcg_wasm_out_op(s, OPC_I64_AND); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 8); > + tcg_wasm_out_op(s, OPC_I64_SHL); > + > + tcg_wasm_out_op_idx(s, OPC_LOCAL_GET, TMP64_LOCAL_0_IDX); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 0x000000ff000000ff); > + tcg_wasm_out_op(s, OPC_I64_AND); > + tcg_wasm_out_op_const(s, OPC_I64_CONST, 24); > + tcg_wasm_out_op(s, OPC_I64_SHL); > + > + tcg_wasm_out_op(s, OPC_I64_OR); > + > + tcg_wasm_out_op(s, OPC_I64_OR); > + tcg_wasm_out_op_idx(s, OPC_GLOBAL_SET, REG_IDX(dest)); > +} Is this any better than the default expansion? r~