summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-03-24 17:16:39 +0000
committerDevang Patel <dpatel@apple.com>2008-03-24 17:16:39 +0000
commiteee4f8490b12d8e3f5cffbf8b9a0dde20a3efb4b (patch)
tree3709200043893cfcb4c318c02b4c5597951f1c2e /test
parent40ca2304a4c192f3075b8be9378dfec7d222b61d (diff)
downloadllvm-eee4f8490b12d8e3f5cffbf8b9a0dde20a3efb4b.tar.gz
llvm-eee4f8490b12d8e3f5cffbf8b9a0dde20a3efb4b.tar.bz2
llvm-eee4f8490b12d8e3f5cffbf8b9a0dde20a3efb4b.tar.xz
Add new test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CFrontend/2008-03-24-BitFiel-And-Alloca.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/CFrontend/2008-03-24-BitFiel-And-Alloca.c b/test/CFrontend/2008-03-24-BitFiel-And-Alloca.c
new file mode 100644
index 0000000000..d7c67f1fd4
--- /dev/null
+++ b/test/CFrontend/2008-03-24-BitFiel-And-Alloca.c
@@ -0,0 +1,87 @@
+// RUN: %llvmgcc -O2 -S %s -o - | not grep alloca
+enum {
+ PP_C,
+ PP_D,
+ PP_R,
+ PP_2D,
+ PP_1D,
+ PP_SR,
+ PP_S2D,
+ PP_S1D,
+ PP_SC
+};
+
+enum {
+ G_VP,
+ G_FP,
+ G_VS,
+ G_GS,
+ G_FS
+};
+
+enum {
+ G_NONE,
+ G_B,
+ G_R
+};
+
+typedef union _Key {
+ struct {
+ unsigned int count : 2;
+ unsigned int Aconst : 1;
+ unsigned int Bconst : 1;
+ unsigned int Cconst : 1;
+ unsigned int Xused : 1;
+ unsigned int Yused : 1;
+ unsigned int Zused : 1;
+ unsigned int Wused : 1;
+ unsigned int ttype : 3;
+ unsigned int scalar : 1;
+ unsigned int AType : 4;
+ unsigned int BType : 4;
+ unsigned int CType : 4;
+ unsigned int RType : 4;
+ unsigned int Size : 2;
+ unsigned int prec : 1;
+
+ unsigned int ASize : 2;
+ unsigned int BSize : 2;
+ unsigned int CSize : 2;
+ unsigned int tTex : 4;
+ unsigned int proj : 1;
+ unsigned int lod : 2;
+ unsigned int dvts : 1;
+ unsigned int uipad : 18;
+ } key_io;
+ struct {
+ unsigned int key0;
+ unsigned int key1;
+ } key;
+ unsigned long long lkey;
+} Key;
+
+static inline __attribute__ ((always_inline)) void foo(const Key iospec, int* ret)
+{
+ *ret=0;
+ if(((iospec.key_io.lod == G_B) &&
+ (iospec.key_io.ttype != G_VS) &&
+ (iospec.key_io.ttype != G_GS) &&
+ (iospec.key_io.ttype != G_FS)) ||
+
+ (((iospec.key_io.tTex == PP_C) ||
+ (iospec.key_io.tTex == PP_SC)) &&
+ ((iospec.key_io.tTex == PP_SR) ||
+ (iospec.key_io.tTex == PP_S2D) ||
+ (iospec.key_io.tTex == PP_S1D) ||
+ (iospec.key_io.tTex == PP_SC))))
+ *ret=1;
+}
+
+
+extern int bar(unsigned long long key_token2)
+{
+ int ret;
+ __attribute__ ((unused)) Key iospec = (Key) key_token2;
+ foo(iospec, &ret);
+ return ret;
+}