Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Branching with Altivec comparisons



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?


I realise it's usually better to write branchless code with vec_sel, etc.



r i c k
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.