This is the mail archive of the gcc@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]

Re: Help restricting args of an intrinsic function


On Fri, 2004-01-30 at 19:58, Syd Polk wrote:

> Not only that, but compile-time constants in a certain range.
> 
Yes, that's fine.  Here's what tree-ssa emits after the tree
optimization passes for the test cases you mentioned.  These aren't even
very hard, actually.

But if the tree optimizers can't tell whether an argument to __rlwimi is
constant, then there's a good chance that the user is doing something
really convoluted, which should at least warrant a warning.


--- foo.c -------------------------------------------------------------
f1 (int r, int arg)
{
  int r2;
  const int shift = 3;
  r2 = __rlwimi (r, arg, shift, 5, 8);
  return r2;
}

f2 (int r, int arg)
{
  int r2;
  enum tests { t1, t2, t3, t4, t5 };
  r2 = __rlwimi(r, arg, t3, 5, 8);
  return r2;
}
  
f3 (int r, int arg)
{
  int r2;
  const int foo = 5;
  const int *shiftPtr = &foo;
  r2 = __rlwimi (r, arg, *shiftPtr, 5, 8);
  return r2;
}
---------------------------------------------------------------------------



--- foo.c.t35.optimized ---------------------------------------------------
f1 (r, arg)
{
  return __rlwimi (r, arg, 3, 5, 8);
}


f2 (r, arg)
{
  tests t5 = 4;
  tests t4 = 3;
  tests t3 = 2;
  tests t2 = 1;
  tests t1 = 0;
  return __rlwimi (r, arg, 2, 5, 8);
}


f3 (r, arg)
{
  int T.3;
  T.3 = __rlwimi (r, arg, 5, 5, 8);
  return T.3;
}
---------------------------------------------------------------------------



Diego.


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