This is an archive of the discontinued LLVM Phabricator instance.

[libc++][math.h] Remove __libcpp_<func> functions and instead call builtins directly
ClosedPublic

Authored by philnik on Nov 5 2022, 1:52 PM.

Diff Detail

Event Timeline

philnik created this revision.Nov 5 2022, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2022, 1:52 PM
philnik requested review of this revision.Nov 5 2022, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2022, 1:52 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

In general a nice cleanup, but I have a question.

libcxx/include/math.h
532

This one and the next ones didn't call a __builtin. Does this work on all supported platforms?

philnik added inline comments.Nov 8 2022, 7:46 AM
libcxx/include/math.h
532

I think the builtin just resolves to either a compiler-rt/libgcc function call or an instruction on most (all?) platforms. At least on x86, armv7 and powerpc64: https://godbolt.org/z/8cb4z98hz, so I think it's fine. In glibc the normal functions are just aliases to the builtins.

Mordante added inline comments.Nov 10 2022, 8:27 AM
libcxx/include/math.h
532

Let's see what the CI says. If it's happy I'm happy. I like to see it run before approving. (It now fails to apply.)

ldionne accepted this revision.Nov 21 2022, 8:22 AM

LGTM if CI is happy. This is a nice simplification and it gets us much closer to working on freestanding implementation that don't have a complete <math.h> implementation.

This revision is now accepted and ready to land.Nov 21 2022, 8:22 AM
Mordante accepted this revision.Nov 22 2022, 8:51 AM

The CI is happy, so I'm happy. LGTM!