Page MenuHomePhabricator

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

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



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

Diff Detail

Event Timeline

mike.dvoretsky created this revision.Apr 17 2018, 7:23 AM
craig.topper added inline comments.Apr 17 2018, 10:13 AM
8427 ↗(On Diff #142772)

This clear isn't needed.

8432 ↗(On Diff #142772)

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

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.


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

Is this not a dead variable now?


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.