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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [bfin/] [arith.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
extern void abort (void);
2
extern void exit (int);
3
 
4
typedef int  __v2hi __attribute ((vector_size(4)));
5
typedef __v2hi fract2x16;
6
typedef short fract16;
7
 
8
int main ()
9
{
10
  fract2x16 a, b, c, d;
11
  fract16 t1, t2;
12
  a = __builtin_bfin_compose_2x16 (0x3000, 0x2000);
13
  b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
14
  c = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
15
 
16
  d = __builtin_bfin_add_fr2x16 (a, b);
17
  t1 = __builtin_bfin_extract_lo (d);
18
  t2 = __builtin_bfin_extract_hi (d);
19
  if (t1 != 0x7000 || t2 != 0x7fff)
20
    abort ();
21
 
22
  d = __builtin_bfin_sub_fr2x16 (a, b);
23
  t1 = __builtin_bfin_extract_lo (d);
24
  t2 = __builtin_bfin_extract_hi (d);
25
  if (t1 != -0x3000 || t2 != -0x4000)
26
    abort ();
27
 
28
  d = __builtin_bfin_negate_fr2x16 (c);
29
  t1 = __builtin_bfin_extract_lo (d);
30
  t2 = __builtin_bfin_extract_hi (d);
31
  if (t1 != 0x4000 || t2 != -0x7000)
32
    abort ();
33
 
34
  if (__builtin_bfin_add_fr1x32 (0x7fffffff, 1) != 0x7fffffff)
35
    abort ();
36
 
37
  if (__builtin_bfin_add_fr1x32 (0x80000000, -1) != 0x80000000)
38
    abort ();
39
 
40
  if (__builtin_bfin_add_fr1x32 (0x80000001, -1) != 0x80000000)
41
    abort ();
42
 
43
  if (__builtin_bfin_add_fr1x32 (0xFEDCBA98, 0x11111111) != 0x0FEDCBA9)
44
    abort ();
45
 
46
  exit (0);
47
}
48
 

powered by: WebSVN 2.1.0

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