[cfe-commits] r136153 - in /cfe/trunk/test/CodeGen: 2002-02-18-64bitConstant.c 2002-05-24-Alloca.c 2002-06-25-FWriteInterfaceFailure.c 2002-07-14-MiscTests3.c 2002-08-02-UnionTest.c 2003-08-21-WideString.c 2003-10-02-UnionLValueError.c 2004-02-13-IllegalVararg.c 2004-02-20-Builtins.c 2004-06-17-UnorderedCompares.c 2005-01-02-VAArgError-ICE.c 2005-04-09-ComplexOps.c 2005-07-20-SqrtNoErrno.c 2006-01-13-Includes.c 2007-09-12-PragmaPack.c 2007-09-27-ComplexIntCompare.c 2008-01-04-WideBitfield.c 2008-12-23-AsmIntPointerTie.c

Eric Christopher echristo at apple.com
Tue Jul 26 14:42:32 PDT 2011


Author: echristo
Date: Tue Jul 26 16:42:32 2011
New Revision: 136153

URL: http://llvm.org/viewvc/llvm-project?rev=136153&view=rev
Log:
Migrate:

       CodeGen/2003-08-21-WideString.c
       CodeGen/2003-10-02-UnionLValueError.c
       CodeGen/2004-02-20-Builtins.c
       CodeGen/2008-01-04-WideBitfield.c
       CodeGen/2002-07-14-MiscTests3.c
       CodeGen/2005-04-09-ComplexOps.c
       CodeGen/2008-12-23-AsmIntPointerTie.c
       CodeGen/2005-07-20-SqrtNoErrno.c
       CodeGen/2005-01-02-VAArgError-ICE.c
       CodeGen/2004-06-17-UnorderedCompares.c
       CodeGen/2002-06-25-FWriteInterfaceFailure.c
       CodeGen/2002-02-18-64bitConstant.c
       CodeGen/2002-05-24-Alloca.c
       CodeGen/2006-01-13-Includes.c
       CodeGen/2007-09-27-ComplexIntCompare.c
       CodeGen/2004-02-13-IllegalVararg.c
       CodeGen/2007-09-12-PragmaPack.c
       CodeGen/2002-08-02-UnionTest.c

from test/FrontendC with changes to remove header file includes.

Added:
    cfe/trunk/test/CodeGen/2002-02-18-64bitConstant.c
    cfe/trunk/test/CodeGen/2002-05-24-Alloca.c
    cfe/trunk/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c
    cfe/trunk/test/CodeGen/2002-07-14-MiscTests3.c
    cfe/trunk/test/CodeGen/2002-08-02-UnionTest.c
    cfe/trunk/test/CodeGen/2003-08-21-WideString.c
    cfe/trunk/test/CodeGen/2003-10-02-UnionLValueError.c
    cfe/trunk/test/CodeGen/2004-02-13-IllegalVararg.c
    cfe/trunk/test/CodeGen/2004-02-20-Builtins.c
    cfe/trunk/test/CodeGen/2004-06-17-UnorderedCompares.c
    cfe/trunk/test/CodeGen/2005-01-02-VAArgError-ICE.c
    cfe/trunk/test/CodeGen/2005-04-09-ComplexOps.c
    cfe/trunk/test/CodeGen/2005-07-20-SqrtNoErrno.c
    cfe/trunk/test/CodeGen/2006-01-13-Includes.c
    cfe/trunk/test/CodeGen/2007-09-12-PragmaPack.c
    cfe/trunk/test/CodeGen/2007-09-27-ComplexIntCompare.c
    cfe/trunk/test/CodeGen/2008-01-04-WideBitfield.c
    cfe/trunk/test/CodeGen/2008-12-23-AsmIntPointerTie.c

Added: cfe/trunk/test/CodeGen/2002-02-18-64bitConstant.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2002-02-18-64bitConstant.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2002-02-18-64bitConstant.c (added)
+++ cfe/trunk/test/CodeGen/2002-02-18-64bitConstant.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+/* GCC wasn't handling 64 bit constants right fixed */
+
+int printf(const char * restrict format, ...);
+
+int main() {
+  long long Var = 123455678902ll;
+  printf("%lld\n", Var);
+}

Added: cfe/trunk/test/CodeGen/2002-05-24-Alloca.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2002-05-24-Alloca.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2002-05-24-Alloca.c (added)
+++ cfe/trunk/test/CodeGen/2002-05-24-Alloca.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+typedef __SIZE_TYPE__ size_t;
+void *alloca(size_t size);
+char *strcpy(char *restrict s1, const char *restrict s2);
+int puts(const char *s);
+int main(int argc, char **argv) {
+  char *C = (char*)alloca(argc);
+  strcpy(C, argv[0]);
+  puts(C);
+}

