OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [loop-13.c] - Rev 774

Go to most recent revision | Compare with Previous | Blame | View Log

/* PR opt/7130 */
#define TYPE long
 
void
scale (TYPE *alpha, TYPE *x, int n)
{
  int i, ix;
 
  if (*alpha != 1)
    for (i = 0, ix = 0; i < n; i++, ix += 2)
      {
	TYPE tmpr, tmpi;
	tmpr = *alpha * x[ix];
	tmpi = *alpha * x[ix + 1];
	x[ix] = tmpr;
	x[ix + 1] = tmpi;
      }
}
 
int
main (void)
{
  int i;
  TYPE x[10];
  TYPE alpha = 2;
 
  for (i = 0; i < 10; i++)
    x[i] = i;
 
  scale (&alpha, x, 5);
 
  if (x[9] != 18)
    abort ();
 
  return 0;
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.