This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyLibCall] Inline calls to cabs when it's safe to do so.
ClosedPublic

Authored by paulwalker-arm on Nov 15 2017, 2:46 AM.

Details

Summary

When unsafe algerbra is allowed calls to cabs(r) can be replaced by:

sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))

Diff Detail

Repository
rL LLVM

Event Timeline

paulwalker-arm created this revision.Nov 15 2017, 2:46 AM
fhahn added a subscriber: fhahn.Nov 15 2017, 6:38 AM
hfinkel accepted this revision.Dec 14 2017, 4:54 PM

LGTM.

At least on PowerPC, the signature is simply two arguments:

declare double @cabs(double, double)
declare float @cabsf(float, float)
declare ppc_fp128 @cabsl(ppc_fp128, ppc_fp128)

If you could add support for that signature as well, that would be much appreciated.

This revision is now accepted and ready to land.Dec 14 2017, 4:54 PM

Adds support for versions of cabs that take discrete real and imaginary parameters.

hfinkel accepted this revision.Dec 15 2017, 7:36 AM

Thanks!

Do you have commit access?

I can commit this for you Paul, but I think you can request commit access now ;)

This revision was automatically updated to reflect the committed changes.