This is an archive of the discontinued LLVM Phabricator instance.

[COMPILER-RT] Implement __addtf3 and __subtf3
ClosedPublic

Authored by koviankevin on Feb 13 2014, 9:47 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

koviankevin updated this revision to Unknown Object (????).Feb 19 2014, 6:12 PM

add test

Please just hardcode the expected results and compare them by using *integer* operations (or other runtime functions, if we have suitable ones).

test/builtins/Unit/addtf3_test.c
43–44 ↗(On Diff #7226)

It can be. Just compare the binary representation.

koviankevin updated this revision to Unknown Object (????).Feb 24 2014, 7:47 PM

Use CRT_HAS_128BIT and apply comments by gribozavr

koviankevin updated this revision to Unknown Object (????).Feb 27 2014, 8:42 PM

introduce CRT_LDBL_128BIT

gribozavr added inline comments.Mar 4 2014, 2:44 AM
test/builtins/Unit/addtf3_test.c
21–57 ↗(On Diff #7329)

Please don't duplicate these helpers, factor them out to a shared header.

83 ↗(On Diff #7329)

It would be easier to read these tests if in addition to fromRep() there were makePlusInf(), makeQNaN() etc.

test/builtins/Unit/subtf3_test.c
21–32 ↗(On Diff #7329)

Even though there is no intention of breaking this union trick in Clang, it is undefined behavior. The correct way to do this is to use memcpy() to copy from long double* to __uint128_t*.

koviankevin updated this revision to Unknown Object (????).Mar 10 2014, 1:12 AM

modify by gribozavr's comment and use COMPILER_RT_ABI

joerg added a subscriber: joerg.May 15 2014, 7:53 AM

Sorry for leaving this hanging so long. Can you just commit the refactoring of addsf3.c / adddf3.c first without changing the comment style?
The file diff should be just the constant translation. Adding the tf frontend with the test cases is fine after that.

koviankevin updated this revision to Diff 9732.May 23 2014, 1:03 AM

use UINT64_C and drop le64
adddf3.c and addsf3.c are refactored in D3885

joerg accepted this revision.May 23 2014, 4:54 AM
joerg added a reviewer: joerg.
This revision is now accepted and ready to land.May 23 2014, 4:54 AM

I'm unfamiliar with this review system... is this just waiting for someone to submit?

joerg closed this revision.Jun 19 2014, 1:32 PM
joerg updated this revision to Diff 10656.

Closed by commit rL211312 (authored by @joerg).