On 11/09/12 16:04, Christophe Lyon wrote: > 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.= > > > bswap16.patch > >
Thanks, This is OK. Ramana has just pointed out to me that predication these days can be set on a per-alternative basis, so all those extra patterns for cond-exec can be eliminated after all (sigh!). I'm not going to insist that you fix that (unless you want to); We've been round this patch too many times now and the code you've written isn't wrong... R.