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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [i386/] [asm-2.c] - Blame information for rev 844

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR opt/13862 */
2
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
3
/* { dg-require-effective-target ilp32 } */
4
/* { dg-options "-O" } */
5
 
6
typedef struct _fame_syntax_t_ {
7
} fame_syntax_t;
8
 
9
typedef struct _fame_bitbuffer_t_
10
{
11
  unsigned char * base;
12
  unsigned char * data;
13
  unsigned long shift;
14
} fame_bitbuffer_t;
15
 
16
#define fast_bitbuffer_write(data, shift, c, l)                         \
17
{                                                                       \
18
  int d;                                                                \
19
                                                                        \
20
  asm("add %1, %%ecx\n"            /* ecx = shift + length */           \
21
      "shrd %%cl, %2, %3\n"        /* adjust code to fit in */          \
22
      "shr %%cl, %2\n"             /* adjust code to fit in */          \
23
      "mov %%ecx, %1\n"            /* shift += length */                \
24
      "bswap %2\n"                 /* reverse byte order of code */     \
25
      "shr $5, %%ecx\n"            /* get dword increment */            \
26
      "or %2, (%0)\n"              /* put first 32 bits */              \
27
      "bswap %3\n"                 /* reverse byte order of code */     \
28
      "lea   (%0, %%ecx, 4), %0\n" /* data += (ecx>32) */               \
29
      "andl $31, %1\n"             /* mask shift */                     \
30
      "orl %3, (%0)\n"             /* put last 32 bits */               \
31
      : "=r"(data), "=r"(shift), "=a"(d), "=d"(d), "=c"(d)              \
32
      : "0"(data), "1"(shift), "2"((unsigned long) c), "3"(0),            \
33
        "c"((unsigned long) l)                                          \
34
      : "memory");                                                      \
35
}
36
 
37
#define bitbuffer_write(bb, c, l) \
38
  fast_bitbuffer_write((bb)->data, (bb)->shift, c, l)
39
 
40
typedef enum { frame_type_I, frame_type_P } frame_type_t;
41
 
42
typedef struct _fame_syntax_mpeg1_t_ {
43
  fame_bitbuffer_t buffer;
44
  frame_type_t frame_type;
45
} fame_syntax_mpeg1_t;
46
 
47
#define FAME_SYNTAX_MPEG1(x) ((fame_syntax_mpeg1_t *) x)
48
 
49
void mpeg1_start_picture(fame_syntax_t *syntax)
50
{
51
  fame_syntax_mpeg1_t *syntax_mpeg1 = FAME_SYNTAX_MPEG1(syntax);
52
  bitbuffer_write(&syntax_mpeg1->buffer, 0xFFFF, 16);
53
 
54
  switch(syntax_mpeg1->frame_type) {
55
    case frame_type_I:
56
      bitbuffer_write(&syntax_mpeg1->buffer, 0, 1);
57
    break;
58
    case frame_type_P:
59
      bitbuffer_write(&syntax_mpeg1->buffer, 0, 1);
60
    break;
61
  }
62
}

powered by: WebSVN 2.1.0

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