Page MenuHomePhabricator

[arm+x86] Make GNU variants behave like GNU w.r.t combining sin+cos into sincos.
ClosedPublic

Authored by dsanders on Jun 16 2016, 6:55 AM.

Details

Summary

canCombineSinCosLibcall() would previously combine sin+cos into sincos for
GNUX32/GNUEABI/GNUEABIHF regardless of whether UnsafeFPMath were set or not.
However, GNU would only combine them for UnsafeFPMath because sincos does not
set errno like sin and cos do. It seems likely that this is an oversight.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 60967.Jun 16 2016, 6:55 AM
dsanders retitled this revision from to [arm+x86] Make GNU variants behave like GNU w.r.t combining sin+cos into sincos..
dsanders updated this object.
dsanders added subscribers: rengolin, llvm-commits.

This looks ok to me, but better to get more feed back from other people, as I was not really in the loop for sin/cos thing. :)

t.p.northover accepted this revision.Jun 16 2016, 8:36 AM
t.p.northover added a reviewer: t.p.northover.
t.p.northover added a subscriber: t.p.northover.

I think it's just an omission to. sincos is definitely in my local copy of libm.so. I say go for it! (And thanks for the work).

Tim.

This revision is now accepted and ready to land.Jun 16 2016, 8:36 AM

Actually, it looks like it's in the androideabi too (since 2.3), so it might be a good idea to add that.

Tim.

Actually, it looks like it's in the androideabi too (since 2.3), so it might be a good idea to add that.

Ah, yes, I thought about that, and forgot to say. :)

--renato

I think it's just an omission to. sincos is definitely in my local copy of libm.so. I say go for it! (And thanks for the work).

Tim.

Thanks.

Actually, it looks like it's in the androideabi too (since 2.3), so it might be a good idea to add that.

Tim.

Is this combine beneficial for android at the moment? According to https://android.googlesource.com/platform/bionic/+/master/libm/sincos.c, android's sincos uses -O0 and just forwards the call to sin and cos. It looks like you'd be getting two calls for the price of three.

dsanders closed this revision.Jun 21 2016, 5:35 AM

I left androideabi alone in the commit since I think it's slower to call sincos than to call sin and cos separately in bionic.