New upstream version 18.02
[deb_dpdk.git] / lib / librte_eal / common / arch / x86 / rte_memcpy.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2017 Intel Corporation
3  */
4
5 #include <rte_memcpy.h>
6 #include <rte_cpuflags.h>
7 #include <rte_log.h>
8
9 void *(*rte_memcpy_ptr)(void *dst, const void *src, size_t n) = NULL;
10
11 RTE_INIT(rte_memcpy_init)
12 {
13 #ifdef CC_SUPPORT_AVX512F
14         if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) {
15                 rte_memcpy_ptr = rte_memcpy_avx512f;
16                 RTE_LOG(DEBUG, EAL, "AVX512 memcpy is using!\n");
17                 return;
18         }
19 #endif
20 #ifdef CC_SUPPORT_AVX2
21         if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) {
22                 rte_memcpy_ptr = rte_memcpy_avx2;
23                 RTE_LOG(DEBUG, EAL, "AVX2 memcpy is using!\n");
24                 return;
25         }
26 #endif
27         rte_memcpy_ptr = rte_memcpy_sse;
28         RTE_LOG(DEBUG, EAL, "Default SSE/AVX memcpy is using!\n");
29 }