--- /dev/null
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep unwind
+
+struct S { ~S(); };
+
+int mightthrow();
+
+int test() {
+ S s;
+ mightthrow();
+}
+++ /dev/null
-// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep unwind
-
-struct S { ~S(); };
-
-int mightthrow();
-
-int test() {
- S s;
- mightthrow();
-}
--- /dev/null
+
+// RUN: %llvmgcc -xc++ -c -o /dev/null %s |& not grep WARNING
+
+struct iterator {
+ iterator();
+ iterator(const iterator &I);
+};
+
+iterator foo(const iterator &I) { return I; }
+
+void test() {
+ foo(iterator());
+}
+++ /dev/null
-
-// RUN: %llvmgcc -xc++ -c -o /dev/null %s |& not grep WARNING
-
-struct iterator {
- iterator();
- iterator(const iterator &I);
-};
-
-iterator foo(const iterator &I) { return I; }
-
-void test() {
- foo(iterator());
-}
--- /dev/null
+// RUN: %llvmgcc -xc++ -S -o - %s | grep {struct.X::Y}
+struct X {
+
+ struct Y {
+ Y();
+ };
+
+};
+
+X::Y::Y() {
+
+}
+++ /dev/null
-// RUN: %llvmgcc -xc++ -S -o - %s | grep {struct.X::Y}
-struct X {
-
- struct Y {
- Y();
- };
-
-};
-
-X::Y::Y() {
-
-}
--- /dev/null
+// RUN: %llvmgcc -xc++ -S -o - %s | not grep weak
+// The template should compile to linkonce linkage, not weak linkage.
+
+template<class T>
+void thefunc();
+
+template<class T>
+inline void thefunc() {}
+
+void test() {
+ thefunc<int>();
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc++ -S -o - %s | not grep weak
-// The template should compile to linkonce linkage, not weak linkage.
-
-template<class T>
-void thefunc();
-
-template<class T>
-inline void thefunc() {}
-
-void test() {
- thefunc<int>();
-}
-
--- /dev/null
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep getelementptr
+
+struct foo {
+ int array[100];
+ void *getAddr(unsigned i);
+};
+
+void *foo::getAddr(unsigned i) {
+ return &array[i];
+}
+++ /dev/null
-// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep getelementptr
-
-struct foo {
- int array[100];
- void *getAddr(unsigned i);
-};
-
-void *foo::getAddr(unsigned i) {
- return &array[i];
-}
--- /dev/null
+// The code generated for this testcase should be completely typesafe!
+// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | \
+// RUN: notcast
+
+struct contained {
+ unsigned X;
+ contained();
+};
+
+struct base {
+ unsigned A, B;
+};
+
+struct derived : public base {
+ contained _M_value_field;
+};
+
+int test() {
+ derived X;
+}
+
+++ /dev/null
-// The code generated for this testcase should be completely typesafe!
-// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | \
-// RUN: notcast
-
-struct contained {
- unsigned X;
- contained();
-};
-
-struct base {
- unsigned A, B;
-};
-
-struct derived : public base {
- contained _M_value_field;
-};
-
-int test() {
- derived X;
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | notcast
+
+struct A {
+ A() : i(0) {}
+ int getI() {return i;}
+ int i;
+};
+
+int f(int j)
+{
+ A a;
+ return j+a.getI();
+}
+++ /dev/null
-// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | notcast
-
-struct A {
- A() : i(0) {}
- int getI() {return i;}
- int i;
-};
-
-int f(int j)
-{
- A a;
- return j+a.getI();
-}
--- /dev/null
+// RUN: %llvmgcc -xc++ -S -o - %s | not grep { constant }
+
+extern int X;
+const int Y = X;
+const int* foo() { return &Y; }
+
+++ /dev/null
-// RUN: %llvmgcc -xc++ -S -o - %s | not grep { constant }
-
-extern int X;
-const int Y = X;
-const int* foo() { return &Y; }
-
--- /dev/null
+// RUN: %llvmgcc -xc++ -c -o - %s | llvm-dis | grep _ZN11AccessFlags6strlenEv
+
+struct AccessFlags {
+ void strlen();
+};
+
+void AccessFlags::strlen() { }
+
+++ /dev/null
-// RUN: %llvmgcc -xc++ -c -o - %s | llvm-dis | grep _ZN11AccessFlags6strlenEv
-
-struct AccessFlags {
- void strlen();
-};
-
-void AccessFlags::strlen() { }
-
--- /dev/null
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep callDefaultCtor | \
+// RUN: not grep declare
+
+// This is a testcase for LLVM PR445, which was a problem where the
+// instantiation of callDefaultCtor was not being emitted correctly.
+
+struct Pass {};
+
+template<typename PassName>
+Pass *callDefaultCtor() { return new Pass(); }
+
+void foo(Pass *(*C)());
+
+struct basic_string {
+ bool empty() const { return true; }
+};
+
+
+bool foo2(basic_string &X) {
+ return X.empty();
+}
+void baz() { foo(callDefaultCtor<Pass>); }
+
+++ /dev/null
-// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep callDefaultCtor | \
-// RUN: not grep declare
-
-// This is a testcase for LLVM PR445, which was a problem where the
-// instantiation of callDefaultCtor was not being emitted correctly.
-
-struct Pass {};
-
-template<typename PassName>
-Pass *callDefaultCtor() { return new Pass(); }
-
-void foo(Pass *(*C)());
-
-struct basic_string {
- bool empty() const { return true; }
-};
-
-
-bool foo2(basic_string &X) {
- return X.empty();
-}
-void baz() { foo(callDefaultCtor<Pass>); }
-
--- /dev/null
+/* RUN: %llvmgcc -xc %s -S -o - | grep -v alloca | not grep bitcast
+ */
+
+void test(int* array, long long N) {
+ array[N] = N[array] = 33;
+}
+
+++ /dev/null
-/* RUN: %llvmgcc -xc %s -S -o - | grep -v alloca | not grep bitcast
- */
-
-void test(int* array, long long N) {
- array[N] = N[array] = 33;
-}
-
--- /dev/null
+/* RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep __builtin_
+ *
+ * __builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp
+ * just like explicit setjmp/longjmp calls are.
+ */
+
+void jumpaway(int *ptr) {
+ __builtin_longjmp(ptr,1);
+}
+
+int main(void) {
+ __builtin_setjmp(0);
+ jumpaway(0);
+}
+++ /dev/null
-/* RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep __builtin_
- *
- * __builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp
- * just like explicit setjmp/longjmp calls are.
- */
-
-void jumpaway(int *ptr) {
- __builtin_longjmp(ptr,1);
-}
-
-int main(void) {
- __builtin_setjmp(0);
- jumpaway(0);
-}
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o %t.o
+
+int test(_Bool pos, _Bool color) {
+ return 0;
+ return (pos && color);
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o %t.o
-
-int test(_Bool pos, _Bool color) {
- return 0;
- return (pos && color);
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
+
+// This should be turned into a tasty getelementptr instruction, not a nasty
+// series of casts and address arithmetic.
+
+char Global[100];
+
+char *test1(unsigned i) {
+ return &Global[i];
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
-
-// This should be turned into a tasty getelementptr instruction, not a nasty
-// series of casts and address arithmetic.
-
-char Global[100];
-
-char *test1(unsigned i) {
- return &Global[i];
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
+
+char *test(char* C) {
+ return C-1; // Should turn into a GEP
+}
+
+int *test2(int* I) {
+ return I-1;
+}
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
-
-char *test(char* C) {
- return C-1; // Should turn into a GEP
-}
-
-int *test2(int* I) {
- return I-1;
-}
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
+
+int *test(int *X, int Y) {
+ return X + Y;
+}
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr
-
-int *test(int *X, int Y) {
- return X + Y;
-}
--- /dev/null
+// RUN: %llvmgcc -xc %s -S -o /dev/null |& not grep warning
+
+struct item {
+ short delta[4];
+};
+
+int TEST(int nt) {
+ register struct item *aa;
+ aa[nt].delta;
+ return 1;
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc %s -S -o /dev/null |& not grep warning
-
-struct item {
- short delta[4];
-};
-
-int TEST(int nt) {
- register struct item *aa;
- aa[nt].delta;
- return 1;
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep dead_function
+
+extern __inline__ void dead_function() {}
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep dead_function
-
-extern __inline__ void dead_function() {}
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memcpy
+
+struct X { int V[10000]; };
+struct X Global1, Global2;
+void test() {
+ Global2 = Global1;
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memcpy
-
-struct X { int V[10000]; };
-struct X Global1, Global2;
-void test() {
- Global2 = Global1;
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.*address | count 4
+
+void *test1() {
+ return __builtin_return_address(1);
+}
+void *test2() {
+ return __builtin_frame_address(0);
+}
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.*address | count 4
-
-void *test1() {
- return __builtin_return_address(1);
-}
-void *test2() {
- return __builtin_frame_address(0);
-}
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llc
+
+#include <stdarg.h>
+
+float test(int X, ...) {
+ va_list ap;
+ float F;
+ va_start(ap, X);
+ F = va_arg(ap, float);
+ return F;
+}
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llc
-
-#include <stdarg.h>
-
-float test(int X, ...) {
- va_list ap;
- float F;
- va_start(ap, X);
- F = va_arg(ap, float);
- return F;
-}
--- /dev/null
+// RUN: %llvmgcc -O3 -xc %s -c -o - | llvm-dis | not grep builtin
+
+void zsqrtxxx(float num) {
+ num = sqrt(num);
+}
+
+++ /dev/null
-// RUN: %llvmgcc -O3 -xc %s -c -o - | llvm-dis | not grep builtin
-
-void zsqrtxxx(float num) {
- num = sqrt(num);
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep constant
+
+extern const int a[]; // 'a' should be marked constant even though it's external!
+int foo () {
+ return a[0];
+}
+
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep constant
-
-extern const int a[]; // 'a' should be marked constant even though it's external!
-int foo () {
- return a[0];
-}
-
--- /dev/null
+// RUN: %llvmgcc -xc -std=c99 %s -c -o - | llvm-dis | grep -v llvm.isunordered | not grep call
+
+#include <math.h>
+
+_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);
+}
+++ /dev/null
-// RUN: %llvmgcc -xc -std=c99 %s -c -o - | llvm-dis | grep -v llvm.isunordered | not grep call
-
-#include <math.h>
-
-_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);
-}
--- /dev/null
+// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep -v div
+
+int Diff(int *P, int *Q) { return P-Q; }
+++ /dev/null
-// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep -v div
-
-int Diff(int *P, int *Q) { return P-Q; }