This is an archive of the discontinued LLVM Phabricator instance.

clang: Start emitting intrinsic for __builtin_ldexp*
ClosedPublic

Authored by arsenm on May 1 2023, 7:38 AM.

Details

Summary

Also introduce __builtin_ldexpf16.

Diff Detail

Event Timeline

arsenm created this revision.May 1 2023, 7:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 7:38 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
arsenm requested review of this revision.May 1 2023, 7:38 AM
tra added a comment.May 1 2023, 11:36 AM

Can you add a test for CUDA/NVPTX, too?

clang/lib/CodeGen/CGBuiltin.cpp
3057–3058

Should those builtins that map to an experimental intrinsic be experimental, too?

Alternatively, if the intrinsic functionality is something we intend to officially provide via clang builtin, should we drop the experimental part?

kpn added inline comments.May 2 2023, 5:24 AM
clang/lib/CodeGen/CGBuiltin.cpp
3057–3058

They only map to experimental intrinsics if you use the still fairly new FENV_ACCESS support. So I'd say no to marking them experimental. Most users of them will not encounter any experimental support.

I'm still working on getting the IR Verifier changes into the tree. At the very least I don't think we should be dropping the experimental from the names of the constrained intrinsics when there's no checking at all for violations of the rules of using them.

arsenm added inline comments.May 2 2023, 8:06 AM
clang/lib/CodeGen/CGBuiltin.cpp
3057–3058

It's not a constrained builtin, it's constrained handling for a builtin. Certainly part of the experimental part is that we only have patchwork support for strictfp for all of the builtins.

arsenm added a comment.May 2 2023, 8:12 AM

Can you add a test for CUDA/NVPTX, too?

There's nothing target specific here and I don't see a pre-existing test for nvptx generic builtin handling

arsenm updated this revision to Diff 518742.May 2 2023, 8:12 AM

Fix errno handling

tra added a comment.May 2 2023, 10:35 AM

There's nothing target specific here and I don't see a pre-existing test for nvptx generic builtin handling

You're right. My concern is actually about handling the intrinsics, not the builtins and is irrelevant for this patch.

arsenm updated this revision to Diff 518937.May 2 2023, 7:11 PM
sepavloff accepted this revision.Jun 5 2023, 5:09 AM

LGTM.

This revision is now accepted and ready to land.Jun 5 2023, 5:09 AM