[PATCH] D28637: [PPC] Inline expansion of memcmp

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 04:58:44 PST 2017

nemanjai added a comment.

In https://reviews.llvm.org/D28637#647200, @uweigand wrote:

> On SystemZ, we use the existing callback EmitTargetCodeForMemcmp to expand memcmp calls.    Can you explain how the new hook is different and why we'd need two hooks?

I think the primary difference is that SystemZ has instructions that can perform these comparisons directly (i.e. with an instruction that compares memory from two addresses). On Power, we have to do the loads, comparison and branch out of the load sequence as soon as a mismatch is found. And the SDAG isn't well suited for adding new control flow.
So I'd say the old hook is useful for targets that have instructions that can terminate the comparison on a mismatch without an explicit branch, whereas the new hook is useful for targets that don't.
But I'll let Zaara chime in for the full answer.


More information about the llvm-commits mailing list