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

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHenrik Gramner <gramner@twoorioles.com>2022-06-03 20:19:25 +0300
committerHenrik Gramner <henrik@gramner.com>2022-06-03 21:55:53 +0300
commit7576cd572f3ab5f6543a70dcc606e131110dbcd8 (patch)
tree23e4e7f2dd795e7563f335e98519693b2ced73bd /tests
parent0aa04fd326a1109fc4cd24aba1874fe74f85a562 (diff)
checkasm: Print the cpu model and cpuid signature on x86
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/checkasm.c11
-rw-r--r--tests/checkasm/x86/checkasm.asm54
2 files changed, 57 insertions, 8 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index e60011c..e0aebaf 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -589,7 +589,6 @@ int main(int argc, char *argv[]) {
int ret = 0;
if (!state.function_listing) {
- fprintf(stderr, "checkasm: using random seed %u\n", state.seed);
#if ARCH_X86_64
void checkasm_warmup_avx2(void);
void checkasm_warmup_avx512(void);
@@ -601,8 +600,14 @@ int main(int argc, char *argv[]) {
checkasm_simd_warmup();
#endif
#if ARCH_X86
- void checkasm_init_x86(void);
- checkasm_init_x86();
+ unsigned checkasm_init_x86(char *name);
+ char name[48];
+ const unsigned cpuid = checkasm_init_x86(name);
+ for (size_t len = strlen(name); len && name[len-1] == ' '; len--)
+ name[len-1] = '\0'; /* trim trailing whitespace */
+ fprintf(stderr, "checkasm: %s (%08X) using random seed %u\n", name, cpuid, state.seed);
+#else
+ fprintf(stderr, "checkasm: using random seed %u\n", state.seed);
#endif
}
diff --git a/tests/checkasm/x86/checkasm.asm b/tests/checkasm/x86/checkasm.asm
index 2972fa4..313a127 100644
--- a/tests/checkasm/x86/checkasm.asm
+++ b/tests/checkasm/x86/checkasm.asm
@@ -69,22 +69,64 @@ cextern fail_func
; (max_args % 4) must equal 3 for stack alignment
%define max_args 15
+%if UNIX64
+ DECLARE_REG_TMP 0
+%else
+ DECLARE_REG_TMP 4
+%endif
+
;-----------------------------------------------------------------------------
-; void checkasm_init_x86(void)
+; unsigned checkasm_init_x86(char *name)
;-----------------------------------------------------------------------------
-cglobal init_x86, 0, 4
+cglobal init_x86, 0, 5
%if ARCH_X86_64
push rbx
%endif
+ movifnidn t0, r0mp
+ mov eax, 0x80000000
+ cpuid
+ cmp eax, 0x80000004
+ jb .no_brand ; processor brand string not supported
+ mov eax, 0x80000002
+ cpuid
+ mov [t0+4* 0], eax
+ mov [t0+4* 1], ebx
+ mov [t0+4* 2], ecx
+ mov [t0+4* 3], edx
+ mov eax, 0x80000003
+ cpuid
+ mov [t0+4* 4], eax
+ mov [t0+4* 5], ebx
+ mov [t0+4* 6], ecx
+ mov [t0+4* 7], edx
+ mov eax, 0x80000004
+ cpuid
+ mov [t0+4* 8], eax
+ mov [t0+4* 9], ebx
+ mov [t0+4*10], ecx
+ mov [t0+4*11], edx
+ xor eax, eax
+ cpuid
+ jmp .check_xcr1
+.no_brand: ; use manufacturer id as a fallback
xor eax, eax
+ mov [t0+4*3], eax
cpuid
- cmp eax, 13
- jb .end ; leaf 13 not supported
+ mov [t0+4*0], ebx
+ mov [t0+4*1], edx
+ mov [t0+4*2], ecx
+.check_xcr1:
+ test eax, eax
+ jz .end2 ; cpuid leaf 1 not supported
+ mov t0d, eax ; max leaf
mov eax, 1
cpuid
and ecx, 0x18000000
cmp ecx, 0x18000000
- jne .end ; osxsave/avx not supported
+ jne .end2 ; osxsave/avx not supported
+ cmp t0d, 13 ; cpuid leaf 13 not supported
+ jb .end2
+ mov t0d, eax ; cpuid signature
mov eax, 13
mov ecx, 1
cpuid
@@ -101,6 +143,8 @@ cglobal init_x86, 0, 4
mov [check_vzeroupper], ecx
%endif
.end:
+ mov eax, t0d
+.end2:
%if ARCH_X86_64
pop rbx
%endif