blob: 5fac2a9ca5565fa95bde03aa9e2f89a2f106c67d [file] [log] [blame]
Devang Pateleee4f842008-03-24 17:16:39 +00001// RUN: %llvmgcc -O2 -S %s -o - | not grep alloca
Dale Johannesen8ac9ea82009-06-23 18:34:37 +00002// RUN: %llvmgcc -m32 -O2 -S %s -o - | grep store | not grep {align 8}
Bill Wendling67b9a2a2008-12-31 08:26:55 +00003
Devang Pateleee4f842008-03-24 17:16:39 +00004enum {
5 PP_C,
6 PP_D,
7 PP_R,
8 PP_2D,
9 PP_1D,
10 PP_SR,
11 PP_S2D,
12 PP_S1D,
13 PP_SC
14};
15
16enum {
17 G_VP,
18 G_FP,
19 G_VS,
20 G_GS,
21 G_FS
22};
23
24enum {
25 G_NONE,
26 G_B,
27 G_R
28};
29
30typedef union _Key {
31 struct {
32 unsigned int count : 2;
33 unsigned int Aconst : 1;
34 unsigned int Bconst : 1;
35 unsigned int Cconst : 1;
36 unsigned int Xused : 1;
37 unsigned int Yused : 1;
38 unsigned int Zused : 1;
39 unsigned int Wused : 1;
40 unsigned int ttype : 3;
41 unsigned int scalar : 1;
42 unsigned int AType : 4;
43 unsigned int BType : 4;
44 unsigned int CType : 4;
45 unsigned int RType : 4;
46 unsigned int Size : 2;
47 unsigned int prec : 1;
48
49 unsigned int ASize : 2;
50 unsigned int BSize : 2;
51 unsigned int CSize : 2;
52 unsigned int tTex : 4;
53 unsigned int proj : 1;
54 unsigned int lod : 2;
55 unsigned int dvts : 1;
56 unsigned int uipad : 18;
57 } key_io;
58 struct {
59 unsigned int key0;
60 unsigned int key1;
61 } key;
62 unsigned long long lkey;
63} Key;
64
Chris Lattnerd62fc882009-01-09 05:49:27 +000065static void foo(const Key iospec, int* ret)
Devang Pateleee4f842008-03-24 17:16:39 +000066{
67 *ret=0;
68 if(((iospec.key_io.lod == G_B) &&
69 (iospec.key_io.ttype != G_VS) &&
70 (iospec.key_io.ttype != G_GS) &&
71 (iospec.key_io.ttype != G_FS)) ||
72
73 (((iospec.key_io.tTex == PP_C) ||
74 (iospec.key_io.tTex == PP_SC)) &&
75 ((iospec.key_io.tTex == PP_SR) ||
76 (iospec.key_io.tTex == PP_S2D) ||
77 (iospec.key_io.tTex == PP_S1D) ||
78 (iospec.key_io.tTex == PP_SC))))
79 *ret=1;
80}
81
82
83extern int bar(unsigned long long key_token2)
84{
85 int ret;
86 __attribute__ ((unused)) Key iospec = (Key) key_token2;
87 foo(iospec, &ret);
88 return ret;
89}