We want the !fpmath metadata to be attached to the sqrt intrinsic to
make it to the backend lowering. Emit an available_externally
definition which uses the builtin, which emits the !fpmath.
Fixes #64264
Differential D156743
clang/OpenCL: Add inline implementations of sqrt in builtin header arsenm on Jul 31 2023, 2:15 PM. Authored by
Details
Diff Detail Event TimelineComment Actions Move to base header and fix test. update_cc_test_checks --include-generated-funcs does a terrible job here so write manually checks
Comment Actions If we go with this approach, please also remove sqrt from clang/lib/Sema/OpenCLBuiltins.td (and ideally add a comment pointing out that sqrt is handled in opencl-c-base.h)
Comment Actions ping The alternative is to directly put the !fpmath on the sqrt call sites but I have no idea how to do that Comment Actions If we think there are no better alternatives and implementation is generic enough for every vendor, LGTM! Comment Actions You could argue annotating the raw callsite is better but I don't know how to implement that |