Added: cfe/trunk/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c (added)
+++ cfe/trunk/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+typedef struct _IO_FILE FILE;
+extern FILE *stderr;
+int fprintf(FILE * restrict stream, const char * restrict format, ...);
+
+void test() {
+  fprintf(stderr, "testing\n");
+}

Added: cfe/trunk/test/CodeGen/2002-07-14-MiscTests3.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2002-07-14-MiscTests3.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2002-07-14-MiscTests3.c (added)
+++ cfe/trunk/test/CodeGen/2002-07-14-MiscTests3.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,182 @@
+// RUN: %clang_cc1 -w -emit-llvm %s  -o /dev/null
+
+void *malloc(unsigned);
+int puts(const char *s);
+
+struct FunStructTest {
+  int Test1;
+  char *Pointer;
+  int Array[12];
+};
+
+struct SubStruct {
+  short X, Y;
+};
+
+struct Quad {
+  int w;
+  struct SubStruct SS;
+  struct SubStruct *SSP;
+  char c;
+  int y;
+};
+
+struct Quad GlobalQuad = { 4, {1, 2}, 0, 3, 156 };
+
+typedef int (*FuncPtr)(int);
+
+unsigned PtrFunc(int (*Func)(int), int X) {
+  return Func(X);
+}
+
+char PtrFunc2(FuncPtr FuncTab[30], int Num) {
+  return FuncTab[Num]('b');
+}
+
+extern char SmallArgs2(char w, char x, long long Zrrk, char y, char z);
+extern int SomeFunc(void);
+char SmallArgs(char w, char x, char y, char z) {
+  SomeFunc();
+  return SmallArgs2(w-1, x+1, y, z, w);
+}
+
+static int F0(struct Quad Q, int i) {              /* Pass Q by value */
+  struct Quad R;
+  if (i) R.SS = Q.SS;
+  Q.SSP = &R.SS;
+  Q.w = Q.y = Q.c = 1;
+  return Q.SS.Y + i + R.y - Q.c;
+}
+
+int F1(struct Quad *Q, int i) {             /* Pass Q by address */
+  struct Quad R;
+#if 0
+  if (i) R.SS = Q->SS;
+#else
+  if (i) R = *Q;
+#endif
+  Q->w = Q->y = Q->c = 1;
+  return Q->SS.Y+i+R.y-Q->c;
+}
+
+
+int BadFunc(float Val) {
+  int Result;
+  if (Val > 12.345) Result = 4;
+  return Result;     /* Test use of undefined value */
+}
+
+int RealFunc(void) {
+  return SomeUndefinedFunction(1, 4, 5);
+}
+
+extern int EF1(int *, char *, int *);
+
+int Func(int Param, long long Param2) {
+  int Result = Param;
+
+  {{{{
+      char c; int X;
+      EF1(&Result, &c, &X);
+    }}}
+
+    {   // c & X are duplicate names!
+      char c; int X;
+      EF1(&Result, &c, &X);
+    }
+
+  }
+  return Result;
+}
+
+
+short FunFunc(long long x, char z) {
+  return x+z;
+}
+
+unsigned castTest(int X) { return X; }
+
+double TestAdd(double X, float Y) {
+  return X+Y+.5;
+}
+
+int func(int i, int j) {
+  while (i != 20)
+    i += 2;
+
+  j += func(2, i);
+  return (i * 3 + j*2)*j;
+}
+
+int SumArray(int Array[], int Num) {
+  int i, Result = 0;
+  for (i = 0; i < Num; ++i)
+    Result += Array[i];
+
+  return Result;
+}
+
+int ArrayParam(int Values[100]) {
+  return EF1((int*)Values[50], (char*)1, &Values[50]);
+}
+
+int ArrayToSum(void) {
+  int A[100], i;
+  for (i = 0; i < 100; ++i)
+    A[i] = i*4;
+
+  return A[A[0]]; //SumArray(A, 100);
+}
+
+
+int ExternFunc(long long, unsigned*, short, unsigned char);
+
+int main(int argc, char *argv[]) {
+  unsigned i;
+  puts("Hello world!\n");
+
+  ExternFunc(-1, 0, (short)argc, 2);
+  //func(argc, argc);
+
+  for (i = 0; i < 10; i++)
+    puts(argv[3]);
+  return 0;
+}
+
+double MathFunc(double X, double Y, double Z,
+                double AA, double BB, double CC, double DD,
+                double EE, double FF, double GG, double HH,
+                double aAA, double aBB, double aCC, double aDD,
+                double aEE, double aFF) {
+  return X + Y + Z + AA + BB + CC + DD + EE + FF + GG + HH
+       + aAA + aBB + aCC + aDD + aEE + aFF;
+}
+
+
+
+void strcpy(char *s1, char *s2) {
+  while (*s1++ = *s2++);
+}
+
+void strcat(char *s1, char *s2) {
+  while (*s1++);
+  s1--;
+  while (*s1++ = *s2++);
+}
+
+int strcmp(char *s1, char *s2) {
+  while (*s1++ == *s2++);
+  if (*s1 == 0) {
+    if (*s2 == 0) {
+      return 0;
+    } else {
+      return -1;
+    }
+  } else {
+    if (*s2 == 0) {
+      return 1;
+    } else {
+      return (*(--s1) - *(--s2));
+    }
+  }
+}

