Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gc -mabi=lp64 -O3 -fno-schedule-insns -fno-schedule-insns2" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 /*
6 ** test_1:
7 ** ...
8 ** sext\.w\s+[atx][0-9]+,\s*[atx][0-9]+
9 ** ...
10 */
11 void
12 test_1 (int *a, int *b, int *out, unsigned count)
13 {
14 unsigned i;
15
16 count = count > 128 ? 128 : count;
17
18 for (i = 0; i < count; i++)
19 out[i] = a[i] + b[i];
20 }
21
22 /*
23 ** test_2:
24 ** ...
25 ** vadd\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
26 ** ...
27 */
28 void
29 __attribute__((target("arch=+v")))
30 test_2 (int *a, int *b, int *out, unsigned count)
31 {
32 unsigned i;
33
34 count = count > 128 ? 128 : count;
35
36 for (i = 0; i < count; i++)
37 out[i] = a[i] + b[i];
38 }
39
40 /*
41 ** test_3:
42 ** ...
43 ** minu\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+
44 ** ...
45 */
46 void
47 __attribute__((target("arch=+zbb")))
48 test_3 (int *a, int *b, int *out, unsigned count)
49 {
50 unsigned i;
51
52 count = count > 128 ? 128 : count;
53
54 for (i = 0; i < count; i++)
55 out[i] = a[i] + b[i];
56 }
57
58 /*
59 ** test_4:
60 ** ...
61 ** sext\.w\s+[atx][0-9]+,\s*[atx][0-9]+
62 ** ...
63 */
64 void
65 test_4 (int *a, int *b, int *out, unsigned count)
66 {
67 unsigned i;
68
69 count = count > 128 ? 128 : count;
70
71 for (i = 0; i < count; i++)
72 out[i] = a[i] + b[i];
73 }
74
75 /*
76 ** test_5:
77 ** ...
78 ** fadd\.h\s+fa[0-9]+,\s*fa[0-9]+,\s*fa[0-9]+
79 ** ...
80 */
81 void
82 __attribute__((target("arch=+zfh")))
83 test_5 (_Float16 *a, _Float16 *b, _Float16 *out, unsigned count)
84 {
85 unsigned i;
86
87 count = count > 128 ? 128 : count;
88
89 for (i = 0; i < count; i++)
90 out[i] = a[i] + b[i];
91 }
92
93 /*
94 ** test_6:
95 ** ...
96 ** call\s+__extendhfsf2(?:@plt)?
97 ** ...
98 ** call\s+__truncsfhf2(?:@plt)?
99 ** ...
100 */
101 void
102 test_6 (_Float16 *a, _Float16 *b, _Float16 *out, unsigned count)
103 {
104 unsigned i;
105
106 count = count > 128 ? 128 : count;
107
108 for (i = 0; i < count; i++)
109 out[i] = a[i] + b[i];
110 }
111
112 /* { dg-final { scan-assembler ".attribute arch, \"rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0\"" } } */
113 /* { dg-final { scan-assembler ".option arch, rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_v1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0" } } */
114 /* { dg-final { scan-assembler ".option arch, rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zbb1p0" } } */
115 /* { dg-final { scan-assembler ".option arch, rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zfh1p0_zfhmin1p0_zca1p0_zcd1p0" } } */