Author: Fraser Cormack Date: 2025-02-24T12:31:55Z New Revision: aca8a5cb2325767859f38894f42ce47732cbb53e
URL: https://github.com/llvm/llvm-project/commit/aca8a5cb2325767859f38894f42ce47732cbb53e DIFF: https://github.com/llvm/llvm-project/commit/aca8a5cb2325767859f38894f42ce47732cbb53e.diff LOG: [libclc] Remove clspv-specific clc conversions (#128500) The clc and clc+clspv modes produced the same conversions code, so this patch simplifies the process. It further simplifies the internal checks the script makes by assuming the mutual exclusivity. Added: Modified: libclc/CMakeLists.txt libclc/generic/lib/gen_convert.py Removed: ################################################################################ diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 2a2ebec66f6a9..22c3075801785 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -258,13 +258,6 @@ if ( clspv-- IN_LIST LIBCLC_TARGETS_TO_BUILD OR clspv64-- IN_LIST LIBCLC_TARGETS DEPENDS ${script_loc} ) add_custom_target( generate-clspv-convert.cl DEPENDS clspv-convert.cl ) set_target_properties( generate-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" ) - - add_custom_command( - OUTPUT clc-clspv-convert.cl - COMMAND ${Python3_EXECUTABLE} ${script_loc} --clc --clspv > clc-clspv-convert.cl - DEPENDS ${script_loc} ) - add_custom_target( generate-clc-clspv-convert.cl DEPENDS clc-clspv-convert.cl ) - set_target_properties( generate-clc-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" ) endif() enable_testing() @@ -314,12 +307,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) endif() set( clc_lib_files ) - - if( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 ) - set( clc_gen_files clc-clspv-convert.cl ) - else() - set( clc_gen_files clc-convert.cl ) - endif() + set( clc_gen_files clc-convert.cl ) libclc_configure_lib_source( clc_lib_files diff --git a/libclc/generic/lib/gen_convert.py b/libclc/generic/lib/gen_convert.py index d2d5b7975275c..3359102224060 100644 --- a/libclc/generic/lib/gen_convert.py +++ b/libclc/generic/lib/gen_convert.py @@ -28,6 +28,7 @@ # convert_<destTypen><_sat><_roundingMode>(<sourceTypen>) import argparse +from sys import stderr parser = argparse.ArgumentParser() parser.add_argument( @@ -41,6 +42,14 @@ clc = args.clc clspv = args.clspv + +# We don't generate clspv-specific code for clc conversions - don't allow this +# accidentally (later checks rely on mutual exclusivity) +if clc and clspv: + print("Error: clc and clspv conversions are mutually exclusive", file=stderr) + exit(1) + + types = [ "char", "uchar", @@ -308,7 +317,7 @@ def generate_default_conversion(src, dst, mode): # Do not generate user-facing default conversions for clspv as they are handled # natively -if clc or not clspv: +if not clspv: for src in types: for dst in types: generate_default_conversion(src, dst, "") @@ -318,7 +327,7 @@ def generate_default_conversion(src, dst, mode): for mode in rounding_modes: # Do not generate user-facing "_rte" conversions for clspv as they # are handled natively - if clspv and not clc and mode == "_rte": + if clspv and mode == "_rte": continue generate_default_conversion(src, dst, mode) @@ -560,6 +569,6 @@ def generate_float_conversion(src, dst, size, mode, sat): for mode in rounding_modes: # Do not generate user-facing "_rte" conversions for clspv as # they are handled natively - if clspv and not clc and mode == "_rte": + if clspv and mode == "_rte": continue generate_float_conversion(src, dst, size, mode, "") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits