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 middle-end/13191] New: Redundant sign extends


The following testcase taken from lmbench shows gcc inserting needless sign
extends to convert intermediate results to ints (ppc64 logical operations are
done on full 64 bit registers).  Ideally, gcc could implement this function with
just one sign extend for the final result.  Different results, but still not
ideal, are seen when using an int for iter.

typedef long iter;

int
do_integer_bitwise (iter iterations, int r)
{
  int s = iterations;
#if 0
  while (iterations-- > 0)
#endif
    {
      r^=iterations; s^=r; r|=s;
      r^=iterations; s^=r; r|=s;
      r^=iterations; s^=r; r|=s;
      r^=iterations; s^=r; r|=s;
    }
  return r;
}

-- 
           Summary: Redundant sign extends
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu


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


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