diff options
Diffstat (limited to 'volk/gen')
-rw-r--r-- | volk/gen/archs.xml | 9 | ||||
-rw-r--r-- | volk/gen/compilers.xml | 18 | ||||
-rw-r--r-- | volk/gen/make_cpuid_c.py | 22 |
3 files changed, 35 insertions, 14 deletions
diff --git a/volk/gen/archs.xml b/volk/gen/archs.xml index 960558b7c..effd90d33 100644 --- a/volk/gen/archs.xml +++ b/volk/gen/archs.xml @@ -1,8 +1,8 @@ <!-- archs appear in order of significance for blind, de-facto version ordering --> <grammar> -<arch name="generic" type="all"> - <flag>none</flag> +<arch name="generic" type="all"> <!-- name and type are both required--> + <flag>none</flag> <!-- flag is the only required field--> </arch> <arch name="altivec" type="powerpc"> @@ -11,7 +11,7 @@ </arch> <arch name="neon" type="arm"> - <flag>mfpu=neon -mfloat-abi=softfp -funsafe-math-optimizations</flag> + <flag>mfpu=neon,mfloat-abi=softfp,funsafe-math-optimizations</flag> <alignment>16</alignment> </arch> @@ -29,7 +29,6 @@ <val>1</val> <overrule>MD_SUBCPU</overrule> <overrule_val>x86</overrule_val> - <mutex>32</mutex> </arch> <arch name="3dnow" type="x86"> @@ -46,7 +45,7 @@ <op>0x80000001</op> <reg>d</reg> <shift>5</shift> - <flag>sse4.2</flag> + <flag>msse4.2</flag> <alignment>16</alignment> </arch> diff --git a/volk/gen/compilers.xml b/volk/gen/compilers.xml new file mode 100644 index 000000000..70c82e555 --- /dev/null +++ b/volk/gen/compilers.xml @@ -0,0 +1,18 @@ +<!-- compilers remap gcc-specific information from archs.xml to specific compiler cases--> +<grammar> + +<compiler name="MSVC"> + <remap name="mmmx">arch:SSE</remap> + <remap name="msse">arch:SSE</remap> + <remap name="msse2">arch:SSE2</remap> + <prefix>/</prefix> +</compiler> + +<compiler name="GNU"> + <prefix>-</prefix> +</compiler> + + + + +</grammar>
\ No newline at end of file diff --git a/volk/gen/make_cpuid_c.py b/volk/gen/make_cpuid_c.py index eb88dcd7f..7281f45a3 100644 --- a/volk/gen/make_cpuid_c.py +++ b/volk/gen/make_cpuid_c.py @@ -30,7 +30,11 @@ HEADER_TEMPL = """\ struct VOLK_CPU volk_cpu; -#if defined(__i386__) || (__x86_64__) +#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) +# define VOLK_CPU_x86 +#endif + +#if defined(VOLK_CPU_x86) //implement get cpuid for gcc compilers using a copy of cpuid.h #if defined(__GNUC__) @@ -40,32 +44,32 @@ struct VOLK_CPU volk_cpu; //implement get cpuid for MSVC compilers using __cpuid intrinsic #elif defined(_MSC_VER) #include <intrin.h> -#define cpuid(op, r) __cpuid(r, op) +#define cpuid_x86(op, r) __cpuid(r, op) #else #error "A get cpuid for volk is not available on this compiler..." #endif static inline unsigned int cpuid_eax(unsigned int op) { - unsigned int regs[4]; + int regs[4]; cpuid_x86 (op, regs); return regs[0]; } static inline unsigned int cpuid_ebx(unsigned int op) { - unsigned int regs[4]; + int regs[4]; cpuid_x86 (op, regs); return regs[1]; } static inline unsigned int cpuid_ecx(unsigned int op) { - unsigned int regs[4]; + int regs[4]; cpuid_x86 (op, regs); return regs[2]; } static inline unsigned int cpuid_edx(unsigned int op) { - unsigned int regs[4]; + int regs[4]; cpuid_x86 (op, regs); return regs[3]; } @@ -103,7 +107,7 @@ def make_cpuid_c(dom) : if no_test: tempstring = tempstring + """\ int i_can_has_%s () { -#if defined(__i386__) || (__x86_64__) +#if defined(VOLK_CPU_x86) return 1; #else return 0; @@ -115,7 +119,7 @@ int i_can_has_%s () { elif op == "1": tempstring = tempstring + """\ int i_can_has_%s () { -#if defined(__i386__) || (__x86_64__) +#if defined(VOLK_CPU_x86) unsigned int e%sx = cpuid_e%sx (%s); return ((e%sx >> %s) & 1) == %s; #else @@ -128,7 +132,7 @@ int i_can_has_%s () { elif op == "0x80000001": tempstring = tempstring + """\ int i_can_has_%s () { -#if defined(__i386__) || (__x86_64__) +#if defined(VOLK_CPU_x86) unsigned int extended_fct_count = cpuid_eax(0x80000000); if (extended_fct_count < 0x80000001) return %s^1; |