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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [bfin/] [shift.c] - Blame information for rev 697

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

Line No. Rev Author Line
1 691 jeremybenn
extern void abort (void);
2
extern void exit (int);
3
 
4
typedef short  __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 (0xe005, 0x1000);
13
  b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
14
  c = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
15
 
16
  d = __builtin_bfin_shl_fr2x16 (c, 2);
17
  t1 = __builtin_bfin_extract_lo (d);
18
  t2 = __builtin_bfin_extract_hi (d);
19
  if ((unsigned short)t1 != 0x8000 || t2 != 0x7fff)
20
    abort ();
21
 
22
  d = __builtin_bfin_shl_fr2x16 (c, -2);
23
  t1 = __builtin_bfin_extract_lo (d);
24
  t2 = __builtin_bfin_extract_hi (d);
25
  if ((unsigned short)t1 != 0xf000 || t2 != 0x1c00)
26
    abort ();
27
 
28
  d = __builtin_bfin_shl_fr2x16 (a, 2);
29
  t1 = __builtin_bfin_extract_lo (d);
30
  t2 = __builtin_bfin_extract_hi (d);
31
  if (t1 != 0x4000 || (unsigned short)t2 != 0x8014)
32
    abort ();
33
 
34
  d = __builtin_bfin_shl_fr2x16 (c, -4);
35
  t1 = __builtin_bfin_extract_lo (d);
36
  t2 = __builtin_bfin_extract_hi (d);
37
  if ((unsigned short)t1 != 0xfc00 || t2 != 0x0700)
38
    abort ();
39
 
40
  d = __builtin_bfin_shl_fr2x16 (c, 2);
41
  t1 = __builtin_bfin_extract_lo (d);
42
  t2 = __builtin_bfin_extract_hi (d);
43
  if ((unsigned short)t1 != 0x8000 || t2 != 0x7fff)
44
    abort ();
45
 
46
  d = __builtin_bfin_shl_fr2x16 (a, -2);
47
  t1 = __builtin_bfin_extract_lo (d);
48
  t2 = __builtin_bfin_extract_hi (d);
49
  if (t1 != 0x0400 || (unsigned short)t2 != 0xf801)
50
    abort ();
51
 
52
  /* lsh */
53
  d = __builtin_bfin_lshl_fr2x16 (c, -4);
54
  t1 = __builtin_bfin_extract_lo (d);
55
  t2 = __builtin_bfin_extract_hi (d);
56
  if (t1 != 0x0c00 || t2 != 0x0700)
57
    abort ();
58
 
59
  d = __builtin_bfin_lshl_fr2x16 (c, 2);
60
  t1 = __builtin_bfin_extract_lo (d);
61
  t2 = __builtin_bfin_extract_hi (d);
62
  if (t1 != 0x0000 || t2 != -0x4000)
63
    abort ();
64
 
65
  d = __builtin_bfin_lshl_fr2x16 (a, -2);
66
  t1 = __builtin_bfin_extract_lo (d);
67
  t2 = __builtin_bfin_extract_hi (d);
68
  if (t1 != 0x0400 || (unsigned short)t2 != 0x3801)
69
    abort ();
70
 
71
  exit (0);
72
}
73
 

powered by: WebSVN 2.1.0

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