* gcc.dg/ucnid-[23456].c: XFAIL on AIX.
[official-gcc.git] / gcc / testsuite / gcc.dg / asm-5.c
blob7b8d0f2f6c526dea87064e1af54ac0f686962e9a
1 /* Asm operands that are given as hard registers must keep the same
2 hard register all the way through compilation. Example derived
3 from glibc source. */
4 /* { dg-do compile { target alpha*-*-* } } */
5 /* { dg-options "-O2 -frename-registers -fcprop-registers" } */
6 /* { dg-final { scan-assembler "callsys1 .0 .19 .0 .16 .17" } } */
7 /* { dg-final { scan-assembler "callsys2 .0 .19 .0 .16 .17" } } */
9 struct stat {
10 int dummy;
13 struct kernel_stat {
14 int dummy;
17 extern int xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
18 extern int *__errno_location (void) __attribute__ ((__const__));
20 int
21 __fxstat (int vers, int fd, struct stat *buf)
23 struct kernel_stat kbuf;
24 int result;
26 if (vers == 0)
27 return
29 long _sc_ret, _sc_err;
31 register long _sc_0 __asm__("$0");
32 register long _sc_16 __asm__("$16");
33 register long _sc_17 __asm__("$17");
34 register long _sc_19 __asm__("$19");
35 _sc_0 = 91;
36 _sc_16 = (long) (fd);
37 _sc_17 = (long) (((struct kernel_stat *) buf));
38 __asm__("callsys1 %0 %1 %2 %3 %4"
39 : "=r"(_sc_0), "=r"(_sc_19)
40 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17)
41 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
42 "$22", "$23", "$24", "$25", "$27", "$28", "memory");
43 _sc_ret = _sc_0, _sc_err = _sc_19;
45 if (_sc_err)
47 (*__errno_location ()) = (_sc_ret);
48 _sc_ret = -1L;
50 _sc_ret;
51 });
53 result =
55 long _sc_ret, _sc_err;
57 register long _sc_0 __asm__("$0");
58 register long _sc_16 __asm__("$16");
59 register long _sc_17 __asm__("$17");
60 register long _sc_19 __asm__("$19");
61 _sc_0 = 91;
62 _sc_16 = (long) (fd);
63 _sc_17 = (long) ((&kbuf));
64 __asm__("callsys2 %0 %1 %2 %3 %4"
65 : "=r"(_sc_0), "=r"(_sc_19)
66 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17)
67 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
68 "$22", "$23", "$24", "$25", "$27", "$28", "memory");
69 _sc_ret = _sc_0, _sc_err = _sc_19;
71 if (_sc_err)
73 (*__errno_location ()) = (_sc_ret);
74 _sc_ret = -1L;
76 _sc_ret;
77 });
78 if (result == 0)
79 result = xstat_conv (vers, &kbuf, buf);
81 return result;