This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][ConstantFolding] Fold llvm.amdgcn.cube* intrinsics
ClosedPublic

Authored by foad on Feb 26 2020, 8:27 AM.

Details

Summary

This folds the following family of intrinsics:
llvm.amdgcn.cubeid (face id)
llvm.amdgcn.cubema (major axis)
llvm.amdgcn.cubesc (S coordinate)
llvm.amdgcn.cubetc (T coordinate)

Diff Detail

Event Timeline

foad created this revision.Feb 26 2020, 8:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2020, 8:27 AM
arsenm added inline comments.Feb 26 2020, 8:41 AM
llvm/lib/Analysis/ConstantFolding.cpp
2312

Using host FP operations is generally frowned on, and this should use APFloat

foad marked an inline comment as done.Feb 26 2020, 8:49 AM
foad added inline comments.
llvm/lib/Analysis/ConstantFolding.cpp
2312

OK, but the APFloat API is horrible to use for anything more complicated than + - * /.

foad updated this revision to Diff 246824.Feb 26 2020, 1:19 PM

Use APFloats.

arsenm added inline comments.Feb 26 2020, 1:53 PM
llvm/lib/Analysis/ConstantFolding.cpp
2313

const references

2319–2322

This can use const references and can be moved to a separate function since there's no local captures

2378–2380

Avoid the copy by sinking thees to the uses

foad updated this revision to Diff 246909.Feb 27 2020, 4:16 AM

Address review comments, rebase on D75237.

foad marked 5 inline comments as done.
foad added inline comments.
llvm/lib/Analysis/ConstantFolding.cpp
2319–2322

I moved it to APFloat::operator>= instead.

arsenm accepted this revision.Mar 4 2020, 3:54 PM

LGTM

This revision is now accepted and ready to land.Mar 4 2020, 3:54 PM
This revision was automatically updated to reflect the committed changes.
foad marked an inline comment as done.