Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM? #55

Closed
anfractuosity opened this issue Nov 16, 2015 · 12 comments
Closed

ARM? #55

anfractuosity opened this issue Nov 16, 2015 · 12 comments

Comments

@anfractuosity
Copy link

Theres no easy way I presume, that I could get ramp to
work on an ARM processor I assume, due to the inline ASM?

cheers

Chris

@zcdziura
Copy link

You'd have to rewrite the inline'd ASM for ARM, then use conditional compilation to target ARM.

@anfractuosity
Copy link
Author

Cheers, appreciate the heads up

@Aatch
Copy link
Owner

Aatch commented Nov 17, 2015

In theory, Ramp should work as-is on ARM, as the inline asm isn't actually necessary (there's fallback to Rust versions already). Though performance won't be nearly as good.

@anfractuosity
Copy link
Author

Yup :) I just found that yesterday, I managed to compile it ok, on my Raspberry Pi

@anfractuosity
Copy link
Author

I've just found it fails a very large percentage of tests:

failures:

---- div::assign_baseint stdout ----
    thread 'div::assign_baseint' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("a"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::assign_i32 stdout ----
    thread 'div::assign_i32' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-9"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::assign_int stdout ----
    thread 'div::assign_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-cdb"), BigIntStr("19"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::assign_intref stdout ----
    thread 'div::assign_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("9"), BigIntStr("6"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::assign_limb stdout ----
    thread 'div::assign_limb' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("c"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::assign_usize stdout ----
    thread 'div::assign_usize' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("c"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_baseint stdout ----
    thread 'div::int_baseint' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("d"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_i32 stdout ----
    thread 'div::int_i32' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("67"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_int stdout ----
    thread 'div::int_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("6c"), BigIntStr("5"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_intref stdout ----
    thread 'div::int_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("f0"), BigIntStr("-6"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_limb stdout ----
    thread 'div::int_limb' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("5"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::int_usize stdout ----
    thread 'div::int_usize' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("48c4a"), 2)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::intref_int stdout ----
    thread 'div::intref_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("231"), BigIntStr("d"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- div::intref_intref stdout ----
    thread 'div::intref_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("149"), BigIntStr("e"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- divmod stdout ----
    thread 'divmod' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("600"), BigIntStr("4b"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- dsquare stdout ----
    thread 'dsquare' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-b0000000000000000000000000000660723ffffffff"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- format::debug stdout ----
    thread 'format::debug' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (BigIntStr("bbe06d556ffff"))
Error: "UNABLE TO SHOW RESULT OF PANIC."', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- format::display stdout ----
    thread 'format::display' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (BigIntStr("5b7ed4ffffff"))
Error: "UNABLE TO SHOW RESULT OF PANIC."', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- from_str_decimal stdout ----
    thread 'from_str_decimal' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (BigIntStr("8c47576000000000000000000000a695bf33bdfffffffffceb1fdfffffffffffffffffffffffffffffffffffff4beb10617b700"))
Error: "UNABLE TO SHOW RESULT OF PANIC."', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- from_str_radix stdout ----
    thread 'from_str_radix' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("d5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), 7)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::assign_int stdout ----
    thread 'mul::assign_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("2a02ffff"), BigIntStr("-fcacb000000000000000000000000000"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::assign_intref stdout ----
    thread 'mul::assign_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("61b00000000000000000000000000a2fd50000000000000000dc4ae00821000000000"), BigIntStr("b8fffffffff4"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::int_int stdout ----
    thread 'mul::int_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("f628a800"), BigIntStr("c80ff46efff"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::int_intref stdout ----
    thread 'mul::int_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-840004c7ffffff"), BigIntStr("-a1d1000000000000000000002ac7ffffffff"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::intref_int stdout ----
    thread 'mul::intref_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("93cf42130ac00000000"), BigIntStr("-224f0cb0000000e000000000000f97b7bca8cf00000000000"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- mul::intref_intref stdout ----
    thread 'mul::intref_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("5e1e50c0ff8348bcffff"), BigIntStr("95f5fffffffff"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- pow stdout ----
    thread 'pow' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("e8"), 42)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_baseint stdout ----
    thread 'rem::assign_baseint' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("e"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_i32 stdout ----
    thread 'rem::assign_i32' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("5f"), 19)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_int stdout ----
    thread 'rem::assign_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("87f"), BigIntStr("46"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_intref stdout ----
    thread 'rem::assign_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("500"), BigIntStr("36"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_limb stdout ----
    thread 'rem::assign_limb' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-64"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::assign_usize stdout ----
    thread 'rem::assign_usize' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-6e"), 19)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_baseint stdout ----
    thread 'rem::int_baseint' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("b"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_i32 stdout ----
    thread 'rem::int_i32' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("e"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_int stdout ----
    thread 'rem::int_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("70"), BigIntStr("9"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_intref stdout ----
    thread 'rem::int_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("7f"), BigIntStr("13"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_limb stdout ----
    thread 'rem::int_limb' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-23"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::int_usize stdout ----
    thread 'rem::int_usize' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("1c"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::intref_int stdout ----
    thread 'rem::intref_int' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-4e"), BigIntStr("6"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- rem::intref_intref stdout ----
    thread 'rem::intref_intref' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("df"), BigIntStr("b"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- sqrt_rem stdout ----
    thread 'sqrt_rem' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("9ffffffff79f00"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- square stdout ----
    thread 'square' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("-7f000000000000000000000000000000dacd461a70ed685"))', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- to_str_decimal stdout ----
    thread 'to_str_decimal' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (BigIntStr("d360000000000"))
Error: "UNABLE TO SHOW RESULT OF PANIC."', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- to_str_radix stdout ----
    thread 'to_str_radix' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("c74f00000000"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113

---- write_radix stdout ----
    thread 'write_radix' panicked at '[quickcheck] TEST FAILED. Arguments: (BigIntStr("c6d000000"), 3)', /home/pi/.cargo/registry/src/github.com-121aea75f9ef2ce2/quickcheck-0.2.24/src/tester.rs:113


failures:
    div::assign_baseint
    div::assign_i32
    div::assign_int
    div::assign_intref
    div::assign_limb
    div::assign_usize
    div::int_baseint
    div::int_i32
    div::int_int
    div::int_intref
    div::int_limb
    div::int_usize
    div::intref_int
    div::intref_intref
    divmod
    dsquare
    format::debug
    format::display
    from_str_decimal
    from_str_radix
    mul::assign_int
    mul::assign_intref
    mul::int_int
    mul::int_intref
    mul::intref_int
    mul::intref_intref
    pow
    rem::assign_baseint
    rem::assign_i32
    rem::assign_int
    rem::assign_intref
    rem::assign_limb
    rem::assign_usize
    rem::int_baseint
    rem::int_i32
    rem::int_int
    rem::int_intref
    rem::int_limb
    rem::int_usize
    rem::intref_int
    rem::intref_intref
    sqrt_rem
    square
    to_str_decimal
    to_str_radix
    write_radix

test result: FAILED. 209 passed; 46 failed; 0 ignored; 0 measured

@huonw
Copy link
Contributor

huonw commented Nov 18, 2015

I took a quick look, and there's at least two bugs here:

  • x3 = x1 + (1 << (Limb::BITS / 2));
    should probably be x3 = x3 + (1 << (Limb::BITS / 2));
  • Limb division seems to be wrong. I don't know any specifics, but changing division to cast to u64 and divide when Limb is 32 bits seems to make a simple case pass.

@anfractuosity
Copy link
Author

With your first fix the tests that fail are reduced to 35:

failures:
    div::assign_baseint
    div::assign_i32
    div::assign_int
    div::assign_intref
    div::assign_limb
    div::assign_usize
    div::int_baseint
    div::int_i32
    div::int_int
    div::int_intref
    div::int_limb
    div::int_usize
    div::intref_int
    div::intref_intref
    divmod
    format::debug
    format::display
    rem::assign_baseint
    rem::assign_i32
    rem::assign_int
    rem::assign_intref
    rem::assign_limb
    rem::assign_usize
    rem::int_baseint
    rem::int_i32
    rem::int_int
    rem::int_intref
    rem::int_limb
    rem::int_usize
    rem::intref_int
    rem::intref_intref
    sqrt_rem
    to_str_decimal
    to_str_radix
    write_radix

test result: FAILED. 220 passed; 35 failed; 0 ignored; 0 measured

@anfractuosity
Copy link
Author

@huonw I'm somewhat confused what needs to be typecasted to u64?
cheers
Chris

@huonw
Copy link
Contributor

huonw commented Nov 18, 2015

I added the following to the start of div_impl:

            if Limb::BITS == 32 {
                let numer = (nh.0 as u64) << 32 | nl.0 as u64;
                let denom = d.0 as u64;
                let (q, r) = (numer / denom, numer % denom);
                return (Limb(q as BaseInt), Limb(r as BaseInt))
            }

@anfractuosity
Copy link
Author

Thanks a lot for your help!

I ran the test suite on ARM, and it passed all of them.

And my ARM application using RAMP, works great now :)

@huonw
Copy link
Contributor

huonw commented Nov 19, 2015

Awesome! (NB. that the fix for div_impl won't handle AArch64.)

@rozbb
Copy link
Collaborator

rozbb commented Jun 18, 2018

Looks like this is solved.

@rozbb rozbb closed this as completed Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants