Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1269746pxu; Mon, 23 Nov 2020 16:35:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAi/lgtHyAxEyhkWVS6og8aGvW5E7FWn/pPpYUM5mg5XsonNTUl1r4Qz0BsgZfs7/P1+aE X-Received: by 2002:a17:906:4c85:: with SMTP id q5mr1931160eju.375.1606178131703; Mon, 23 Nov 2020 16:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606178131; cv=none; d=google.com; s=arc-20160816; b=LSt81YI3TkgKgcrYX2UQugu6h0clTp92cNl4VrLNR3AQCa8gx/T2nuije43yoskGt0 ZTvrzMIPn4uSHGLM+lIUA4kl8VegV7kLu8ZDjp96rcyIqUrwwy3lEhIn9uHaseRjEzjI zakxnuDhpKsjG2Lr/YOJWO5HUcdVqPbjP5Uuc+y4IAOZ51YGY5bDfIy0kBdDgalo/wbA 7f41KhUvRMYZKIghfxL24PlyL9ijASgsW62A5WkFUxMhhysPIuCCNQ4OV8TVkjjzjJVm WyptbwjSO9X1yIAK9nWGFw4gJwZbut9YjIFYuGx1d4yhq9Rg7QN1l5mGwZJ+AFmJSQKf KDjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=n6ql3VbjYT3UQMZEAEWSAAKb2v1qSJpb45k+j/2GXXM=; b=EZGT4vO8TMt/mAhMCe0eFwjr1MM0Perd51TvkzDcUHC6hl5LqTtjKTnORu2J2aM67R V6E54FQigx8k3qkFMvBw7qUsFEVnyTLj8YjmCvM0AWa97Tz5CANNw4j/14OKkKrjEvOA nX8mct2QikQMi2mB9JrcT/euUw4ma9Sr/32xPGi4xezVymfMEaP1LDmyrbPuftD5bzES fICXlS8pGaial4Hh6OZFP2Zo6Dz91+7ShYpHI8r6alhsTD65AYm5+vDmmxaL5csaUVnK Y7Oz2p1gcFHfTtkQmifob1B07muObxQeMB/bwcmBE5GO98SoUVL3HLwOpJZ4dSANoIRJ lRDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eJDt8chJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si7640254edh.227.2020.11.23.16.35.09; Mon, 23 Nov 2020 16:35:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eJDt8chJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731754AbgKWSQH (ORCPT + 99 others); Mon, 23 Nov 2020 13:16:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730522AbgKWSQH (ORCPT ); Mon, 23 Nov 2020 13:16:07 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 937ABC0613CF for ; Mon, 23 Nov 2020 10:16:05 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id u184so3273093qkf.3 for ; Mon, 23 Nov 2020 10:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=n6ql3VbjYT3UQMZEAEWSAAKb2v1qSJpb45k+j/2GXXM=; b=eJDt8chJwEwQb4BqRB/iAFPtMcipaJigu/nYu8excAJUkwmXCUx6VWL5tq6do8TxUw waCqY2pD3H+R3Rzt+uIAEvZbMoTJC7awNdirtc9o8kDQetJtFoiDi7ADcyjHE8tdPPoJ eUMYCpGe+EFBMX59FUX8gLbOFc4s11FEExP2QDvzgBatfT4sO43Ym6R7qFHqxgHg9uTb PnLcVq4W3VPSplFkW1+FjxZaTYIenVx7c3wUuQMpoOibEb8y+R5T2VRxqe+7l5efNOlD JISITbdHvCG9YCyAjIXiogEbYeGg7LhsYKv64cMVxTG5oAKDMM4B63YudPJlBKu4YikM YQEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=n6ql3VbjYT3UQMZEAEWSAAKb2v1qSJpb45k+j/2GXXM=; b=KiS5cq3wYa9b5Upkn9EIZSXISChJkupWA2uTIN0XF2osqhOQPWLJ7TSnfFz/1o3H5c HRgdqc4j4S1NPFbJnt0cZlTxQJLVvR+jAtXli4xxYYFmabKQPVpbfIePxb7HbFbsnTSr 4Q1P2Vt63zTjUOkhtCNCXxyPQVl8FaFkl8ITxRPBeV4dkVkbD4jLTb7dBHOE3AimcHci dGHNIkoNV4xmsltFwUvD76qGKcNDow9BuF9toXbFav7uvbjiKfG/DGjhvvRy13v6C4Am GsMi2oHMcGT/xeHflLEfz/vyMzPW9ZLGkGxskFTQMjQ2olABs6yGWlG/TmsfRJfq1b7J Ph0Q== X-Gm-Message-State: AOAM533S5n1KO4UH/IKd7vCtJBEbwPGWAtRhj2YoSW2rUEmOGog3uoD1 NQUzjARI9yUudNinkUmwB8E= X-Received: by 2002:a37:e40b:: with SMTP id y11mr744826qkf.29.1606155364813; Mon, 23 Nov 2020 10:16:04 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id g9sm10211626qti.86.2020.11.23.10.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 10:16:03 -0800 (PST) Date: Mon, 23 Nov 2020 11:16:02 -0700 From: Nathan Chancellor To: Antony Yu Cc: Russell King , Nick Desaulniers , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [RESEND,PATCH] ARM: fix __div64_32() error when compiling with clang Message-ID: <20201123181602.GA2637357@ubuntu-m3-large-x86> References: <20201123073634.6854-1-swpenim@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201123073634.6854-1-swpenim@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23, 2020 at 03:36:32PM +0800, Antony Yu wrote: > __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 > I am not sure that I am qualified to review this (my assembly knowledge is not the best) but your commit title mentions an error when compiling with clang. What is the exact error, what configuration generates it, and what version of clang? We have done fairly decent testing for 32-bit ARM, I would like to know what we are missing. Cheers, Nathan