[LLVMdev] test all ones/zeros in vector
Roland Leißa
leissa at cs.uni-saarland.de
Mon May 14 20:04:34 PDT 2012
Hi all,
is there a portable and effective way of emitting code which checks whether all vector elements are true or false?
Currently, I'm doing this:
%sext = sext <4 x i1> %my_cmp to <4 x i8>
%bcast = bitcast <4 x i8> %sext to i32
%all_zeros = icmp ne i32 %bcast, 0
br i1 %all_zeros, label %A, label %B
The emitted code works, but it's not great. I'd like to make use of movmask or ptest in the case of SSE.
Of course, I could emit some intrinsic functions but I always consider these kind of things a hack; I'd rather like to emit some code which the back-end likes. So is there some llvm code sequence which does the trick?
--
Roland
More information about the llvm-dev
mailing list