LGTM.
juzhe.zh...@rivai.ai From: pan2.li Date: 2023-11-06 16:33 To: gcc-patches CC: juzhe.zhong; pan2.li; yanzhang.wang; kito.cheng Subject: [PATCH v1] RISC-V: Adjust FP rint round tests for RV32 From: Pan Li <pan2...@intel.com> The FP rint test cases for RV32 need some additional adjust for types and data. This patch would like to fix this which is missed in FP rint support PATCH for RV32 only by mistake. Please note the math-llrintf-run-0.c will trigger one ICE in the vsetvl pass in RV32 only. ./riscv32-unknown-elf-gcc -march=rv32gcv -mabi=ilp32d \ -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math \ gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c \ -o test.elf -lm Then there will have ICE similar as below, and will file bugzilla for it. config/riscv/riscv-v.cc:4314 65 | } | ^ 0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**, rtx_def*, bool) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314 0x1fb1aa2 pre_vsetvl::remove_avl_operand() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342 0x1fb18c1 pre_vsetvl::cleaup() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308 0x1fb216d pass_vsetvl::lazy_vsetvl() /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480 0x1fb2214 pass_vsetvl::execute(function*) /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: Adjust test cases. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: Ditto. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: Ditto. Signed-off-by: Pan Li <pan2...@intel.com> --- .../riscv/rvv/autovec/unop/math-irint-run-0.c | 94 +++++++++--------- .../rvv/autovec/unop/math-llrintf-run-0.c | 98 ++++++++++--------- .../rvv/autovec/unop/math-lrint-rv32-run-0.c | 88 ++++++++--------- 3 files changed, 141 insertions(+), 139 deletions(-) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c index 43bc0849695..aae1d95c2b6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c @@ -5,59 +5,59 @@ #define ARRAY_SIZE 128 -float in[ARRAY_SIZE]; -long out[ARRAY_SIZE]; -long ref[ARRAY_SIZE]; +double in[ARRAY_SIZE]; +int out[ARRAY_SIZE]; +int ref[ARRAY_SIZE]; -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) -TEST_ASSERT (long) +TEST_UNARY_CALL_CVT (double, int, __builtin_irint) +TEST_ASSERT (int) -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +TEST_INIT_CVT (double, 1.2, int, __builtin_irint (1.2), 1) +TEST_INIT_CVT (double, -1.2, int, __builtin_irint (-1.2), 2) +TEST_INIT_CVT (double, 0.5, int, __builtin_irint (0.5), 3) +TEST_INIT_CVT (double, -0.5, int, __builtin_irint (-0.5), 4) +TEST_INIT_CVT (double, 0.1, int, __builtin_irint (0.1), 5) +TEST_INIT_CVT (double, -0.1, int, __builtin_irint (-0.1), 6) +TEST_INIT_CVT (double, 3.0, int, __builtin_irint (3.0), 7) +TEST_INIT_CVT (double, -3.0, int, __builtin_irint (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, int, __builtin_irint (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, int, __builtin_irint (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, int, __builtin_irint (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, int, __builtin_irint (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, int, __builtin_irint (-0.0), 13) +TEST_INIT_CVT (double, -0.0, int, __builtin_irint (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, int, __builtin_irint (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, int, __builtin_irint (9223372036854775808.0), 16) +TEST_INIT_CVT (double, -9223372036854775808.0, int, __builtin_irint (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, int, __builtin_irint (-9223372036854777856.0), 18) +TEST_INIT_CVT (double, __builtin_inf (), int, __builtin_irint (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), int, __builtin_irint (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), int, 0x7fffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 1, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 2, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 3, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 4, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 5, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 6, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 7, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 8, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 9, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 10, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 11, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 12, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 13, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 14, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 15, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 16, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 17, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 18, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 19, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 20, __builtin_irint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, int, 21, __builtin_irint, in, out, ref, ARRAY_SIZE); return 0; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c index 43bc0849695..e9394df0e44 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c @@ -1,63 +1,65 @@ /* { dg-do run { target { riscv_v } } } */ /* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ +#include <stdint-gcc.h> #include "test-math.h" #define ARRAY_SIZE 128 float in[ARRAY_SIZE]; -long out[ARRAY_SIZE]; -long ref[ARRAY_SIZE]; - -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) -TEST_ASSERT (long) - -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +int64_t out[ARRAY_SIZE]; +int64_t ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (float, int64_t, __builtin_llrintf) +TEST_ASSERT (int64_t) + + +TEST_INIT_CVT (float, 1.2, int64_t, __builtin_llrintf (1.2), 1) +TEST_INIT_CVT (float, -1.2, int64_t, __builtin_llrintf (-1.2), 2) +TEST_INIT_CVT (float, 0.5, int64_t, __builtin_llrintf (0.5), 3) +TEST_INIT_CVT (float, -0.5, int64_t, __builtin_llrintf (-0.5), 4) +TEST_INIT_CVT (float, 0.1, int64_t, __builtin_llrintf (0.1), 5) +TEST_INIT_CVT (float, -0.1, int64_t, __builtin_llrintf (-0.1), 6) +TEST_INIT_CVT (float, 3.0, int64_t, __builtin_llrintf (3.0), 7) +TEST_INIT_CVT (float, -3.0, int64_t, __builtin_llrintf (-3.0), 8) +TEST_INIT_CVT (float, 2147483520.0, int64_t, __builtin_llrintf (2147483520.0), 9) +TEST_INIT_CVT (float, 2147483648.0, int64_t, __builtin_llrintf (2147483648.0), 10) +TEST_INIT_CVT (float, -2147483648.0, int64_t, __builtin_llrintf (-2147483648.0), 11) +TEST_INIT_CVT (float, -2147483904.0, int64_t, __builtin_llrintf (-2147483904.0), 12) +TEST_INIT_CVT (float, 0.0, int64_t, __builtin_llrintf (-0.0), 13) +TEST_INIT_CVT (float, -0.0, int64_t, __builtin_llrintf (-0.0), 14) +TEST_INIT_CVT (float, 9223372036854775807.0, int64_t, __builtin_llrintf (9223372036854775807.0), 15) +TEST_INIT_CVT (float, 9223373136366403584.0, int64_t, __builtin_llrintf (9223373136366403584.0), 16) +TEST_INIT_CVT (float, -9223372036854775807.0, int64_t, __builtin_llrintf (-9223372036854775807.0), 17) +TEST_INIT_CVT (float, -9223373136366403584.0, int64_t, __builtin_llrintf (-9223373136366403584.0), 18) +TEST_INIT_CVT (float, __builtin_inf (), int64_t, __builtin_llrintf (__builtin_inff ()), 19) +TEST_INIT_CVT (float, -__builtin_inf (), int64_t, __builtin_llrintf (-__builtin_inff ()), 20) +TEST_INIT_CVT (float, __builtin_nanf (""), int64_t, 0x7fffffffffffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 1, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 2, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 3, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 4, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 5, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 6, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 7, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 8, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 9, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 10, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 11, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 12, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 13, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 14, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 15, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 16, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 17, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 18, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 19, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 20, __builtin_llrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, int64_t, 21, __builtin_llrintf, in, out, ref, ARRAY_SIZE); return 0; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c index c1c8cc32588..e195f479f7b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c @@ -5,59 +5,59 @@ #define ARRAY_SIZE 128 -float in[ARRAY_SIZE]; +double in[ARRAY_SIZE]; long out[ARRAY_SIZE]; long ref[ARRAY_SIZE]; -TEST_UNARY_CALL_CVT (float, long, __builtin_lrintf) +TEST_UNARY_CALL_CVT (double, long, __builtin_lrint) TEST_ASSERT (long) -TEST_INIT_CVT (float, 1.2, long, __builtin_lrintf (1.2), 1) -TEST_INIT_CVT (float, -1.2, long, __builtin_lrintf (-1.2), 2) -TEST_INIT_CVT (float, 0.5, long, __builtin_lrintf (0.5), 3) -TEST_INIT_CVT (float, -0.5, long, __builtin_lrintf (-0.5), 4) -TEST_INIT_CVT (float, 0.1, long, __builtin_lrintf (0.1), 5) -TEST_INIT_CVT (float, -0.1, long, __builtin_lrintf (-0.1), 6) -TEST_INIT_CVT (float, 3.0, long, __builtin_lrintf (3.0), 7) -TEST_INIT_CVT (float, -3.0, long, __builtin_lrintf (-3.0), 8) -TEST_INIT_CVT (float, 4503599627370495.5, long, __builtin_lrintf (4503599627370495.5), 9) -TEST_INIT_CVT (float, 4503599627370497.0, long, __builtin_lrintf (4503599627370497.0), 10) -TEST_INIT_CVT (float, -4503599627370495.5, long, __builtin_lrintf (-4503599627370495.5), 11) -TEST_INIT_CVT (float, -4503599627370496.0, long, __builtin_lrintf (-4503599627370496.0), 12) -TEST_INIT_CVT (float, 0.0, long, __builtin_lrintf (-0.0), 13) -TEST_INIT_CVT (float, -0.0, long, __builtin_lrintf (-0.0), 14) -TEST_INIT_CVT (float, 9223372036854774784.0, long, __builtin_lrintf (9223372036854774784.0), 15) -TEST_INIT_CVT (float, 9223372036854775808.0, long, __builtin_lrintf (9223372036854775808.0), 16) -TEST_INIT_CVT (float, -9223372036854775808.0, long, __builtin_lrintf (-9223372036854775808.0), 17) -TEST_INIT_CVT (float, -9223372036854777856.0, long, __builtin_lrintf (-9223372036854777856.0), 18) -TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lrintf (__builtin_inf ()), 19) -TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lrintf (-__builtin_inf ()), 20) -TEST_INIT_CVT (float, __builtin_nan (""), long, 0x7fffffffffffffff, 21) +TEST_INIT_CVT (double, 1.2, long, __builtin_lrint (1.2), 1) +TEST_INIT_CVT (double, -1.2, long, __builtin_lrint (-1.2), 2) +TEST_INIT_CVT (double, 0.5, long, __builtin_lrint (0.5), 3) +TEST_INIT_CVT (double, -0.5, long, __builtin_lrint (-0.5), 4) +TEST_INIT_CVT (double, 0.1, long, __builtin_lrint (0.1), 5) +TEST_INIT_CVT (double, -0.1, long, __builtin_lrint (-0.1), 6) +TEST_INIT_CVT (double, 3.0, long, __builtin_lrint (3.0), 7) +TEST_INIT_CVT (double, -3.0, long, __builtin_lrint (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, long, __builtin_lrint (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, long, __builtin_lrint (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, long, __builtin_lrint (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, long, __builtin_lrint (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, long, __builtin_lrint (-0.0), 13) +TEST_INIT_CVT (double, -0.0, long, __builtin_lrint (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, long, __builtin_lrint (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, long, __builtin_lrint (9223372036854775808.0), 16) +TEST_INIT_CVT (double, -9223372036854775808.0, long, __builtin_lrint (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, long, __builtin_lrint (-9223372036854777856.0), 18) +TEST_INIT_CVT (double, __builtin_inf (), long, __builtin_lrint (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), long, __builtin_lrint (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), long, 0x7fffffff, 21) int main () { - RUN_TEST_CVT (float, long, 1, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 2, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 3, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 4, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 5, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 6, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 7, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 8, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 9, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 10, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 11, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 12, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 13, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 14, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 15, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 16, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 17, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 18, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 19, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 20, __builtin_lrintf, in, out, ref, ARRAY_SIZE); - RUN_TEST_CVT (float, long, 21, __builtin_lrintf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 1, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 2, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 3, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 4, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 5, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 6, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 7, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 8, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 9, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 10, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 11, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 12, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 13, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 14, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 15, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 16, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 17, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 18, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 19, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 20, __builtin_lrint, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 21, __builtin_lrint, in, out, ref, ARRAY_SIZE); return 0; } -- 2.34.1