From nobody Thu Nov 28 10:37:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1692822470; cv=none; d=zohomail.com; s=zohoarc; b=jwOndzBqxGHWRGIbBVohRcn+Ny6WdHBc2ZP/biebqRWIStnW7+oa2T22Z9MCVH93+DqmwLHCtDRlUxPTUSpdtr5Czuttx36sGDTC02Lh++mdEmyxQj4t9RmUQUQYt6gV9XipCPDVK8escmiyXQuZ0eixzb6dvVBAxeYalTZv+SY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692822470; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GM9qcgiCUzexTHGWX5t+ahLOGZIdFkTo6Y1+THQiB14=; b=bciqvK3kXQWOxavAIbOrSa9A1POfSSPeDO2C9JQXWyePI13tX6KHRfRuuW7RVuwxZm+vh0Gy8hI1RgIJ/1sA6fjWgsAqb6mp1I4cjsNu9EqtS+IBqOK5VTu80vobd8QFBwqaTrsCfE6a00Q2srlHHLQ9QtsxvFzXuo7FF2seH5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1692822470984582.7418909796506; Wed, 23 Aug 2023 13:27:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYuRc-0005KL-J0; Wed, 23 Aug 2023 16:27: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 1qYuRY-00055e-8v for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:27:08 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYuRW-0006CR-G0 for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:27:07 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-68a1af910e0so3238923b3a.2 for ; Wed, 23 Aug 2023 13:27:06 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:72f0:1ea7:85d2:141e]) by smtp.gmail.com with ESMTPSA id j25-20020aa783d9000000b006873aa079aasm10117871pfn.171.2023.08.23.13.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 13:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692822425; x=1693427225; 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=GM9qcgiCUzexTHGWX5t+ahLOGZIdFkTo6Y1+THQiB14=; b=fhjxzxnWlPTHUNn54KpsaVCc/2JvLM79nZ8K6ZpVMzklcPrjcFx4/Oi16r8WIiLo9O wOyNOQWXTD3ajs9cNqrIvtxHfcXpK+DTOEL+FAU1HnbtLCXjfMxkOaXIX79AzCQtgIS5 pPA8tvUFxbWQbMBOeyFvijE2FyfnSbVDS1pzqvZjgVNxXVfkwD2CsrwQD4vmBJdscaIY qaZyHhgpymOsvcHipqawipP4EI6wb4jUlcf23SiNT2u1tazKJzd9pqmkqCsB6QbuGxnv yThp99c6RbCWKDojhZtP0cSKb/I5xT2Y9J6sP+tBdeG7VllGB/yJUObJHJaeeSfFqbhM Hpgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692822425; x=1693427225; 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=GM9qcgiCUzexTHGWX5t+ahLOGZIdFkTo6Y1+THQiB14=; b=g9MZ3RDxGv/YJApLn2jjOgBEhDR5L4k7jf7tqA4Qa3jyAPgT4Iq5Bn27J78B9jChvK gnmQhNs+cRLwWBEaXW1AU+QPSrqcZc04bBeZCJA3pDTHpP4pNpIhM9mKU6VoKBfB+2Xa VmfjafzJG9zwHKzBf6/a5LXSU7KMQ6fckanzsqf+LAmUZ4ECm80xUmv+oFuyZl5QRx1q tYbVIGHRmntKY7uoreaNLZCb7WiehWU2XSvKecFBOl+oAeKOqKSME+ynk2whdGdjLt3X snkO9wU2KtcuQThFbf/dlX4E9y+y6UBMLhytgI8mbEXH/1oa4zvolXMeoottWSU9rwgX OcOw== X-Gm-Message-State: AOJu0YyNvyNdWcaatu5OJ9KoENB6PWpCjAnxLzOFdgMKv4xAu/afa1nU Rxs2jTYO5zS5Fr2LQTtQ6l+VlwB5XhNwmf5Yk04= X-Google-Smtp-Source: AGHT+IGmLKRzhHwraLigkBLFUl83bo8ntjCFZGJiz3STL3i06sbvtpsMb/7cgwJFHzlzn5rB7P3+LQ== X-Received: by 2002:a05:6a00:896:b0:68a:582b:6b6d with SMTP id q22-20020a056a00089600b0068a582b6b6dmr9084609pfj.1.1692822424760; Wed, 23 Aug 2023 13:27:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 40/48] tcg/tcg-op: Document bswap16_i64() byte pattern Date: Wed, 23 Aug 2023 13:23:18 -0700 Message-Id: <20230823202326.1353645-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230823202326.1353645-1-richard.henderson@linaro.org> References: <20230823202326.1353645-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1692822471621100001 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230823145542.79633-3-philmd@linaro.org> Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index fc3a0ab7fc..88c7c60ffe 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1767,6 +1767,14 @@ void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg) } } =20 +/* + * bswap16_i64: 16-bit byte swap on the low bits of a 64-bit value. + * + * Byte pattern: xxxxxxxxab -> yyyyyyyyba + * + * With TCG_BSWAP_IZ, x =3D=3D zero, else undefined. + * With TCG_BSWAP_OZ, y =3D=3D zero, with TCG_BSWAP_OS y =3D=3D sign, else= undefined. + */ void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) { /* Only one extension flag may be present. */ @@ -1785,22 +1793,25 @@ void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg= , int flags) TCGv_i64 t0 =3D tcg_temp_ebb_new_i64(); TCGv_i64 t1 =3D tcg_temp_ebb_new_i64(); =20 - tcg_gen_shri_i64(t0, arg, 8); + /* arg =3D ......ab or xxxxxxa= b */ + tcg_gen_shri_i64(t0, arg, 8); /* t0 =3D .......a or .xxxxxx= a */ if (!(flags & TCG_BSWAP_IZ)) { - tcg_gen_ext8u_i64(t0, t0); + tcg_gen_ext8u_i64(t0, t0); /* t0 =3D .......a */ } =20 if (flags & TCG_BSWAP_OS) { - tcg_gen_shli_i64(t1, arg, 56); - tcg_gen_sari_i64(t1, t1, 48); + tcg_gen_shli_i64(t1, arg, 56); /* t1 =3D b....... */ + tcg_gen_sari_i64(t1, t1, 48); /* t1 =3D ssssssb. */ } else if (flags & TCG_BSWAP_OZ) { - tcg_gen_ext8u_i64(t1, arg); - tcg_gen_shli_i64(t1, t1, 8); + tcg_gen_ext8u_i64(t1, arg); /* t1 =3D .......b */ + tcg_gen_shli_i64(t1, t1, 8); /* t1 =3D ......b. */ } else { - tcg_gen_shli_i64(t1, arg, 8); + tcg_gen_shli_i64(t1, arg, 8); /* t1 =3D xxxxxab. */ } =20 - tcg_gen_or_i64(ret, t0, t1); + tcg_gen_or_i64(ret, t0, t1); /* ret =3D ......ba (OZ) */ + /* ssssssba (OS) */ + /* xxxxxaba (no flag) */ tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); } --=20 2.34.1