blob: 3b89f940459ec9b5010fe9de5599389e73b8e0d5 [file] [log] [blame]
Cindy Liub4929142023-10-20 11:36:04 -07001/*
2 * Copyright 2023 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Henry Herman4112b6f2021-08-13 20:50:37 +000017#ifndef SOFTRVV_VSUB_H
18#define SOFTRVV_VSUB_H
19
20#include <stddef.h>
21
22namespace softrvv {
23
24template <typename T>
25void vsub_vx(T *dest, T *src1, const T *src2, int32_t avl) {
26 for (int idx = 0; idx < avl; idx++) {
27 dest[idx] = src1[idx] - *src2;
28 }
29}
30
31template <typename T>
32void vsub_vv(T *dest, T *src1, T *src2, int32_t avl) {
33 for (int32_t idx = 0; idx < avl; idx++) {
34 dest[idx] = src1[idx] - src2[idx];
35 }
36}
37
38template <typename T>
39void vrsub_vx(T *dest, T *src1, const T *src2, int32_t avl) {
40 for (int32_t idx = 0; idx < avl; idx++) {
41 dest[idx] = *src2 - src1[idx];
42 }
43}
44
45} // namespace softrvv
46
47#endif // SOFTRVV_VSUB_H