Add AMD SSE5 support; Add iterator over function arguments; Add stdarg_p, prototype_p...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / loop-3.c
blob782512f4c36318ac55306fed5dd3b7d4ab34b90c
1 /* PR target/11044 */
2 /* Originator: Tim McGrath <misty-@charter.net> */
3 /* Testcase contributed by Eric Botcazou <ebotcazou@libertysurf.fr> */
4 /* { dg-do run } */
5 /* { dg-require-effective-target ilp32 } */
6 /* { dg-options "-mtune=k6 -O3 -ffast-math -funroll-loops" } */
8 extern void *memset (void *, int, __SIZE_TYPE__);
9 extern void abort (void);
11 typedef struct
13 unsigned char colormod;
14 } entity_state_t;
16 typedef struct
18 int num_entities;
19 entity_state_t *entities;
20 } packet_entities_t;
22 typedef struct
24 double senttime;
25 float ping_time;
26 packet_entities_t entities;
27 } client_frame_t;
29 typedef enum
31 cs_free,
32 cs_server,
33 cs_zombie,
34 cs_connected,
35 cs_spawned
36 } sv_client_state_t;
38 typedef struct client_s
40 sv_client_state_t state;
41 int ping;
42 client_frame_t frames[64];
43 } client_t;
45 int CalcPing (client_t *cl)
47 float ping;
48 int count, i;
49 register client_frame_t *frame;
51 if (cl->state == cs_server)
52 return cl->ping;
53 ping = 0;
54 count = 0;
55 for (frame = cl->frames, i = 0; i < 64; i++, frame++) {
56 if (frame->ping_time > 0) {
57 ping += frame->ping_time;
58 count++;
61 if (!count)
62 return 9999;
63 ping /= count;
65 return ping * 1000;
68 int main(void)
70 client_t cl;
72 memset(&cl, 0, sizeof(cl));
74 cl.frames[0].ping_time = 1.0f;
76 if (CalcPing(&cl) != 1000)
77 abort();
79 return 0;