Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-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 "vfncvt-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 src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 8.947289; \
11 vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
12 for (int i = 0; i < NUM; i++) \
13 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
14 __builtin_abort ();
15
16 #define RUN2(TYPE1, TYPE2, NUM) \
17 TYPE1 src##TYPE1##TYPE2##NUM[NUM]; \
18 TYPE2 dst##TYPE1##TYPE2##NUM[NUM]; \
19 for (int i = 0; i < NUM; i++) \
20 src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 8.947289; \
21 vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
22 for (int i = 0; i < NUM; i++) \
23 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
24 __builtin_abort ();
25
26 int
27 main ()
28 {
29 RUN (_Float16, int8_t, 3)
30 RUN (_Float16, int8_t, 4)
31 RUN (_Float16, int8_t, 13)
32 RUN (_Float16, int8_t, 29)
33
34 RUN2 (_Float16, uint8_t, 1)
35 RUN2 (_Float16, uint8_t, 8)
36 RUN2 (_Float16, uint8_t, 21)
37 RUN2 (_Float16, uint8_t, 33)
38 }