By adding compiler default flags for vector instructions to
cgcc we'll be able to check the same sources that we're building.
Also, this will allow to avoid re-defining these flags and
types specifically for "sparse" includes.

"sparse" headers "bmi2intrin.h" and "emmintrin.h" dropped as
not needed anymore.

Signed-off-by: Ilya Maximets <[email protected]>
---
 acinclude.m4                | 10 ++++++++++
 include/sparse/automake.mk  |  2 --
 include/sparse/bmi2intrin.h | 25 -------------------------
 include/sparse/emmintrin.h  | 27 ---------------------------
 4 files changed, 10 insertions(+), 54 deletions(-)
 delete mode 100644 include/sparse/bmi2intrin.h
 delete mode 100644 include/sparse/emmintrin.h

diff --git a/acinclude.m4 b/acinclude.m4
index cf9cc8b8b..08686044f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1140,6 +1140,16 @@ AC_DEFUN([OVS_CHECK_SPARSE_TARGET],
      [x86], [SPARSEFLAGS= CGCCFLAGS="-target=i86 -target=host_os_specs"],
      [x86_64], [SPARSEFLAGS=-m64 CGCCFLAGS="-target=x86_64 
-target=host_os_specs"],
      [SPARSEFLAGS= CGCCFLAGS=])
+
+   dnl Get the the default defines for vector instructions from compiler to
+   dnl allow "sparse" correctly check the same code that will be built.
+   dnl Required for checking DPDK headers.
+   AC_MSG_CHECKING([vector options for cgcc])
+   VECTOR=$($CC -dM -E - < /dev/null | grep -E "MMX|SSE|AVX" | \
+            cut -c 9- | sed 's/ /=/' | sed 's/^/-D/' | tr '\n' ' ')
+   AC_MSG_RESULT([$VECTOR])
+   CGCCFLAGS="$CGCCFLAGS $VECTOR"
+
    AC_SUBST([SPARSEFLAGS])
    AC_SUBST([CGCCFLAGS])])
 
diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk
index 8d96d0346..274d52577 100644
--- a/include/sparse/automake.mk
+++ b/include/sparse/automake.mk
@@ -11,8 +11,6 @@ noinst_HEADERS += \
         include/sparse/arpa/inet.h \
         include/sparse/bits/floatn.h \
         include/sparse/assert.h \
-        include/sparse/bmi2intrin.h \
-        include/sparse/emmintrin.h \
         include/sparse/math.h \
         include/sparse/netinet/in.h \
         include/sparse/netinet/ip6.h \
diff --git a/include/sparse/bmi2intrin.h b/include/sparse/bmi2intrin.h
deleted file mode 100644
index 3ee37bb72..000000000
--- a/include/sparse/bmi2intrin.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2015 Nicira, Inc.
- *
- * 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 __CHECKER__
-#error "Use this header only with sparse.  It is not a correct implementation."
-#endif
-
-/* Sparse doesn't know the __int128 type used by GCC 4.9 *intrin.h headers.
- * We cannot use a typedef because the type is used with a qualifier
- * ('unsigned __int128') */
-#define __int128 int
-#include_next <bmi2intrin.h>
-#undef __int128
diff --git a/include/sparse/emmintrin.h b/include/sparse/emmintrin.h
deleted file mode 100644
index 3810f55a2..000000000
--- a/include/sparse/emmintrin.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (c) 2015 Nicira, Inc.
- *
- * 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 __CHECKER__
-#error "Use this header only with sparse.  It is not a correct implementation."
-#endif
-
-/* GCC 4.8 *intrin.h headers do not work if these are not defined */
-#define __SSE2__
-#define __SSE__
-#define __MMX__
-#include_next <emmintrin.h>
-#undef __MMX__
-#undef __SSE__
-#undef __SSE2__
-- 
2.17.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to