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/] [20011119-1.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
/* Test for reload failing to eliminate from argp to sp.  */
2
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
3
/* { dg-require-effective-target ilp32 } */
4
/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
5
/* { dg-skip-if "PIC default" { "*-*-darwin*" } { "*" } { "" } } */
6
/* { dg-options "-O2 -fomit-frame-pointer" } */
7
 
8
static int ustrsize (const char *s);
9
static int (*ucwidth) (int c);
10
static int (*ugetxc) (const char **s);
11
static int (*usetc) (char *s, int c);
12
 
13
char *ustrzcat(char *dest, int size, const char *src)
14
{
15
   int pos = ustrsize(dest);
16
   int c;
17
 
18
   size -= pos + ucwidth(0);
19
 
20
   while ((c = ugetxc(&src)) != 0) {
21
      size -= ucwidth(c);
22
      if (size < 0)
23
         break;
24
 
25
      pos += usetc(dest+pos, c);
26
   }
27
 
28
   usetc(dest+pos, 0);
29
 
30
   return dest;
31
}
32
 
33
static int __attribute__((noinline))
34
ustrsize (const char *s)
35
{
36
  return 0;
37
}
38
 
39
static int
40
ucwidth_ (int c)
41
{
42
  return 1;
43
}
44
 
45
static int
46
ugetxc_ (const char **s)
47
{
48
  return '\0';
49
}
50
 
51
static int
52
usetc_ (char *s, int c)
53
{
54
  return 1;
55
}
56
 
57
int
58
main()
59
{
60
  ucwidth = ucwidth_;
61
  ugetxc = ugetxc_;
62
  usetc = usetc_;
63
 
64
  /* ??? It is impossible to explicitly modify the hard frame pointer.
65
     This will run afoul of code in flow.c that declines to mark regs
66
     in eliminate_regs in regs_ever_used.  Apparently, we have to wait
67
     for reload to decide that it won't need a frame pointer before a
68
     variable can be allocated to %ebp.
69
 
70
     So save, restore, and clobber %ebp by hand.  */
71
 
72
  asm ("pushl %%ebp\n\t"
73
       "movl $-1, %%ebp\n\t"
74
       "pushl $0\n\t"
75
       "pushl $0\n\t"
76
       "pushl $0\n\t"
77
       "call %P0\n\t"
78
       "addl $12, %%esp\n\t"
79
       "popl %%ebp"
80
       : : "i"(ustrzcat) : "memory" );
81
 
82
  return 0;
83
}

powered by: WebSVN 2.1.0

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