Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-trunc-run-1.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 float out[ARRAY_SIZE];
10 float ref[ARRAY_SIZE];
11
12 TEST_UNARY_CALL (float, __builtin_truncf)
13 TEST_ASSERT (float)
14
15 TEST_INIT (float, 1.2, __builtin_truncf (1.2), 1)
16 TEST_INIT (float, -1.2,__builtin_truncf (-1.2), 2)
17 TEST_INIT (float, 3.0, __builtin_truncf (3.0), 3)
18 TEST_INIT (float, 8388607.5, __builtin_truncf (8388607.5), 4)
19 TEST_INIT (float, 8388609.0, __builtin_truncf (8388609.0), 5)
20 TEST_INIT (float, 0.0, __builtin_truncf (0.0), 6)
21 TEST_INIT (float, -0.0, __builtin_truncf (-0.0), 7)
22 TEST_INIT (float, -8388607.5, __builtin_truncf (-8388607.5), 8)
23 TEST_INIT (float, -8388608.0, __builtin_truncf (-8388608.0), 9)
24
25 int
26 main ()
27 {
28 RUN_TEST (float, 1, __builtin_truncf, in, out, ref, ARRAY_SIZE);
29 RUN_TEST (float, 2, __builtin_truncf, in, out, ref, ARRAY_SIZE);
30 RUN_TEST (float, 3, __builtin_truncf, in, out, ref, ARRAY_SIZE);
31 RUN_TEST (float, 4, __builtin_truncf, in, out, ref, ARRAY_SIZE);
32 RUN_TEST (float, 5, __builtin_truncf, in, out, ref, ARRAY_SIZE);
33 RUN_TEST (float, 6, __builtin_truncf, in, out, ref, ARRAY_SIZE);
34 RUN_TEST (float, 7, __builtin_truncf, in, out, ref, ARRAY_SIZE);
35 RUN_TEST (float, 8, __builtin_truncf, in, out, ref, ARRAY_SIZE);
36 RUN_TEST (float, 9, __builtin_truncf, in, out, ref, ARRAY_SIZE);
37
38 return 0;
39 }