Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c

raw
1 /* { dg-do run { target { riscv_v && rv64 } } } */
2 /* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */
3
4 #include <stdint-gcc.h>
5 #include "test-math.h"
6
7 #define ARRAY_SIZE 128
8
9 double in[ARRAY_SIZE];
10 int64_t out[ARRAY_SIZE];
11 int64_t ref[ARRAY_SIZE];
12
13 TEST_UNARY_CALL_CVT (double, int64_t, __builtin_llrint)
14 TEST_ASSERT (int64_t)
15
16 TEST_INIT_CVT (double, 1.2, int64_t, __builtin_llrint (1.2), 1)
17 TEST_INIT_CVT (double, -1.2, int64_t, __builtin_llrint (-1.2), 2)
18 TEST_INIT_CVT (double, 0.5, int64_t, __builtin_llrint (0.5), 3)
19 TEST_INIT_CVT (double, -0.5, int64_t, __builtin_llrint (-0.5), 4)
20 TEST_INIT_CVT (double, 0.1, int64_t, __builtin_llrint (0.1), 5)
21 TEST_INIT_CVT (double, -0.1, int64_t, __builtin_llrint (-0.1), 6)
22 TEST_INIT_CVT (double, 3.0, int64_t, __builtin_llrint (3.0), 7)
23 TEST_INIT_CVT (double, -3.0, int64_t, __builtin_llrint (-3.0), 8)
24 TEST_INIT_CVT (double, 4503599627370495.5, int64_t, __builtin_llrint (4503599627370495.5), 9)
25 TEST_INIT_CVT (double, 4503599627370497.0, int64_t, __builtin_llrint (4503599627370497.0), 10)
26 TEST_INIT_CVT (double, -4503599627370495.5, int64_t, __builtin_llrint (-4503599627370495.5), 11)
27 TEST_INIT_CVT (double, -4503599627370496.0, int64_t, __builtin_llrint (-4503599627370496.0), 12)
28 TEST_INIT_CVT (double, 0.0, int64_t, __builtin_llrint (-0.0), 13)
29 TEST_INIT_CVT (double, -0.0, int64_t, __builtin_llrint (-0.0), 14)
30 TEST_INIT_CVT (double, 9223372036854774784.0, int64_t, __builtin_llrint (9223372036854774784.0), 15)
31 TEST_INIT_CVT (double, 9223372036854775808.0, int64_t, __builtin_llrint (9223372036854775808.0), 16)
32 TEST_INIT_CVT (double, -9223372036854775808.0, int64_t, __builtin_llrint (-9223372036854775808.0), 17)
33 TEST_INIT_CVT (double, -9223372036854777856.0, int64_t, __builtin_llrint (-9223372036854777856.0), 18)
34 TEST_INIT_CVT (double, __builtin_inf (), int64_t, __builtin_llrint (__builtin_inf ()), 19)
35 TEST_INIT_CVT (double, -__builtin_inf (), int64_t, __builtin_llrint (-__builtin_inf ()), 20)
36 TEST_INIT_CVT (double, __builtin_nan (""), int64_t, 0x7fffffffffffffff, 21)
37
38 int
39 main ()
40 {
41 RUN_TEST_CVT (double, int64_t, 1, __builtin_llrint, in, out, ref, ARRAY_SIZE);
42 RUN_TEST_CVT (double, int64_t, 2, __builtin_llrint, in, out, ref, ARRAY_SIZE);
43 RUN_TEST_CVT (double, int64_t, 3, __builtin_llrint, in, out, ref, ARRAY_SIZE);
44 RUN_TEST_CVT (double, int64_t, 4, __builtin_llrint, in, out, ref, ARRAY_SIZE);
45 RUN_TEST_CVT (double, int64_t, 5, __builtin_llrint, in, out, ref, ARRAY_SIZE);
46 RUN_TEST_CVT (double, int64_t, 6, __builtin_llrint, in, out, ref, ARRAY_SIZE);
47 RUN_TEST_CVT (double, int64_t, 7, __builtin_llrint, in, out, ref, ARRAY_SIZE);
48 RUN_TEST_CVT (double, int64_t, 8, __builtin_llrint, in, out, ref, ARRAY_SIZE);
49 RUN_TEST_CVT (double, int64_t, 9, __builtin_llrint, in, out, ref, ARRAY_SIZE);
50 RUN_TEST_CVT (double, int64_t, 10, __builtin_llrint, in, out, ref, ARRAY_SIZE);
51 RUN_TEST_CVT (double, int64_t, 11, __builtin_llrint, in, out, ref, ARRAY_SIZE);
52 RUN_TEST_CVT (double, int64_t, 12, __builtin_llrint, in, out, ref, ARRAY_SIZE);
53 RUN_TEST_CVT (double, int64_t, 13, __builtin_llrint, in, out, ref, ARRAY_SIZE);
54 RUN_TEST_CVT (double, int64_t, 14, __builtin_llrint, in, out, ref, ARRAY_SIZE);
55 RUN_TEST_CVT (double, int64_t, 15, __builtin_llrint, in, out, ref, ARRAY_SIZE);
56 RUN_TEST_CVT (double, int64_t, 16, __builtin_llrint, in, out, ref, ARRAY_SIZE);
57 RUN_TEST_CVT (double, int64_t, 17, __builtin_llrint, in, out, ref, ARRAY_SIZE);
58 RUN_TEST_CVT (double, int64_t, 18, __builtin_llrint, in, out, ref, ARRAY_SIZE);
59 RUN_TEST_CVT (double, int64_t, 19, __builtin_llrint, in, out, ref, ARRAY_SIZE);
60 RUN_TEST_CVT (double, int64_t, 20, __builtin_llrint, in, out, ref, ARRAY_SIZE);
61 RUN_TEST_CVT (double, int64_t, 21, __builtin_llrint, in, out, ref, ARRAY_SIZE);
62
63 return 0;
64 }