<html><body><p><font face="Calibri">Currently on PowerPC, calls to memcmp are not expanded and are left as library calls. In certain conditions, expansion can improve performance rather than calling the library function as done for functions like memcpy, memmove, etc. This patch </font><b><font face="Calibri">(</font></b><a href="https://reviews.llvm.org/D28163"><b><font face="Calibri">https://reviews.llvm.org/D28163</font></b></a><b><font face="Calibri">)</font></b><font face="Calibri"> is an initial implementation for PowerPC to expand memcmp when the size is an 8 byte multiple.</font><p><font face="Calibri">The approach currently added for this expansion tries to use the existing infrastructure by overriding the virtual function EmitTargetCodeForMemcmp. This function works on the SelectionDAG, but the expansion requires control flow for early exit. So, instead of implementing the expansion within EmitTargetCodeForMemcmp, a new pseudo instruction is added for memcmp and a SelectionDAG node for this new pseudo is created in EmitTargetCodeForMemcmp. This pseudo instruction is then expanded during lowering in EmitInstrWithCustomInserter.<br><br>The advantage of this approach is that it uses the existing infrastructure and does not impact other targets. If other targets would like to expand memcmp, they can also override EmitTargetCodeForMemcmp and create their own expansion. </font><p><font face="Calibri">Another option to consider is adding a new optimization pass for this expansion that isn’t target specific if other targets would benefit from a more general infrastructure. </font><p><font face="Calibri">Please provide feedback if this approach should be continued to implement the PowerPC specific memcmp expansions or whether the community is interested in devising a more general approach</font><font face="Times New Roman">.<br><br>Thanks,</font><p><font face="Times New Roman">Zaara Syeda</font><BR>
</body></html>