1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/* PR target/69706 */
/* Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> */
/* { dg-do run } */
/* { dg-options "-std=gnu99" }
/* { dg-require-effective-target lp64 } */
extern void abort (void);
/* Pass a 12-byte structure partially in slot #15 and on the stack. */
struct t_rgb { float r, g, b; };
void write_xpm (void *out, unsigned int flags, const char *title,
const char *legend, const char *label_x, const char *label_y,
int n_x, int n_y, float axis_x[], float axis_y[], float *mat[],
float lo, float hi, struct t_rgb rlo, struct t_rgb rhi)
{
register float f30 asm ("f30");
register float f31 asm ("f31");
if (f30 != 1.0f)
abort ();
if (f31 != 2.0f)
abort ();
if (rhi.r != 1.0f)
abort ();
if (rhi.g != 2.0f)
abort ();
if (rhi.b != 3.0f)
abort ();
}
/* Pass a 16-byte structure partially in slot #15 and on the stack. */
struct S1 { _Complex float f1; _Complex float f2; };
void f1 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
int p9, int p10, int p11, int p12, int p13, int p14, int p15,
struct S1 s1)
{
register float f30 asm ("f30");
register float f31 asm ("f31");
if (f30 != 4.0f)
abort ();
if (f31 != 5.0f)
abort ();
if (__real__ s1.f1 != 4.0f)
abort ();
if (__imag__ s1.f1 != 5.0f)
abort ();
if (__real__ s1.f2 != 6.0f)
abort ();
if (__imag__ s1.f2 != 7.0f)
abort ();
}
/* Pass a 16-byte structure partially in slot #15 and on the stack. */
struct S2 { double d1; double d2; };
void f2 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
int p9, int p10, int p11, int p12, int p13, int p14, int p15,
struct S2 s2)
{
register double d30 asm ("f30");
if (d30 != 1.0)
abort ();
if (s2.d1 != 1.0)
abort ();
if (s2.d2 != 2.0)
abort ();
}
/* Pass a 16-byte structure partially in slot #15 and on the stack. */
struct S3 { _Complex double d; };
void f3 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
int p9, int p10, int p11, int p12, int p13, int p14, int p15,
struct S3 s3)
{
register double d30 asm ("f30");
if (d30 != 3.0)
abort ();
if (__real__ s3.d != 3.0)
abort ();
if (__imag__ s3.d != 4.0)
abort ();
}
/* Pass a 16-byte structure entirely on the stack. */
struct S4 { long l; double d; };
void f4 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
int p9, int p10, int p11, int p12, int p13, int p14, int p15,
struct S4 s4)
{
if (s4.l != 5)
abort ();
if (s4.d != 6.0)
abort ();
}
#define PI 3.141592654
int main (void)
{
struct t_rgb lo = { -1.0f, -2.0f, -3.0f };
struct t_rgb hi = { 1.0f, 2.0f, 3.0f };
float arrf[1];
float *arrp[1];
struct S1 s1 = { 4.0f + 5.0fi, 6.0f + 7.0fi };
struct S2 s2 = { 1.0, 2.0 };
struct S3 s3 = { 3.0 + 4.0i };
struct S4 s4 = { 5, 6.0 };
register double d32 asm ("f32") = PI;
write_xpm (0, 0, "", "", "", "", 0, 0, arrf, arrf, arrp, 0.0f, 0.0f, lo, hi);
f1 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s1);
f2 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s2);
f3 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s3);
f4 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s4);
if (d32 != PI)
abort ();
return 0;
}
|