stdarch icon indicating copy to clipboard operation
stdarch copied to clipboard

Change test tool to use a loop and load intrinsic.

Open Jmc18134 opened this issue 3 years ago • 3 comments

The files generated by the intrinsic test tool currently repeat the lines for the call multiple times, which sometimes generates very large test files. Changing it to use a loop and a load intrinsic reduces the size of the generated files and gives some coverage for the load intrinsics. This seems to also reduce the run-time for the test tool, enough that some of the intrinsics that are currently skipped because they take too long can be added back and the Rust test files can be built with --target again.

Example generated C before:

{
    uint64x1_t a = { 0x10000000000000 };
    uint64x1_t b = { 0x10000000000000 };
    auto __return_value = vadd_u64(a, b);
    std::cout << "Result -1: uint64x1_t(" << std::fixed << std::setprecision(150) <<  cast<uint64_t>(__return_value) << ")" << std::endl;
}
{
    uint64x1_t a = { 0x3FDFFFFFFFFFFFFF };
    uint64x1_t b = { 0x3FDFFFFFFFFFFFFF };
    auto __return_value = vadd_u64(a, b);
    std::cout << "Result -2: uint64x1_t(" << std::fixed << std::setprecision(150) <<  cast<uint64_t>(__return_value) << ")" << std::endl;
}
...
// Several more similar blocks

Example generated after:

const uint64_t a_vals[] = { 0x0,0x10000000000000,0x3FDFFFFFFFFFFFFF,0x3FE0000000000000,0x3FE0000000000001,0x3FEFFFFFFFFFFFFF,0x3FF0000000000000,0x3FF0000000000001,0x3FF8000000000000,0x4024000000000000,  0x7FEFFFFFFFFFFFFF,0x7FF0000000000000,0x7FF923456789ABCD,0x7FF8000000000000,0x7FF123456789ABCD,0x7FF0000000000000,0x123456789ABCD,0xFFFFFFFFFFFFF,0x1,0x8000000000000000 };
const uint64_t b_vals[] = { 0x0,0x10000000000000,0x3FDFFFFFFFFFFFFF,0x3FE0000000000000,0x3FE0000000000001,0x3FEFFFFFFFFFFFFF,0x3FF0000000000000,0x3FF0000000000001,0x3FF8000000000000,0x4024000000000000,  0x7FEFFFFFFFFFFFFF,0x7FF0000000000000,0x7FF923456789ABCD,0x7FF8000000000000,0x7FF123456789ABCD,0x7FF0000000000000,0x123456789ABCD,0xFFFFFFFFFFFFF,0x1,0x8000000000000000 };

...

{
    for (int i=0; i<20; i++) {
        uint64x1_t a = vld1_u64(&a_vals[i]);
        uint64x1_t b = vld1_u64(&b_vals[i]);
        auto __return_value = vadd_u64(a, b);
        std::cout << "Result -" << i+1 << ": uint64x1_t(" << std::fixed << std::setprecision(150) <<  cast<uint64_t>(__return_value) << ")" << std::endl;
    }
}

Jmc18134 avatar Aug 11 '22 15:08 Jmc18134

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

rust-highfive avatar Aug 11 '22 15:08 rust-highfive

CI should be fixed now, can you rebase?

Amanieu avatar Aug 12 '22 15:08 Amanieu

CI should be fixed by #1326, can you rebase?

Amanieu avatar Aug 20 '22 20:08 Amanieu