From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <viktorin@rehivetech.com>
Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16])
 by dpdk.org (Postfix) with ESMTP id 3636A8DA1
 for <dev@dpdk.org>; Fri, 30 Oct 2015 01:27:35 +0100 (CET)
Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz
 [147.229.13.147])
 by wes1-so2.wedos.net (Postfix) with ESMTPSA id 3nn4GZ6cB0zBkl;
 Fri, 30 Oct 2015 01:27:34 +0100 (CET)
From: Jan Viktorin <viktorin@rehivetech.com>
To: david.marchand@6wind.com, David Hunt <david.hunt@intel.com>,
 Thomas Monjalon <thomas.monjalon@6wind.com>
Date: Fri, 30 Oct 2015 01:25:35 +0100
Message-Id: <1446164742-29546-9-git-send-email-viktorin@rehivetech.com>
X-Mailer: git-send-email 2.6.1
In-Reply-To: <1446164742-29546-1-git-send-email-viktorin@rehivetech.com>
References: <5289220.BuGOiUSaJq@xps13>
 <1446164742-29546-1-git-send-email-viktorin@rehivetech.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v5 08/15] eal/arm: use vector memcpy only when
	NEON is enabled
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Oct 2015 00:27:35 -0000

The GCC can be configured to avoid using NEON extensions.
For that purpose, we provide just the memcpy implementation
of the rte_memcpy.

Based on the patch by David Hunt and Armuta Zende:

  lib: added support for armv7 architecture

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Amruta Zende <amruta.zende@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
v5: prepare for applying ARMv8
---
 .../common/include/arch/arm/rte_memcpy_32.h        | 59 +++++++++++++++++++++-
 1 file changed, 57 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h b/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
index 11f8241..df47c0d 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
@@ -35,8 +35,6 @@
 
 #include <stdint.h>
 #include <string.h>
-/* ARM NEON Intrinsics are used to copy data */
-#include <arm_neon.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -44,6 +42,11 @@ extern "C" {
 
 #include "generic/rte_memcpy.h"
 
+#ifdef __ARM_NEON_FP
+
+/* ARM NEON Intrinsics are used to copy data */
+#include <arm_neon.h>
+
 static inline void
 rte_mov16(uint8_t *dst, const uint8_t *src)
 {
@@ -272,6 +275,58 @@ rte_memcpy_func(void *dst, const void *src, size_t n)
 	return ret;
 }
 
+#else
+
+static inline void
+rte_mov16(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 16);
+}
+
+static inline void
+rte_mov32(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 32);
+}
+
+static inline void
+rte_mov48(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 48);
+}
+
+static inline void
+rte_mov64(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 64);
+}
+
+static inline void
+rte_mov128(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 128);
+}
+
+static inline void
+rte_mov256(uint8_t *dst, const uint8_t *src)
+{
+	memcpy(dst, src, 256);
+}
+
+static inline void *
+rte_memcpy(void *dst, const void *src, size_t n)
+{
+	return memcpy(dst, src, n);
+}
+
+static inline void *
+rte_memcpy_func(void *dst, const void *src, size_t n)
+{
+	return memcpy(dst, src, n);
+}
+
+#endif /* __ARM_NEON_FP */
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.6.1