<div dir="ltr">Ok, seems that I simply need to check by isVectorTy()<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-30 9:49 GMT+02:00 Nemanja Ivanovic <span dir="ltr"><<a href="mailto:nemanja.i.ibm@gmail.com" target="_blank">nemanja.i.ibm@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>I'm also not sure what you mean by "its size is a multiple of the operands size". An instruction's (encoding) size has no correlation to the size of the registers it operates on in a general sense.<br><br></div>So if you're looking for whether an IR instruction is a "vector instruction" (i.e. it operates on or produces vectors), you should keep in mind that every `llvm::Instruction` is an `llvm::Value` and you can get it's type and check if it's a vector type with something like `I.getType()->isVectorTy()`.<br></div><br>For MachineInstr's, I think you'd have to ensure that the operand you're interested in is a register operand, get the register and check the `MachineRegisterInfo::<wbr>getRegClass()` for whether it's a vector register.<br><br></div>The reason I've put "vector instruction" in quotes is because that of course doesn't have a clear definition. For example, is `extractelt` a vector instruction? How about `insertelt`? What I'm getting at is if an instruction has scalar inputs and vector outputs or vice-versa. Or if the instruction has a mixture of vector and scalar operands (think of loads/stores - address is likely in a scalar register or perhaps some kind of arithmetic binary operator between a vector and a scalar).<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 29, 2017 at 8:28 PM, Sam Elliott via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>This depends on what you mean by "instruction". More context would have been useful.</div><div><br></div>LLVM IR is typed, and therefore you will see the operation applied to vector-typed arguments. For example `%3 = add i32 %1, %2` is the scalar version, `%3 = add <4 x i32> %1, %2` is the vectorised version (for a given IR vector type). The language reference [] has specifics on which instructions can operate on both vectors and scalars. <div><br></div><div>I don't know anything about MIR.</div><div><br></div><div>If you're looking at target-specific instructions (such as x86), you should look up the instruction documentation as provided by the manufacturer/ISA)</div><div><br></div><div>Sam</div><div><br></div><div>[] <a href="https://llvm.org/docs/LangRef.html" target="_blank">https://llvm.org/docs/LangR<wbr>ef.html</a><br><div><br></div><div><br><div><blockquote type="cite"><span><div>On 29 Aug 2017, at 2:44 am, Anastasiya Ruzhanskaya via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-24938855717658088m_5547919204857834578Apple-interchange-newline"></span><div><span><div dir="ltr"><div>Hello,<br></div>is there a good way to determine that the instruction is a vector instruction? Or the only way like it's size is multiple of the operands size?<br></div></span>
______________________________<wbr>_________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div>--</div><div>Archibald Sam Elliott</div><div><a href="mailto:ashe2@cs.washington.edu" target="_blank">ashe2@cs.washington.edu</a></div><div>PhD Student, PLSE Group</div></div></div></div></div></div>
</div>
<br></div></div></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>