Skip to content

Commit c74b94d

Browse files
committed
update checkasm files
1 parent a9bc1d1 commit c74b94d

File tree

9 files changed

+658
-117
lines changed

9 files changed

+658
-117
lines changed

tests/checkasm/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ checkasm_LDADD += \
2828
endif
2929

3030
if HAVE_X86ASM
31-
checkasm_SOURCES += checkasm_x86.asm timer_x86.h
31+
checkasm_SOURCES += x86/checkasm.asm x86/timer.h
3232
checkasm_LDADD += \
3333
$(top_builddir)/lib/upipe-v210/v210dec.o \
3434
$(top_builddir)/lib/upipe-v210/v210enc.o \
@@ -43,7 +43,7 @@ endif
4343
endif
4444

4545
if ARCH_AARCH64
46-
checkasm_SOURCES += asm_aarch64.S checkasm_aarch64.S timer_aarch64.h
46+
checkasm_SOURCES += aarch64/asm.S aarch64/checkasm.S aarch64/timer.h
4747
endif
4848

4949
V_ASM = $(V_ASM_@AM_V@)

tests/checkasm/asm_aarch64.S renamed to tests/checkasm/aarch64/asm.S

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,47 @@
3838
# define __has_feature(x) 0
3939
#endif
4040

41+
#if HAVE_AS_ARCH_DIRECTIVE
42+
.arch AS_ARCH_LEVEL
43+
#endif
44+
45+
#if HAVE_AS_ARCHEXT_DOTPROD_DIRECTIVE
46+
#define ENABLE_DOTPROD .arch_extension dotprod
47+
#define DISABLE_DOTPROD .arch_extension nodotprod
48+
#else
49+
#define ENABLE_DOTPROD
50+
#define DISABLE_DOTPROD
51+
#endif
52+
53+
#if HAVE_AS_ARCHEXT_I8MM_DIRECTIVE
54+
#define ENABLE_I8MM .arch_extension i8mm
55+
#define DISABLE_I8MM .arch_extension noi8mm
56+
#else
57+
#define ENABLE_I8MM
58+
#define DISABLE_I8MM
59+
#endif
60+
61+
#if HAVE_AS_ARCHEXT_SVE_DIRECTIVE
62+
#define ENABLE_SVE .arch_extension sve
63+
#define DISABLE_SVE .arch_extension nosve
64+
#else
65+
#define ENABLE_SVE
66+
#define DISABLE_SVE
67+
#endif
68+
69+
#if HAVE_AS_ARCHEXT_SVE2_DIRECTIVE
70+
#define ENABLE_SVE2 .arch_extension sve2
71+
#define DISABLE_SVE2 .arch_extension nosve2
72+
#else
73+
#define ENABLE_SVE2
74+
#define DISABLE_SVE2
75+
#endif
76+
77+
DISABLE_DOTPROD
78+
DISABLE_I8MM
79+
DISABLE_SVE
80+
DISABLE_SVE2
81+
4182

4283
/* Support macros for
4384
* - Armv8.3-A Pointer Authentication and
@@ -157,7 +198,7 @@
157198
.popsection
158199
#endif
159200

160-
.macro function name, export=0, align=2
201+
.macro function name, export=0, align=4
161202
.macro endfunc
162203
ELF .size \name, . - \name
163204
FUNC .endfunc
@@ -178,7 +219,7 @@ FUNC .func \name
178219
.endif
179220
.endm
180221

181-
.macro const name, align=2, relocate=0
222+
.macro const name, align=4, relocate=0
182223
.macro endconst
183224
ELF .size \name, . - \name
184225
.purgem endconst
File renamed without changes.

tests/checkasm/timer_aarch64.h renamed to tests/checkasm/aarch64/timer.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424
#include <stdint.h>
2525
#include "config.h"
2626

27-
#if defined(__APPLE__)
28-
29-
#include <mach/mach_time.h>
30-
31-
#define AV_READ_TIME mach_absolute_time
32-
33-
#elif HAVE_INLINE_ASM
27+
#if HAVE_INLINE_ASM
3428

3529
#define AV_READ_TIME read_time
3630

@@ -39,7 +33,16 @@ static inline uint64_t read_time(void)
3933
uint64_t cycle_counter;
4034
__asm__ volatile(
4135
"isb \t\n"
36+
#if defined(__ANDROID__) || defined(__APPLE__)
37+
// cntvct_el0 has lower resolution than pmccntr_el0, but is usually
38+
// accessible from user space by default.
39+
"mrs %0, cntvct_el0 "
40+
#else
41+
// pmccntr_el0 has higher resolution, but is usually not accessible
42+
// from user space by default (but access can be enabled with a custom
43+
// kernel module).
4244
"mrs %0, pmccntr_el0 "
45+
#endif
4346
: "=r"(cycle_counter) :: "memory" );
4447

4548
return cycle_counter;

0 commit comments

Comments
 (0)