Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-iceil-run-0.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 float in[ARRAY_SIZE];
9 int out[ARRAY_SIZE];
10 int ref[ARRAY_SIZE];
11
12 TEST_UNARY_CALL_CVT (float, int, __builtin_iceilf)
13 TEST_ASSERT (int)
14
15 TEST_INIT_CVT (float, 1.2, int, __builtin_iceilf (1.2), 1)
16 TEST_INIT_CVT (float, -1.2, int, __builtin_iceilf (-1.2), 2)
17 TEST_INIT_CVT (float, 0.5, int, __builtin_iceilf (0.5), 3)
18 TEST_INIT_CVT (float, -0.5, int, __builtin_iceilf (-0.5), 4)
19 TEST_INIT_CVT (float, 0.1, int, __builtin_iceilf (0.1), 5)
20 TEST_INIT_CVT (float, -0.1, int, __builtin_iceilf (-0.1), 6)
21 TEST_INIT_CVT (float, 3.0, int, __builtin_iceilf (3.0), 7)
22 TEST_INIT_CVT (float, -3.0, int, __builtin_iceilf (-3.0), 8)
23 TEST_INIT_CVT (float, 8388607.5, int, __builtin_iceilf (8388607.5), 9)
24 TEST_INIT_CVT (float, 8388609.0, int, __builtin_iceilf (8388609.0), 10)
25 TEST_INIT_CVT (float, -8388607.5, int, __builtin_iceilf (-8388607.5), 11)
26 TEST_INIT_CVT (float, -8388609.0, int, __builtin_iceilf (-8388609.0), 12)
27 TEST_INIT_CVT (float, 0.0, int, __builtin_iceilf (-0.0), 13)
28 TEST_INIT_CVT (float, -0.0, int, __builtin_iceilf (-0.0), 14)
29 TEST_INIT_CVT (float, 2147483520.0, int, __builtin_iceilf (2147483520.0), 15)
30 TEST_INIT_CVT (float, 2147483648.0, int, 0x7fffffff, 16)
31 TEST_INIT_CVT (float, -2147483648.0, int, __builtin_iceilf (-2147483648.0), 17)
32 TEST_INIT_CVT (float, -2147483904.0, int, 0x80000000, 18)
33 TEST_INIT_CVT (float, __builtin_inf (), int, __builtin_iceilf (__builtin_inff ()), 19)
34 TEST_INIT_CVT (float, -__builtin_inf (), int, __builtin_iceilf (-__builtin_inff ()), 20)
35 TEST_INIT_CVT (float, __builtin_nanf (""), int, 0x7fffffff, 21)
36
37 int
38 main ()
39 {
40 RUN_TEST_CVT (float, int, 1, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
41 RUN_TEST_CVT (float, int, 2, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
42 RUN_TEST_CVT (float, int, 3, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
43 RUN_TEST_CVT (float, int, 4, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
44 RUN_TEST_CVT (float, int, 5, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
45 RUN_TEST_CVT (float, int, 6, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
46 RUN_TEST_CVT (float, int, 7, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
47 RUN_TEST_CVT (float, int, 8, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
48 RUN_TEST_CVT (float, int, 9, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
49 RUN_TEST_CVT (float, int, 10, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
50 RUN_TEST_CVT (float, int, 11, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
51 RUN_TEST_CVT (float, int, 12, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
52 RUN_TEST_CVT (float, int, 13, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
53 RUN_TEST_CVT (float, int, 14, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
54 RUN_TEST_CVT (float, int, 15, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
55 RUN_TEST_CVT (float, int, 16, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
56 RUN_TEST_CVT (float, int, 17, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
57 RUN_TEST_CVT (float, int, 18, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
58 RUN_TEST_CVT (float, int, 19, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
59 RUN_TEST_CVT (float, int, 20, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
60 RUN_TEST_CVT (float, int, 21, __builtin_iceilf, in, out, ref, ARRAY_SIZE);
61
62 return 0;
63 }