Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Lin <tesheng@andestech.com>
To: Paul Walmsley <paul.walmsley@sifive.com>
Cc: "dslin1010@gmail.com" <dslin1010@gmail.com>,
	"Alan Quey-Liang Kao(高魁良)" <alankao@andestech.com>,
	"palmer@sifive.com" <palmer@sifive.com>,
	"Rick Jian-Zhi Chen(陳建志)" <rick@andestech.com>,
	"K.C. Kuen-Chern Lin(林坤成)" <kclin@andestech.com>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"jimw@sifive.com" <jimw@sifive.com>
Subject: Re: About __udivdi3
Date: Tue, 6 Aug 2019 10:59:25 +0800	[thread overview]
Message-ID: <20190806025925.GA18995@andestech.com> (raw)
In-Reply-To: <alpine.DEB.2.21.9999.1908051911290.13971@viisi.sifive.com>

Hi Paul,

On Tue, Aug 06, 2019 at 10:13:40AM +0800, Paul Walmsley wrote:
> On Tue, 6 Aug 2019, Eric Lin wrote:
> 
> > Cc: mailing list
> > On Mon, Aug 05, 2019 at 01:58:56PM +0800, Eric Lin wrote:
> > > Hi Palmer/Paul, 
> > > 
> > > Recently I encounter a problem that the output from __udivdi3 is wrong.
> > > The compiler will generate __udivdi3 library call when doing 64-bit
> > > over 64-bit division on 32-bit platform.
> > > 
> > > It seems __udivdi3 only supports 64-bit platform.
> > > Do you have any comments? Thanks.
> 
> It sounds like you're describing a potential issue with gcc, rather than 
> the kernel.  If that's so, then the gcc mailing list(s) would be a better 
> place to discuss this:  https://gcc.gnu.org/lists.html
>  
> 
> - Paul

Sorry, maybe I didn't describe it clearly.
When doing 64-bit over 64-bit division on 32-bit platform, the gcc will
link the __udivdi3 function in arch/riscv/lib/udivdi3.S, but the output
is wrong because the function is designed for RV64 ABI only.

I've tried to modify the arch/riscv/Makefile to make it link libgcc's
__udivdi3 library. The output is correct after using the libgcc's __udivdi3.

So, I don't think the __udivdi3 in arch/riscv/lib can support 64-bit
over 64-bit division on 32-bit platform.

Best Regards,
Eric

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2019-08-06  2:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190805055844.GE4292@andestech.com>
2019-08-06  1:37 ` About __udivdi3 Eric Lin
2019-08-06  2:13   ` Paul Walmsley
2019-08-06  2:59     ` Eric Lin [this message]
2019-08-06  3:01     ` Jim Wilson
2019-08-06  3:45       ` Nicolas Pitre
2019-08-06  8:31       ` Christoph Hellwig
2019-08-06 15:08         ` Palmer Dabbelt
2019-08-06 17:53           ` Paul Walmsley
2019-08-06 17:59             ` Palmer Dabbelt
2019-08-06 18:37           ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190806025925.GA18995@andestech.com \
    --to=tesheng@andestech.com \
    --cc=alankao@andestech.com \
    --cc=dslin1010@gmail.com \
    --cc=jimw@sifive.com \
    --cc=kclin@andestech.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rick@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox