Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp88083rdb; Wed, 21 Feb 2024 18:38:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU85jV2dBBAQxEDXODn3xQrlKK5oI09mtAqBqQOyR5g1UiqngPfoGxzBVGwotULzT+IW27iDy86lA4ugTcVbqj2kR59nU4ZGtPVtnZQDQ== X-Google-Smtp-Source: AGHT+IHiyr/zJLQGCCxtZuVNXyj7oql0UIZVFIBBsAM8A3kakhCW30ZY8/WKurgAw0kZp7PvvDw6 X-Received: by 2002:a05:620a:56a:b0:787:4169:16e5 with SMTP id p10-20020a05620a056a00b00787416916e5mr17117337qkp.61.1708569500206; Wed, 21 Feb 2024 18:38:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708569500; cv=pass; d=google.com; s=arc-20160816; b=utTJRo3dT+I/EUHnnGbY16AjaUg+58x4MGlo49UeQbBKOOTNvKNqtNwE3qOB2dNLXp Yf9exWRYXYgCYDXb/MXpdm3/saOVRfqI17eGMtn/fkUSZy8ubJCe1/f7S2tHUE7RnHB5 G/DhpIzklFrZJcAyHt2K1bGiJO0vJRhPaDb/B4JWrY8G2kYdWPidjIf7DLxpIGm8dfXv GiwL6rPY89XiM1k7HFqUyyl4jadZBHCnbKomGjFwbjcjucGVi7TSRISvVuiiU8WEs8fp 1XtLExuABAZg+DiNfWk6fm3jKQ0AoCNRWGaVzMPkW4tfkfWMpMNi8Z13P7ItfXLthlXx P2LA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=K6YZh5OBHggNhG2iazj7ayAHylZjnHIget6Lw5n4A74=; fh=/pkm6kGJw9TnKqYp3GWjusId02PN+onWfNWEjqoYFG8=; b=VWM7yjj6j5kupZhxK8gfuE1rjzrIYB3CV6gt4IHH/1M6xbBjABLYINWW+xd0CYK/MW X/Qgdob3vtfYS6NXXxM9DtnqyMVo339Kd6WOY7JHJnrlbhgM3qYbUzq/3PDjI80ftBn6 fBJQdfRGVYhQ8LyIbUNUxIDbCGQj5ib/s3kf7KmpdX/x2Prng78XqqSs8r1vwSixswOm xyW1UZIoLjDaYiucqsHeJ7SZERa4iWeoDyYHXOpuyT0O1muy/+OxrEX36YFPok9Zzs/T 6V71pcz/5r7OuH+n7EcZdRlw3n8317oBRgKGWjxAuvtO2EiQcGPdbMkVaJDR4Mu0HWwU OCaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=jilndtav; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-75804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75804-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x7-20020a05620a448700b007879b91f029si594047qkp.497.2024.02.21.18.38.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 18:38:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=jilndtav; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-75804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75804-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 892D81C2260C for ; Thu, 22 Feb 2024 02:38:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 806F418C08; Thu, 22 Feb 2024 02:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="jilndtav" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45110175AC for ; Thu, 22 Feb 2024 02:37:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708569459; cv=none; b=Egx1UgfG2F1FDUgxYw6Ucdc9CBFSUwn0iUdKol8ZC5x4v4CxPvGbkICGylwHS/RIopUldqYs98gRQLnVDZr9HT/3bbdXeEp2p3wwI0WAQXgVT1fV14kfaolQnBgwESUWWUZCfExDPypq2t2mJELEfoz+D9zfByKJLRwesJy4Q8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708569459; c=relaxed/simple; bh=mYOv5YQT1yDdOTCAzi4OkkPsYH4iMvZEO+odMa9t9OU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mOreJzAG3plR9os5Y+qjZk1fUpBu161z0SOryv4Q1DXrs7qAjdHQxpkKjMWOXu3+pF7sbH0losgZ0PlsSUyZ2j/ZHijHvznXl67xe4kXuLJUJVdyI4UPD05s/CMs7nM4Nt+BeE41y/dEuwsPARI9rX96erTOfsRne+ZwPtHHIuo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=jilndtav; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6e22e63abf1so3451457b3a.3 for ; Wed, 21 Feb 2024 18:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708569457; x=1709174257; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=K6YZh5OBHggNhG2iazj7ayAHylZjnHIget6Lw5n4A74=; b=jilndtav6wK9tlin1vZ80mFJXVjji8doG7sZyl7JpysdxrkyxaOefh6QIAmLsoXFgj wNTbNODr/2hOaE7wIOvZWUmgtrP0HweIbG2zpPvCS3A/rrjc3YTpU7k9x2/WEVCQT/SK pJXf415f+RZt3z466pXUGS5I+zPL6761GDxu5FvNSVOlhEvuQUzT0VR1WkqlupHQSoI7 M7rGYjUmygHH3KA0VoUKceZbVHGW/oFAwZJf6Und66esSukQHLQWqE0FCkhyYSkbwLW6 v1whZDp+GwAJxQtw3Eu3DY+IQ+9l9VPoDjXTzyaccYq+V5w6JBJv6qylE8q7bsWSf0mQ L3RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708569457; x=1709174257; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K6YZh5OBHggNhG2iazj7ayAHylZjnHIget6Lw5n4A74=; b=NkBGtiPbbUOsLHN5K3rPqQp23Vn6Y4LO7oEpl87IFIoRl0bfwINH9KCaAq9pz93m4L r6i3pG/tVF+SHPGzBtSzq+9e17VehPH73xlfdRR69K487FlVgA+/EGurkmHm317RIlXN c6YyccQYZmU+WU1RrCjrHih7P7m3pFvHlHWVVMTW/PEFF6Y69uDnYnWyc0FJU/od2fS4 LZTgd+iXP5tOE5/8e4SJwaWshySu33RNwHHb0hh0V06RnI8yK5nAp/WGQcORJwMofZCL +lKebE/Kd8bIWoBJC6eDuGeCxOLlXJe9l5xesOpOiS3x3uuDniR5PVRAJP5quYGc7jdJ 8pMg== X-Forwarded-Encrypted: i=1; AJvYcCVNF4I+Ipi9vwN4YvlNUziL3codqua7lekH0sDbROuj5GD3ZEgvAX+UcHpRZ4dyYnUTUcrqn287iRNLcL1v+7yXdEZPFNfMLvHulOmB X-Gm-Message-State: AOJu0Yyxmst4QzRmCFf4s0fI/XL0lw7hpDPnTCUq4PdmbRT4+QMhnPvN y1//m1PyHgFqDK7jopoPWbdOEdUBPu0Zx9YUSm1c42ZzvYerehU2zlbLYuwBBBH6Zm+EFpBXDNd P X-Received: by 2002:a62:e306:0:b0:6e4:cf7c:6c28 with SMTP id g6-20020a62e306000000b006e4cf7c6c28mr15413pfh.22.1708569457164; Wed, 21 Feb 2024 18:37:37 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id kt21-20020a056a004bb500b006e465e1573esm6469705pfb.74.2024.02.21.18.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 18:37:36 -0800 (PST) From: Charlie Jenkins Date: Wed, 21 Feb 2024 18:37:14 -0800 Subject: [PATCH 4/4] parisc: checksum: Optimize from32to16 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240221-parisc_use_generic_checksum-v1-4-ad34d895fd1b@rivosinc.com> References: <20240221-parisc_use_generic_checksum-v1-0-ad34d895fd1b@rivosinc.com> In-Reply-To: <20240221-parisc_use_generic_checksum-v1-0-ad34d895fd1b@rivosinc.com> To: "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Andrew Morton , Guenter Roeck Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708569451; l=833; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=mYOv5YQT1yDdOTCAzi4OkkPsYH4iMvZEO+odMa9t9OU=; b=kcPBmJJuQfkQSLxjGXYurjNDqCrgbi6FLLWky02d0x0JjqeH/QjvkkY9LAedCaybC9FPI+/Uo 2tOaKUsjuarDrM9ZBbUaloDo2KRy4cHqTwp5CTnTJDmua6pJs9ksfxQ X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= Replace the shifting and masking of x with a rotation. This generates better assembly. Signed-off-by: Charlie Jenkins --- arch/parisc/lib/checksum.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/parisc/lib/checksum.c b/arch/parisc/lib/checksum.c index eaa660491e24..1ae8cc730d13 100644 --- a/arch/parisc/lib/checksum.c +++ b/arch/parisc/lib/checksum.c @@ -27,11 +27,8 @@ static inline unsigned short from32to16(unsigned int x) { - /* 32 bits --> 16 bits + carry */ - x = (x & 0xffff) + (x >> 16); - /* 16 bits + carry --> 16 bits including carry */ - x = (x & 0xffff) + (x >> 16); - return (unsigned short)x; + x += ror32(x, 16); + return (unsigned short)(x >> 16); } unsigned int do_csum(const unsigned char *buff, int len) -- 2.34.1