blob: f0d7439d40e2287a6dfa1f7fc86ac2b35fb04105 [file] [log] [blame]
Gian Marco58c57942017-11-28 09:10:03 +00001/*
2 * Copyright (c) 2017 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#ifndef __ARM_COMPUTE_NEASYMM_H__
25#define __ARM_COMPUTE_NEASYMM_H__
26
27#include <arm_neon.h>
28
29namespace arm_compute
30{
Michel Iwaniec5dfeae62017-11-29 10:48:23 +000031using qasymm8x8_t = uint8x8_t; /**< 8 bit quantized asymmetric vector with 8 elements */
32using qasymm8x8x2_t = uint8x8x2_t; /**< 8 bit quantized asymmetric vector with 16 elements */
33using qasymm8x8x3_t = uint8x8x3_t; /**< 8 bit quantized asymmetric vector with 24 elements */
34using qasymm8x8x4_t = uint8x8x4_t; /**< 8 bit quantized asymmetric vector with 32 elements */
35using qasymm8x16_t = uint8x16_t; /**< 8 bit quantized asymmetric vector with 16 elements */
36
Gian Marco58c57942017-11-28 09:10:03 +000037/** Round to the nearest division by a power-of-two using exponent
38 *
39 * @note This function calculates the following expression: (x + 2^n -1 ) / 2^n where n = exponent
40 *
41 * @param[in] x Vector of 4 elements
42 * @param[in] exponent Integer value used to round to nearest division by a power-of-two
43 *
44 * @return the nearest division by a power-of-two using exponent
45 */
46int32x4_t rounding_divide_by_pow2(int32x4_t x, int exponent);
Michel Iwaniec5dfeae62017-11-29 10:48:23 +000047
48/** Perform a multiply-accumulate on all 16 components of a QASYMM8 vector
49 *
50 * vd*vs + vo
51 *
52 * @param[in] vd Input vector value in QASYMM8 format
53 * @param[in] vs Vector multiplier in F32 format. The multiplier value must be duplicated across all four lanes.
54 * @param[in] vo Vector addend in F32 format. The addend value must be duplicated across all four lanes.
55 *
56 * @return A 16-component vector in QASYMM8 format, saturated to fit
57 */
58uint8x16_t vmlaq_qasymm8(qasymm8x16_t vd, float32x4_t vs, float32x4_t vo);
Gian Marco58c57942017-11-28 09:10:03 +000059} // namespace arm_compute
60#include "arm_compute/core/NEON/NEAsymm.inl"
Michel Iwaniec5dfeae62017-11-29 10:48:23 +000061#endif // __ARM_COMPUTE_NEASYMM_H__