Debian Codegraph @

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