This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/63321] [SH] Unused T bit result of shll / shlr insns


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63321

--- Comment #7 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Another example:

unsigned int
count_trailing_nonzero_bits (unsigned int v, unsigned int c)
{
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  c += v & 1;
  v >>= 1;
  return c;
}

ideally should compile to:
  mov   #0,r1
  shlr  r4
  movt  r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0
  shlr  r4
  addc  r1,r0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]