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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr32293.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2" } */
3
 
4
unsigned int _IDEC_glbround;
5
unsigned int _IDEC_glbflags;
6
typedef unsigned UINT32;
7
typedef signed SINT32;
8
typedef unsigned long long UINT64;
9
typedef signed long long SINT64;
10
typedef
11
__attribute__ ((aligned(16)))
12
     struct {
13
       UINT64 w[2];
14
     } UINT128;
15
 
16
static __inline UINT64
17
unpack_BID128 (UINT64 * psign_x, int *pexponent_x,
18
        UINT128 * pcoefficient_x, UINT128 * px) {
19
  UINT128 coeff;
20
  UINT64 ex;
21
  *psign_x = (px->w[1]) & 0x8000000000000000ull;
22
  ex = (px->w[1]) >> 49;
23
  *pexponent_x = ((int) ex) & 0x3fff;
24
  return coeff.w[0] | coeff.w[1];
25
}
26
 
27
static __inline UINT32
28
get_BID32 (UINT32 sgn, int expon, UINT64 coeff, int rmode,
29
    unsigned *fpsc) {
30
  UINT32 r;
31
 
32
  if (((unsigned) expon) > 191) {
33
      r = sgn | 0x78000000ul;
34
      switch (rmode) {
35
      case 0x00002:
36
        if (sgn)
37
          r = sgn | 0x77f8967f;
38
      }
39
      return r;
40
  }
41
  r = expon;
42
  return r;
43
}
44
 
45
UINT32
46
bid128_to_bid32 (UINT128 x)
47
{
48
  UINT128 *px;
49
  UINT128 CX;
50
  UINT64 sign_x;
51
  UINT32 res;
52
  int exponent_x = 0;
53
  px = &x;
54
  if (!unpack_BID128 (&sign_x, &exponent_x, &CX, px)) {
55
      return(res);
56
  }
57
  res = get_BID32 ((UINT32) (sign_x >> 32),
58
        exponent_x, CX.w[0], _IDEC_glbround, &_IDEC_glbflags);
59
  return(res);;
60
}
61
 

powered by: WebSVN 2.1.0

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