1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8 
9 #pragma once
10 
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include <xnnpack/params.h>
15 #include <xnnpack/common.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 
22 #define DECLARE_F16_CLAMP_UKERNEL_FUNCTION(fn_name)   \
23   XNN_INTERNAL void fn_name(                          \
24       size_t n,                                       \
25       const void* x,                                  \
26       void* y,                                        \
27       const struct xnn_f16_minmax_params* params);
28 
29 DECLARE_F16_CLAMP_UKERNEL_FUNCTION(xnn_f16_clamp_ukernel__neonfp16arith_x8)
30 DECLARE_F16_CLAMP_UKERNEL_FUNCTION(xnn_f16_clamp_ukernel__neonfp16arith_x16)
31 
32 #define DECLARE_F32_CLAMP_UKERNEL_FUNCTION(fn_name)   \
33   XNN_INTERNAL void fn_name(                          \
34       size_t n,                                       \
35       const float* x,                                 \
36       float* y,                                       \
37       const union xnn_f32_minmax_params* params);
38 
39 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__neon_x4)
40 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__neon_x8)
41 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__sse_x4)
42 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__sse_x8)
43 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__avx_x8)
44 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__avx_x16)
45 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__avx512f_x16)
46 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__avx512f_x32)
47 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasmsimd_arm_x4)
48 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasmsimd_arm_x8)
49 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasmsimd_x86_x4)
50 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasmsimd_x86_x8)
51 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasm_x1)
52 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasm_x2)
53 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__wasm_x4)
54 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__scalar_x1)
55 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__scalar_x2)
56 DECLARE_F32_CLAMP_UKERNEL_FUNCTION(xnn_f32_clamp_ukernel__scalar_x4)
57 
58 
59 #define DECLARE_U8_CLAMP_UKERNEL_FUNCTION(fn_name) \
60   XNN_INTERNAL void fn_name(                       \
61       size_t n,                                    \
62       const uint8_t* x,                            \
63       uint8_t* y,                                  \
64       const union xnn_u8_minmax_params* params);
65 
66 DECLARE_U8_CLAMP_UKERNEL_FUNCTION(xnn_u8_clamp_ukernel__neon_x64)
67 DECLARE_U8_CLAMP_UKERNEL_FUNCTION(xnn_u8_clamp_ukernel__sse2_x64)
68 DECLARE_U8_CLAMP_UKERNEL_FUNCTION(xnn_u8_clamp_ukernel__scalar_x4)
69 
70 
71 #ifdef __cplusplus
72 }  // extern "C"
73 #endif
74