This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add documentation about how to add a math function to LLVM-libc.
ClosedPublic

Authored by lntue on Dec 12 2021, 9:02 PM.

Details

Summary

Add documentation about how to add a math function to LLVM-libc.

Diff Detail

Event Timeline

lntue created this revision.Dec 12 2021, 9:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2021, 9:02 PM
lntue requested review of this revision.Dec 12 2021, 9:02 PM
sivachandra added inline comments.Dec 13 2021, 11:54 PM
libc/src/math/docs/add_math_function.md
2

We should talk about the why of this document. For example, something like:

This document is to serve as a cookbook for adding a new math function implementation to LLVM libc. To add a new function, apart from the actual implementation, one has to follow a few other steps to setup proper registration and shipping of the new function. This documents describes each of these steps in detail.
6

Explain a little about what this registration is for. Ditto for all sections.

michaelrj accepted this revision.Dec 14 2021, 10:16 AM

LGTM with a few nits

libc/src/math/docs/add_math_function.md
46

I think you mean "preferred to be included: as opposed to "preferable to be implemented"

59

I think adding the word "link" between "corresponding" and "between" makes the sentence clearer.

75

"Add an exhaustive test to:"

182

fix the missing newline at the end of the file.

This revision is now accepted and ready to land.Dec 14 2021, 10:16 AM
lntue updated this revision to Diff 394595.Dec 15 2021, 9:55 AM

[libc] Add documentation about how to add a math function to LLVM-libc.

lntue marked 6 inline comments as done.Dec 15 2021, 9:55 AM
sivachandra added inline comments.Dec 16 2021, 12:12 AM
libc/src/math/docs/add_math_function.md
29

In the below example, put func in angle brackets like <func> to indicate that it is the variable.

71

Line length.

117

s/default implementation (glibc)/system libc implementation (which very often is glibc).

122

s/func_perf.cpp/<func>_perf.cpp

153

We don't do libm anymore.

164

Replace func_test with <func>_test below.

171

This does not run the test.

sivachandra accepted this revision.Dec 16 2021, 12:12 AM
lntue updated this revision to Diff 394861.Dec 16 2021, 7:04 AM
lntue marked 6 inline comments as done.

[libc] Add documentation about how to add a math function to LLVM-libc.

libc/src/math/docs/add_math_function.md
171

Somehow it actually does for exhaustive tests. I'll update the doc when we change that behavior.

sivachandra accepted this revision.Dec 16 2021, 8:12 AM
sivachandra added inline comments.
libc/src/math/docs/add_math_function.md
143

If you don't specify the full build option, you don't need clang and clang-tools-extra.

lntue updated this revision to Diff 394905.Dec 16 2021, 9:12 AM

[libc] Add documentation about how to add a math function to LLVM-libc.

This revision was landed with ongoing or failed builds.Dec 16 2021, 9:13 AM
This revision was automatically updated to reflect the committed changes.
lntue marked an inline comment as done.Dec 16 2021, 9:14 AM