On 11 September 2012 12:52, Richard Earnshaw <rearn...@arm.com> wrote:
> Try something like:
>
> short foo(int);
>
> short swaps (short x, int y)
> {
>   int z = x;
>   if (y)
>         z = __builtin_bswap16(x);
>   return foo (z);
> }
>
> If that's not enough, try adding 1 to z before calling foo.
>

Thanks, it works.
It's surprising however that 'return z' isn't enough.

Here is a new version of the patch, which also transforms the 32 bits
arm_rev/thumb1_rev into arm_rev/arm_rev_cond.

I have enhanced the testcase too.

Christophe.

Attachment: bswap16.patch
Description: Binary data

Reply via email to