From nobody Sat Dec 21 16:53:36 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=1694796247; cv=none; d=zohomail.com; s=zohoarc; b=Vh+wXkS3s7oCksYMSJPaYeA+PHg+0pJ7Tes7DgAsNUjvqrkHWpHX3n7xaOHwYVaC1mOdDJHuSiNt3qqUT0ana6annHyqkqOIJsqZIHpvVDZlY5GTBsQduIvxkwYPzG+Y8e4SpnkGxKIlQxYSwOQ/TIwXUFqk8Zy94mXqjv0TRQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694796247; 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=b+3/8IiHtNpBs5dwlAlcrSMhCtecqGkkP2HhC4y759E=; b=boHWpThRrBFR31gjAb4SesccczbLg79GMMgHD2aXNbt84ynTAHyoBkk4pByG9/Kbylo9V/BWkcBKygbojDtZKDlQsd72KXKORdd3+cAM3k6T90al0ChRdvTcNNhscz4nXeYClwo+WQgxeUhEm6YNwNMg3Um0/pQWq5ZTW7WtzAg= 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 1694796247275995.2713290205268; Fri, 15 Sep 2023 09:44:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhBu6-0004Vj-Fs; Fri, 15 Sep 2023 12:42:50 -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 1qhBu4-0004VR-VH for qemu-devel@nongnu.org; Fri, 15 Sep 2023 12:42:48 -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 1qhBu3-0004wm-Cg for qemu-devel@nongnu.org; Fri, 15 Sep 2023 12:42:48 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-68fdd5c1bbbso1722775b3a.1 for ; Fri, 15 Sep 2023 09:42:47 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id s187-20020a6377c4000000b00577f55e4a4esm3010087pgc.20.2023.09.15.09.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 09:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694796166; x=1695400966; darn=nongnu.org; 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=b+3/8IiHtNpBs5dwlAlcrSMhCtecqGkkP2HhC4y759E=; b=TrLqvRrkTYTzuerEopt6OwLgWG+K1+eZXhWlX7gLqT0ERI1lu9nCQOaj/YXeueIbg/ Ndru3nJK8XqtfVgGmoB47DhwhkF6uHcet2JBGtYUhKdtIYBw8Xe7jktUCAFhFzyEEk8Y 8zrzbw6Z0XLZ4hl57B80j+CrYOc/hd/tS5NAyj2roRG2vw+k/c59FwiDadY4pqARujgl VYzwET2qadZlj08pjLDrxZ+rrhF4sU75z3ZMlS9g6n/3BLLrxz9XsImGwuE6suNd1xWx eINCtF1qg6XW/8lx+swIAS1PMdZ+eLGl8G4DONrh6p8b+9MwzVKyi4VG0Lg1cDhkOtVm 1xPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694796166; x=1695400966; 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=b+3/8IiHtNpBs5dwlAlcrSMhCtecqGkkP2HhC4y759E=; b=Ld3tWyey6gp/7jfLZ2cJpnPszToXdUtw3K811gjJiEJHbpo+L+9RclE4RbkfHagTp6 Zjetx3+ICloxh7+nURrIH+h45zEOwqNYwiqp/gync8QvYjePltppANtQLeOfs3fhb+rr smrz5wBrMWK8EufhYs3cGRhBHJtin0V63c7nM4J20bEmKM34rM/BpTTtz7IYw960zMQj dnCKZRU+DUgx+TQINNLDXylm/wIupjUddtvjG+SPSEQInXO75NY/VdSJ3domrVqGp5tk JGArRnx/DRnWAI1vVSzakCW4uxCQc1LiXY8a801nyR5oqEcH9qTS1L2go7XW3y9FLwsP itqg== X-Gm-Message-State: AOJu0YydBY5AlytmRIv3D3ZmbidpwhMv/3F7ywhL+nFPqqAxUIJ7eJy/ DTFd2J4ZX7W0WI36Kll4O+ipLh2quEq1u1OyviA= X-Google-Smtp-Source: AGHT+IG9a5LF1bnb7JgZGyu37DmTsoquDayqpwsPPcJLa+/QfHcqowgeBLyb8bczV4L7DjNxH4mtcQ== X-Received: by 2002:a05:6a20:430d:b0:159:d061:58e9 with SMTP id h13-20020a056a20430d00b00159d06158e9mr7314745pzk.26.1694796165954; Fri, 15 Sep 2023 09:42:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 15/19] target/i386: Use clmul_64 Date: Fri, 15 Sep 2023 09:42:27 -0700 Message-Id: <20230915164231.123580-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915164231.123580-1-richard.henderson@linaro.org> References: <20230915164231.123580-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: 1694796249078100001 Use generic routine for 64-bit carry-less multiply. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index a0e425733f..33908c0691 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -20,6 +20,7 @@ =20 #include "crypto/aes.h" #include "crypto/aes-round.h" +#include "crypto/clmul.h" =20 #if SHIFT =3D=3D 0 #define Reg MMXReg @@ -2122,41 +2123,18 @@ target_ulong helper_crc32(uint32_t crc1, target_ulo= ng msg, uint32_t len) =20 #endif =20 -#if SHIFT =3D=3D 1 -static void clmulq(uint64_t *dest_l, uint64_t *dest_h, - uint64_t a, uint64_t b) -{ - uint64_t al, ah, resh, resl; - - ah =3D 0; - al =3D a; - resh =3D resl =3D 0; - - while (b) { - if (b & 1) { - resl ^=3D al; - resh ^=3D ah; - } - ah =3D (ah << 1) | (al >> 63); - al <<=3D 1; - b >>=3D 1; - } - - *dest_l =3D resl; - *dest_h =3D resh; -} -#endif - void glue(helper_pclmulqdq, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg = *s, uint32_t ctrl) { - uint64_t a, b; - int i; + int a_idx =3D (ctrl & 1) !=3D 0; + int b_idx =3D (ctrl & 16) !=3D 0; =20 - for (i =3D 0; i < 1 << SHIFT; i +=3D 2) { - a =3D v->Q(((ctrl & 1) !=3D 0) + i); - b =3D s->Q(((ctrl & 16) !=3D 0) + i); - clmulq(&d->Q(i), &d->Q(i + 1), a, b); + for (int i =3D 0; i < SHIFT; i++) { + uint64_t a =3D v->Q(2 * i + a_idx); + uint64_t b =3D s->Q(2 * i + b_idx); + Int128 *r =3D (Int128 *)&d->ZMM_X(i); + + *r =3D clmul_64(a, b); } } =20 --=20 2.34.1