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