I was reading the PowerPC instruction reference that comes with
Shark and it says that the Altivec comparison instructions (e.g.
vcmpeq*, vcmpgt*, vcmpge*, etc.) set the CR6 part of the condition
register. I take it this means that it's possible to use
conditional branch instructions with Altivec comparisons.
Is there any way to do this using the GCC Altivec intrinsics
instead of resorting to assembly? For example, something similar to:
if (vec_cmpeq(v1, v2)) {
// do something ...
} else {
// do something else ...
}
If so, can it be combined with GCC specific functions like
__builtin_expect?
Yes for all of the above. Well...the answer to the gcc question is
yes, theoretically, but I haven't tested it.