2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr37101.c
blob0675f0fc6e8cdc09df41faf2e79b793665ffcfb3
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -msse2 -ftree-vectorize -march=nocona" } */
4 typedef __SIZE_TYPE__ size_t;
5 extern void *malloc (size_t);
6 extern void free (void *);
8 typedef struct _Resource
10 struct _Resource *next;
11 unsigned int id;
12 } ResourceRec, *ResourcePtr;
14 typedef struct _ClientResource
16 ResourcePtr *resources;
17 int elements;
18 int buckets;
19 int hashsize;
20 } ClientResourceRec;
22 static ClientResourceRec clientTable[256];
23 int Hash (int, unsigned int);
25 void
26 RebuildTable (int client)
28 int j;
29 ResourcePtr res, next;
30 ResourcePtr **tails, *resources;
31 ResourcePtr **tptr, *rptr;
33 j = 2 * clientTable[client].buckets;
35 tails =
36 (ResourcePtr **) malloc ((unsigned long) (j * sizeof (ResourcePtr *)));
37 resources =
38 (ResourcePtr *) malloc ((unsigned long) (j * sizeof (ResourcePtr)));
40 for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
42 *rptr = ((ResourcePtr) ((void *) 0));
43 *tptr = rptr;
46 clientTable[client].hashsize++;
47 for (j = clientTable[client].buckets,
48 rptr = clientTable[client].resources; --j >= 0; rptr++)
50 for (res = *rptr; res; res = next)
52 next = res->next;
53 res->next = ((ResourcePtr) ((void *) 0));
54 tptr = &tails[Hash (client, res->id)];
55 **tptr = res;
56 *tptr = &res->next;
59 free ((void *) tails);
60 clientTable[client].buckets *= 2;
61 free ((void *) clientTable[client].resources);
62 clientTable[client].resources = resources;
65 /* { dg-final { scan-assembler-not "movlps" } } */