From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 5A34736B90A for ; Mon, 3 Aug 2026 09:47:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785750447; cv=none; b=Hs6QebCu8/wMr5y41BmTBcZxfGqd8NrCsriBKKIqAdNBhibGThV9R/ZdZwFXRv65z5wKFcoLY7WQKRC7YSSf0LlesBHDFkVP6tCVwlwNf3mhmCTLs422Bv3lmCscaHmpC/8V6aeM9nhs+BPp7xvDuFVKHGEZsSlYtFnIeQb5TlA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785750447; c=relaxed/simple; bh=LWYY8L7+pvjuSuZEFdHjZfRoFPq8zyMB3S5viJiE/iA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JPUTlmdea9OvKre6pyVfJIRO118pePUeHmSmwDaARwFzpgfth8PKdBCOVPqqe2DeZa7LAg2otH0wNjYG6XCA7tSBSJRccbxUg5xN8503aFUy3HIipPzOfnIrGNTGUVjOMbklSDbxA8+FThbXDVK1iKO4uQ2pLqhy3YeBMCJrlJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AkwGxU48; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AkwGxU48" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-495757ccbc1so16992375e9.2 for ; Mon, 03 Aug 2026 02:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785750444; x=1786355244; darn=vger.kernel.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:content-type; bh=R9i39fr/WBI88YaO8QjXXMpzLgg7mu0h7vSI7lGAbl4=; b=AkwGxU48BVJp9hfXDilmko5xKq5++iOmExFN9zEkFqu3S3o75V8OnxXXYXfyAhnEJL mSwlkSqi3h/GLqROVzQY0ByOnOEDk0uHA/iM9pyvNdID6Hk3ED6VoOXSRxOXrwTz9j9H bFCc2v0W5Phvd9txI526YLBosqhcVffYImMo/eSnBKadLc/Sav44230cfipmYUK8kD/G bUKfP4AZSsMLF1wBYfoskKymVRRgpQ72c6UgJP+7ahHcHR16glcNlMLWJnwJDB7BJT+D Ytj++WAffwNBV9Ls4qR9QjWsxKMlmOZ9MQfgX3QkLlTr9eX6BGkX0TLbF+1m4CB2cTYL WF5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785750444; x=1786355244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=R9i39fr/WBI88YaO8QjXXMpzLgg7mu0h7vSI7lGAbl4=; b=VQsWKDu4ejhAaltkHkTLy5bVaxL7IfsQW1L1J2KPUmfSJZqDLfAuq795qet6OPowG2 V5NyckLKg5X7F/YZOvioSi2t28t7V+7V/sroPI5pEhQJ/hCzSbIFFTN1nhY9ARnsUFrO FmPN96m+ITY8TxQf3bBRk63Y0ehgWq8l6RZeJ39obv9+9N5+TsRZpWNEOqKdZAMCZ+aN TaiLqjDJzdhe8lV1Nzox8of4POjCazRKxuf9b/ajVZaubmMDKL/0DnCTRwqSORwHDYSK 4ALI8kTJ3ZWdzJ/72/6XKnUoA1VAOD5i+UkcX34asMVWstA9OFExEMbPudKDEoyuY2Rc lMwg== X-Forwarded-Encrypted: i=1; AHgh+RokwBazD0XWppqSbqYjICaEse1cbWgR7177aeUPY5i+65BzrDafbXV5anGGjcrzGnbkQWy2rsGPSwhxQaA=@vger.kernel.org X-Gm-Message-State: AOJu0YwSZ6owHpO2Qsz3pVBCQlULavw2DA1yGTwDKoxES/iFiBFtGLI6 f2Uz1EIAzFpcPvkUYAn5a2LE0nywq6b/SPX6sZk010vRyids+cQ1cFKo X-Gm-Gg: AR+sD12jfCMUt6CQFbGC0QTtGM6SsqKqHb3kKQ4B/9HRsgVajXFC+hgSCJmvKFZ2k5J G3VTTZXXS67oin+yy0ARLC7bW/X6q4dldPkfmgu/Q8G3MFEI4V3UJI1VEjSPI6fTxVgXAxNgSMs te04Xuq/9tcjR7/ZYN7Iwl0fbkCNEss2Wl+vmxG68To5K/dX5zA51ukmISAnwvxXtLZYo98jYo3 YFUDNg1Y7m0qSXFb0EDcH8zDepEnxV/v6cc35ll4urMIrUZ/UQ3lZiXU6q6tQYaxvs1CJfmF4Ke tnGrzc0WWnPOeGegU/1yR220MhlgGGl+B/+ASs25X774DKYsUUE6S/quBSG77M94AKqd278fe8+ g/AJEtIOD/iZkXu5FzgJp6PfU2I5/usD/SnnDnGy4uRQLJSNE23vA/OvdXPHyIRvEsEsXsI2low m0R08lhU9DVJMYZCOihRJ84Mgl+8r/n0aDTBBFT5OaM5W5ppMOGQsoCM/9itK4Vi2X15BSQt29g l3an8ZEitwyD3tnuXQNgNV9LwuLzifLwVvZ24XFTG+5vQ== X-Received: by 2002:a05:600c:2294:b0:492:4e09:9fc1 with SMTP id 5b1f17b1804b1-4980c67af97mr166579215e9.15.1785750444131; Mon, 03 Aug 2026 02:47:24 -0700 (PDT) Received: from snowdrop.snailnet.com (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4980878dbaesm367219305e9.12.2026.08.03.02.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 02:47:23 -0700 (PDT) From: David Laight To: Borislav Betkov , Ingo Molnar , Thomas Gleinxer , Dave Hansen , x86@kernel.org, Andrew Morton , linux-kernel@vger.kernel.org Cc: David Laight , Nicolas Pitre , "H. Peter Anvin" , Peter Zijlstra , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , rodrigo.alencar@analog.com, jic23@kernel.org Subject: [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants Date: Mon, 3 Aug 2026 10:47:01 +0100 Message-Id: <20260803094702.3852-2-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260803094702.3852-1-david.laight.linux@gmail.com> References: <20260803094702.3852-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Adding constants over 2^31 fails to compile because the ADD instruction only supports 32bit signed immediates. Replace the "irm" constraint with "erm" so that the compiler loads large constants into a register. Found by a patch to drivers/iio/frequency/ad9910.c Fixes: 6480241f31f5 ("lib: add mul_u64_add_u64_div_u64() and mul_u64_u64_div_u64_roundup()") Signed-off-by: David Laight --- arch/x86/include/asm/div64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h index 30fd06ede751..8a2d343f977e 100644 --- a/arch/x86/include/asm/div64.h +++ b/arch/x86/include/asm/div64.h @@ -111,7 +111,7 @@ static inline u64 mul_u64_add_u64_div_u64(u64 rax, u64 mul, u64 add, u64 div) if (!statically_true(!add)) asm ("addq %[add], %[lo]; adcq $0, %[hi]" : - [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "irm" (add)); + [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "erm" (add)); asm ("divq %[div]" : "+a" (rax), "+d" (rdx) : [div] "rm" (div)); -- 2.39.5