This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Re-implement the lowering for 32-bit floating point division
ClosedPublic

Authored by cfang on Apr 13 2016, 2:31 PM.

Details

Summary

Expand fdiv32 instruction to generate the desired precision following IEEE spec.

NOTE: we may still need to modify fdiv.ll test to check the exact code sequence! This implementation has mainly been done by Wei!

Diff Detail

Event Timeline

cfang updated this revision to Diff 53620.Apr 13 2016, 2:31 PM
cfang retitled this revision from to AMDGPU/SI: Re-implement the lowering for 32-bit floating point division.
cfang updated this object.
cfang added reviewers: tstellarAMD, arsenm, wdng.
cfang added subscribers: llvm-commits, arsenm.
arsenm edited edge metadata.Apr 13 2016, 2:43 PM

Can you reupload the diff with context. Is this fixing the lowering of just frem?

cfang updated this revision to Diff 53627.Apr 13 2016, 2:52 PM
cfang edited edge metadata.

New diff posted. This actually implements the lowering of 32-bit floating point division: SITargetLowering::LowerFDIV32.
It affects frem because frem is using fdiv.

The fdiv test must be modified.

We should not simply replace the division lowering this way. This should be controlled by precision options, so the existing lowering should still be able to work

cfang updated this revision to Diff 55314.Apr 27 2016, 2:23 PM

Update based on Matt's comments:

  1. Keep the original fpdiv32 expansion under fast_math;
  2. update the LIT test for fpdiv.ll
cfang updated this revision to Diff 56210.May 4 2016, 3:12 PM

update a typo. && Ping

arsenm added inline comments.May 9 2016, 10:21 AM
test/CodeGen/AMDGPU/fdiv.ll
83–88

Can you add a test where the fast math flag is missing from the interaction, but globally enabled?

129–134

A lot of these are broken with _. Also note that repeating the same instruction multiple times with -DAG does not behave as expected

cfang updated this revision to Diff 57374.May 16 2016, 11:08 AM

Add a test with function attribute "unsafe-fp-math=true";
Correct a typo (SI-DAG instead of SI_DAG)

Thanks;

arsenm accepted this revision.Jun 27 2016, 2:31 PM
arsenm edited edge metadata.

A version of this was committed a while ago

This revision is now accepted and ready to land.Jun 27 2016, 2:31 PM
arsenm closed this revision.Jun 27 2016, 2:31 PM