Added: cfe/trunk/test/CodeGen/2002-08-02-UnionTest.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2002-08-02-UnionTest.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2002-08-02-UnionTest.c (added)
+++ cfe/trunk/test/CodeGen/2002-08-02-UnionTest.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+/* In this testcase, the return value of foo() is being promoted to a register
+ * which breaks stuff
+ */
+int printf(const char * restrict format, ...);
+
+union X { char X; void *B; int a, b, c, d;};
+
+union X foo() {
+  union X Global;
+  Global.B = (void*)123;   /* Interesting part */
+  return Global;
+}
+
+int main() {
+  union X test = foo();
+  printf("0x%p", test.B);
+}

Added: cfe/trunk/test/CodeGen/2003-08-21-WideString.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2003-08-21-WideString.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2003-08-21-WideString.c (added)
+++ cfe/trunk/test/CodeGen/2003-08-21-WideString.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
+typedef __WCHAR_TYPE__ wchar_t;
+#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
+  || defined(_M_X64) || defined(SHORT_WCHAR)
+  #define WCHAR_T_TYPE unsigned short
+#elif defined(__sun) || defined(__AuroraUX__)
+  #define WCHAR_T_TYPE long
+#else /* Solaris or AuroraUX. */
+  #define WCHAR_T_TYPE int
+#endif
+
+struct {
+  wchar_t *name;
+} syms = { L"NUL" };

Added: cfe/trunk/test/CodeGen/2003-10-02-UnionLValueError.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2003-10-02-UnionLValueError.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2003-10-02-UnionLValueError.c (added)
+++ cfe/trunk/test/CodeGen/2003-10-02-UnionLValueError.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
+
+int sprintf(char * restrict str, const char * restrict format, ...);
+union U{
+  int i[8];
+  char s[80];
+};
+
+void format_message(char *buffer, union U *u) {
+  sprintf(buffer, u->s);
+}

Added: cfe/trunk/test/CodeGen/2004-02-13-IllegalVararg.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2004-02-13-IllegalVararg.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2004-02-13-IllegalVararg.c (added)
+++ cfe/trunk/test/CodeGen/2004-02-13-IllegalVararg.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1  %s -w -emit-llvm -o -
+
+float test(int X, ...) {
+  __builtin_va_list ap;
+  float F;
+  __builtin_va_start(ap, X);
+  F = __builtin_va_arg(ap, float);
+  return F;
+}

Added: cfe/trunk/test/CodeGen/2004-02-20-Builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2004-02-20-Builtins.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2004-02-20-Builtins.c (added)
+++ cfe/trunk/test/CodeGen/2004-02-20-Builtins.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1  %s -emit-llvm -o - | not grep builtin
+double sqrt(double x);
+void zsqrtxxx(float num) {
+   num = sqrt(num);
+}

Added: cfe/trunk/test/CodeGen/2004-06-17-UnorderedCompares.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2004-06-17-UnorderedCompares.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2004-06-17-UnorderedCompares.c (added)
+++ cfe/trunk/test/CodeGen/2004-06-17-UnorderedCompares.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1  -std=c99 %s -emit-llvm -o - | grep -v llvm.isunordered | not grep call
+
+_Bool A, B, C, D, E, F;
+void TestF(float X, float Y) {
+  A = __builtin_isgreater(X, Y);
+  B = __builtin_isgreaterequal(X, Y);
+  C = __builtin_isless(X, Y);
+  D = __builtin_islessequal(X, Y);
+  E = __builtin_islessgreater(X, Y);
+  F = __builtin_isunordered(X, Y);
+}
+void TestD(double X, double Y) {
+  A = __builtin_isgreater(X, Y);
+  B = __builtin_isgreaterequal(X, Y);
+  C = __builtin_isless(X, Y);
+  D = __builtin_islessequal(X, Y);
+  E = __builtin_islessgreater(X, Y);
+  F = __builtin_isunordered(X, Y);
+}

