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