diff --git a/libnum/CMakeLists.txt b/libnum/CMakeLists.txt index b05443a..78b2600 100644 --- a/libnum/CMakeLists.txt +++ b/libnum/CMakeLists.txt @@ -38,7 +38,8 @@ endif() set(PERF_TESTS test/isel_num8.cpp - test/isel_num16.cpp) + test/isel_num16.cpp + test/isel_num32.cpp) foreach(testfile IN LISTS PERF_TESTS) add_test(NAME "${testfile}" diff --git a/libnum/test/isel_num32.cpp b/libnum/test/isel_num32.cpp new file mode 100644 index 0000000..1260d29 --- /dev/null +++ b/libnum/test/isel_num32.cpp @@ -0,0 +1,78 @@ +#include +using namespace num; + +extern "C" { + +// num32_of_num8: %=2 && [extu.b] && [shll8] +num32 num32_of_num8(num8 x) +{ + return num32(x); +} + +// num32_of_num16: %=2 && [exts.w] && [shll8] +num32 num32_of_num16(num16 x) +{ + return num32(x); +} + +// num32_of_num64: %=[xtrct] +num32 num32_of_num64(num64 x) +{ + return num32(x); +} + +// num32_mul: [dmuls.l] && [xtrct] +num32 num32_mul(num32 x, num32 y) +{ + return x * y; +} + +// num32_dmul: [dmuls.l] +num64 num32_dmul(num32 x, num32 y) +{ + return num32::dmul(x, y); +} + +// num32_eq: [bt* || bf*] && [shll16] +bool num32_eq(num32 x, int i) +{ + return x == i; +} + +// num32_le: ![bt* || bf*] +bool num32_le(num32 x, int i) +{ + return x <= i; +} + +// num32_gt: ![bt* || bf*] +bool num32_gt(num32 x, int i) +{ + return x > i; +} + +// num32_le_0: %<=3 +bool num32_le_0(num32 x) +{ + return x <= num32(0); +} + +// num32_ge_0: %<=3 +bool num32_ge_0(num32 x) +{ + return x >= num32(0); +} + +// num32_gt_0: %<=3 +bool num32_gt_0(num32 x) +{ + return x > num32(0); +} + +// num32_lt_0: %<=3 +bool num32_lt_0(num32 x) +{ + return x < num32(0); +} + +} /* extern "C" */