Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c

raw
1 /* { dg-do run { target { riscv_v && riscv_zvfh } } } */
2 /* { dg-additional-options "-std=c99 -fno-vect-cost-model -mrvv-vector-bits=scalable" } */
3
4 #include "vfcvt_rtz-template.h"
5
6 #define RUN(TYPE1, TYPE2, NUM) \
7 TYPE1 src##TYPE1##TYPE2##NUM[NUM]; \
8 TYPE2 dst##TYPE1##TYPE2##NUM[NUM]; \
9 for (int i = 0; i < NUM; i++) \
10 { \
11 src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 8932.947289; \
12 } \
13 vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
14 for (int i = 0; i < NUM; i++) \
15 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
16 __builtin_abort ();
17
18 #define RUN2(TYPE1, TYPE2, NUM) \
19 TYPE1 src##TYPE1##TYPE2##NUM[NUM]; \
20 TYPE2 dst##TYPE1##TYPE2##NUM[NUM]; \
21 for (int i = 0; i < NUM; i++) \
22 { \
23 src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 8932.947289; \
24 } \
25 vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
26 for (int i = 0; i < NUM; i++) \
27 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
28 __builtin_abort ();
29
30 int
31 main ()
32 {
33 RUN (_Float16, int16_t, 3)
34 RUN (_Float16, int16_t, 4)
35 RUN (_Float16, int16_t, 7)
36 RUN (_Float16, int16_t, 99)
37 RUN (_Float16, int16_t, 119)
38 RUN (_Float16, int16_t, 128)
39 RUN (_Float16, int16_t, 256)
40 RUN (_Float16, int16_t, 279)
41 RUN (_Float16, int16_t, 555)
42 RUN (_Float16, int16_t, 1024)
43 RUN (_Float16, int16_t, 1389)
44 RUN (_Float16, int16_t, 2048)
45 RUN (_Float16, int16_t, 3989)
46 RUN (_Float16, int16_t, 4096)
47 RUN (_Float16, int16_t, 5975)
48
49 RUN2 (_Float16, uint16_t, 3)
50 RUN2 (_Float16, uint16_t, 4)
51 RUN2 (_Float16, uint16_t, 7)
52 RUN2 (_Float16, uint16_t, 99)
53 RUN2 (_Float16, uint16_t, 119)
54 RUN2 (_Float16, uint16_t, 128)
55 RUN2 (_Float16, uint16_t, 256)
56 RUN2 (_Float16, uint16_t, 279)
57 RUN2 (_Float16, uint16_t, 555)
58 RUN2 (_Float16, uint16_t, 1024)
59 RUN2 (_Float16, uint16_t, 1389)
60 RUN2 (_Float16, uint16_t, 2048)
61 RUN2 (_Float16, uint16_t, 3989)
62 RUN2 (_Float16, uint16_t, 4096)
63 RUN2 (_Float16, uint16_t, 5975)
64 }