Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-round-run-2.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */
3
4 #include "test-math.h"
5
6 #define ARRAY_SIZE 128
7
8 double in[ARRAY_SIZE];
9 double out[ARRAY_SIZE];
10 double ref[ARRAY_SIZE];
11
12 TEST_UNARY_CALL (double, __builtin_round)
13 TEST_ASSERT (double)
14
15 TEST_INIT (double, 1.2, __builtin_round (1.2), 1)
16 TEST_INIT (double, -1.8, __builtin_round (-1.8), 2)
17 TEST_INIT (double, 3.0, __builtin_round (3.0), 3)
18 TEST_INIT (double, 4503599627370495.5, __builtin_round (4503599627370495.5), 4)
19 TEST_INIT (double, 4503599627370497.0, __builtin_round (4503599627370497.0), 5)
20 TEST_INIT (double, 0.0, __builtin_round (0.0), 6)
21 TEST_INIT (double, -0.0, __builtin_round (-0.0), 7)
22 TEST_INIT (double, -4503599627370495.5, __builtin_round (-4503599627370495.5), 8)
23 TEST_INIT (double, -4503599627370496.0, __builtin_round (-4503599627370496.0), 9)
24
25 int
26 main ()
27 {
28 RUN_TEST (double, 1, __builtin_round, in, out, ref, ARRAY_SIZE);
29 RUN_TEST (double, 2, __builtin_round, in, out, ref, ARRAY_SIZE);
30 RUN_TEST (double, 3, __builtin_round, in, out, ref, ARRAY_SIZE);
31 RUN_TEST (double, 4, __builtin_round, in, out, ref, ARRAY_SIZE);
32 RUN_TEST (double, 5, __builtin_round, in, out, ref, ARRAY_SIZE);
33 RUN_TEST (double, 6, __builtin_round, in, out, ref, ARRAY_SIZE);
34 RUN_TEST (double, 7, __builtin_round, in, out, ref, ARRAY_SIZE);
35 RUN_TEST (double, 8, __builtin_round, in, out, ref, ARRAY_SIZE);
36 RUN_TEST (double, 9, __builtin_round, in, out, ref, ARRAY_SIZE);
37
38 return 0;
39 }