Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -O2 -emit-llvm %s -o - | not grep alloca
      2 // RUN: %clang_cc1 -m32 -O2 -emit-llvm %s -o - | not grep {store }
      3 
      4 enum {
      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 
     16 enum {
     17  G_VP,
     18  G_FP,
     19  G_VS,
     20  G_GS,
     21  G_FS
     22 };
     23 
     24 enum {
     25  G_NONE,
     26  G_B,
     27  G_R
     28 };
     29 
     30 typedef 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 
     65 static void foo(const Key iospec, int* ret)
     66 {
     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 
     83 extern 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 }
     90