aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-04-17 09:38:11 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-04-17 10:54:34 +0000
commit98f7f0a873514604e2cf0433ea06f1705b023b60 (patch)
tree5c364ca0ae6353b5e048290bcfca601f72811c9c /src
parentb42d27ad4825ae44ff81b83b6170523d8739cb43 (diff)
build: add scalar (no-simd) march variant
for testing purposes, disabled by default Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com> Change-Id: Id616e2b3b21ae0f0b44e2b55ecefd501afacc7f2
Diffstat (limited to 'src')
-rw-r--r--src/cmake/cpu.cmake5
-rw-r--r--src/vppinfra/cpu.h7
-rw-r--r--src/vppinfra/memcpy_x86_64.h7
-rw-r--r--src/vppinfra/test/memcpy_x86_64.c2
4 files changed, 18 insertions, 3 deletions
diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake
index c10158b4ab9..031a9bcfe93 100644
--- a/src/cmake/cpu.cmake
+++ b/src/cmake/cpu.cmake
@@ -131,6 +131,11 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
OFF
)
+ add_vpp_march_variant(scalar
+ FLAGS -march=core2 -mno-mmx -mno-sse
+ OFF
+ )
+
if (GNU_ASSEMBLER_AVX512_BUG)
message(WARNING "AVX-512 multiarch variant(s) disabled due to GNU Assembler bug")
else()
diff --git a/src/vppinfra/cpu.h b/src/vppinfra/cpu.h
index a30401ab371..60439e0e3ca 100644
--- a/src/vppinfra/cpu.h
+++ b/src/vppinfra/cpu.h
@@ -21,6 +21,7 @@
#if defined(__x86_64__)
#define foreach_march_variant \
+ _ (scalar, "Generic (SIMD disabled)") \
_ (hsw, "Intel Haswell") \
_ (trm, "Intel Tremont") \
_ (skx, "Intel Skylake (server) / Cascade Lake") \
@@ -242,6 +243,12 @@ clib_cpu_supports_aes ()
}
static inline int
+clib_cpu_march_priority_scalar ()
+{
+ return 1;
+}
+
+static inline int
clib_cpu_march_priority_spr ()
{
if (clib_cpu_supports_enqcmd ())
diff --git a/src/vppinfra/memcpy_x86_64.h b/src/vppinfra/memcpy_x86_64.h
index e206c69c997..39258f19748 100644
--- a/src/vppinfra/memcpy_x86_64.h
+++ b/src/vppinfra/memcpy_x86_64.h
@@ -38,13 +38,16 @@ clib_memcpy8 (void *d, void *s)
*(u64u *) d = *(u64u *) s;
}
-#ifdef CLIB_HAVE_VEC128
static_always_inline void
clib_memcpy16 (void *d, void *s)
{
+#ifdef CLIB_HAVE_VEC128
*(u8x16u *) d = *(u8x16u *) s;
-}
+#else
+ clib_memcpy8 (d, s);
+ clib_memcpy8 (d + 8, s + 8);
#endif
+}
#ifdef CLIB_HAVE_VEC256
static_always_inline void
diff --git a/src/vppinfra/test/memcpy_x86_64.c b/src/vppinfra/test/memcpy_x86_64.c
index 4d9525d5222..9b93bb1cd90 100644
--- a/src/vppinfra/test/memcpy_x86_64.c
+++ b/src/vppinfra/test/memcpy_x86_64.c
@@ -6,7 +6,7 @@
#include <vppinfra/format.h>
#include <vppinfra/test/test.h>
-#include <vppinfra/vector/mask_compare.h>
+#include <vppinfra/memcpy_x86_64.h>
__test_funct_fn void
wrapper (u8 *dst, u8 *src, uword n)
>
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __LISP_CP_DPO_H__
#define __LISP_CP_DPO_H__

#include <vnet/vnet.h>
#include <vnet/dpo/dpo.h>

/**
 * A representation of punt to the LISP control plane.
 */
typedef struct lisp_cp_dpo_t
{
  /**
   * The transport payload type.
   */
  dpo_proto_t lcd_proto;
} lisp_cp_dpo_t;

extern const dpo_id_t *lisp_cp_dpo_get (dpo_proto_t proto);

extern void lisp_cp_dpo_module_init (void);

#endif

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */