<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Frank,<div class=""><br class=""></div><div class="">SLP vectorizer does something like this. For question (2) you could take a glance at <font face="Menlo" class="">BoUpSLP::vectorizeTree(TreeEntry *E)</font> (file lib/Transforms/Vectorize/SLPVectorizer.cpp) - it also has an example of retrieving an instruction’s opcode and constructing vector operands.</div><div class=""><br class=""></div><div class="">Michael</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 8, 2015, at 3:18 PM, Frank Winter <<a href="mailto:fwinter@jlab.org" class="">fwinter@jlab.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">I'd like to replace scalar instructions with vector instructions such that the code corresponding to following tree would be vectorized:<br class=""><br class="">load0 load1<br class=""> \ /<br class=""> \ /<br class=""> add/sub/mul<br class=""> |<br class=""> |<br class=""> store<br class=""><br class="">I had unsuccessful encounters with load0->replaceAllUsesWith(vec_load0) complaining about mismatching type (makes sense, add's other operand is still scalar at that time..)<br class=""><br class="">Is the only way to create a vectorized version of this tree by<br class=""><br class="">1) creating the vector loads vec_load0 AND vec_load1<br class="">2) retrieving the opcode of the arithmetic instruction and create a new one according to the opcode<br class=""><br class="">How is step 2) in donepractice? Cloning the instruction and replacing the operands? (would that bypass the type checking for a moment?)<br class=""><br class="">Thanks,<br class="">Frank<br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></div></body></html>