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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [spu/] [muldivti3.c] - Blame information for rev 859

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

Line No. Rev Author Line
1 327 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=c99" } */
3
#include <stdlib.h>
4
typedef unsigned int uqword __attribute__((mode(TI)));
5
typedef int qword __attribute__((mode(TI)));
6
 
7
typedef union
8
{
9
  uqword                uq;
10
  qword                 q;
11
  unsigned long long    ull[2];
12
} u;
13
 
14
int main(void)
15
{
16
  uqword e, f;
17
  qword g, h;
18
 
19
  e = 0x1111111111111111ULL;
20
  f = 0xFULL;
21
  g = 0x0000000000111100ULL;
22
  h = 0x0000000000000000ULL;
23
 
24
  u m, n, o, p, q;
25
 
26
  m.ull[0] = f;
27
  m.ull[1] = e;
28
  n.ull[0] = h;
29
  n.ull[1] = g;
30
 
31
  /* __multi3  */
32
  o.q = m.q * n.q;
33
 
34
  o.q = o.q + n.q + 0x1110FF;
35
  /* __udivti3, __umodti3  */
36
  p.uq = o.uq / n.uq;
37
  q.uq = o.uq % n.uq;
38
  if (p.uq != (m.uq+1)) abort();
39
  if (q.uq != 0x1110FF) abort();
40
  /* __divti3, __modti3  */
41
  p.q = -o.q / n.q;
42
  q.q = -o.q % n.q;
43
  if ((-p.q * n.q - q.q) != o.q) abort();
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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