xref: /aosp_15_r20/external/ComputeLibrary/src/cpu/kernels/select/generic/neon/integer.cpp (revision c217d954acce2dbc11938adb493fc0abd69584f3)
1 /*
2  * Copyright (c) 2022 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "arm_compute/core/Helpers.h"
25 #include "arm_compute/core/TensorInfo.h"
26 #include "arm_compute/core/Types.h"
27 
28 #include <arm_neon.h>
29 
30 #include "src/cpu/kernels/select/generic/neon/impl.h"
31 
32 namespace arm_compute
33 {
34 namespace cpu
35 {
neon_s8_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)36 void neon_s8_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
37 {
38     return select_op_8<int8_t, uint8x16_t>(c, x, y, output, window);
39 }
neon_s16_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)40 void neon_s16_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
41 {
42     return select_op_16<int16_t, uint16x8_t>(c, x, y, output, window);
43 }
neon_s32_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)44 void neon_s32_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
45 {
46     return select_op_32<int32_t, uint32x4_t>(c, x, y, output, window);
47 }
neon_s8_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)48 void neon_s8_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
49 {
50     return select_op_not_same_rank<int8_t>(c, x, y, output, window);
51 }
neon_s16_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)52 void neon_s16_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
53 {
54     return select_op_not_same_rank<int16_t>(c, x, y, output, window);
55 }
neon_s32_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)56 void neon_s32_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
57 {
58     return select_op_not_same_rank<int32_t>(c, x, y, output, window);
59 }
neon_u8_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)60 void neon_u8_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
61 {
62     return select_op_8<uint8_t, uint8x16_t>(c, x, y, output, window);
63 }
neon_u16_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)64 void neon_u16_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
65 {
66     return select_op_16<uint16_t, uint16x8_t>(c, x, y, output, window);
67 }
neon_u32_select_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)68 void neon_u32_select_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
69 {
70     return select_op_32<uint32_t, uint32x4_t>(c, x, y, output, window);
71 }
neon_u8_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)72 void neon_u8_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
73 {
74     return select_op_not_same_rank<uint8_t>(c, x, y, output, window);
75 }
neon_u16_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)76 void neon_u16_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
77 {
78     return select_op_not_same_rank<uint16_t>(c, x, y, output, window);
79 }
neon_u32_select_not_same_rank(const ITensor * c,const ITensor * x,const ITensor * y,ITensor * output,const Window & window)80 void neon_u32_select_not_same_rank(const ITensor *c, const ITensor *x, const ITensor *y, ITensor *output, const Window &window)
81 {
82     return select_op_not_same_rank<uint32_t>(c, x, y, output, window);
83 }
84 
85 } // namespace cpu
86 
87 } // namespace arm_compute
88