Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Long division on Nios 2

Hi there

I have a question:

Has anybody performed "long division" on Nios-2? I mean 64-bit/64-bit signed

and unsigned division with [unsigned] long long of [unsigned] long data types

(depends on the compiler). In GCC terminology, this should be an UDW/DW data type.

I mean has anybody verified that "libgcc2.c" compiles OK for Nios-2 regarding

the following runtimes: "divdi3", "udivdi3", "moddi3", "umoddi3". These ones

call "divmoddi4" for performing the underlying arithmetic, so this

question applies to "divmoddi4" as well.

Kind regards

Nikolaos Kavvadias

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yoo-hoo!

    does ANY 64-bit operation work on Nios-2? I mean there are no "movdi" (for DItype) patterns, right?

    I just want to know what should have happened when compiling s'thing like:

    unsigned long long a = 0xAAAAAAAAAAAAAAAA;

    unsigned long long b = 0x5555555555555555;

    unsigned long long c;

    c = a/b;

    ???

    kind regards

    Nikolaos Kavvadias
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    I just want to know what should have happened when compiling s&#39;thing like:

    unsigned long long a = 0xAAAAAAAAAAAAAAAA;

    unsigned long long b = 0x5555555555555555;

    unsigned long long c;

    c = a/b;[/b]

    --- Quote End ---

    I can say that the division should work. I did already before. But I think if you want to specify the constants, you need to add LL :

    unsigned long long a = 0x1122334455667788LL;

    Stefaan
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by svhb@Oct 19 2006, 12:39 PM

    i can say that the division should work. i did already before. but i think if you want to specify the constants, you need to add ll :

    --- Quote End ---

    Hi stefaan

    i think i am missing something here. i will check this with nios2 sdk 5.1.

    i was actually referring to the nios2 gnupro sources (version 6.0). There, "nios2.md" does not include no "movdi" pattern for handling the DItype. Thus, the compiler can&#39;t know how to emit split 64-bit moves.

    what is the version/tool you have checked the load immediate constant for a (64-bit) long long?

    kind regards

    -kavi
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It was definatly not on the 6.0 yet. But you had a point here, because I was planning to port my application to nios2 6.0. I will check before I begin Thanks.