meson.build 1.48 KB
Newer Older
Iñigo Martínez's avatar
Iñigo Martínez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
graphene_bench_sources = [
  'graphene-bench-utils.h',
  'graphene-bench-utils.c'
]

graphene_bench = static_library('graphene-bench', graphene_bench_sources,
                                c_args: [
                                  '-DG_LOG_DOMAIN="Graphene-Bench"'
                                ],
                                include_directories: [ graphene_inc ],
                                install: false,
                                dependencies: [ mathlib, graphene_dep ])
graphene_bench_dep = declare_dependency(link_with: [ graphene_bench ])

have_sse = graphene_simd.contains('sse2')
have_gcc = graphene_simd.contains('gcc')
have_neon = graphene_simd.contains('neon')
have_scalar = true      # scalar support is always compiled in

all_simds = [
  [ 'SSE', 'sse', have_sse ],
  [ 'GCC', 'gcc', have_gcc ],
  [ 'ARM_NEON', 'neon', have_neon ],
  [ 'SCALAR', 'scalar', have_scalar ]
]

bench_units = [
  'matrix'
]

foreach simd: all_simds
  run_test = simd[2]
  if run_test
    foreach unit: bench_units
      exe = executable('@0@-@1@'.format(unit, simd[1]), unit + '.c',
                       c_args: [
                         '-DGRAPHENE_COMPILATION',
                         '-DGRAPHENE_SIMD_BENCHMARK',
                         '-DGRAPHENE_HAS_' + simd[0],
                       ],
                       install: false,
                       dependencies: [ graphene_bench_dep, graphene_dep ])
      benchmark('@0@-@1@'.format(unit, simd[1]), exe)
    endforeach
  endif
endforeach