This is an archive of the discontinued LLVM Phabricator instance.

[SPE] Support constrained float operations on SPE
ClosedPublic

Authored by qiucf on Apr 26 2021, 3:08 AM.

Details

Summary

This patch enables support on SPE for constrained fadd/fsub/fmul/fdiv/fma and compare operations. The motivation is https://bugs.llvm.org/show_bug.cgi?id=50070.

One thing I'm not pretty sure is the fcmp versus fcmps. On description of SPE float comparing instructions, I saw:

If either operand contains a NaN, infinity, or a denorm and floating-point invalid exceptions are enabled in the SPEFSCR, the exception is taken. If the exception is not enabled, the comparison treats NaNs, infinities, and denorms as normalized numbers.

So I think fcmps should be the enabled one. (LangRef section) But when I'm targeting SPE using clang, it generates IR with some fcmp and some other fcmps.

Diff Detail

Event Timeline

qiucf created this revision.Apr 26 2021, 3:08 AM
qiucf requested review of this revision.Apr 26 2021, 3:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2021, 3:08 AM
qiucf updated this revision to Diff 340471.Apr 26 2021, 3:10 AM
qiucf added reviewers: jhibbits, nemanjai, uweigand.
jhibbits accepted this revision.Apr 26 2021, 8:02 AM

To be honest, I don't know the correct intrinsic. SPE is a strange beast, and effectively requires support from the operating system in order to behave comparable to a traditional FPU. What you have looks good to me.

This revision is now accepted and ready to land.Apr 26 2021, 8:02 AM
This revision was automatically updated to reflect the committed changes.