This is an archive of the discontinued LLVM Phabricator instance.

[X86] Lowering SAD (sum of absolute differences) intrinsics to native IR (clang side)
AbandonedPublic

Authored by mike.dvoretsky on Apr 17 2018, 7:23 AM.

Details

Summary

This patch lowers the SAD intrinsics to native LLVM IR. Comes with an LLVM patch (D45723).

Diff Detail

Repository
rC Clang

Event Timeline

mike.dvoretsky created this revision.Apr 17 2018, 7:23 AM
craig.topper added inline comments.Apr 17 2018, 10:13 AM
lib/CodeGen/CGBuiltin.cpp
8427

This clear isn't needed.

8432

You shouldn't need to explicitly create an ArrayRef here. It should automatically convert. And if it doesn't makeArrayRef is what you should use. It will automatically infer the uint32_t from the vector.

Updated per comments.

craig.topper added inline comments.Apr 23 2018, 10:12 AM
clang/lib/CodeGen/CGBuiltin.cpp
8426 ↗(On Diff #142914)

Size the ShuffleMask to N when it's created. Then you can use just direct assign each array entry in the loops. This will remove the need for the clear() in the later loop. It will also remove the hidden code that checks if we need to grow on every call to push_back.

8431 ↗(On Diff #142914)

You can just pass AD twice. You don't need to create an Undef value. It will get optimized later.

Updated per comments.

craig.topper added inline comments.Apr 24 2018, 9:49 AM
clang/lib/CodeGen/CGBuiltin.cpp
8425 ↗(On Diff #143715)

Is this not a dead variable now?

8426 ↗(On Diff #143715)

SmallVector<uint32_t, 8> ShuffleMask(N);

Then you don't need the resize call.

mike.dvoretsky marked 4 inline comments as done.
mike.dvoretsky added a subscriber: ashlykov.

Updated per comments.

This revision is now accepted and ready to land.Apr 25 2018, 9:35 AM
mike.dvoretsky abandoned this revision.Jun 5 2018, 5:19 AM

Closing this due to failure of D45723.