https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63259
--- Comment #12 from thopre01 at gcc dot gnu.org --- (In reply to Oleg Endo from comment #11) > (In reply to thopre01 from comment #10) > > > > I have the same gimple and for me the bswap is correctly detected. Can you > > break at find_bswap_or_nop just after calling find_bswap_or_nop_1 on the if > > (!source_stmt) and show me the output of p/x n->n ? > > n->n = 0x0000000000000102 limit = 4 That's good, it means the pattern is recognized. Is there an optab defined for bswap16? > > For both, test_099 and test_08. > > > Indeed, my mistake. Ok I tested a bit and found that the problem is the > > depth at which it's looking. Try to recompile tree-ssa-math-opts.c after > > increasing the limit number in find_bswap_or_nop. Right now the limit will > > evaluate to 4 and the gimple I have has a depth of 5. > > I've tried ... > > limit += 10 + (int) ceil_log2 ((unsigned HOST_WIDE_INT) limit); > > ... but it doesn't change anything here. Same as the other pattern, can you try to print n->n in hex with this new limit? My guess is that the pattern is now recognized but fails later for the same reason as above. Best regards.