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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [fixed-point/] [noassoc.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=gnu99 -O0" } */
3
 
4
extern void abort (void);
5
 
6
/* Make sure GCC knows there is no associativity for saturating types.  */
7
 
8
/* Don't transform to (temp + (0.5r + 0.8r))  */
9
_Sat _Fract add_test (_Sat _Fract temp)
10
{
11
  return temp + 0.5r + 0.8r;
12
}
13
 
14
/* Don't transform to (temp * ((-0.5r - 0.5r) * (-0.5r - 0.5r)))  */
15
_Sat _Fract mul_test (_Sat _Fract temp)
16
{
17
  return temp * (-0.5r - 0.5r) * (-0.5r - 0.5r);
18
}
19
 
20
/* Don't transform to ((temp1 + temp2) * 0.5r)  */
21
_Sat _Fract mul_add_test (_Sat _Fract temp1, _Sat _Fract temp2)
22
{
23
  return temp1 * 0.5r + temp2 * 0.5r;
24
}
25
 
26
/* Don't transform to ((temp1 - temp2) * 0.5r)  */
27
_Sat _Fract mul_sub_test (_Sat _Fract temp1, _Sat _Fract temp2)
28
{
29
  return temp1 * 0.5r - temp2 * 0.5r;
30
}
31
 
32
int main ()
33
{
34
  _Sat _Fract a;
35
 
36
  a = add_test (-0.5r);
37
  if (a != 0.8r)
38
    abort ();
39
 
40
  a = mul_test (0.1r);
41
  if (a != 0.1r)
42
    abort ();
43
 
44
  a = mul_add_test (0.75r, 0.5r);
45
  if (a != 0.625r)
46
    abort ();
47
 
48
  a = mul_sub_test (0.75r, -0.5r);
49
  if (a != 0.625r)
50
    abort ();
51
 
52
  return 0;
53
}

powered by: WebSVN 2.1.0

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