Added: cfe/trunk/test/CodeGen/2005-01-02-VAArgError-ICE.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2005-01-02-VAArgError-ICE.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2005-01-02-VAArgError-ICE.c (added)
+++ cfe/trunk/test/CodeGen/2005-01-02-VAArgError-ICE.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,9 @@
+// This file is erroneous, but should not cause the compiler to ICE.
+// PR481
+// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
+
+int flags(int a, int b, ...) {
+        __builtin_va_list         args;
+        __builtin_va_start(args,a);       // not the last named arg
+        foo(args);
+}

Added: cfe/trunk/test/CodeGen/2005-04-09-ComplexOps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2005-04-09-ComplexOps.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2005-04-09-ComplexOps.c (added)
+++ cfe/trunk/test/CodeGen/2005-04-09-ComplexOps.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -emit-llvm -o -
+
+#define I 1.0iF
+
+double __complex test(double X) { return ~-(X*I); }
+
+_Bool EQ(double __complex A, double __complex B) { return A == B; }
+_Bool NE(double __complex A, double __complex B) { return A != B; }

Added: cfe/trunk/test/CodeGen/2005-07-20-SqrtNoErrno.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2005-07-20-SqrtNoErrno.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2005-07-20-SqrtNoErrno.c (added)
+++ cfe/trunk/test/CodeGen/2005-07-20-SqrtNoErrno.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// llvm.sqrt has undefined behavior on negative inputs, so it is
+// inappropriate to translate C/C++ sqrt to this.
+float sqrtf(float x);
+float foo(float X) {
+  // CHECK: foo
+  // CHECK: call float @sqrtf(float %tmp) readnone
+  // Check that this is marked readonly when errno is ignored.
+  return sqrtf(X);
+}

Added: cfe/trunk/test/CodeGen/2006-01-13-Includes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2006-01-13-Includes.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2006-01-13-Includes.c (added)
+++ cfe/trunk/test/CodeGen/2006-01-13-Includes.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -g -emit-llvm -o - | FileCheck %s
+// PR676
+
+int printf(const char * restrict format, ...);
+
+void test() {
+  printf("Hello World\n");
+}
+
+// CHECK: test/CodeGen

Added: cfe/trunk/test/CodeGen/2007-09-12-PragmaPack.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2007-09-12-PragmaPack.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2007-09-12-PragmaPack.c (added)
+++ cfe/trunk/test/CodeGen/2007-09-12-PragmaPack.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+
+#pragma pack(push, 1)
+typedef struct
+{
+        uint32_t        a;
+} foo;
+
+typedef struct {
+        uint8_t         major;
+        uint8_t         minor;
+        uint16_t        build;
+} VERSION;
+
+typedef struct {
+        uint8_t       a[5];
+        VERSION       version;
+        uint8_t       b;
+        foo           d;
+        uint32_t      guard;
+} bar;
+#pragma pack(pop)
+
+
+unsigned barsize(void) {
+  // CHECK: ret i32 18
+  return sizeof(bar);
+}

Added: cfe/trunk/test/CodeGen/2007-09-27-ComplexIntCompare.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2007-09-27-ComplexIntCompare.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2007-09-27-ComplexIntCompare.c (added)
+++ cfe/trunk/test/CodeGen/2007-09-27-ComplexIntCompare.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+// PR1708
+
+void __attribute__((noreturn)) abort(void);
+
+struct s { _Complex unsigned short x; };
+struct s gs = { 100 + 200i };
+struct s __attribute__((noinline)) foo (void) { return gs; }
+
+int main ()
+{
+  if (foo ().x != gs.x)
+    abort ();
+  exit (0);
+}

Added: cfe/trunk/test/CodeGen/2008-01-04-WideBitfield.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-01-04-WideBitfield.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2008-01-04-WideBitfield.c (added)
+++ cfe/trunk/test/CodeGen/2008-01-04-WideBitfield.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s
+// PR1386
+typedef unsigned long uint64_t;
+struct X {
+  unsigned char pad : 4;
+  uint64_t a : 64;
+} __attribute__((packed)) x;
+
+uint64_t f(void)
+{
+  return x.a;
+}

Added: cfe/trunk/test/CodeGen/2008-12-23-AsmIntPointerTie.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-12-23-AsmIntPointerTie.c?rev=136153&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2008-12-23-AsmIntPointerTie.c (added)
+++ cfe/trunk/test/CodeGen/2008-12-23-AsmIntPointerTie.c Tue Jul 26 16:42:32 2011
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -emit-llvm -O1 -o -
+
+typedef long intptr_t;
+int test(void *b) {
+ intptr_t a;
+ __asm__ __volatile__ ("%0 %1 " : "=r" (a): "0" (b));
+  return a;
+}





More information about the cfe-commits mailing list