This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Legalize 64-bit G_UDIV/G_UREM
ClosedPublic

Authored by arsenm on Mar 14 2020, 10:56 AM.

Details

Summary

Mostly ported from the DAG version. This results in much worse code
than the DAG version, largely due to a much worse expansion for
G_UMULH.

Diff Detail

Event Timeline

arsenm created this revision.Mar 14 2020, 10:56 AM
foad added inline comments.Mar 15 2020, 2:19 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
2535–2536

Can we have some more comments, or one big comment at the top, showing the calculation that this function builds?

2548

What is this constant?

2555

No, it's -(2**-32).

arsenm updated this revision to Diff 250432.Mar 15 2020, 11:49 AM
arsenm marked 2 inline comments as done.

Add comments

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

I couldn't figure this one out, it's just what's in the existing implementation

2555

No? That would be 0xaf800000?

foad added inline comments.Mar 16 2020, 4:52 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
2555

You're right, sorry.

This revision is now accepted and ready to land.Mar 29 2020, 10:15 PM
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-urem.mir