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.target/] [i386/] [pr36613.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */
2
/* { dg-options "-Os" } */
3
/* PR target/36613 */
4
 
5
extern void abort (void);
6
 
7
static inline int
8
lshifts (int val, int cnt)
9
{
10
  if (val < 0)
11
    return val;
12
  return val << cnt;
13
}
14
 
15
static inline unsigned int
16
lshiftu (unsigned int val, unsigned int cnt)
17
{
18
  if (cnt >= sizeof (unsigned int) * __CHAR_BIT__
19
      || val > ((__INT_MAX__ * 2U) >> cnt))
20
    return val;
21
  return val << cnt;
22
}
23
 
24
static inline int
25
rshifts (int val, unsigned int cnt)
26
{
27
  if (val < 0 || cnt >= sizeof (int) * __CHAR_BIT__)
28
    return val;
29
  return val >> cnt;
30
}
31
 
32
int
33
foo (unsigned int val)
34
{
35
  return rshifts (1 + val, lshifts (lshiftu (val, val), 1));
36
}
37
 
38
int
39
main (void)
40
{
41
  if (foo (1) != 0)
42
    abort ();
43
  return 0;
44
}

powered by: WebSVN 2.1.0

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