summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Foster2011-03-22 16:55:07 -0700
committerNick Foster2011-03-22 16:55:07 -0700
commit258186d5ca2e811ced7ea637fd16e3ed3bb5573e (patch)
tree76aad59d056d6d276aa6f95d0c56dae3b99176e1
parentcef9e33e01e946d82564f517de501cafcb5b1f32 (diff)
downloadgnuradio-258186d5ca2e811ced7ea637fd16e3ed3bb5573e.tar.gz
gnuradio-258186d5ca2e811ced7ea637fd16e3ed3bb5573e.tar.bz2
gnuradio-258186d5ca2e811ced7ea637fd16e3ed3bb5573e.zip
Interim commit.
-rw-r--r--volk/include/volk/make_makefile_am.py140
-rw-r--r--volk/include/volk/make_set_simd.py13
-rw-r--r--volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a16.h4
-rw-r--r--volk/include/volk/volk_32fc_x2_dot_prod_32fc_a16.h4
-rw-r--r--volk/include/volk/volk_64u_popcnt_a16.h2
-rwxr-xr-xvolk/include/volk/volk_register.py43
6 files changed, 195 insertions, 11 deletions
diff --git a/volk/include/volk/make_makefile_am.py b/volk/include/volk/make_makefile_am.py
new file mode 100644
index 000000000..89ea1f4b6
--- /dev/null
+++ b/volk/include/volk/make_makefile_am.py
@@ -0,0 +1,140 @@
+#
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from xml.dom import minidom
+
+def make_makefile_am(dom, machines):
+ tempstring = r"""
+# This file is automatically generated by make_makefile_am.py.
+# Do not edit this file.
+
+include $(top_srcdir)/Makefile.common
+
+#FIXME: forcing the top_builddir for distcheck seems like a bit
+# of a hack. Figure out the right way to do this to find built
+# volk_config.h and volk_tables.h
+
+AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) \
+ -I$(top_builddir)/include \
+ $(WITH_INCLUDES)
+
+lib_LTLIBRARIES = \
+ libvolk.la \
+ libvolk_runtime.la
+
+EXTRA_DIST = \
+ volk_mktables.c \
+ volk_rank_archs.h \
+ volk_proccpu_sim.c \
+ gcc_x86_cpuid.h
+
+# ----------------------------------------------------------------
+# The main library
+# ----------------------------------------------------------------
+
+libvolk_runtime_la_SOURCES = \
+ $(platform_CODE) \
+ volk_runtime.c \
+ volk_rank_archs.c \
+ volk_cpu.c
+
+libvolk_la_SOURCES = \
+ $(platform_CODE) \
+ volk.c \
+ volk_environment_init.c
+
+volk_orc_LDFLAGS = \
+ $(ORC_LDFLAGS) \
+ -lorc-0.4
+
+volk_orc_LIBADD = \
+ ../orc/libvolk_orc.la
+
+"""
+
+ #here be dragons
+ for machine_name in machines:
+ tempstring += "if LV_MACHINE_" + machine_name.swapcase()
+ tempstring += "libvolk_" + machine_name + "_la_LDFLAGS = "
+
+
+ tempstring += """
+if LV_HAVE_ORC
+libvolk_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 $(volk_orc_LDFLAGS)
+libvolk_runtime_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 $(volk_orc_LDFLAGS)
+libvolk_la_LIBADD = $(volk_orc_LIBADD)
+else
+libvolk_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libvolk_runtime_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libvolk_la_LIBADD =
+endif
+
+
+# ----------------------------------------------------------------
+# The QA library. Note libvolk.la in LIBADD
+# ----------------------------------------------------------------
+#libvolk_qa_la_SOURCES = \
+# qa_utils.cc
+
+#libvolk_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 -lboost
+
+#libvolk_qa_la_LIBADD = \
+# libvolk.la \
+# libvolk_runtime.la
+
+# ----------------------------------------------------------------
+# headers that don't get installed
+# ----------------------------------------------------------------
+noinst_HEADERS = \
+ volk_init.h \
+ qa_utils.h
+
+# ----------------------------------------------------------------
+# Our test program
+# ----------------------------------------------------------------
+noinst_PROGRAMS = \
+ testqa
+
+testqa_SOURCES = testqa.cc qa_utils.cc
+testqa_CPPFLAGS = -DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN $(AM_CPPFLAGS)
+testqa_LDFLAGS = $(BOOST_UNIT_TEST_FRAMEWORK_LIB)
+if LV_HAVE_ORC
+testqa_LDADD = \
+ libvolk.la \
+ libvolk_runtime.la \
+ ../orc/libvolk_orc.la
+else
+testqa_LDADD = \
+ libvolk.la
+endif
+
+distclean-local:
+ rm -f volk.c
+ rm -f volk_cpu_generic.c
+ rm -f volk_cpu_powerpc.c
+ rm -f volk_cpu_x86.c
+ rm -f volk_init.c
+ rm -f volk_init.h
+ rm -f volk_mktables.c
+ rm -f volk_proccpu_sim.c
+ rm -f volk_runtime.c
+ rm -f volk_tables.h
+ rm -f volk_environment_init.c
+"""
+
+
+ return tempstring
diff --git a/volk/include/volk/make_set_simd.py b/volk/include/volk/make_set_simd.py
index da631d217..5a848e59e 100644
--- a/volk/include/volk/make_set_simd.py
+++ b/volk/include/volk/make_set_simd.py
@@ -17,7 +17,7 @@
from xml.dom import minidom
-def make_set_simd(dom) :
+def make_set_simd(dom, machines) :
tempstring = "";
tempstring = tempstring +'dnl this file is auto generated by volk_register.py\n\n';
@@ -148,7 +148,16 @@ def make_set_simd(dom) :
for domarch in dom:
arch = str(domarch.attributes["name"].value);
tempstring = tempstring + " AM_CONDITIONAL(LV_MAKE_" + arch.swapcase() + ", test \"$LV_MAKE_" + arch.swapcase() + "\" == \"yes\")\n";
-
+
+ tempstring += "\n"
+ #now we can define the machines we're compiling
+ for machine_name in machines:
+ tempstring += " AM_CONDITIONAL(LV_MACHINE_" + machine_name.swapcase() + ", "
+ marchlist = machines[machine_name]
+ for march in marchlist:
+ tempstring += "test \"$LV_MAKE_" + march.swapcase() + "\" == \"yes\" && "
+
+ tempstring += "test true)\n" #just so we don't have to detect the last one in the group, i know
tempstring = tempstring + " LV_CXXFLAGS=\"${LV_CXXFLAGS} ${ADDONS}\"\n"
tempstring = tempstring + "])\n"
diff --git a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a16.h b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a16.h
index 2e5036f69..d78faf5b5 100644
--- a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a16.h
+++ b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a16.h
@@ -59,7 +59,7 @@ static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a16_generic(lv_32fc_t* r
#endif /*LV_HAVE_GENERIC*/
-#if defined(LV_HAVE_SSE) && defined(LV_HAVE_64)
+#if LV_HAVE_SSE && LV_HAVE_64
static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a16_sse(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
@@ -202,7 +202,7 @@ static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a16_sse(lv_32fc_t* resul
}
#endif
-#if defined(LV_HAVE_SSE) && defined(LV_HAVE_32)
+#if LV_HAVE_SSE && LV_HAVE_32
static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a16_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
static const uint32_t conjugator[4] __attribute__((aligned(16)))= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a16.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a16.h
index 9bfb88934..b7b9768ab 100644
--- a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a16.h
+++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a16.h
@@ -56,7 +56,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a16_generic(lv_32fc_t* result, con
#endif /*LV_HAVE_GENERIC*/
-#if defined(LV_HAVE_SSE) && defined(LV_HAVE_64)
+#if LV_HAVE_SSE && LV_HAVE_64
static inline void volk_32fc_x2_dot_prod_32fc_a16_sse_64(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
@@ -192,7 +192,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a16_sse_64(lv_32fc_t* result, cons
#endif
-#if defined(LV_HAVE_SSE) && defined(LV_HAVE_32)
+#if LV_HAVE_SSE && LV_HAVE_32
static inline void volk_32fc_x2_dot_prod_32fc_a16_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
diff --git a/volk/include/volk/volk_64u_popcnt_a16.h b/volk/include/volk/volk_64u_popcnt_a16.h
index b416d052e..8b92e91a1 100644
--- a/volk/include/volk/volk_64u_popcnt_a16.h
+++ b/volk/include/volk/volk_64u_popcnt_a16.h
@@ -36,7 +36,7 @@ static inline void volk_64u_popcnt_a16_generic(uint64_t* ret, const uint64_t val
#endif /*LV_HAVE_GENERIC*/
-#if defined(LV_HAVE_SSE4_2) && defined(LV_HAVE_64)
+#if LV_HAVE_SSE4_2 && LV_HAVE_64
#include <nmmintrin.h>
diff --git a/volk/include/volk/volk_register.py b/volk/include/volk/volk_register.py
index 20b77da6c..d5a4a968f 100755
--- a/volk/include/volk/volk_register.py
+++ b/volk/include/volk/volk_register.py
@@ -22,6 +22,7 @@ from make_environment_init_c import make_environment_init_c
from make_environment_init_h import make_environment_init_h
from make_mktables import make_mktables
from make_makefile_am import make_makefile_am
+import copy
outfile_set_simd = open("../../config/lv_set_simd_flags.m4", "w");
outfile_reg = open("volk_registry.h", "w");
@@ -91,7 +92,41 @@ for arch in archs:
archs_or = archs_or[0:len(archs_or)-1];
archs_or = archs_or + ")";
-
+#get machine list and parse to a list of machines, each with a list of archs (none of this DOM crap)
+machine_str_dict = {}
+mfile = minidom.parse("machines.xml");
+filemachines = mfile.getElementsByTagName("machine")
+
+for filemachine in filemachines:
+ machine_str_dict[str(filemachine.attributes["name"].value)] = str(filemachine.getElementsByTagName("archs")[0].firstChild.data).split()
+
+#all right now you have a dict of arch lists
+#next we expand it
+#this is an expanded list accounting for the OR syntax
+#TODO: make this work for multiple "|" machines
+machines = {}
+already_done = False
+for machine_name in machine_str_dict:
+ already_done = False
+ marchlist = machine_str_dict[machine_name]
+ for march in marchlist:
+ or_marchs = march.split("|")
+ if len(or_marchs) > 1:
+ marchlist.remove(march)
+ for or_march in or_marchs:
+ tempmarchlist = copy.deepcopy(marchlist)
+ tempmarchlist.append(or_march)
+ machines[machine_name + "_" + or_march] = tempmarchlist
+ already_done = True
+
+ if not already_done:
+ machines[machine_name] = marchlist
+
+#for machine_name in machines:
+# print machine_name + ": " + str(machines[machine_name])
+
+#ok, now we have all the machines we're going to build. next step is to generate a Makefile.am where they're all laid out and compiled
+
taglist = [];
fcountlist = [];
arched_arglist = [];
@@ -107,7 +142,7 @@ for func in functions:
sourcefile = infile_source.readlines();
infile_source.close();
for line in sourcefile:
-
+#FIXME: make it work for multiple #if define()s
archline = re.search("^\#if.*?LV_HAVE_" + archs_or + ".*", line);
if archline:
arch = archline.group(0);
@@ -222,7 +257,7 @@ outfile_cpu_h.close();
outfile_cpu_c.write(make_cpuid_c(filearchs));
outfile_cpu_c.close();
-outfile_set_simd.write(make_set_simd(filearchs));
+outfile_set_simd.write(make_set_simd(filearchs, machines));
outfile_set_simd.close();
#outfile_config_in.write(make_config_in(filearchs));
@@ -264,5 +299,5 @@ outfile_environment_h.close();
outfile_mktables.write(make_mktables(functions));
outfile_mktables.close();
-outfile_makefile_am.write(make_makefile_am(filearchs))
+outfile_makefile_am.write(make_makefile_am(filearchs, machines))
outfile_makefile_am.close()