aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/4100712.c
blob: 7298a3fa7c407d77773d26d167d8cf66d7cc4c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* { dg-do compile } */
/* { dg-options "-O2" } */
void foo(void *pdst, short i, double *sp, 
	short xsize, short dorder, short strided) 
{ 
  unsigned short *dp = (unsigned short*)pdst + i*strided; 
  short j, k; 
  if (strided == xsize) 
    { 
      for (j = 0; j < (xsize << dorder); j++) 
	{ 
	  double x = sp[2*j]; 
	  if (x >= (32767 * 2 + 1)) 
	    x = (32767 * 2 + 1); 
	  if (x <= 0) x
	     = 0; 
	  dp[j] = (short) x; 
	} 
    } 
  else 
    { 
      for (k = 0; k < (1 << dorder); k++) 
	{ 
	  for (j = 0; j < xsize; j++)
	    { 
	      double x = sp[2*j]; 
	      if (x >= (32767 * 2 + 1)) 
		x = (32767 * 2 + 1); 
	      if (x <= 0) 
		x = 0; 
	      dp[j] = (short) x; 
	    } 
	  sp += 2*xsize; 
	  dp += strided; 
	} 
    } 
}