This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU/GlobalISel] Add llvm.amdgcn.fdiv.fast legalization.
ClosedPublic

Authored by kerbowa on Jul 18 2019, 5:58 PM.

Event Timeline

kerbowa created this revision.Jul 18 2019, 5:58 PM

Can you also remove the case for it in AMDGPURegisterBankInfo? It should never make it to RegBankSelected

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1288–1293

We don't really need to use F_CONSTANT. You can just use G_CONSTANT and the constant values directly without going through APFloat

1298

Should propagate the fast math flags

1305–1308

buildFMul

kerbowa updated this revision to Diff 210948.Jul 20 2019, 12:06 AM

Address comments.

kerbowa marked 3 inline comments as done.Jul 20 2019, 12:07 AM
arsenm added inline comments.Jul 20 2019, 9:32 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1290

This one is incorrect and will implicitly convert to integer. You can use FloatToBits(1.0)

1297–1298

You also set the flags here

arsenm added inline comments.Jul 20 2019, 9:36 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1290

1.0f

kerbowa updated this revision to Diff 211155.Jul 22 2019, 11:31 AM
kerbowa marked 3 inline comments as done.

Add flags to everything.

arsenm added inline comments.Jul 22 2019, 5:54 PM
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
659 ↗(On Diff #211155)

Should default to None.

I'm not sure if this one should get a flags argument. You can set it on the instruction separately from constructing it

676 ↗(On Diff #211155)

Should default to None

711 ↗(On Diff #211155)

Should default to None

720 ↗(On Diff #211155)

Should default to None

llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-intrinsic-amdgcn-fdiv-fast.mir
29

Should add another test with the flags

kerbowa marked an inline comment as done.Jul 22 2019, 6:10 PM
kerbowa added inline comments.
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
659 ↗(On Diff #211155)

The defaults are in the header.

Isn't it more consistent if you can set the flags when constructing it?

kerbowa updated this revision to Diff 211238.Jul 22 2019, 6:19 PM

Add test for propagating flags.

kerbowa updated this revision to Diff 212253.Jul 29 2019, 5:01 PM

Remove flags from buildIntrinsic.

arsenm accepted this revision.Jul 30 2019, 5:05 AM

LGTM with fabs flags fixed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1287

Missing flags

This revision is now accepted and ready to land.Jul 30 2019, 5:05 AM
kerbowa closed this revision.Jul 30 2019, 11:53 AM

r367344