2019-04-26 12:27:38 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2013-2019 Software Radio Systems Limited
|
2015-10-11 12:37:12 -07:00
|
|
|
*
|
2019-04-26 12:27:38 -07:00
|
|
|
* This file is part of srsLTE.
|
2015-10-11 12:37:12 -07:00
|
|
|
*
|
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#ifndef SRSLTE_VECTOR_SIMD_H
|
|
|
|
#define SRSLTE_VECTOR_SIMD_H
|
2015-10-11 12:37:12 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "srslte/config.h"
|
2019-12-16 07:04:22 -08:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
2015-10-11 12:37:12 -07:00
|
|
|
|
2017-09-25 04:19:34 -07:00
|
|
|
#ifdef LV_HAVE_AVX512
|
2017-09-28 02:04:26 -07:00
|
|
|
#define SRSLTE_SIMD_BIT_ALIGN 512
|
2019-12-16 07:04:22 -08:00
|
|
|
#define SRSLTE_IS_ALIGNED(PTR) (((size_t)(PTR)&0x3F) == 0)
|
2017-09-25 04:19:34 -07:00
|
|
|
#else /* LV_HAVE_AVX512 */
|
|
|
|
#ifdef LV_HAVE_AVX
|
2017-09-28 02:04:26 -07:00
|
|
|
#define SRSLTE_SIMD_BIT_ALIGN 256
|
2019-12-16 07:04:22 -08:00
|
|
|
#define SRSLTE_IS_ALIGNED(PTR) (((size_t)(PTR)&0x1F) == 0)
|
2017-09-25 04:19:34 -07:00
|
|
|
#else /* LV_HAVE_AVX */
|
|
|
|
#ifdef LV_HAVE_SSE
|
2017-09-28 02:04:26 -07:00
|
|
|
#define SRSLTE_SIMD_BIT_ALIGN 128
|
2019-12-16 07:04:22 -08:00
|
|
|
#define SRSLTE_IS_ALIGNED(PTR) (((size_t)(PTR)&0x0F) == 0)
|
2017-09-25 04:19:34 -07:00
|
|
|
#else /* LV_HAVE_SSE */
|
2017-09-28 02:04:26 -07:00
|
|
|
#define SRSLTE_SIMD_BIT_ALIGN 64
|
2017-09-25 08:08:11 -07:00
|
|
|
#define SRSLTE_IS_ALIGNED(PTR) (1)
|
2017-09-25 04:19:34 -07:00
|
|
|
#endif /* LV_HAVE_SSE */
|
|
|
|
#endif /* LV_HAVE_AVX */
|
|
|
|
#endif /* LV_HAVE_AVX512 */
|
|
|
|
|
2017-11-27 03:10:50 -08:00
|
|
|
/*SIMD Logical operations*/
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_xor_bbb_simd(const int8_t* x, const int8_t* y, int8_t* z, int len);
|
2017-11-27 03:10:50 -08:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Basic vector math */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sum_sss_simd(const int16_t* x, const int16_t* y, int16_t* z, int len);
|
2017-09-25 04:19:34 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sub_sss_simd(const int16_t* x, const int16_t* y, int16_t* z, int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sub_bbb_simd(const int8_t* x, const int8_t* y, int8_t* z, int len);
|
2018-09-04 08:51:35 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API float srslte_vec_acc_ff_simd(const float* x, int len);
|
2015-10-11 12:37:12 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API cf_t srslte_vec_acc_cc_simd(const cf_t* x, int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_add_fff_simd(const float* x, const float* y, float* z, int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sub_fff_simd(const float* x, const float* y, float* z, int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Vector Scalar Product */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sc_prod_cfc_simd(const cf_t* x, const float h, cf_t* y, const int len);
|
2017-09-28 02:04:26 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sc_prod_fff_simd(const float* x, const float h, float* z, const int len);
|
2015-10-11 12:37:12 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_sc_prod_ccc_simd(const cf_t* x, const cf_t h, cf_t* z, const int len);
|
2017-07-07 09:44:17 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Vector Product */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_ccc_split_simd(const float* a_re,
|
|
|
|
const float* a_im,
|
|
|
|
const float* b_re,
|
|
|
|
const float* b_im,
|
|
|
|
float* r_re,
|
|
|
|
float* r_im,
|
|
|
|
const int len);
|
2017-09-28 02:04:26 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_ccc_c16_simd(const int16_t* a_re,
|
|
|
|
const int16_t* a_im,
|
|
|
|
const int16_t* b_re,
|
|
|
|
const int16_t* b_im,
|
|
|
|
int16_t* r_re,
|
|
|
|
int16_t* r_im,
|
|
|
|
const int len);
|
2017-09-28 02:04:26 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_sss_simd(const int16_t* x, const int16_t* y, int16_t* z, const int len);
|
2017-09-28 02:04:26 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_neg_sss_simd(const int16_t* x, const int16_t* y, int16_t* z, const int len);
|
2018-09-04 08:51:35 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_neg_bbb_simd(const int8_t* x, const int8_t* y, int8_t* z, const int len);
|
2018-09-04 08:51:35 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_cfc_simd(const cf_t* x, const float* y, cf_t* z, const int len);
|
2017-09-28 02:04:26 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_fff_simd(const float* x, const float* y, float* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_ccc_simd(const cf_t* x, const cf_t* y, cf_t* z, const int len);
|
2017-07-07 09:44:17 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_prod_conj_ccc_simd(const cf_t* x, const cf_t* y, cf_t* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Division */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_div_ccc_simd(const cf_t* x, const cf_t* y, cf_t* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_div_cfc_simd(const cf_t* x, const float* y, cf_t* z, const int len);
|
2015-10-12 11:12:48 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_div_fff_simd(const float* x, const float* y, float* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Dot product */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API cf_t srslte_vec_dot_prod_conj_ccc_simd(const cf_t* x, const cf_t* y, const int len);
|
2015-10-12 11:12:48 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API cf_t srslte_vec_dot_prod_ccc_simd(const cf_t* x, const cf_t* y, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2018-01-31 01:44:52 -08:00
|
|
|
#ifdef ENABLE_C16
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API c16_t srslte_vec_dot_prod_ccc_c16i_simd(const c16_t* x, const c16_t* y, const int len);
|
2018-01-31 01:44:52 -08:00
|
|
|
#endif /* ENABLE_C16 */
|
2017-09-25 04:19:34 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API int srslte_vec_dot_prod_sss_simd(const int16_t* x, const int16_t* y, const int len);
|
2015-10-11 12:37:12 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Modulus functions */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_abs_cf_simd(const cf_t* x, float* z, const int len);
|
2017-09-25 04:19:34 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_abs_square_cf_simd(const cf_t* x, float* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* Other Functions */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_lut_sss_simd(const short* x, const unsigned short* lut, short* y, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_lut_bbb_simd(const int8_t* x, const unsigned short* lut, int8_t* y, const int len);
|
2018-09-04 08:51:35 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_convert_if_simd(const int16_t* x, float* z, const float scale, const int len);
|
2018-02-21 05:50:41 -08:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_convert_fi_simd(const float* x, int16_t* z, const float scale, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_convert_fb_simd(const float* x, int8_t* z, const float scale, const int len);
|
2018-09-04 08:51:35 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_cp_simd(const cf_t* src, cf_t* dst, int len);
|
2017-07-07 07:34:05 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_interleave_simd(const cf_t* x, const cf_t* y, cf_t* z, const int len);
|
2018-01-08 03:04:39 -08:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_interleave_add_simd(const cf_t* x, const cf_t* y, cf_t* z, const int len);
|
2017-05-18 05:47:40 -07:00
|
|
|
|
2019-04-24 11:04:47 -07:00
|
|
|
SRSLTE_API void srslte_vec_gen_sine_simd(cf_t amplitude, float freq, cf_t* z, int len);
|
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_vec_apply_cfo_simd(const cf_t* x, float cfo, cf_t* z, int len);
|
2018-05-25 07:05:59 -07:00
|
|
|
|
2019-04-12 08:21:24 -07:00
|
|
|
SRSLTE_API float srslte_vec_estimate_frequency_simd(const cf_t* x, int len);
|
2018-05-25 07:05:59 -07:00
|
|
|
|
2017-09-28 02:04:26 -07:00
|
|
|
/* SIMD Find Max functions */
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API uint32_t srslte_vec_max_fi_simd(const float* x, const int len);
|
2017-09-25 04:19:34 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API uint32_t srslte_vec_max_abs_fi_simd(const float* x, const int len);
|
2018-06-27 08:01:37 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API uint32_t srslte_vec_max_ci_simd(const cf_t* x, const int len);
|
2017-07-07 07:34:05 -07:00
|
|
|
|
2015-10-11 12:37:12 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#endif // SRSLTE_VECTOR_SIMD_H
|