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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20020423-1.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* PR c/5430 */
2
/* Verify that the multiplicative folding code is not fooled
3
   by the mix between signed variables and unsigned constants. */
4
 
5
extern void abort (void);
6
extern void exit (int);
7
 
8
int main (void)
9
{
10
  int my_int = 924;
11
  unsigned int result;
12
 
13
  result = ((my_int*2 + 4) - 8U) / 2;
14
  if (result != 922U)
15
    abort();
16
 
17
  result = ((my_int*2 - 4U) + 2) / 2;
18
  if (result != 923U)
19
    abort();
20
 
21
  result = (((my_int + 2) * 2) - 8U - 4) / 2;
22
  if (result != 920U)
23
    abort();
24
  result = (((my_int + 2) * 2) - (8U + 4)) / 2;
25
  if (result != 920U)
26
    abort();
27
 
28
  result = ((my_int*4 + 2U) - 4U) / 2;
29
  if (result != 1847U)
30
    abort();
31
 
32
  exit(0);
33
}

powered by: WebSVN 2.1.0

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