From nobody Wed Nov 13 12:26:46 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=1694796274; cv=none; d=zohomail.com; s=zohoarc; b=Bx0JfeT+y2ZjauS6IxYx4+4w8N7fRKn6axBFf2NEm3TPpllcc9UWw1+tsvSg9OP4ik6cb8FC76RcTb6aBpNcaLvqFQ8VD7OfAQa+UTQQOwheW3lAA6IZ5GDCuksoI2PyhKG0iyqbjoStKjqqjS+2WPncMEutw2oCwZL1mIkO7gA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694796274; 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=W1FQxefxQxkmUZ1SixwcnXZvZP/IO9ZUpCwPt+2NITw=; b=A3We3KSeGBCyfKG5d1IK52k6HiVPsg17xSrgML9nagVWdzWVubKtLwURiEGwIR4wuaGgJ3oABTmZ1gimXamsVbrxg688oKuvCdUX306rabdhMguyB/fjIpncGN4OtBnmb3AfGTp5mpR9mCElgob/d0BtaKUPfb+Jd+CBHgSImgk= 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 1694796274573641.1364953921324; Fri, 15 Sep 2023 09:44:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhBu5-0004VW-67; Fri, 15 Sep 2023 12:42:49 -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 1qhBu2-0004UV-Me for qemu-devel@nongnu.org; Fri, 15 Sep 2023 12:42:46 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhBu1-0004w9-1e for qemu-devel@nongnu.org; Fri, 15 Sep 2023 12:42:46 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-68fb79ef55eso2146752b3a.0 for ; Fri, 15 Sep 2023 09:42:44 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id s187-20020a6377c4000000b00577f55e4a4esm3010087pgc.20.2023.09.15.09.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 09:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694796162; x=1695400962; 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=W1FQxefxQxkmUZ1SixwcnXZvZP/IO9ZUpCwPt+2NITw=; b=PMWdIkfwC61+8PGZrE/P5bWc4p7fH3392/XU18lhRK4xO4P6ZJ2MGYxL6NhdMGKapn /n5KapAX8lF1ZXj9pUDtalmYPELYF/uTSe9P9A9Ju03IU3kWPBZRCEq3LmyFjZxNzASj 33BhVhpXVqtEy1qv/0uVyN6pr5Futzm+Btv7FdLk0OlVFAnUwoCwGYDyvQfo5SyfWXZY C+9N/AD6Rl/qvA00vEqjec4oWEX9DTvWl5YWQYf6Zuv/kPumBy3rJMJL7nenmxu/2EWw ZsmyVSpC/8VKZyQRZ43VSRp1gM8ltvOLseEMu1rrZVJbd/jr4iI9rSfSUGY0BNMuWxnE 3TOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694796162; x=1695400962; 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=W1FQxefxQxkmUZ1SixwcnXZvZP/IO9ZUpCwPt+2NITw=; b=FD9lNuHUPe1AD1JyDQTOQuxTUNFLKkxSUmSQr1hwuLDiSSdTwldoroCbEWLqcDH48l AOymYdDUdqyn3qYLwEVjOgG/JYuCeUS0zNtzEDhrIqRZegj8jjjsABLBi/36RnCrExxh whlhUwb2kT2BvKGCeA5iFo2IQ9ZD7yOgDWQlQ95YOhQsIMwdRk/833QG0316f6L0+Pgp wg7yCsvhzvSudyDlij0A9w1NlH+ljrkj/wDS27R1apY+LLG3lFvtcm3AzI+8Kmt+KPKi 5vVK9JGrtwgXg9GZAa8w6/vlPwQvFQSGYMybTXq9GN2h0eOMGkdyfiyLEJOeej1X0UBJ bX9Q== X-Gm-Message-State: AOJu0YxCpDuI/BpY5eDukG0pgR7qIKu+fE+GtJirFhqUuHwD/wSu9uFr hHJxG7cxtq3RPqBxc0ZTwpyYqSSCY5tNwAI1nB4= X-Google-Smtp-Source: AGHT+IF4t+SsMaogr17mQxO3gCidEyq2/PnZNaR8bNd2IT5rk9gtdTx9TUt3/i6zNZi7fPoxLacnfQ== X-Received: by 2002:a05:6a20:8f01:b0:136:faec:a7dc with SMTP id b1-20020a056a208f0100b00136faeca7dcmr2989402pzk.11.1694796162576; Fri, 15 Sep 2023 09:42:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/19] target/s390x: Use clmul_32* routines Date: Fri, 15 Sep 2023 09:42:23 -0700 Message-Id: <20230915164231.123580-12-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::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: 1694796277235100003 Use generic routines for 32-bit carry-less multiply. Remove our local version of galois_multiply32. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/s390x/tcg/vec_int_helper.c | 75 +++++++++---------------------- 1 file changed, 22 insertions(+), 53 deletions(-) diff --git a/target/s390x/tcg/vec_int_helper.c b/target/s390x/tcg/vec_int_h= elper.c index 11477556e5..ba284b5379 100644 --- a/target/s390x/tcg/vec_int_helper.c +++ b/target/s390x/tcg/vec_int_helper.c @@ -165,22 +165,6 @@ DEF_VCTZ(8) DEF_VCTZ(16) =20 /* like binary multiplication, but XOR instead of addition */ -#define DEF_GALOIS_MULTIPLY(BITS, TBITS) = \ -static uint##TBITS##_t galois_multiply##BITS(uint##TBITS##_t a, = \ - uint##TBITS##_t b) = \ -{ = \ - uint##TBITS##_t res =3D 0; = \ - = \ - while (b) { = \ - if (b & 0x1) { = \ - res =3D res ^ a; = \ - } = \ - a =3D a << 1; = \ - b =3D b >> 1; = \ - } = \ - return res; = \ -} -DEF_GALOIS_MULTIPLY(32, 64) =20 static S390Vector galois_multiply64(uint64_t a, uint64_t b) { @@ -254,24 +238,29 @@ void HELPER(gvec_vgfma16)(void *v1, const void *v2, c= onst void *v3, q1[1] =3D do_gfma16(q2[1], q3[1], q4[1]); } =20 -#define DEF_VGFM(BITS, TBITS) = \ -void HELPER(gvec_vgfm##BITS)(void *v1, const void *v2, const void *v3, = \ - uint32_t desc) = \ -{ = \ - int i; = \ - = \ - for (i =3D 0; i < (128 / TBITS); i++) { = \ - uint##BITS##_t a =3D s390_vec_read_element##BITS(v2, i * 2); = \ - uint##BITS##_t b =3D s390_vec_read_element##BITS(v3, i * 2); = \ - uint##TBITS##_t d =3D galois_multiply##BITS(a, b); = \ - = \ - a =3D s390_vec_read_element##BITS(v2, i * 2 + 1); = \ - b =3D s390_vec_read_element##BITS(v3, i * 2 + 1); = \ - d =3D d ^ galois_multiply32(a, b); = \ - s390_vec_write_element##TBITS(v1, i, d); = \ - } = \ +static inline uint64_t do_gfma32(uint64_t n, uint64_t m, uint64_t a) +{ + return clmul_32(n, m) ^ clmul_32(n >> 32, m >> 32) ^ a; +} + +void HELPER(gvec_vgfm32)(void *v1, const void *v2, const void *v3, uint32_= t d) +{ + uint64_t *q1 =3D v1; + const uint64_t *q2 =3D v2, *q3 =3D v3; + + q1[0] =3D do_gfma32(q2[0], q3[0], 0); + q1[1] =3D do_gfma32(q2[1], q3[1], 0); +} + +void HELPER(gvec_vgfma32)(void *v1, const void *v2, const void *v3, + const void *v4, uint32_t d) +{ + uint64_t *q1 =3D v1; + const uint64_t *q2 =3D v2, *q3 =3D v3, *q4 =3D v4; + + q1[0] =3D do_gfma32(q2[0], q3[0], q4[0]); + q1[1] =3D do_gfma32(q2[1], q3[1], q4[1]); } -DEF_VGFM(32, 64) =20 void HELPER(gvec_vgfm64)(void *v1, const void *v2, const void *v3, uint32_t desc) @@ -288,26 +277,6 @@ void HELPER(gvec_vgfm64)(void *v1, const void *v2, con= st void *v3, s390_vec_xor(v1, &tmp1, &tmp2); } =20 -#define DEF_VGFMA(BITS, TBITS) = \ -void HELPER(gvec_vgfma##BITS)(void *v1, const void *v2, const void *v3, = \ - const void *v4, uint32_t desc) = \ -{ = \ - int i; = \ - = \ - for (i =3D 0; i < (128 / TBITS); i++) { = \ - uint##BITS##_t a =3D s390_vec_read_element##BITS(v2, i * 2); = \ - uint##BITS##_t b =3D s390_vec_read_element##BITS(v3, i * 2); = \ - uint##TBITS##_t d =3D galois_multiply##BITS(a, b); = \ - = \ - a =3D s390_vec_read_element##BITS(v2, i * 2 + 1); = \ - b =3D s390_vec_read_element##BITS(v3, i * 2 + 1); = \ - d =3D d ^ galois_multiply32(a, b); = \ - d =3D d ^ s390_vec_read_element##TBITS(v4, i); = \ - s390_vec_write_element##TBITS(v1, i, d); = \ - } = \ -} -DEF_VGFMA(32, 64) - void HELPER(gvec_vgfma64)(void *v1, const void *v2, const void *v3, const void *v4, uint32_t desc) { --=20 2.34.1