summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/riscv/rvv/base/merge_constraint-1.c
blob: 380d67fab53203372eed007600e0c6dce0770ff2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/* { dg-do compile } */
/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */

#include "riscv_vector.h"

void f (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vmv_v_v_i8mf4 (v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f2 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vmv_v_x_i8mf4_tu (v, 3, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f3 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vint8mf4_t v2 = __riscv_vle8_v_i8mf4 (base1 + 100, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vmerge_vvm_i8mf4 (v, v2, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f4 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vmerge_vxm_i8mf4 (v, 3, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f5 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vmerge_vxm_i8mf4 (v, 100, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f6 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vuint8mf4_t v = __riscv_vle8_v_u8mf4 (base1 + 100, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vluxei8_v_u8mf4 (base2, v, 32);
    v = __riscv_vle8_v_u8mf4_tu (v, base2 + 200, 32);
  }
  __riscv_vse8_v_u8mf4 (out, v, 32);
}

void f7 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vadd_vv_i8mf4 (v, v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f8 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vadd_vv_i8mf4 (v, v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f9 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vsll_vx_i8mf4 (v, 101, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f10 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vor_vx_i8mf4 (v, 101, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f11 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vadc_vvm_i8mf4 (v, v, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f12 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vsbc_vvm_i8mf4 (v, v, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f13 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vadc_vxm_i8mf4 (v, 100, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f14 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  vbool32_t m = __riscv_vlm_v_b32 (base1 + 200, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vsbc_vxm_i8mf4 (v, 100, m, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f15 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vneg_v_i8mf4 (v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f16 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vsadd_vv_i8mf4 (v, v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f17 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vsadd_vx_i8mf4 (v, 100, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f18 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vaadd_vv_i8mf4 (v, v, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

void f19 (int8_t* base1,int8_t* base2,int8_t* out,int n)
{
  vint8mf4_t v = __riscv_vle8_v_i8mf4 (base1, 32);
  for (int i = 0; i < n; i++){
    v = __riscv_vaadd_vx_i8mf4 (v, 100, 32);
    v = __riscv_vle8_v_i8mf4_tu (v, base2, 32);
  }
  __riscv_vse8_v_i8mf4 (out, v, 32);
}

/* { dg-final { scan-assembler-not {vmv1r} } } */