[LLVMdev] Instruction pattern type inference problem
Morten Ofstad
morten at hue.no
Tue Apr 24 06:09:03 PDT 2007
Christopher Lamb wrote:
> A strategy that we have had luck with in the past is the concept of a
> "vector boolean" type, which is the result of a comparison between two
> vectors. It's then necessary to perform a reduction (and, or) on the
> elements in order to produce a scalar boolean value that's suitable for
> a branch. This also allows stuff like letting 'select' accept a vector
> boolean predicate and vector values to perform a vector select.
this is the semantics that GLSL uses for vector compares, for example the signature of one of the overloads for the
built-in function 'lessThan' is:
bvec4 lessThan(vec4 x, vec4 y)
what I wanted to mention are the built-in functions 'any' and 'all' which have signatures (for 4-vectors)
bool any(bvec4 x)
bool all(bvec4 x)
and the obvious semantics any(x)= x.x || x.y || x.z || x.w and all(x)= x.x && x.y && x.z && x.w -- I think if vector
comparisions and vector boolean types are added to LLVM, it would also be very nice to have the 'any' and 'all' added as
intrinsics...
m.
More information about the llvm-dev
mailing list