------- Comment #2 from nemet at gcc dot gnu dot org  2009-01-13 21:08 -------
Here is the testcase simplified with delta.  It's reproducible even with a
mipsisa64r2-elfobai compiler with -O1.

I don't think the bug is MIPS-specific.  Inside expand_shift, amount which is:

(int) VIEW_CONVERT_EXPR<const unsigned int>(D.4496)

gets expanded into an SF pseudo.  Shifting by a floating-point value might be
confusing the rest of the function.

typedef unsigned long sample;
struct pam
{
  sample maxval;
};
typedef sample *tuple;
enum function
{
  FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR,
    FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT
};
struct cmdlineInfo
{
  enum function function;
  union
  {
    float divisor;
    unsigned int shiftCount;
  }
  u;
};
applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam,
               struct pam const outpam, tuple * const inputRow,
               tuple * const outputRow)
{
  float const oneOverDivisor = 1 / cmdline.u.divisor;
  int col;
  {
    int plane;
    {
      sample const inSample = inputRow[col][plane];
      sample outSample;
      switch (cmdline.function)
        {
        case FN_DIVIDE:
          outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5));
          break;
        case FN_SHIFTLEFT:
          outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval;
        }
      outputRow[col][plane] =
        ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample));
    }
  }
}


-- 


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

Reply via email to