diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index c149673bce991..c458efb528b8f 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -105,7 +105,7 @@ macro(add_libclc_builtin_set arch_suffix) install( FILES ${LIBCLC_LIBRARY_OUTPUT_INTDIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) - + # Generate remangled variants if requested if( LIBCLC_GENERATE_REMANGLED_VARIANTS ) set(dummy_in "${CMAKE_BINARY_DIR}/lib/clc/libclc_dummy_in.cc") @@ -149,6 +149,29 @@ macro(add_libclc_builtin_set arch_suffix) DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) endforeach() endforeach() + + # For remangler tests we do not care about long_width, or signedness, as it + # performs no substitutions. + # Collect all remangler tests in libclc-remangler-tests to later add + # dependency against check-libclc. + set(libclc-remangler-tests) + set(libclc-remangler-test-no 0) + set(libclc-remangler-target-ir + "$" + "${LIBCLC_LIBRARY_OUTPUT_INTDIR}/builtins.link.${obj_suffix}" + "$") + foreach(target-ir ${libclc-remangler-target-ir}) + math(EXPR libclc-remangler-test-no "${libclc-remangler-test-no}+1") + set(current-test "libclc-remangler-test-${obj_suffix}-${libclc-remangler-test-no}") + add_custom_target(${current-test} + COMMAND libclc-remangler + --long-width=l32 + --char-signedness=signed + --input-ir=${target-ir} + ${dummy_in} -t -o - + DEPENDS "${builtins_obj_path}" "prepare-${obj_suffix}" "${dummy_in}" libclc-remangler) + list(APPEND libclc-remangler-tests ${current-test}) + endforeach() endif() # nvptx-- targets don't include workitem builtins diff --git a/libclc/test/CMakeLists.txt b/libclc/test/CMakeLists.txt index 2b5af7df26872..2a71b2842d9f7 100644 --- a/libclc/test/CMakeLists.txt +++ b/libclc/test/CMakeLists.txt @@ -45,25 +45,9 @@ foreach( t ${LIBCLC_TARGET_TO_TEST} ) endforeach( t ) if(LIBCLC_GENERATE_REMANGLED_VARIANTS) - # Run remangler in test mode if generating remangled variants and make sure - # it depends on check-libclc target. - # Both `long_widths` and `char_signedness` are set in AddLibclc.cmake and can - # be used here. - foreach(long_width ${long_widths}) - foreach(signedness ${char_signedness}) - # In `-t` (TestRun) the remangler does not perform any substitutions, it - # needs to make sure that the remangled name matches the original mangled - # one. - set (test_target_name "test-remangled-${long_width}-${signedness}_char") - add_custom_target(${test_target_name} - COMMAND libclc-remangler - --long-width=${long_width} - --char-signedness=${signedness} - --input-ir="$" - ${dummy_in} -t -o - - DEPENDS "${builtins_obj_path}" "prepare-${obj_suffix}" "${dummy_in}" libclc-remangler) - - add_dependencies(check-libclc ${test_target_name}) - endforeach() + #Now that check-libclc is defined make sure that all remangler targets depend + # on it. + foreach(remangler-test ${libclc-remangler-tests}) + add_dependencies(check-libclc ${remangler-test}) endforeach() endif()