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