Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Asteborg <maastebo@microsoft.com>2022-07-07 07:35:16 +0300
committerMark Harris <mark.hsj@gmail.com>2022-07-08 08:07:33 +0300
commit510e1029b45aa01a7047e5b3b82169be40911b96 (patch)
tree862a8e1b774311edb4b2beab2ede4b400623896d /cmake/cpu_info_by_asm.c
parenta80e9e9533d4edeaae282b82f77b8bd8a4903eca (diff)
cmake - fix rtcd detection on x86 non windows
Signed-off-by: Mark Harris <mark.hsj@gmail.com>
Diffstat (limited to 'cmake/cpu_info_by_asm.c')
-rw-r--r--cmake/cpu_info_by_asm.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/cpu_info_by_asm.c b/cmake/cpu_info_by_asm.c
new file mode 100644
index 00000000..1a70a815
--- /dev/null
+++ b/cmake/cpu_info_by_asm.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+int main() {
+ unsigned int CPUInfo0;
+ unsigned int CPUInfo1;
+ unsigned int CPUInfo2;
+ unsigned int CPUInfo3;
+ unsigned int InfoType;
+#if defined(__i386__) && defined(__PIC__)
+/* %ebx is PIC register in 32-bit, so mustn't clobber it. */
+ __asm__ __volatile__ (
+ "xchg %%ebx, %1\n"
+ "cpuid\n"
+ "xchg %%ebx, %1\n":
+ "=a" (CPUInfo0),
+ "=r" (CPUInfo1),
+ "=c" (CPUInfo2),
+ "=d" (CPUInfo3) :
+ "0" (InfoType), "2" (0)
+ );
+#else
+ __asm__ __volatile__ (
+ "cpuid":
+ "=a" (CPUInfo0),
+ "=b" (CPUInfo1),
+ "=c" (CPUInfo2),
+ "=d" (CPUInfo3) :
+ "0" (InfoType), "2" (0)
+ );
+#endif
+ return 0;
+}