Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp190830lqa; Fri, 26 Apr 2024 21:00:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtMMPDZFqSAu/VmGa4sjmMKogI4PMt6hq2ro1vy4GiRSognkDCxAkCcDJJ/Qrn2OIJX+ApWpym1xsbPfV718Vg0d4LgEU+2UMOu6vQpA== X-Google-Smtp-Source: AGHT+IFeX9sCpJGDQevm3TPC3cF+jtOg/HvmJVWBHHjn94n338AtyG6W3pNxsJSS5+mhUM8CVje+ X-Received: by 2002:a17:906:2b4a:b0:a58:ebd9:7001 with SMTP id b10-20020a1709062b4a00b00a58ebd97001mr3020ejg.18.1714190441008; Fri, 26 Apr 2024 21:00:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714190440; cv=pass; d=google.com; s=arc-20160816; b=iABHhbrOSSuCJRhe+I2fn/SoKgTjZY/r2TKq81LykOmoUOb22j9ZmtbLAcqTMsWvKT 9+CvKPehUYYlbJNcSePvYBKgtyGyHPxIojRttOEMmLKl2BJqMgl1hGuvP6NMXdgEPtZR eavyYBQmaOMsHl0GtDs3fo7NSJMXwwkG/K/nmMcUyoMyfYpfogpznjYigfMhwL4fF2VU HxaBwwu3ZipPqnRcGPDtDBse1/Qa6IqBQkDAnAJ5lBA9zPjOMhDLzCT9rXsliaRV3shw f0tjYq8rs4RdLdp4ScCJqndGS4L7oZbFJA11JnU82Y4yiRVoKzmXPOjN4cwVV/az1Jma JEXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:content-transfer-encoding:references:in-reply-to:cc :to:from:subject:message-id:dkim-signature; bh=qHWkG2WcNhaES+vK4oX90EQ0V84eSmt7OSToLrWXD3A=; fh=snhKlX7XHt6q2sim2OSEqWRWsZF0IN4JResaPd8RRzw=; b=L6U3RSS+CTXR8Z3qXMZKE4cSYP72G5/Lxy+daqNUkclgoc7qzbSOspzGtsAkBGcWQR z7qCdEEqSZMFS5A3r55P6jsMvMB7lmNIqdFuFUIkMkALKrpeNx5jneVYnt4HWQuFPkug K0KMO7Agykj9H0DuilOIKn3jdFXUZyWcj3vewdXj1xhMAaT3FEUpC7NjpGoAVo43Qi8C jC9W3LfQRiLRAnxzr4j3/BlmRYvtVEr7zjT6J7CcxkgseX/bmv9o/GaZp1YqagDrXZF+ mTLmb4QAYPnV1JorYZZ5XJpOv+0rmzPbFAX1f2RlEAFU1E43E2RiX26d7HKwi2RLyGJz w3ZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=OOdDeghY; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-160883-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u9-20020a17090626c900b00a55b1e013a7si7868149ejc.635.2024.04.26.21.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 21:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160883-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=OOdDeghY; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-160883-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B8B911F22BC6 for ; Sat, 27 Apr 2024 04:00:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 393AA3BBED; Sat, 27 Apr 2024 04:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="OOdDeghY" Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4241381CC for ; Sat, 27 Apr 2024 04:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714190433; cv=none; b=t1dbqw5AA75lTt68CxP+7dmq6fy0wU+olQyOpl6UHY3yYTTB5RVoWip5UeQwTqCTzyYFiTH6FTgAJ/CIPSxYYqIakBU2cet0imrKx6XimMG7G2yzjjCajd6c3PrNj7MsrUg8yYdFWGezP5yaewbCixhpjNzizdfmIh0CiRgCDuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714190433; c=relaxed/simple; bh=sJtvoDhIP4YEm0QlGbaEJ5BUzGmdsLXCnyaF1NsEp1Y=; h=Message-ID:Subject:From:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=BnKxf314LPswF5Wo5OL3LV7Ezgiww27LdhGH1GOx8nSvt9U0a9koxLIVb8SZo8jgCp6KCQSc3zVsL/0EUEYfqrArI5I3FLussquyeDW96m7Bh58hXCUtPzHN7IfwiQk95b8TeynzxcHNgYgckHAui/qPgbepoJMRxcy1dZ4u53U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=OOdDeghY; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1714190429; bh=sJtvoDhIP4YEm0QlGbaEJ5BUzGmdsLXCnyaF1NsEp1Y=; h=Subject:From:To:Cc:In-Reply-To:References:Date:From; b=OOdDeghYMYvaUCy+MTrdb7XoT7Zaie53pTl0Huk4DUY4L5ZIAnidGuahtW2mrQ78Q DrX1nDEdNSVIJr2jazrr6fEnuHjTW11pQ9APrCur2D3kLepNZVgZUDp3wQ7/1ntuPB aasnR/wzyrxU91CA3BqwnarxJaE9l8f/kHlTy7wI= Received: from [IPv6:240e:358:1198:0:dc73:854d:832e:4] (unknown [IPv6:240e:358:1198:0:dc73:854d:832e:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 9F6B767168; Sat, 27 Apr 2024 00:00:26 -0400 (EDT) Message-ID: Subject: Re: [PATCH] LoongArch: Provide __lshrti3, __ashrti3, and __ashrti3 From: Xi Ruoyao To: Huacai Chen Cc: WANG Xuerui , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Tiezhu Yang In-Reply-To: References: <20240426121442.882029-1-xry111@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Sat, 27 Apr 2024 12:00:08 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Evolution 3.52.1 On Sat, 2024-04-27 at 10:50 +0800, Huacai Chen wrote: > Hi, Ruoyao, >=20 > I don't think #ifdef CONFIG_ARCH_SUPPORTS_INT128 is needed here. > S390/ARM64/RISCV all built it unconditionally. The problem here is RISCV and ARM64 are using an incorrect prototype for these functions in asm-prototypes.h: long long __lshrti3(long long a, int b);=20 long long __ashrti3(long long a, int b);=20 long long __ashlti3(long long a, int b);=20 where "long long" is not 128-bit. Despite this seems working for RISC-V and ARM64 I really dislike it. S390 seems assuming CONFIG_ARCH_SUPPORTS_INT128 is always true, but I don't think we can assume it too (at least it'll likely to be false for LA32, so doing so will cause trouble when we add LA32 support). So if we don't want to check CONFIG_ARCH_SUPPORTS_INT128 and still use a correct prototype, we'll do: diff --git a/arch/loongarch/include/asm/asm-prototypes.h b/arch/loongarch/i= nclude/asm/asm-prototypes.h index 51f224bcfc65..0a57db01116d 100644 --- a/arch/loongarch/include/asm/asm-prototypes.h +++ b/arch/loongarch/include/asm/asm-prototypes.h @@ -7,8 +7,6 @@ #include #include =20 -#ifdef CONFIG_ARCH_SUPPORTS_INT128 -__int128_t __ashlti3(__int128_t a, int b); -__int128_t __ashrti3(__int128_t a, int b); -__int128_t __lshrti3(__int128_t a, int b); -#endif +struct { u64 lo, hi; } __ashlti3(u64 lo, u64 hi, int b); +struct { u64 lo, hi; } __ashrti3(u64 lo, u64 hi, int b); +struct { u64 lo, hi; } __lshrti3(u64 lo, u64 hi, int b); diff --git a/arch/loongarch/lib/Makefile b/arch/loongarch/lib/Makefile index f61af161f16e..23600c128e05 100644 --- a/arch/loongarch/lib/Makefile +++ b/arch/loongarch/lib/Makefile @@ -10,4 +10,4 @@ obj-$(CONFIG_CPU_HAS_LSX) +=3D xor_simd.o xor_simd_glue.o =20 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) +=3D error-inject.o =20 -obj-$(CONFIG_ARCH_SUPPORTS_INT128) +=3D tishift.o +obj-$(CONFIG_64BIT) +=3D tishift.o Is this really better than checking CONFIG_ARCH_SUPPORTS_INT128? I don't know... --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University