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

            Bug ID: 121517
           Summary: [16 Regression] __builtin_bswap32 is not recognized
                    anymore
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

This issue shows as following failures on x86_64:

FAIL: gcc.target/i386/pr115102.c scan-assembler bswaphisi2_lowpart
FAIL: gcc.target/i386/xchg-4.c scan-assembler rolw
FAIL: gcc.target/i386/xchg-4.c scan-assembler-not mov

where tree optimizers don't recognize __builtin_bswap32 anymore.

With gcc-15, pr115102.c compiles (-Os -march=x86-64) with:

_.optimized:

unsigned int bswap8 (unsigned int val)
{
  unsigned int _1;
  unsigned int bswapdst_4;
  unsigned int _8;
  unsigned int _10;
  unsigned int bswapmaskdst_11;

  <bb 2> [local count: 1073741824]:
  _1 = val_7(D) & 4294901760;
  bswapdst_4 = __builtin_bswap32 (val_7(D));
  bswapmaskdst_11 = bswapdst_4 & 4294901760;
  _10 = bswapmaskdst_11 r>> 16;
  _8 = _1 | _10;
  return _8;

}

while gcc-16 compiles the same testcase with:

unsigned int bswap8 (unsigned int val)
{
  unsigned int _1;
  unsigned int _2;
  unsigned int _3;
  unsigned int _5;
  unsigned int _6;
  unsigned int _8;
  unsigned int _10;

  <bb 2> [local count: 1073741824]:
  _1 = val_7(D) & 4294901760;
  _2 = val_7(D) >> 8;
  _3 = _2 & 255;
  _5 = val_7(D) << 8;
  _6 = _5 & 65535;
  _10 = _3 | _6;
  _8 = _1 | _10;
  return _8;

}

Reply via email to