From patchwork Mon Aug 21 16:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 715381 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1924939wrs; Mon, 21 Aug 2023 09:19:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFP2AJ1neqrIhu+Z0fMm8CXp3MisH80Sj1/Og2d6jxSBGkR1L8jdsOuHQALt3jN/3UiIZgP X-Received: by 2002:a0c:eb4c:0:b0:641:8df1:79e2 with SMTP id c12-20020a0ceb4c000000b006418df179e2mr6833729qvq.30.1692634797301; Mon, 21 Aug 2023 09:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692634797; cv=none; d=google.com; s=arc-20160816; b=sqShE3oru4NXAfMBrgRnIe6FqDp1orq9FBnZampNKdk5RYDU4G7t5Xscekk1f0a0kw AwKjqi8B15Om56t/BUbWDmL/WzwyndMlkZdSiMj/lib0X61o5LU5qFHciHeCWRWe9QTs jj0lla4xcm2ikQ0JFVhZsRXHIsnuovhkQY+d/FCueQzl7cU/gQ2C5fIirj3jHyCuq2Xh BFK/jDURFLd9Y91cevOa2UOChorwHgcei4ucywB9YRp0o+ZUIMpZF5GlYIN1fvpjayRW vkdPiDzCOefaQovU2DF6KBkZloLPcXTQNCYzFA4Q+VTuHv1aVj3KUDrofPSUX0xBePF4 t5ng== 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=47nFV1aM9JE1wMIAXCDJba3wZ1tlxMIcg3CYQKdGdcE=; fh=4xNVIrgzKzsUJFZ/LK5iWzslbipp0obh3zmyxXTMM5Q=; b=Vy8EyaCTIOonIwxHP+2BSW5TmpYtPaDNTMhdxwUovSkiYey7FxW3Yuj6u1kjbGCNDm qDB3UnZ8rVzaSTqAqIJPV7O0BVRFG0pJ0+iIql03PZMki2QxSRUXGhSnQow62czJUf6S 4oeYuhnB3OyZx5eR0AwEZWdBE8KZHEwB0oYbgEaTrEmMrMDH0k8wFpyhsze2dlSMq6Rs W2oD8x68+VTH2f5Pk2xSShv0Jf+uUScQodY6iA+uJvFtD+FtXQYonfZwvyZJVf545UmP 1z1dC6JI7JsLHrS+5qIIwtg7Rdn/Awmd/z9I1/njQXGOXino8fJ880kxZZ7YAIbXiHYQ DKxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIeynuDE; 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 k19-20020a05621414f300b006430c810209si5013039qvw.108.2023.08.21.09.19.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 09:19:57 -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=nIeynuDE; 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 1qY7cs-0001vb-So; Mon, 21 Aug 2023 12:19:34 -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 1qY7cZ-0001Va-5J for qemu-devel@nongnu.org; Mon, 21 Aug 2023 12:19:17 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY7cS-0005dV-A1 for qemu-devel@nongnu.org; Mon, 21 Aug 2023 12:19:10 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-68a42d06d02so771010b3a.0 for ; Mon, 21 Aug 2023 09:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692634746; x=1693239546; 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=47nFV1aM9JE1wMIAXCDJba3wZ1tlxMIcg3CYQKdGdcE=; b=nIeynuDEs0kpNs/miJbGhjMavgYqA1EgL+mcu36Sph9T0LJ1tODu7QwEHribXt06Wg ArEkEegk8s3VW3bas8d3962RTcT+T+7kJmxdxG/E2DEtc8yXG+p3VPKP86ePtZnT/FxK DEtZEBZhfsEqnnqZv2742ldxGazUQfeGYZHI7UpUkp1D4nU+iXQsZKEe4MZIIAGWxl5R ujDWwazdtJ54ci460Q89zf1pqu8JEm0dRt86LPf0/nYX71kUXZa09V9HzVklfnfVYhrt TLqzVMIQmIPtQiKRnZ+kblPbM7oVwmFgFtRjLloNPfXYBu+ZsGmJykT3O/sw1Ov+DdRg 8kDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692634746; x=1693239546; 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=47nFV1aM9JE1wMIAXCDJba3wZ1tlxMIcg3CYQKdGdcE=; b=VhbSNrrlRVCShl2pocCjPZaDyg5oidMvDhg0GjYsGKLdgzQk5Ep4EXiB0ghPu8e9xR cGeFqvwP54JwVl3YrWCJb9ercuZcCW2L85SEfBMatQdCtgw5VCtOEDXNT02G+E8K8Bph OcaMUqI7QiLmdDW0w3/DxT5dO30X0RozP2Bv2ZOf6ufLe7O06dRedH7UgStmzFZdIw3s da7LIFcDCXS3U9CZ3LqJkbyyOdbCwuG4HdthMXpIxQ1k1EjBlXJMgNhwDHSwepRpcd/R qQ8S3DCO6FTQEx1cm21GcT969GXHzESQBLKxucP6GWDOwBfPFZOjHM0u7DtFE2osxlCx OiEQ== X-Gm-Message-State: AOJu0YyNHrgkzN20rfwYPWbu9uYD0k6fYl02hLg/T3igDtXZXGogwYkc eqYN5sCXdBR7iXMQ/A8AmWgL04O6QKS68A9571E= X-Received: by 2002:a05:6a20:dd9f:b0:137:9622:17b7 with SMTP id kw31-20020a056a20dd9f00b00137962217b7mr5003877pzb.25.1692634746644; Mon, 21 Aug 2023 09:19:06 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:2c08:e710:4459:46f1]) by smtp.gmail.com with ESMTPSA id e16-20020a17090301d000b001ab2b4105ddsm7234549plh.60.2023.08.21.09.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 09:19:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: berrange@redhat.com, ardb@kernel.org Subject: [PATCH v3 12/19] target/ppc: Use clmul_32* routines Date: Mon, 21 Aug 2023 09:18:46 -0700 Message-Id: <20230821161854.419893-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821161854.419893-1-richard.henderson@linaro.org> References: <20230821161854.419893-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 32-bit carry-less multiply. Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 10e19d8c9b..ce793cf163 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1446,28 +1446,14 @@ void helper_vpmsumh(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) } } -#define PMSUM(name, srcfld, trgfld, trgtyp) \ -void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ -{ \ - int i, j; \ - trgtyp prod[sizeof(ppc_avr_t) / sizeof(a->srcfld[0])]; \ - \ - VECTOR_FOR_INORDER_I(i, srcfld) { \ - prod[i] = 0; \ - for (j = 0; j < sizeof(a->srcfld[0]) * 8; j++) { \ - if (a->srcfld[i] & (1ull << j)) { \ - prod[i] ^= ((trgtyp)b->srcfld[i] << j); \ - } \ - } \ - } \ - \ - VECTOR_FOR_INORDER_I(i, trgfld) { \ - r->trgfld[i] = prod[2 * i] ^ prod[2 * i + 1]; \ - } \ +void helper_vpmsumw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) +{ + for (int i = 0; i < 2; ++i) { + uint64_t aa = a->u64[i], bb = b->u64[i]; + r->u64[i] = clmul_32(aa, bb) ^ clmul_32(aa >> 32, bb >> 32); + } } -PMSUM(vpmsumw, u32, u64, uint64_t) - void helper_VPMSUMD(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i, j;