public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54803] New: Manual constant unfolding breaks vectorization
@ 2012-10-04  0:00 jasongross9+bugzilla at gmail dot com
  2012-10-04  0:15 ` [Bug tree-optimization/54803] Rotates are not vectorized pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jasongross9+bugzilla at gmail dot com @ 2012-10-04  0:00 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54803
           Summary: Manual constant unfolding breaks vectorization
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jasongross9+bugzilla@gmail.com


Created attachment 28348
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28348
code files

Manually unfolding constants sometimes prevents vectorization.

For example, these loops vectorize:

void multi_left_shift0(uint64_t *const array, size_t len, size_t num_bits) {
  for (size_t i = 0; i < len; i++) {
    array[i] = (array[i] >> 31) | (array[i] << 31);
  }
}

void multi_left_shift2(uint64_t *const array, size_t len, size_t num_bits) {
  for (size_t i = 0; i < len; i++) {
    const uint64_t tempa = array[i] >> 32;
    const uint64_t tempb = array[i] << 32;
    array[i] = tempa | tempb;
  }
}


but this loops does not:

void multi_left_shiftb0(uint64_t *const array, size_t len, size_t num_bits) {
  for (size_t i = 0; i < len; i++) {
    array[i] = (array[i] >> 32) | (array[i] << 32);
  }
}


See attached file for the code, preprocessed code, gcc command line log, and
assembly.


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

end of thread, other threads:[~2021-08-24 22:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04  0:00 [Bug c/54803] New: Manual constant unfolding breaks vectorization jasongross9+bugzilla at gmail dot com
2012-10-04  0:15 ` [Bug tree-optimization/54803] Rotates are not vectorized pinskia at gcc dot gnu.org
2012-10-04 12:11 ` rguenth at gcc dot gnu.org
2015-06-12 13:21 ` alalaw01 at gcc dot gnu.org
2015-08-10 22:34 ` miyuki at gcc dot gnu.org
2015-08-13 10:44 ` vekumar at gcc dot gnu.org
2015-08-13 10:52 ` vekumar at gcc dot gnu.org
2021-08-24 22:50 ` 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).