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