diff --git a/meson.build b/meson.build index af233ad4..86fb652c 100644 --- a/meson.build +++ b/meson.build @@ -437,6 +437,28 @@ if is_asm_enabled and host_machine.cpu_family().startswith('x86') ]) endif +use_gaspp = false +if (is_asm_enabled and + (host_machine.cpu_family() == 'aarch64' or + host_machine.cpu_family().startswith('arm')) and + cc.get_argument_syntax() == 'msvc') + gaspp = find_program('gas-preprocessor.pl') + use_gaspp = true + gaspp_gen = generator(gaspp, + output: '@BASENAME@.obj', + arguments: [ + '-as-type', 'armasm', + '-arch', host_machine.cpu_family(), + '--', + host_machine.cpu_family() == 'aarch64' ? 'armasm64' : 'armasm', + '-nologo', + '-I@0@'.format(dav1d_src_root), + '-I@0@/'.format(meson.current_build_dir()), + '@INPUT@', + '-c', + '-o', '@OUTPUT@' + ]) +endif # Generate config.h config_h_target = configure_file(output: 'config.h', configuration: cdata) diff --git a/src/meson.build b/src/meson.build index e19194df..0bed80f0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -82,7 +82,7 @@ libdav1d_entrypoints_sources = files( ) # ASM specific sources -libdav1d_nasm_objs = [] +libdav1d_asm_objs = [] # Arch-specific flags arch_flags = [] if is_asm_enabled @@ -102,7 +102,7 @@ if is_asm_enabled ) if (host_machine.cpu_family() == 'aarch64' or host_machine.cpu() == 'arm64') - libdav1d_sources += files( + libdav1d_sources_asm = files( # itx.S is used for both 8 and 16 bpc. 'arm/64/itx.S', 'arm/64/looprestoration_common.S', @@ -110,7 +110,7 @@ if is_asm_enabled ) if dav1d_bitdepths.contains('8') - libdav1d_sources += files( + libdav1d_sources_asm += files( 'arm/64/cdef.S', 'arm/64/ipred.S', 'arm/64/loopfilter.S', @@ -120,7 +120,7 @@ if is_asm_enabled endif if dav1d_bitdepths.contains('16') - libdav1d_sources += files( + libdav1d_sources_asm += files( 'arm/64/cdef16.S', 'arm/64/ipred16.S', 'arm/64/itx16.S', @@ -130,12 +130,12 @@ if is_asm_enabled ) endif elif host_machine.cpu_family().startswith('arm') - libdav1d_sources += files( + libdav1d_sources_asm = files( 'arm/32/msac.S', ) if dav1d_bitdepths.contains('8') - libdav1d_sources += files( + libdav1d_sources_asm += files( 'arm/32/cdef.S', 'arm/32/ipred.S', 'arm/32/itx.S', @@ -146,11 +146,17 @@ if is_asm_enabled endif if dav1d_bitdepths.contains('16') - libdav1d_sources += files( + libdav1d_sources_asm += files( 'arm/32/mc16.S', ) endif endif + + if use_gaspp + libdav1d_asm_objs = gaspp_gen.process(libdav1d_sources_asm) + else + libdav1d_sources += libdav1d_sources_asm + endif elif host_machine.cpu_family().startswith('x86') libdav1d_sources += files( @@ -201,7 +207,7 @@ if is_asm_enabled endif # Compile the ASM sources with NASM - libdav1d_nasm_objs = nasm_gen.process(libdav1d_sources_asm) + libdav1d_asm_objs = nasm_gen.process(libdav1d_sources_asm) elif host_machine.cpu() == 'ppc64le' arch_flags = ['-maltivec', '-mvsx'] libdav1d_sources += files( @@ -291,7 +297,7 @@ endif libdav1d = library('dav1d', libdav1d_sources, - libdav1d_nasm_objs, + libdav1d_asm_objs, libdav1d_rc_obj, objects : [ diff --git a/tests/meson.build b/tests/meson.build index 6cdcbbf5..d13ec138 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -60,20 +60,27 @@ if is_asm_enabled checkasm_bitdepth_objs += checkasm_bitdepth_lib.extract_all_objects() endforeach - checkasm_nasm_objs = [] + checkasm_asm_objs = [] + checkasm_asm_sources = [] if host_machine.cpu_family() == 'aarch64' or host_machine.cpu() == 'arm64' - checkasm_sources += files('checkasm/arm/checkasm_64.S') + checkasm_asm_sources += files('checkasm/arm/checkasm_64.S') elif host_machine.cpu_family().startswith('arm') - checkasm_sources += files('checkasm/arm/checkasm_32.S') + checkasm_asm_sources += files('checkasm/arm/checkasm_32.S') elif host_machine.cpu_family().startswith('x86') - checkasm_nasm_objs = nasm_gen.process(files('checkasm/x86/checkasm.asm')) + checkasm_asm_objs += nasm_gen.process(files('checkasm/x86/checkasm.asm')) + endif + + if use_gaspp + checkasm_asm_objs += gaspp_gen.process(checkasm_asm_sources) + else + checkasm_sources += checkasm_asm_sources endif m_lib = cc.find_library('m', required: false) checkasm = executable('checkasm', checkasm_sources, - checkasm_nasm_objs, + checkasm_asm_objs, objects: [ checkasm_bitdepth_objs,