[LLVMdev] vector compare

Eli Friedman eli.friedman at gmail.com
Thu Dec 25 18:11:24 PST 2008


On Thu, Dec 25, 2008 at 5:44 PM, Claudio Basile <cbasile at tempo-da.com> wrote:
> Thanks for your answer.
> It looks like vicmp is part of LLVM 2.4. It is documented there, at least.

Hmm, really?  I don't see it at
http://llvm.org/releases/2.4/docs/LangRef.html.  If it's there, then
it should work, I think.

> How do you suggest I use it to compare two vector operands?
> I'd guess I could generate a mask by extracting the most significant bits in
> each words, but that approach doesn't work per my initial posting.

For the best code generation, I'd suggest using
@llvm.x86.sse.movmsk.ps.  Something like icmp
eq(movmskps(vicmp(a,b)),0) should do the trick assuming a and b are <4
x i32>.  As far as I know, there isn't any way to make LLVM generate
that without using the x86-specific intrinsic.

-Eli



More information about the llvm-dev mailing list