Debian Codegraph @

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

raw
1 /* { dg-do run { target { riscv_v } } } */
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 - 88932.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 + 88932.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 (float, int32_t, 3)
34 RUN (float, int32_t, 4)
35 RUN (float, int32_t, 7)
36 RUN (float, int32_t, 99)
37 RUN (float, int32_t, 119)
38 RUN (float, int32_t, 128)
39 RUN (float, int32_t, 256)
40 RUN (float, int32_t, 279)
41 RUN (float, int32_t, 555)
42 RUN (float, int32_t, 1024)
43 RUN (float, int32_t, 1389)
44 RUN (float, int32_t, 2048)
45 RUN (float, int32_t, 3989)
46 RUN (float, int32_t, 4096)
47 RUN (float, int32_t, 5975)
48
49 RUN2 (float, uint32_t, 3)
50 RUN2 (float, uint32_t, 4)
51 RUN2 (float, uint32_t, 7)
52 RUN2 (float, uint32_t, 99)
53 RUN2 (float, uint32_t, 119)
54 RUN2 (float, uint32_t, 128)
55 RUN2 (float, uint32_t, 256)
56 RUN2 (float, uint32_t, 279)
57 RUN2 (float, uint32_t, 555)
58 RUN2 (float, uint32_t, 1024)
59 RUN2 (float, uint32_t, 1389)
60 RUN2 (float, uint32_t, 2048)
61 RUN2 (float, uint32_t, 3989)
62 RUN2 (float, uint32_t, 4096)
63 RUN2 (float, uint32_t, 5975)
64
65 RUN (double, int64_t, 3)
66 RUN (double, int64_t, 4)
67 RUN (double, int64_t, 7)
68 RUN (double, int64_t, 99)
69 RUN (double, int64_t, 119)
70 RUN (double, int64_t, 128)
71 RUN (double, int64_t, 256)
72 RUN (double, int64_t, 279)
73 RUN (double, int64_t, 555)
74 RUN (double, int64_t, 1024)
75 RUN (double, int64_t, 1389)
76 RUN (double, int64_t, 2048)
77 RUN (double, int64_t, 3989)
78 RUN (double, int64_t, 4096)
79 RUN (double, int64_t, 5975)
80
81 RUN2 (double, uint64_t, 3)
82 RUN2 (double, uint64_t, 4)
83 RUN2 (double, uint64_t, 7)
84 RUN2 (double, uint64_t, 99)
85 RUN2 (double, uint64_t, 119)
86 RUN2 (double, uint64_t, 128)
87 RUN2 (double, uint64_t, 256)
88 RUN2 (double, uint64_t, 279)
89 RUN2 (double, uint64_t, 555)
90 RUN2 (double, uint64_t, 1024)
91 RUN2 (double, uint64_t, 1389)
92 RUN2 (double, uint64_t, 2048)
93 RUN2 (double, uint64_t, 3989)
94 RUN2 (double, uint64_t, 4096)
95 RUN2 (double, uint64_t, 5975)
96 }