From nobody Thu Nov 28 10:52:07 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=1692822394; cv=none; d=zohomail.com; s=zohoarc; b=hZQaWZfWWp7Ukeeqz0orsQmgNxfhyanGzR+nE47vuohd/7NZUlyL2gHUbNwxDZcw66IxHumhL9vxTQtfVQ+aE+cOA7AQEVKNL8R0s1Ph2F9o4o62nt0HseUeY6jVFZBuAIcYYQqpFo72zucuvmUU4JVdKRlPsE5bN+A7A52iSbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692822394; 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=2d7f9xMn3s76GGCrTSbv49LCbGX2TpxUayf0OW1Jmmg=; b=WV3GxYt0jYjWvMpotYqS3vVWxA3XHEQ6JOxwpBcLc/SdQ6kUaC5C88siEJ3TEIzEzDYiKJ+bLj9OynIsKzQW8mEj1QMlUS7SvLBRZ9LJXO9e0JpJqpF/umY9R0heeXdpfx0IMIfjo4KY3ABCRsBwnWIlFgTpxcPw/pbZr8tK08Q= 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 1692822394193786.8119128131465; Wed, 23 Aug 2023 13:26:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYuOh-0000Ht-Ej; Wed, 23 Aug 2023 16:24:11 -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 1qYuOd-00005V-Hq for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:24:07 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYuOa-0005ZU-SG for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:24:06 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1bf57366ccdso1605605ad.1 for ; Wed, 23 Aug 2023 13:24:04 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:72f0:1ea7:85d2:141e]) by smtp.gmail.com with ESMTPSA id iz22-20020a170902ef9600b001b9da42cd7dsm11418641plb.279.2023.08.23.13.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 13:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692822243; x=1693427043; 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=2d7f9xMn3s76GGCrTSbv49LCbGX2TpxUayf0OW1Jmmg=; b=i7LrKwRtWPnBLIGZngc6Xiy7boKCuCaTb2gsuiXUbTHpbGnkarDf0KE6Ke/M9rewHT dYMcdy7RIUVHmky80ZKf94XklAxxpu6Mo/W2Ay2CW4ixje4GZnGurIUmZgw25Lj8qQrb 7T8LCo2YHmG+9eN5xAVV16ZFLfk8t82yHmR5wxDfm+yxVcf1a77OkAcgWEVbqRAB4PNn AkuPZYJlqlPG8WTZln6CFgcyHERsuxwK9PmzQYUo7eY2NbeOl+Dx+svRKDXi1eYyOi+4 5fuEJUC5Ifg25o95P260IAvsTJ7dEtZ4vIFCnsKShoUG4O4PM+ELp9AgOuefkfc0jdNH lSkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692822243; x=1693427043; 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=2d7f9xMn3s76GGCrTSbv49LCbGX2TpxUayf0OW1Jmmg=; b=JiI0+gb/DT8jt9wbSIxgw03xSpPN9LXY8l7ns70/1QtcZwUBn/CEI+P+7MELm0hl7g PDtPAnWVAHO6pYJkY4bi9lghoInGvygUs8U8hZMRpQhRCeD1eam3j3tlP/rTZZFm51aq jrXrecD1MMf4WfFa7rQXKXqns/OsGMRnNFP40Z8ndSNU2FYW+2izwAL55Et/RsdWGbDZ +3FOcWgFITO9JiU/8+pEoz8yndlsy4KU/QIBF4JuZWiZ4lvzBH4jtOGd9Lt57gcubmhx StkHqvSC+KYlwJ3vIaMNpZjdwseiPpm9kN1hZX5+Om5mxKHMzs6c6gjSKIVZlpSt6f1h cpmQ== X-Gm-Message-State: AOJu0YyaOBEau1092dYo1OW8P282+q6eSFM7f74JMzuou9nw5gO3HQWl 7KahsKqfYo+i6Xz+zIuWJxkKCaSYzIyi6t7vtHc= X-Google-Smtp-Source: AGHT+IH0UI/i/9XYMzFp3baFwwmWbeX71vUQ6w/8hfP5fOgLI58PHq1cbU7n1MiYFhBfrmDi2adQ2w== X-Received: by 2002:a17:903:1c4:b0:1b5:522a:1578 with SMTP id e4-20020a17090301c400b001b5522a1578mr20049442plh.29.1692822243553; Wed, 23 Aug 2023 13:24:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 39/48] tcg/tcg-op: Document bswap16_i32() byte pattern Date: Wed, 23 Aug 2023 13:23:17 -0700 Message-Id: <20230823202326.1353645-40-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: 1692822396360100007 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230823145542.79633-2-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 b59a50a5a9..fc3a0ab7fc 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1035,6 +1035,14 @@ void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg) } } =20 +/* + * bswap16_i32: 16-bit byte swap on the low bits of a 32-bit value. + * + * Byte pattern: xxab -> yyba + * + * 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_i32(TCGv_i32 ret, TCGv_i32 arg, int flags) { /* Only one extension flag may be present. */ @@ -1046,22 +1054,25 @@ void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg= , int flags) TCGv_i32 t0 =3D tcg_temp_ebb_new_i32(); TCGv_i32 t1 =3D tcg_temp_ebb_new_i32(); =20 - tcg_gen_shri_i32(t0, arg, 8); + /* arg =3D ..ab (IZ) xxab (!IZ= ) */ + tcg_gen_shri_i32(t0, arg, 8); /* t0 =3D ...a (IZ) .xxa (!IZ= ) */ if (!(flags & TCG_BSWAP_IZ)) { - tcg_gen_ext8u_i32(t0, t0); + tcg_gen_ext8u_i32(t0, t0); /* t0 =3D ...a */ } =20 if (flags & TCG_BSWAP_OS) { - tcg_gen_shli_i32(t1, arg, 24); - tcg_gen_sari_i32(t1, t1, 16); + tcg_gen_shli_i32(t1, arg, 24); /* t1 =3D b... */ + tcg_gen_sari_i32(t1, t1, 16); /* t1 =3D ssb. */ } else if (flags & TCG_BSWAP_OZ) { - tcg_gen_ext8u_i32(t1, arg); - tcg_gen_shli_i32(t1, t1, 8); + tcg_gen_ext8u_i32(t1, arg); /* t1 =3D ...b */ + tcg_gen_shli_i32(t1, t1, 8); /* t1 =3D ..b. */ } else { - tcg_gen_shli_i32(t1, arg, 8); + tcg_gen_shli_i32(t1, arg, 8); /* t1 =3D xab. */ } =20 - tcg_gen_or_i32(ret, t0, t1); + tcg_gen_or_i32(ret, t0, t1); /* ret =3D ..ba (OZ) */ + /* =3D ssba (OS) */ + /* =3D xaba (no flag) */ tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); } --=20 2.34.1