summaryrefslogtreecommitdiff
path: root/volk/include
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2011-02-15 18:48:56 -0800
committerNick Foster <nick@nerdnetworks.org>2011-02-15 18:52:28 -0800
commit1633e9371a0bce876757f1c2c3e4054436b57950 (patch)
tree06c8d5914acd4702749ed55582694dd95ec47ecd /volk/include
parent26fc07eac6a3029e2d7361b1502f69e7592e708b (diff)
cpuid: No more compile-time CPU checks. Compiles everything that gcc allows.
Configure- and compile-time checks modified to only compile architectures that the compiler will handle. This means that volk will compile every arch that your gcc will compile, no matter if your CPU can execute the instructions or not. This lets you cross-compile volk. volk_rank_archs will be deferred to runtime. This has not been done yet.
Diffstat (limited to 'volk/include')
-rw-r--r--volk/include/volk/make_cpuid_c.py184
-rw-r--r--volk/include/volk/make_cpuid_generic_c.py60
-rw-r--r--volk/include/volk/make_cpuid_powerpc_c.py67
-rw-r--r--volk/include/volk/make_cpuid_x86_c.py133
-rw-r--r--volk/include/volk/make_mktables.py2
-rw-r--r--volk/include/volk/make_set_simd.py243
-rwxr-xr-xvolk/include/volk/volk_register.py23
7 files changed, 257 insertions, 455 deletions
diff --git a/volk/include/volk/make_cpuid_c.py b/volk/include/volk/make_cpuid_c.py
new file mode 100644
index 0000000000..20621769b8
--- /dev/null
+++ b/volk/include/volk/make_cpuid_c.py
@@ -0,0 +1,184 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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, or (at your option)
+# any later version.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from xml.dom import minidom
+
+HEADER_TEMPL = """\
+/*this file is auto_generated by volk_register.py*/
+
+#include <volk/volk_cpu.h>
+#include <volk/volk_config_fixed.h>
+
+struct VOLK_CPU volk_cpu;
+
+#if defined(__i386__) || (__x86_64__)
+#include <gcc_x86_cpuid.h>
+#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3)
+
+static inline unsigned int cpuid_eax(unsigned int op) {
+ unsigned int regs[4];
+ cpuid_x86 (op, regs);
+ return regs[0];
+}
+
+static inline unsigned int cpuid_ebx(unsigned int op) {
+ unsigned int regs[4];
+ cpuid_x86 (op, regs);
+ return regs[1];
+}
+
+static inline unsigned int cpuid_ecx(unsigned int op) {
+ unsigned int regs[4];
+ cpuid_x86 (op, regs);
+ return regs[2];
+}
+
+static inline unsigned int cpuid_edx(unsigned int op) {
+ unsigned int regs[4];
+ cpuid_x86 (op, regs);
+ return regs[3];
+}
+#endif
+
+"""
+
+def make_cpuid_c(dom) :
+ tempstring = HEADER_TEMPL;
+
+ for domarch in dom:
+ if str(domarch.attributes["type"].value) == "x86":
+ if "no_test" in domarch.attributes.keys():
+ no_test = str(domarch.attributes["no_test"].value);
+ if no_test == "true":
+ no_test = True;
+ else:
+ no_test = False;
+ else:
+ no_test = False;
+ arch = str(domarch.attributes["name"].value);
+ op = domarch.getElementsByTagName("op");
+ if op:
+ op = str(op[0].firstChild.data);
+ reg = domarch.getElementsByTagName("reg");
+ if reg:
+ reg = str(reg[0].firstChild.data);
+ shift = domarch.getElementsByTagName("shift");
+ if shift:
+ shift = str(shift[0].firstChild.data);
+ val = domarch.getElementsByTagName("val");
+ if val:
+ val = str(val[0].firstChild.data);
+
+ if no_test:
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+#if defined(__i386__) || (__x86_64__)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+""" % (arch)
+
+ elif op == "1":
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+#if defined(__i386__) || (__x86_64__)
+ unsigned int e%sx = cpuid_e%sx (%s);
+ return ((e%sx >> %s) & 1) == %s;
+#else
+ return 0;
+#endif
+}
+
+""" % (arch, reg, reg, op, reg, shift, val)
+
+ elif op == "0x80000001":
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+#if defined(__i386__) || (__x86_64__)
+ unsigned int extended_fct_count = cpuid_eax(0x80000000);
+ if (extended_fct_count < 0x80000001)
+ return %s^1;
+ unsigned int extended_features = cpuid_e%sx (%s);
+ return ((extended_features >> %s) & 1) == %s;
+#else
+ return 0;
+#endif
+}
+
+""" % (arch, val, reg, op, shift, val)
+
+ elif str(domarch.attributes["type"].value) == "powerpc":
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+#ifdef __PPC__
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+""" % (arch)
+
+ elif str(domarch.attributes["type"].value) == "all":
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+ return 1;
+}
+
+""" % (arch)
+ else:
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + """\
+int i_can_has_%s () {
+ return 0;
+}
+
+""" % (arch)
+
+ tempstring = tempstring + "void volk_cpu_init() {\n";
+ for domarch in dom:
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + " volk_cpu.has_" + arch + " = &i_can_has_" + arch + ";\n"
+ tempstring = tempstring + "}\n\n"
+
+ tempstring = tempstring + "unsigned int volk_get_lvarch() {\n";
+ tempstring = tempstring + " unsigned int retval = 0;\n"
+ tempstring = tempstring + " volk_cpu_init();\n"
+ for domarch in dom:
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + " retval += volk_cpu.has_" + arch + "() << LV_" + arch.swapcase() + ";\n"
+ tempstring = tempstring + " return retval;\n"
+ tempstring = tempstring + "}\n\n"
+
+ return tempstring;
+
+
+
+
+
+
+
diff --git a/volk/include/volk/make_cpuid_generic_c.py b/volk/include/volk/make_cpuid_generic_c.py
deleted file mode 100644
index c682d4138d..0000000000
--- a/volk/include/volk/make_cpuid_generic_c.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from xml.dom import minidom
-
-def make_cpuid_generic_c(dom) :
- tempstring = "";
- tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
- tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
- tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
- tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
-
- for domarch in dom:
- if str(domarch.attributes["type"].value) == "all":
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 1;\n"
- tempstring = tempstring + "}\n\n"
-
- else:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 0;\n"
- tempstring = tempstring + "}\n\n"
-
- tempstring = tempstring + "void volk_cpu_init() {\n";
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " volk_cpu.has_" + arch + " = &i_can_has_" + arch + ";\n"
- tempstring = tempstring + "}\n\n"
-
- tempstring = tempstring + "unsigned int volk_get_lvarch() {\n";
- tempstring = tempstring + " unsigned int retval = 0;\n"
- tempstring = tempstring + " volk_cpu_init();\n"
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " retval += volk_cpu.has_" + arch + "() << LV_" + arch.swapcase() + ";\n"
- tempstring = tempstring + " return retval;\n"
- tempstring = tempstring + "}\n\n"
-
- return tempstring;
diff --git a/volk/include/volk/make_cpuid_powerpc_c.py b/volk/include/volk/make_cpuid_powerpc_c.py
deleted file mode 100644
index 0b0ea84e7a..0000000000
--- a/volk/include/volk/make_cpuid_powerpc_c.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from xml.dom import minidom
-
-def make_cpuid_powerpc_c(dom) :
- tempstring = "";
- tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
- tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
- tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
- tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
-
- #just assume it has them for powerpc
- for domarch in dom:
- if str(domarch.attributes["type"].value) == "powerpc":
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 1;\n"
- tempstring = tempstring + "}\n\n"
- elif str(domarch.attributes["type"].value) == "all":
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 1;\n"
- tempstring = tempstring + "}\n\n"
- else:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 0;\n"
- tempstring = tempstring + "}\n\n"
-
-
- tempstring = tempstring + "void volk_cpu_init() {\n";
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " volk_cpu.has_" + arch + " = &i_can_has_" + arch + ";\n"
-
- tempstring = tempstring + "}\n\n"
- tempstring = tempstring + "unsigned int volk_get_lvarch() {\n";
- tempstring = tempstring + " unsigned int retval = 0;\n"
- tempstring = tempstring + " volk_cpu_init();\n"
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " retval += volk_cpu.has_" + arch + "() << LV_" + arch.swapcase() + ";\n"
- tempstring = tempstring + " return retval;\n"
- tempstring = tempstring + "}\n\n"
-
- return tempstring;
-
diff --git a/volk/include/volk/make_cpuid_x86_c.py b/volk/include/volk/make_cpuid_x86_c.py
deleted file mode 100644
index 2b2bd7c912..0000000000
--- a/volk/include/volk/make_cpuid_x86_c.py
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from xml.dom import minidom
-
-def make_cpuid_x86_c(dom) :
- tempstring = "";
- tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
- tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
- tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
- tempstring = tempstring + "#include <gcc_x86_cpuid.h>\n\n"
- tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
-
- tempstring = tempstring + "#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3)\n\n"
- tempstring = tempstring + "static inline unsigned int cpuid_eax(unsigned int op) {\n";
- tempstring = tempstring + " unsigned int regs[4];\n"
- tempstring = tempstring + " cpuid_x86 (op, regs);\n"
- tempstring = tempstring + " return regs[0];\n"
- tempstring = tempstring + "}\n\n";
-
- tempstring = tempstring + "static inline unsigned int cpuid_ebx(unsigned int op) {\n";
- tempstring = tempstring + " unsigned int regs[4];\n"
- tempstring = tempstring + " cpuid_x86 (op, regs);\n"
- tempstring = tempstring + " return regs[1];\n"
- tempstring = tempstring + "}\n\n";
-
- tempstring = tempstring + "static inline unsigned int cpuid_ecx(unsigned int op) {\n";
- tempstring = tempstring + " unsigned int regs[4];\n"
- tempstring = tempstring + " cpuid_x86 (op, regs);\n"
- tempstring = tempstring + " return regs[2];\n"
- tempstring = tempstring + "}\n\n";
-
- tempstring = tempstring + "static inline unsigned int cpuid_edx(unsigned int op) {\n";
- tempstring = tempstring + " unsigned int regs[4];\n"
- tempstring = tempstring + " cpuid_x86 (op, regs);\n"
- tempstring = tempstring + " return regs[3];\n"
- tempstring = tempstring + "}\n\n";
-
- for domarch in dom:
- if str(domarch.attributes["type"].value) == "x86":
- if "no_test" in domarch.attributes.keys():
- no_test = str(domarch.attributes["no_test"].value);
- if no_test == "true":
- no_test = True;
- else:
- no_test = False;
- else:
- no_test = False;
- arch = str(domarch.attributes["name"].value);
- op = domarch.getElementsByTagName("op");
- if op:
- op = str(op[0].firstChild.data);
- reg = domarch.getElementsByTagName("reg");
- if reg:
- reg = str(reg[0].firstChild.data);
- shift = domarch.getElementsByTagName("shift");
- if shift:
- shift = str(shift[0].firstChild.data);
- val = domarch.getElementsByTagName("val");
- if val:
- val = str(val[0].firstChild.data);
-
- if no_test:
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 1;\n"
- tempstring = tempstring + "}\n\n"
- elif op == "1":
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " unsigned int e" + reg + "x = cpuid_e" + reg + "x (" + op + ");\n"
- tempstring = tempstring + " return ((e" + reg + "x >> " + shift + ") & 1) == " + val + ";\n"
- tempstring = tempstring + "}\n\n";
-
- elif op == "0x80000001":
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " unsigned int extended_fct_count = cpuid_eax(0x80000000);\n";
- tempstring = tempstring + " if (extended_fct_count < 0x80000001)\n";
- tempstring = tempstring + " return "+ val + "^1;\n\n"
- tempstring = tempstring + " unsigned int extended_features = cpuid_e" + reg + "x (" + op + ");\n";
- tempstring = tempstring + " return ((extended_features >> " + shift + ") & 1) == " + val + ";\n"
- tempstring = tempstring + "}\n\n";
- elif str(domarch.attributes["type"].value) == "all":
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 1;\n"
- tempstring = tempstring + "}\n\n"
- else:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + "int i_can_has_" + arch + " () {\n"
- tempstring = tempstring + " return 0;\n"
- tempstring = tempstring + "}\n\n"
-
- tempstring = tempstring + "void volk_cpu_init() {\n";
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " volk_cpu.has_" + arch + " = &i_can_has_" + arch + ";\n"
- tempstring = tempstring + "}\n\n"
-
- tempstring = tempstring + "unsigned int volk_get_lvarch() {\n";
- tempstring = tempstring + " unsigned int retval = 0;\n"
- tempstring = tempstring + " volk_cpu_init();\n"
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- tempstring = tempstring + " retval += volk_cpu.has_" + arch + "() << LV_" + arch.swapcase() + ";\n"
- tempstring = tempstring + " return retval;\n"
- tempstring = tempstring + "}\n\n"
-
- return tempstring;
-
-
-
-
-
-
-
diff --git a/volk/include/volk/make_mktables.py b/volk/include/volk/make_mktables.py
index 051ac268de..25da086faa 100644
--- a/volk/include/volk/make_mktables.py
+++ b/volk/include/volk/make_mktables.py
@@ -18,7 +18,7 @@ def make_mktables(funclist) :
tempstring = tempstring + ' fprintf(output, "#define INCLUDED_VOLK_TABLES_H\\n\\n");\n';
for func in funclist:
- tempstring = tempstring + ' fprintf(output, "static const ' + func + '_func_table = %u;\\n", volk_rank_archs(' + func + '_arch_defs, volk_get_lvarch()));\n';
+ tempstring = tempstring + ' fprintf(output, "static const ' + func + '_func_table = %u;\\n", 0);\n';
tempstring = tempstring + ' fprintf(output, "#endif /*INCLUDED_VOLK_TABLES_H*/\\n");\n';
tempstring = tempstring + ' fclose(output);\n'
tempstring = tempstring + '}\n';
diff --git a/volk/include/volk/make_set_simd.py b/volk/include/volk/make_set_simd.py
index c74b0464d4..8aef5bb164 100644
--- a/volk/include/volk/make_set_simd.py
+++ b/volk/include/volk/make_set_simd.py
@@ -15,53 +15,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+#TODO: add in checking for 32-bit and 64-bit compiler support, to pick
+#which version to use.
+
+#for a given compiler: first try 64 bit, then fall back to 32 bit.
+#to try 64 bit, just try compiling a program with -m64
+#if it passes, whee you're 64-bit
+#if not, 32
+#this should probably be elsewhere and just referred in here
+#actually, why the fuck does LF_CHECK_CC_FLAG([-m64]) work at all? it doesn't even COMPILE
+
from xml.dom import minidom
def make_set_simd(dom) :
tempstring = "";
tempstring = tempstring +'dnl this file is auto generated by volk_register.py\n\n';
- tempstring = tempstring + "AC_DEFUN([_MAKE_FAKE_PROCCPU],\n";
- tempstring = tempstring + "[\n";
- tempstring = tempstring + " AC_REQUIRE([GR_SET_MD_CPU])\n";
- tempstring = tempstring + " AC_MSG_CHECKING([proccpu])\n";
- tempstring = tempstring + " case \"$MD_CPU\" in\n";
- tempstring = tempstring + " (x86)\n";
- tempstring = tempstring + " if test -z \"`${CC} -o proccpu -I$srcdir/include/ -I$srcdir/lib $srcdir/lib/volk_proccpu_sim.c $srcdir/lib/volk_cpu_x86.c 2>&1`\"\n";
- tempstring = tempstring + " then\n";
- tempstring = tempstring + " AC_MSG_RESULT(yes)\n";
- tempstring = tempstring + " lv_PROCCPU=\"`./proccpu`\"\n";
- tempstring = tempstring + " rm -f proccpu\n";
- tempstring = tempstring + " else\n";
- tempstring = tempstring + " AC_MSG_RESULT(no)\n";
- tempstring = tempstring + " lv_PROCCPU=no\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " ;;\n";
- tempstring = tempstring + " (powerpc)\n";
- tempstring = tempstring + " if test -z \"`${CC} -o proccpu -I$srcdir/include/ $srcdir/lib/volk_proccpu_sim.c $srcdir/lib/volk_cpu_powerpc.c 2>&1`\"\n";
- tempstring = tempstring + " then\n";
- tempstring = tempstring + " AC_MSG_RESULT(yes)\n";
- tempstring = tempstring + " lv_PROCCPU=\"`./proccpu`\"\n";
- tempstring = tempstring + " rm -f proccpu\n";
- tempstring = tempstring + " else\n";
- tempstring = tempstring + " AC_MSG_RESULT(no)\n";
- tempstring = tempstring + " lv_PROCCPU=no\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " ;;\n";
- tempstring = tempstring + " (*)\n";
- tempstring = tempstring + " if test -z \"`${CC} -o proccpu -I$srcdir/include/ $srcdir/lib/volk_proccpu_sim.c $srcdir/lib/volk_cpu_generic.c 2>&1`\"\n";
- tempstring = tempstring + " then\n";
- tempstring = tempstring + " AC_MSG_RESULT(yes)\n";
- tempstring = tempstring + " lv_PROCCPU=\"`./proccpu`\"\n";
- tempstring = tempstring + " rm -f proccpu\n";
- tempstring = tempstring + " else\n";
- tempstring = tempstring + " AC_MSG_RESULT(no)\n";
- tempstring = tempstring + " lv_PROCCPU=no\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " ;;\n";
- tempstring = tempstring + " esac\n";
- tempstring = tempstring + "])\n"
-
+ tempstring = tempstring +'\ndnl define arch checks\n';
for domarch in dom:
if str(domarch.attributes["type"].value) != "all":
arch = str(domarch.attributes["name"].value);
@@ -73,9 +43,10 @@ def make_set_simd(dom) :
tempstring = tempstring + " LF_CHECK_CXX_FLAG([-" + flag + "])\n";
tempstring = tempstring + "])\n";
+ tempstring = tempstring +'\ndnl main set_simd_flags\n';
tempstring = tempstring + "AC_DEFUN([LV_SET_SIMD_FLAGS],\n";
tempstring = tempstring + "[\n";
- tempstring = tempstring + " AC_REQUIRE([GR_SET_MD_CPU])\n";
+ #tempstring = tempstring + " AC_REQUIRE([GR_SET_MD_CPU])\n";
tempstring = tempstring + " AC_SUBST(LV_CXXFLAGS)\n";
tempstring = tempstring + " indCC=no\n";
tempstring = tempstring + " indCXX=no\n";
@@ -96,29 +67,33 @@ def make_set_simd(dom) :
tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [always set "+ arch + "!])\n";
tempstring = tempstring + " ADDONS=\"\"\n";
tempstring = tempstring + " BUILT_ARCHS=\"\"\n";
- tempstring = tempstring + " _MAKE_FAKE_PROCCPU\n";
+ #tempstring = tempstring + " _MAKE_FAKE_PROCCPU\n";
tempstring = tempstring + " OVERRULE_FLAG=\"no\"\n";
tempstring = tempstring + " if test -z \"$cf_with_lv_arch\"; then\n";
- tempstring = tempstring + " cf_with_lv_arch=$lv_PROCCPU\n";
+ tempstring = tempstring + " cf_with_lv_arch=\"";
+ for domarch in dom:
+ arch = str(domarch.attributes["name"].value);
+ tempstring = tempstring + arch + " ";
+ tempstring = tempstring[0:-1] + "\"\n";
tempstring = tempstring + " OVERRULE_FLAG=\"yes\"\n";
-
tempstring = tempstring + " fi\n";
+
+ tempstring = tempstring +'\ndnl init LV_HAVE_XXX and then try to add archs\n';
for domarch in dom:
if str(domarch.attributes["type"].value) != "all":
arch = str(domarch.attributes["name"].value);
tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=no\n";
- tempstring = tempstring + " case \"$MD_CPU\" in\n";
- tempstring = tempstring + " (x86)\n"
for domarch in dom:
arch = str(domarch.attributes["name"].value);
atype = str(domarch.attributes["type"].value);
- if atype == "x86":
- tempstring = tempstring + " _TRY_ADD_" + arch.swapcase() + "\n";
+ if atype != "all":
+ tempstring = tempstring + " _TRY_ADD_" + arch.swapcase() + "\n";
for domarch in dom:
arch = str(domarch.attributes["name"].value);
atype = str(domarch.attributes["type"].value);
+ tempstring = tempstring +'\ndnl add in flags for arch ' + arch + '\n';
overrule = domarch.getElementsByTagName("overrule");
if overrule:
overrule = str(overrule[0].firstChild.data);
@@ -131,139 +106,57 @@ def make_set_simd(dom) :
overrule_val = "";
flag = domarch.getElementsByTagName("flag");
flag = str(flag[0].firstChild.data);
- if atype == "x86":
- tempstring = tempstring + " for i in $lf_CXXFLAGS\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
- tempstring = tempstring + " indCXX=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " for i in $lf_CFLAGS\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
- tempstring = tempstring + " indCC=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " for i in $cf_with_lv_arch\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
- tempstring = tempstring + " indLV_ARCH=yes\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
+ if atype != "all":
+ tempstring = tempstring + " for i in $lf_CXXFLAGS\n"
+ tempstring = tempstring + " do\n"
+ tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
+ tempstring = tempstring + " indCXX=yes\n";
tempstring = tempstring + " fi\n"
-
- tempstring = tempstring + " if test \"$indCC\" == \"yes\" && test \"$indCXX\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
-
- tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
- tempstring = tempstring + " ADDONS=\"${ADDONS} -" + flag + "\"\n";
- tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
- tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " indCC=no\n"
- tempstring = tempstring + " indCXX=no\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
- elif atype == "all":
- tempstring = tempstring + " for i in $cf_with_lv_arch\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
- tempstring = tempstring + " indLV_ARCH=yes\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
+ tempstring = tempstring + " done\n"
+ tempstring = tempstring + " for i in $lf_CFLAGS\n"
+ tempstring = tempstring + " do\n"
+ tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
+ tempstring = tempstring + " indCC=yes\n";
tempstring = tempstring + " fi\n"
- tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
- tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
- tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
+ tempstring = tempstring + " done\n"
+ tempstring = tempstring + " for i in $cf_with_lv_arch\n"
+ tempstring = tempstring + " do\n"
+ tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
+ tempstring = tempstring + " indLV_ARCH=yes\n"
tempstring = tempstring + " fi\n"
+ tempstring = tempstring + " done\n"
+ tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
tempstring = tempstring + " indLV_ARCH=no\n"
+ tempstring = tempstring + " fi\n"
- tempstring = tempstring + " ;;\n"
-
- tempstring = tempstring + " (powerpc)\n"
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- atype = str(domarch.attributes["type"].value);
- if atype == "powerpc":
- tempstring = tempstring + " _TRY_ADD_" + arch.swapcase() + "\n";
-
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- atype = str(domarch.attributes["type"].value);
- flag = domarch.getElementsByTagName("flag");
- flag = str(flag[0].firstChild.data);
- if atype == "powerpc":
- tempstring = tempstring + " for i in $lf_CXXFLAGS\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
- tempstring = tempstring + " indCXX=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " for i in $lf_CFLAGS\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X-" + flag +"; then\n";
- tempstring = tempstring + " indCC=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " for i in $cf_with_lv_arch\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
- tempstring = tempstring + " indLV_ARCH=yes\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " if test \"$indCC\" = yes && test \"indCXX\" = yes && \"indLV_ARCH\" = yes; then\n"
- tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
- tempstring = tempstring + " ADDONS=\"${ADDONS} -" + flag + "\"\n";
- tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
- tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " indCC=no\n"
- tempstring = tempstring + " indCXX=no\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
- elif atype == "all":
- tempstring = tempstring + " for i in $cf_with_lv_arch\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
- tempstring = tempstring + " indLV_ARCH=yes\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
- tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
- tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
- tempstring = tempstring + " ;;\n"
- tempstring = tempstring + " (*)\n"
- for domarch in dom:
- arch = str(domarch.attributes["name"].value);
- atype = str(domarch.attributes["type"].value);
- flag = domarch.getElementsByTagName("flag");
- flag = str(flag[0].firstChild.data);
- if atype == "all":
- tempstring = tempstring + " for i in $cf_with_lv_arch\n"
- tempstring = tempstring + " do\n"
- tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
- tempstring = tempstring + " indLV_ARCH=yes\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " done\n"
- tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " indLV_ARCH=no\n"
- tempstring = tempstring + " fi\n"
- tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n"
- tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
- tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
- tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
+ tempstring = tempstring + " if test \"$indCC\" == \"yes\" && test \"$indCXX\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
+
+ tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
+ tempstring = tempstring + " ADDONS=\"${ADDONS} -" + flag + "\"\n";
+ tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
+ tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
+ tempstring = tempstring + " fi\n"
+ tempstring = tempstring + " indCC=no\n"
+ tempstring = tempstring + " indCXX=no\n"
+ tempstring = tempstring + " indLV_ARCH=no\n"
+ else:
+ tempstring = tempstring + " for i in $cf_with_lv_arch\n"
+ tempstring = tempstring + " do\n"
+ tempstring = tempstring + " if test \"X$i\" = X" + arch + "; then\n";
+ tempstring = tempstring + " indLV_ARCH=yes\n"
tempstring = tempstring + " fi\n"
+ tempstring = tempstring + " done\n"
+ tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n"
tempstring = tempstring + " indLV_ARCH=no\n"
- tempstring = tempstring + " ;;\n"
- tempstring = tempstring + " esac\n"
+ tempstring = tempstring + " fi\n"
+ tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n"
+ tempstring = tempstring + " AC_DEFINE(LV_HAVE_" + arch.swapcase() + ", 1, [" + arch + " flag set])\n";
+ tempstring = tempstring + " LV_HAVE_" + arch.swapcase() + "=yes\n";
+ tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n";
+ tempstring = tempstring + " fi\n"
+ tempstring = tempstring + " indLV_ARCH=no\n"
+
+
tempstring = tempstring + " LV_CXXFLAGS=\"${LV_CXXFLAGS} ${ADDONS}\"\n"
tempstring = tempstring + "])\n"
diff --git a/volk/include/volk/volk_register.py b/volk/include/volk/volk_register.py
index bc8f959af6..242a8dee75 100755
--- a/volk/include/volk/volk_register.py
+++ b/volk/include/volk/volk_register.py
@@ -5,12 +5,9 @@ import re
import string
from xml.dom import minidom
from volk_regexp import *
-from make_cpuid_x86_c import make_cpuid_x86_c
+from make_cpuid_c import make_cpuid_c
from make_cpuid_h import make_cpuid_h
-from make_proccpu_sim import make_proccpu_sim
from make_set_simd import make_set_simd
-from make_cpuid_generic_c import make_cpuid_generic_c
-from make_cpuid_powerpc_c import make_cpuid_powerpc_c
from make_registry import make_registry
from make_h import make_h
from make_init_h import make_init_h
@@ -35,10 +32,7 @@ outfile_typedefs = open("volk_typedefs.h", "w");
outfile_init_h = open("../../lib/volk_init.h", "w");
outfile_init_c = open("../../lib/volk_init.c", "w");
outfile_cpu_h = open("volk_cpu.h", "w");
-outfile_cpu_x86_c = open("../../lib/volk_cpu_x86.c", "w");
-outfile_cpu_generic_c = open("../../lib/volk_cpu_generic.c", "w");
-outfile_cpu_powerpc_c = open("../../lib/volk_cpu_powerpc.c", "w");
-outfile_proccpu_sim = open("../../lib/volk_proccpu_sim.c", "w");
+outfile_cpu_c = open("../../lib/volk_cpu.c", "w");
outfile_config_in = open("../../volk_config.h.in", "w");
outfile_config_fixed = open("volk_config_fixed.h", "w");
outfile_mktables = open("../../lib/volk_mktables.c", "w");
@@ -226,21 +220,12 @@ outfile_mktables.close();
outfile_cpu_h.write(make_cpuid_h(filearchs));
outfile_cpu_h.close();
-outfile_cpu_x86_c.write(make_cpuid_x86_c(filearchs));
-outfile_cpu_x86_c.close();
-
-outfile_proccpu_sim.write(make_proccpu_sim(filearchs));
-outfile_proccpu_sim.close();
+outfile_cpu_c.write(make_cpuid_c(filearchs));
+outfile_cpu_c.close();
outfile_set_simd.write(make_set_simd(filearchs));
outfile_set_simd.close();
-outfile_cpu_generic_c.write(make_cpuid_generic_c(filearchs));
-outfile_cpu_generic_c.close();
-
-outfile_cpu_powerpc_c.write(make_cpuid_powerpc_c(filearchs));
-outfile_cpu_powerpc_c.close();
-
outfile_config_in.write(make_config_in(filearchs));
outfile_config_in.close();