[Bug tree-optimization/93118] New: >>32<<32 is not always converted into &~0ffffffffull at the tree level

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 1 23:05:00 GMT 2020


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

            Bug ID: 93118
           Summary: >>32<<32 is not always converted into &~0ffffffffull
                    at the tree level
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
              Host: aarch64-linux-gnu

Take:

typedef unsigned long long u64;
void f(u64 *aa, u64 a)
{
  u64 b = a>>32;
  int c = b;
  u64 d = c;
  *aa = d<<32;
}

This should produce the same as:
typedef unsigned long long u64;
void f1(u64 *aa, u64 a)
{
  u64 b = a>>32;
  unsigned c = b;
  u64 d = c;
  *aa = d<<32;
}

But the first produces in .optimized:
  b_3 = a_2(D) >> 32;
  c_4 = (int) b_3;
  d_5 = (u64) c_4;
  _1 = d_5 << 32;
  *aa_7(D) = _1;

While the second one produces:
  _1 = a_2(D) & 18446744069414584320;
  *aa_4(D) = _1;


More information about the Gcc-bugs mailing list