From what I've seen from the compiler, single statement if statements are the same; however, if the if statement block is too large or too complex then the compiler can't/doesn't apply this optimization (and creates separate clauses for each if block) and manual coding is required for better performance.
You can check your particular code by looking at the generator ISA via the profiler or SKA.
So, in short, it's better to try to use the select() function or the conditional operator....this is because the compiler doesn't "pack" across if blocks (else included along with else if, etc, etc...).
If you use the select() or cond. operator for each statement then the compiler isn't going to create extra clauses and you will give the comiler the ability to "pack" across all your statements (instead of along the statements in each block) thereby better utilizing the ALU. Also, you are reducing the amount of clause switching that needs to occur.
Hope that helps.
I am considering this issue too. based on the ATI programming guide, it is much faster with the predication but can anyone (esp ATI people) help us know what the reason of this improvement compared to an "if condition" checking? Is there any special hardware for the predication?
Like I said above, single statement if statements don't cause extra clauses (more CF clauses) to be created, thereby reducing control flow and allowing for greater packing.
Instead the single assignment (select() or single if statement) generally, from what I've seen, uses some kind of CNDE_INT or essentially a CONDITIONAL set instruction, the same holds true for the software based predication.
There are actually cases where the software based predication is better than using the select() but I'm not going to get into that here.