Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/zvfhmin-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv_zvfhmin -mabi=ilp32d -mrvv-vector-bits=scalable -ffast-math -fdump-rtl-final" } */
3
4 #include <stdint-gcc.h>
5
6 void f0 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
7 {
8 for (int i = 0; i < n; i++)
9 a[i] = -b[i];
10 }
11
12 void f1 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
13 {
14 for (int i = 0; i < n; i++)
15 a[i] = a[i]+b[i];
16 }
17
18 void f2 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
19 {
20 for (int i = 0; i < n; i++)
21 a[i] = a[i]-b[i];
22 }
23
24 void f3 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
25 {
26 for (int i = 0; i < n; i++)
27 a[i] = a[i]*b[i];
28 }
29
30 void f4 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
31 {
32 for (int i = 0; i < n; i++)
33 a[i] = a[i]/b[i];
34 }
35
36 void f6 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
37 {
38 for (int i = 0; i < n; i++)
39 a[i] = __builtin_fabs (b[i]);
40 }
41
42 void f7 (_Float16 * __restrict a, _Float16 * __restrict b, int n)
43 {
44 for (int i = 0; i < n; i++)
45 a[i] = __builtin_sqrtf16 (b[i]);
46 }
47
48 void f8 (_Float16 * __restrict a, int16_t * __restrict b, int n)
49 {
50 for (int i = 0; i < n; i++)
51 a[i] = (_Float16) (b[i]);
52 }
53
54 void f9 (_Float16 * __restrict a, uint16_t * __restrict b, int n)
55 {
56 for (int i = 0; i < n; i++)
57 a[i] = (_Float16) (b[i]);
58 }
59
60 void f10 (int16_t * __restrict a, _Float16 * __restrict b, int n)
61 {
62 for (int i = 0; i < n; i++)
63 a[i] = (int16_t) (b[i]);
64 }
65
66 void f11 (uint16_t * __restrict a, _Float16 * __restrict b, int n)
67 {
68 for (int i = 0; i < n; i++)
69 a[i] = (uint16_t) (b[i]);
70 }
71
72 /* We can't enable FP16 NEG/PLUS/MINUS/MULT/DIV/ABS/SQRTF as well as int/float
73 conversion auto-vectorization when -march="*zvfhmin*" because the min
74 variant of the extension only provides loads, stores and conversions.
75 As we might still vectorize after promotion to float, we need to make
76 sure that no vector operations with an HFmode are being generated. */
77 /* { dg-final { scan-rtl-dump-not "plus:VNx\[0-9\]+HF" "final" } } */
78 /* { dg-final { scan-rtl-dump-not "minus:VNx\[0-9\]+HF" "final" } } */
79 /* { dg-final { scan-rtl-dump-not "mult:VNx\[0-9\]+HF" "final" } } */
80 /* { dg-final { scan-rtl-dump-not "div:VNx\[0-9\]+HF" "final" } } */
81 /* { dg-final { scan-rtl-dump-not "neg:VNx\[0-9\]+HF" "final" } } */
82 /* { dg-final { scan-rtl-dump-not "abs:VNx\[0-9\]+HF" "final" } } */
83 /* { dg-final { scan-rtl-dump-not "sqrt:VNx\[0-9\]+HF" "final" } } */
84 /* { dg-final { scan-rtl-dump-not "float:VNx\[0-9\]+HF" "final" } } */
85 /* { dg-final { scan-rtl-dump-not "fix:VNx\[0-9\]+HI\s*.+reg:VNx\[0-9\]+HF" "final" } } */