public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55181] New: [4.7/4.8 Regression] Expensive shift loop where a bit-testing instruction could be used
@ 2012-11-02 16:06 gjl at gcc dot gnu.org
  2012-11-02 16:10 ` [Bug other/55181] " gjl at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-11-02 16:06 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55181

             Bug #: 55181
           Summary: [4.7/4.8 Regression] Expensive shift loop where a
                    bit-testing instruction could be used
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
            Target: avr


The following C code:

unsigned char lfsr (unsigned long number)
{
  unsigned char b = 0;
  if (number & (1L << 29)) b++;
  if (number & (1L << 13)) b++;

  return b;
}

compiles to a right shift 29 bits of number which is very expensive because AVR
has no barrel shifter.  Instead, a bit-testing instruction could be used which
takes just a few cycles and not more than 100 like with the right shift.

4.6.2 uses a bit testing instruction.

== Command line ==


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-05-20  5:08 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02 16:06 [Bug other/55181] New: [4.7/4.8 Regression] Expensive shift loop where a bit-testing instruction could be used gjl at gcc dot gnu.org
2012-11-02 16:10 ` [Bug other/55181] " gjl at gcc dot gnu.org
2012-11-02 16:12 ` gjl at gcc dot gnu.org
2012-11-02 16:13 ` gjl at gcc dot gnu.org
2012-11-02 16:15 ` gjl at gcc dot gnu.org
2012-11-25 15:55 ` rguenth at gcc dot gnu.org
2012-12-06 16:09 ` [Bug target/55181] " rguenth at gcc dot gnu.org
2013-03-05 23:46 ` steven at gcc dot gnu.org
2013-03-06  8:52 ` rguenth at gcc dot gnu.org
2013-04-11  7:59 ` [Bug target/55181] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2013-12-16 10:28 ` olegendo at gcc dot gnu.org
2014-03-02 18:08 ` olegendo at gcc dot gnu.org
2014-03-02 18:52 ` olegendo at gcc dot gnu.org
2014-06-12 13:45 ` [Bug target/55181] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:28 ` [Bug target/55181] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-23  8:21 ` [Bug target/55181] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:57 ` [Bug target/55181] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:29 ` jakub at gcc dot gnu.org
2021-05-14  9:46 ` [Bug target/55181] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:05 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug target/55181] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-05-19 23:13 ` [Bug target/55181] [10/11/12/13/14 " pinskia at gcc dot gnu.org
2023-05-20  5:07 ` pinskia at gcc dot gnu.org
2023-05-20  5:08 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).