Your first and second proposed code snippets both use EXCLUSIVE OR, which 
happens to set the condition code. As a general rule, I tend to avoid 
CC-setting operations unless some subsequent instruction depends on the CC.  
Also, if you're writing exceedingly clever code where previously-set CC is 
needed later, putting these snippets in between blows that cleverness away.

Your initial description of the problem said that you were short on registers, 
so the second and third proposed code snippets – where you zero a register – 
seem to conflict with this goal.

To avoid all of these issues, the MVHHI solution seems like a good bet if the 
instruction is available. MVHHI was introduced as part of the 
general-instructions-extension facility in February 2008 (IIRC, this puts it in 
the z10 family).

Reply via email to