brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.4 KiB · 618a6d0 Raw
515 lines · plain
1add_library(2  libc_diff_test_utils STATIC3  Timer.cpp4  Timer.h5)6target_include_directories(7  libc_diff_test_utils8  PRIVATE9    ${LIBC_SOURCE_DIR}10)11add_dependencies(12  libc_diff_test_utils13  libc.src.__support.macros.config14)15 16# A convenience target to build all performance tests.17add_custom_target(libc-math-performance-tests)18 19function(add_perf_binary target_name)20  cmake_parse_arguments(21    "PERF"22    "" # No optional arguments23    "SUITE;CXX_STANDARD" # Single value arguments24    "SRCS;HDRS;DEPENDS;COMPILE_OPTIONS;LINK_LIBRARIES" # Multi-value arguments25    ${ARGN}26  )27  if(NOT PERF_SRCS)28    message(FATAL_ERROR "'add_perf_binary' target requires a SRCS list of .cpp "29                        "files.")30  endif()31  if(NOT PERF_DEPENDS)32    message(FATAL_ERROR "'add_perf_binary' target requires a DEPENDS list of "33                        "'add_entrypoint_object' targets.")34  endif()35 36  get_fq_target_name(${target_name} fq_target_name)37  get_fq_deps_list(fq_deps_list ${PERF_DEPENDS})38  get_object_files_for_test(39      link_object_files skipped_entrypoints_list ${fq_deps_list})40  if(skipped_entrypoints_list)41    if(LIBC_CMAKE_VERBOSE_LOGGING)42      set(msg "Will not build ${fq_target_name} as it has missing deps: "43              "${skipped_entrypoints_list}.")44      message(STATUS ${msg})45    endif()46    return()47  endif()48 49  add_executable(50    ${fq_target_name}51    EXCLUDE_FROM_ALL52    ${PERF_SRCS}53    ${PERF_HDRS}54  )55  target_include_directories(56    ${fq_target_name}57    PRIVATE58      ${LIBC_SOURCE_DIR}59  )60  if(PERF_COMPILE_OPTIONS)61    target_compile_options(62      ${fq_target_name}63      PRIVATE ${PERF_COMPILE_OPTIONS}64    )65  endif()66 67  set(link_libraries ${link_object_files})68  foreach(lib IN LISTS PERF_LINK_LIBRARIES)69    list(APPEND link_libraries ${lib}.unit)70  endforeach()71  target_link_libraries(72      ${fq_target_name}73      PRIVATE ${link_libraries} libc_diff_test_utils)74 75  set_target_properties(${fq_target_name}76    PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})77 78  if(PERF_CXX_STANDARD)79    set_target_properties(80      ${fq_target_name}81      PROPERTIES82        CXX_STANDARD ${PERF_CXX_STANDARD}83    )84  endif()85 86  add_dependencies(87    ${fq_target_name}88    libc.src.__support.FPUtil.fp_bits89    ${fq_deps_list}90  )91  add_dependencies(libc-math-performance-tests ${fq_target_name})92endfunction()93 94add_header_library(95  perf_test96  HDRS97    PerfTest.h98  DEPENDS99    libc.src.__support.CPP.algorithm100    libc.src.__support.FPUtil.fp_bits101)102 103add_perf_binary(104  sinf_perf105  SRCS106    sinf_perf.cpp107  DEPENDS108    .perf_test109    libc.src.math.sinf110  COMPILE_OPTIONS111    -fno-builtin112)113 114add_perf_binary(115  cosf_perf116  SRCS117    cosf_perf.cpp118  DEPENDS119    .perf_test120    libc.src.math.cosf121  COMPILE_OPTIONS122    -fno-builtin123)124 125add_perf_binary(126  expm1f_perf127  SRCS128    expm1f_perf.cpp129  DEPENDS130    .perf_test131    libc.src.math.expm1f132  COMPILE_OPTIONS133    -fno-builtin134)135 136add_perf_binary(137  ceilf_perf138  SRCS139    ceilf_perf.cpp140  DEPENDS141    .perf_test142    libc.src.math.ceilf143  COMPILE_OPTIONS144    -fno-builtin145)146 147add_perf_binary(148  exp10f16_perf149  SRCS150    exp10f16_perf.cpp151  DEPENDS152    .perf_test153    libc.src.math.exp10f16154  COMPILE_OPTIONS155    -fno-builtin156)157 158add_perf_binary(159  exp2f_perf160  SRCS161    exp2f_perf.cpp162  DEPENDS163    .perf_test164    libc.src.math.exp2f165  COMPILE_OPTIONS166    -fno-builtin167)168 169add_perf_binary(170  exp2f16_perf171  SRCS172    exp2f16_perf.cpp173  DEPENDS174    .perf_test175    libc.src.math.exp2f16176  COMPILE_OPTIONS177    -fno-builtin178)179 180add_perf_binary(181  expf_perf182  SRCS183    expf_perf.cpp184  DEPENDS185    .perf_test186    libc.src.math.expf187  COMPILE_OPTIONS188    -fno-builtin189)190 191add_perf_binary(192  expf16_perf193  SRCS194    expf16_perf.cpp195  DEPENDS196    .perf_test197    libc.src.math.expf16198  COMPILE_OPTIONS199    -fno-builtin200)201 202add_perf_binary(203  fabsf_perf204  SRCS205    fabsf_perf.cpp206  DEPENDS207    .perf_test208    libc.src.math.fabsf209  COMPILE_OPTIONS210    -fno-builtin211)212 213add_perf_binary(214  floorf_perf215  SRCS216    floorf_perf.cpp217  DEPENDS218    .perf_test219    libc.src.math.floorf220  COMPILE_OPTIONS221    -fno-builtin222)223 224add_perf_binary(225  log10f_perf226  SRCS227    log10f_perf.cpp228  DEPENDS229    .perf_test230    libc.src.math.log10f231  COMPILE_OPTIONS232    -fno-builtin233)234 235add_perf_binary(236  log1pf_perf237  SRCS238    log1pf_perf.cpp239  DEPENDS240    .perf_test241    libc.src.math.log1pf242  COMPILE_OPTIONS243    -fno-builtin244)245 246add_perf_binary(247  log2f_perf248  SRCS249    log2f_perf.cpp250  DEPENDS251    .perf_test252    libc.src.math.log2f253  COMPILE_OPTIONS254    -fno-builtin255)256 257add_perf_binary(258  logf_perf259  SRCS260    logf_perf.cpp261  DEPENDS262    .perf_test263    libc.src.math.logf264  COMPILE_OPTIONS265    -fno-builtin266)267 268add_perf_binary(269  logbf_perf270  SRCS271    logbf_perf.cpp272  DEPENDS273    .perf_test274    libc.src.math.logbf275  COMPILE_OPTIONS276    -fno-builtin277)278 279add_perf_binary(280  nearbyintf_perf281  SRCS282    nearbyintf_perf.cpp283  DEPENDS284    .perf_test285    libc.src.math.nearbyintf286  COMPILE_OPTIONS287    -fno-builtin288)289 290add_perf_binary(291  rintf_perf292  SRCS293    rintf_perf.cpp294  DEPENDS295    .perf_test296    libc.src.math.rintf297  COMPILE_OPTIONS298    -fno-builtin299)300 301add_perf_binary(302  roundf_perf303  SRCS304    roundf_perf.cpp305  DEPENDS306    .perf_test307    libc.src.math.roundf308  COMPILE_OPTIONS309    -fno-builtin310)311 312add_perf_binary(313  sqrtf_perf314  SRCS315    sqrtf_perf.cpp316  DEPENDS317    .perf_test318    libc.src.math.sqrtf319  COMPILE_OPTIONS320    -fno-builtin321)322 323add_perf_binary(324  truncf_perf325  SRCS326    truncf_perf.cpp327  DEPENDS328    .perf_test329    libc.src.math.truncf330  COMPILE_OPTIONS331    -fno-builtin332)333 334add_perf_binary(335  hypotf16_perf336  SRCS337    hypotf16_perf.cpp338  DEPENDS339    .perf_test340    libc.src.math.hypotf16341    libc.src.__support.FPUtil.fp_bits342  COMPILE_OPTIONS343    -fno-builtin344)345 346add_perf_binary(347  hypotf_perf348  SRCS349    hypotf_perf.cpp350  DEPENDS351    .perf_test352    libc.src.math.hypotf353  COMPILE_OPTIONS354    -fno-builtin355)356 357add_perf_binary(358  hypot_perf359  SRCS360    hypot_perf.cpp361  DEPENDS362    .perf_test363    libc.src.math.hypot364  COMPILE_OPTIONS365    -fno-builtin366)367 368add_perf_binary(369  fmodf_perf370  SRCS371    fmodf_perf.cpp372  DEPENDS373    .perf_test374    libc.src.math.fmodf375  COMPILE_OPTIONS376    -fno-builtin377)378 379add_perf_binary(380  fmod_perf381  SRCS382    fmod_perf.cpp383  DEPENDS384    .perf_test385    libc.src.math.fmod386  COMPILE_OPTIONS387    -fno-builtin388)389 390add_perf_binary(391  fmodl_perf392  SRCS393    fmodl_perf.cpp394  DEPENDS395    .perf_test396    libc.src.math.fmodl397  COMPILE_OPTIONS398    -fno-builtin399)400 401add_perf_binary(402  fmodf16_perf403  SRCS404    fmodf16_perf.cpp405  DEPENDS406    .perf_test407    libc.src.math.fmodf16408    libc.src.__support.FPUtil.generic.fmod409    libc.src.__support.macros.properties.types410)411 412add_perf_binary(413  fmodf128_perf414  SRCS415    fmodf128_perf.cpp416  DEPENDS417    .perf_test418    libc.src.math.fmodf128419    libc.src.__support.macros.properties.types420  COMPILE_OPTIONS421    -fno-builtin422)423 424add_perf_binary(425  nearest_integer_funcs_perf426  SRCS427    nearest_integer_funcs_perf.cpp428  DEPENDS429    libc.src.math.ceilf430    libc.src.math.ceilf16431    libc.src.math.floorf432    libc.src.math.floorf16433    libc.src.math.rintf434    libc.src.math.rintf16435    libc.src.math.roundf436    libc.src.math.roundf16437    libc.src.math.roundevenf438    libc.src.math.roundevenf16439    libc.src.math.truncf440    libc.src.math.truncf16441  COMPILE_OPTIONS442    -fno-builtin443  LINK_LIBRARIES444    LibcFPTestHelpers445)446 447add_perf_binary(448  misc_basic_ops_perf449  SRCS450    misc_basic_ops_perf.cpp451  DEPENDS452    .perf_test453    libc.src.math.copysignf454    libc.src.math.copysignf16455    libc.src.math.fabsf456    libc.src.math.fabsf16457  COMPILE_OPTIONS458    -fno-builtin459)460 461add_perf_binary(462  max_min_funcs_perf463  SRCS464    max_min_funcs_perf.cpp465  DEPENDS466    .perf_test467    libc.src.math.fmaxf468    libc.src.math.fmaxf16469    libc.src.math.fmaximumf470    libc.src.math.fmaximumf16471    libc.src.math.fmaximum_numf472    libc.src.math.fmaximum_numf16473    libc.src.math.fminf474    libc.src.math.fminf16475    libc.src.math.fminimumf476    libc.src.math.fminimumf16477    libc.src.math.fminimum_numf478    libc.src.math.fminimum_numf16479  COMPILE_OPTIONS480    -fno-builtin481)482 483add_perf_binary(484  fmul_perf485  SRCS486    fmul_perf.cpp487  DEPENDS488    .perf_test489    libc.src.math.fmul490    libc.src.__support.FPUtil.generic.mul491    libc.src.__support.FPUtil.fp_bits492  COMPILE_OPTIONS493    -fno-builtin494)495 496add_perf_binary(497  fmull_perf498  SRCS499    fmull_perf.cpp500  DEPENDS501    .perf_test502    libc.src.math.fmull503  COMPILE_OPTIONS504    -fno-builtin505)506 507add_perf_binary(508  sqrtf128_perf509  SRCS510    sqrtf128_perf.cpp511  DEPENDS512    .perf_test513    libc.src.math.sqrtf128514)515