From patchwork Sat Aug 19 01:02:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 715001 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp800787wrs; Fri, 18 Aug 2023 18:03:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgzLgqn3c7zD/2ugXaQIjJHhL5B1hrAinlQ6zxGmWdhdDIqtj35XAgLZMOjEm/O3x5DmeQ X-Received: by 2002:a05:620a:394c:b0:767:a1ab:b3db with SMTP id qs12-20020a05620a394c00b00767a1abb3dbmr942509qkn.16.1692407019810; Fri, 18 Aug 2023 18:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692407019; cv=none; d=google.com; s=arc-20160816; b=p5DpKKnf1dq1CDUT5ZNeynFWUtKvilDSrcLK0I1A/KKsJINRdBVz8tqYFK3Mhjk5GV lH1MOO6Uddi85MnoHlYPkFN4vrdqpz4ZF+h4JpOw0n2LX0bdvAuPrjjjsAYXpYmMOsIA ri0N8zit8STJcfdJruX2IHPuR1fiSUeUlR7B05Q0LwfbEwSiauu0UVV3RkHbzeSfW1rU 0t7/q/UN4qI/hRMh2WUaBUbxTjlz5KbYu2wecnhgti7Cx2w6Lyc4K6a7u2Cd/WEWIlqY gduGU3Zy/4NEyN3iZQi9mb3/kAiKM+HVPNh3foUJMJxJdTdGqO+am1PwpXruSZ2QCnv+ cgHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7MlO/4lz23eNLFrlyrvCLQF2KGu4x8cNZ2TLPxKRIDg=; fh=4xNVIrgzKzsUJFZ/LK5iWzslbipp0obh3zmyxXTMM5Q=; b=dq4yjXtX+A+e8nY4ockb/hC4/lPWYEEXq24f5bCHTG2QuG4UtCwmqn9jyXqUKlhqyI TPfXjEMrlejbWiaN3G0pU+ra9FDK+1TfrqL9dnnxG3Hm3JlxZj+zdWTrJQs+Cbzgpd1S GbtTY/DgtAz1EwuG4emJDa8fLl0U3uT48H3h6JRFZtXL1DJv/uqMfDQ2D+tg3Kq9V7uz 5ZY96fYiIiUp2c0L57Zb80ZVr2wF1ChV9uJSxWzYjwiDUinoD4nry9G0ld77Hy5lziuj 0RR0A9N0T6fFjnaOccY+OS2uqbnRdyxj1uKmsoWO93E+ODWfUxFyn13wN3/NidiRTMXB 8EPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H70jcr5B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s11-20020ac85ccb000000b00403ad99b849si2017075qta.789.2023.08.18.18.03.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 18:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H70jcr5B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXAMH-0008QQ-FB; Fri, 18 Aug 2023 21:02:29 -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 1qXAMF-0008Pd-FH for qemu-devel@nongnu.org; Fri, 18 Aug 2023 21:02:27 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qXAMC-0007Ky-M0 for qemu-devel@nongnu.org; Fri, 18 Aug 2023 21:02:27 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bee82fab5aso12288785ad.3 for ; Fri, 18 Aug 2023 18:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692406943; x=1693011743; 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=7MlO/4lz23eNLFrlyrvCLQF2KGu4x8cNZ2TLPxKRIDg=; b=H70jcr5BfrlqBN0+pLjDPgqW+cWguEilfHAWtClZWlwrUtNDHgD3uVTPWaVR4qRTyY Va4MmaWdThnG94WnKFg9+VVPMwH55eQZzBubMSnUCInWcqoC5uLX7TeRDZm3PvUjdPvp SPN2DokvV7Duef9esDrH+4AWoo1eqM0g9CBMK4IAi/oeU0Rp+XsN28mTbp6rjrVPOFDJ 5okLb05kYHbkMqWZCQX0yo2sD0c3aWc/TPDXa6q3kpZy2VVO8IieM0B0KzfEi882r5tG FXbruWVc3SXnlt7OE7mhNaKzwBJAvP1zarWoJBjwHTD2QCYOmNm/13ZSLnzIR+GccvLh Vgnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692406943; x=1693011743; 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=7MlO/4lz23eNLFrlyrvCLQF2KGu4x8cNZ2TLPxKRIDg=; b=TL8njucepis+tHkT5f7eaQSrww4JYjXslHUvVGO7wnTBimta+l6w9JyCHN+sX5KH0R qDweF7zRNYFgJEGGo+Lz0z+e3PRMoXmCQURm6mNphTh4fv7bXFhVmIUkG93bYX1aiVjx wEy5JRfn2uk1jkrpJ+XJfA7WE0tW+RyXf7Emszqs82OAjVzeDgMZGvz/yO0hb2uMf+zR JMroVDQP5pn1DsZSdEl260jflGK1WLyQv7pKM7Oo6CGL6ZYKFxR3LDFkI5Oo21qHp5hj Rc/2GD5cCa7/Me2eqiehTn43n5qTaK1UVP4XOjTTVgk0tB0mGtuQLtdBYDx92RYRCiU3 RGgA== X-Gm-Message-State: AOJu0YyxXwoblws6q6+PknbrBrW5Z/3vmHpSfMdQcj1JO2wEV2WL8lG9 538npG355g5AxOrmnd8e/MSkL+0phJ9CAbUujHw= X-Received: by 2002:a17:903:2291:b0:1bc:6c8:cde3 with SMTP id b17-20020a170903229100b001bc06c8cde3mr1000380plh.57.1692406943358; Fri, 18 Aug 2023 18:02:23 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:cf24:6daf:2b9e:7972]) by smtp.gmail.com with ESMTPSA id b13-20020a170902d50d00b001b87bedcc6fsm2372019plg.93.2023.08.18.18.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 18:02:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: berrange@redhat.com, ardb@kernel.org Subject: [PATCH v2 03/18] target/s390x: Use clmul_8* routines Date: Fri, 18 Aug 2023 18:02:03 -0700 Message-Id: <20230819010218.192706-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230819010218.192706-1-richard.henderson@linaro.org> References: <20230819010218.192706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use generic routines for 8-bit carry-less multiply. Remove our local version of galois_multiply8. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/vec_int_helper.c | 32 ++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/target/s390x/tcg/vec_int_helper.c b/target/s390x/tcg/vec_int_helper.c index 53ab5c5eb3..edff4d6b2b 100644 --- a/target/s390x/tcg/vec_int_helper.c +++ b/target/s390x/tcg/vec_int_helper.c @@ -14,6 +14,7 @@ #include "vec.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" +#include "crypto/clmul.h" static bool s390_vec_is_zero(const S390Vector *v) { @@ -179,7 +180,6 @@ static uint##TBITS##_t galois_multiply##BITS(uint##TBITS##_t a, \ } \ return res; \ } -DEF_GALOIS_MULTIPLY(8, 16) DEF_GALOIS_MULTIPLY(16, 32) DEF_GALOIS_MULTIPLY(32, 64) @@ -203,6 +203,34 @@ static S390Vector galois_multiply64(uint64_t a, uint64_t b) return res; } +/* + * There is no carry across the two doublewords, so their order does + * not matter. Nor is there partial overlap between registers. + */ +static inline uint64_t do_gfma8(uint64_t n, uint64_t m, uint64_t a) +{ + return clmul_8x4_even(n, m) ^ clmul_8x4_odd(n, m) ^ a; +} + +void HELPER(gvec_vgfm8)(void *v1, const void *v2, const void *v3, uint32_t d) +{ + uint64_t *q1 = v1; + const uint64_t *q2 = v2, *q3 = v3; + + q1[0] = do_gfma8(q2[0], q3[0], 0); + q1[1] = do_gfma8(q2[1], q3[1], 0); +} + +void HELPER(gvec_vgfma8)(void *v1, const void *v2, const void *v3, + const void *v4, uint32_t desc) +{ + uint64_t *q1 = v1; + const uint64_t *q2 = v2, *q3 = v3, *q4 = v4; + + q1[0] = do_gfma8(q2[0], q3[0], q4[0]); + q1[1] = do_gfma8(q2[1], q3[1], q4[1]); +} + #define DEF_VGFM(BITS, TBITS) \ void HELPER(gvec_vgfm##BITS)(void *v1, const void *v2, const void *v3, \ uint32_t desc) \ @@ -220,7 +248,6 @@ void HELPER(gvec_vgfm##BITS)(void *v1, const void *v2, const void *v3, \ s390_vec_write_element##TBITS(v1, i, d); \ } \ } -DEF_VGFM(8, 16) DEF_VGFM(16, 32) DEF_VGFM(32, 64) @@ -257,7 +284,6 @@ void HELPER(gvec_vgfma##BITS)(void *v1, const void *v2, const void *v3, \ s390_vec_write_element##TBITS(v1, i, d); \ } \ } -DEF_VGFMA(8, 16) DEF_VGFMA(16, 32) DEF_VGFMA(32, 64)