From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB77BC63798 for ; Mon, 23 Nov 2020 07:38:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F44B20738 for ; Mon, 23 Nov 2020 07:38:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qvj6AalT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="smrn5v9z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F44B20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dwOv3c6wOKAyk5rfPqb+/yvweGrAYfh5Pl55ZxLB6BM=; b=qvj6AalTT5U1ovyAQxowG/jTX/ KWWMTgzcibvN05Pr9q60yKWEt/XgTyelMZ81iFr1CltTKtTFkM6PFOjaYjgqhXgr2/8ApPxHgjwPY kX/C1IspM+GuIYaugdvIj+395fC7Scrh7qlZnlSgOIJe9+sx3XjJu1CHCykwDQaHrdllMaUqBEWdg FceTnHLl1r+OjCPFtkAPRZ8rZlTYOlnIht++p7veq9Hsu9Oi3/FhgiZa8a+dZS/4L41IfZZyZzSfO tvSJ1+jKuNPGPvP5jMI2H/dDKewXNY60+ABRDsoPL1nIzOLr/bKf5tnm03lXWq68I3Xvygvyjj1Tj 6HC5zBaQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kh6Qh-0003kw-7e; Mon, 23 Nov 2020 07:38:31 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kh6Qd-0003kG-8P for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 07:38:28 +0000 Received: by mail-wm1-x344.google.com with SMTP id c9so16934388wml.5 for ; Sun, 22 Nov 2020 23:38:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKnvipRdH5O5nwcZGT41u1DCEbXND0993nykFgKds7Y=; b=smrn5v9zKwc7LpQiiXvRkqe4V4Xyo+HcNnQfIYBjcjZxl8xKleGocb/Dw0+JucTxl0 gxQvqP/MpdMJlRV26CVCy/SJ2AcVpTLt99cqNxGb634lBSI0yaa06VsU0RIpc1PNV9B2 USJUf+z6LxdBBxOQEVYDTvkfQmRouuPJkvz5niDZI9/IAFuBvKhiyCJf7i3FlSXlHqMS +ekzryEGGiDuUjaltP2PZHoT6qlajd5DcBNhcsTILlV9wfjhUJiRbLYBZiXSSwqoYPPW /BnY6F2MeKVCVJlJEv7htF1Zbtqj9S23U2Z88XxTzAkbKxALjrAVhrxuVYEEwknCfApz 5+jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKnvipRdH5O5nwcZGT41u1DCEbXND0993nykFgKds7Y=; b=bwkef0lPiPRApUZ7mmq+PW6nNdYvvD4xx4Gy7z/WokvA8g8LfxNEdRFPk+N6Q72ZxW XMBAYDLCViiOlvQe68yNA7Gz2rSP3F3Qdhg/C7o+6EDPQ5A780TKDUQQgfypJ68HfF3n Id5Ec7dpEI66oVqRTXtI6yWY8inBjdkXuW3LcgboyfDot66hf9CcmtJcLZ0WDVz8rmaN P5UnzxNFMwVdtOEu+YR+Y8WGzWIPIj04beLKl2vc2gqxCqIm0/3F+kFWW2ePXiG4hPHM Ob8I1Ytu1vR12sB3Vb6Q1yd9ZuouGTFYbeyaVZLiDyCBS5y21gQoVlJjUlzT8HNl9KmB 1y1Q== X-Gm-Message-State: AOAM53255swuhYqMkV0ZBiwW+f3QZXLqWklWPAQHHcc0hLurkuFw3QLF OnD/Az1eGEO3yC0l5rC6S9U= X-Google-Smtp-Source: ABdhPJwtvwR4tEbGdt64452+NtS6ThnxMs/sNtsxvROMuyckjORrFOrYWPoMYP+r428ViukTUJSJ7w== X-Received: by 2002:a1c:3d05:: with SMTP id k5mr23507181wma.151.1606117106354; Sun, 22 Nov 2020 23:38:26 -0800 (PST) Received: from localhost.localdomain (60-250-204-170.HINET-IP.hinet.net. [60.250.204.170]) by smtp.googlemail.com with ESMTPSA id 17sm50927847wma.3.2020.11.22.23.38.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Nov 2020 23:38:25 -0800 (PST) From: Antony Yu To: Subject: [RESEND,PATCH] ARM: fix __div64_32() error when compiling with clang Date: Mon, 23 Nov 2020 15:36:32 +0800 Message-Id: <20201123073634.6854-1-swpenim@gmail.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_023827_344582_E6B8B13D X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: swpenim@gmail.com, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __do_div64 clobbers the input register r0 in little endian system. According to the inline assembly document, if an input operand is modified, it should be tied to a output operand. This patch can prevent compilers from reusing r0 register after asm statements. Signed-off-by: Antony Yu --- arch/arm/include/asm/div64.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h index 898e9c78a7e7..809efc51e90f 100644 --- a/arch/arm/include/asm/div64.h +++ b/arch/arm/include/asm/div64.h @@ -39,9 +39,10 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base) asm( __asmeq("%0", __xh) __asmeq("%1", "r2") __asmeq("%2", "r0") - __asmeq("%3", "r4") + __asmeq("%3", "r0") + __asmeq("%4", "r4") "bl __do_div64" - : "=r" (__rem), "=r" (__res) + : "=r" (__rem), "=r" (__res), "=r" (__n) : "r" (__n), "r" (__base) : "ip", "lr", "cc"); *n = __res; -- 2.23.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel