Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-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 "vfwcvt-ftoi-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 - 832.947289; \
12 } \
13 vfwcvt_##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 + 832.947289; \
24 } \
25 vfwcvt_##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, int32_t, 3)
34 RUN (_Float16, int32_t, 4)
35 RUN (_Float16, int32_t, 7)
36 RUN (_Float16, int32_t, 99)
37 RUN (_Float16, int32_t, 119)
38 RUN (_Float16, int32_t, 128)
39 RUN (_Float16, int32_t, 256)
40 RUN (_Float16, int32_t, 279)
41 RUN (_Float16, int32_t, 555)
42 RUN (_Float16, int32_t, 1024)
43 RUN (_Float16, int32_t, 1389)
44 RUN (_Float16, int32_t, 2048)
45 RUN (_Float16, int32_t, 3989)
46 RUN (_Float16, int32_t, 4096)
47 RUN (_Float16, int32_t, 5975)
48
49 RUN2 (_Float16, uint32_t, 3)
50 RUN2 (_Float16, uint32_t, 4)
51 RUN2 (_Float16, uint32_t, 7)
52 RUN2 (_Float16, uint32_t, 99)
53 RUN2 (_Float16, uint32_t, 119)
54 RUN2 (_Float16, uint32_t, 128)
55 RUN2 (_Float16, uint32_t, 256)
56 RUN2 (_Float16, uint32_t, 279)
57 RUN2 (_Float16, uint32_t, 555)
58 RUN2 (_Float16, uint32_t, 1024)
59 RUN2 (_Float16, uint32_t, 1389)
60 RUN2 (_Float16, uint32_t, 2048)
61 RUN2 (_Float16, uint32_t, 3989)
62 RUN2 (_Float16, uint32_t, 4096)
63 RUN2 (_Float16, uint32_t, 5975)
64
65 RUN (_Float16, int64_t, 3)
66 RUN (_Float16, int64_t, 4)
67 RUN (_Float16, int64_t, 7)
68 RUN (_Float16, int64_t, 99)
69 RUN (_Float16, int64_t, 119)
70 RUN (_Float16, int64_t, 128)
71 RUN (_Float16, int64_t, 256)
72 RUN (_Float16, int64_t, 279)
73 RUN (_Float16, int64_t, 555)
74 RUN (_Float16, int64_t, 1024)
75 RUN (_Float16, int64_t, 1389)
76 RUN (_Float16, int64_t, 2048)
77 RUN (_Float16, int64_t, 3989)
78 RUN (_Float16, int64_t, 4096)
79 RUN (_Float16, int64_t, 5975)
80
81 RUN2 (_Float16, uint64_t, 3)
82 RUN2 (_Float16, uint64_t, 4)
83 RUN2 (_Float16, uint64_t, 7)
84 RUN2 (_Float16, uint64_t, 99)
85 RUN2 (_Float16, uint64_t, 119)
86 RUN2 (_Float16, uint64_t, 128)
87 RUN2 (_Float16, uint64_t, 256)
88 RUN2 (_Float16, uint64_t, 279)
89 RUN2 (_Float16, uint64_t, 555)
90 RUN2 (_Float16, uint64_t, 1024)
91 RUN2 (_Float16, uint64_t, 1389)
92 RUN2 (_Float16, uint64_t, 2048)
93 RUN2 (_Float16, uint64_t, 3989)
94 RUN2 (_Float16, uint64_t, 4096)
95 RUN2 (_Float16, uint64_t, 5975)
96 }