Check in LLVM r95781.
diff --git a/test/CodeGen/CBackend/2002-05-16-NameCollide.ll b/test/CodeGen/CBackend/2002-05-16-NameCollide.ll
new file mode 100644
index 0000000..0b06041
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-05-16-NameCollide.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c
+
+; Make sure that global variables do not collide if they have the same name,
+; but different types.
+
+@X = global i32 5               ; <i32*> [#uses=0]
+@X.upgrd.1 = global i64 7               ; <i64*> [#uses=0]
+
diff --git a/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll b/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll
new file mode 100644
index 0000000..a9f54e4
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s -march=c
+
+; This case was emitting code that looked like this:
+; ...
+;   llvm_BB1:       /* no statement here */
+; }
+; 
+; Which the Sun C compiler rejected, so now we are sure to put a return 
+; instruction in there if the basic block is otherwise empty.
+;
+define void @test() {
+        br label %BB1
+
+BB2:            ; preds = %BB2
+        br label %BB2
+
+BB1:            ; preds = %0
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll b/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll
new file mode 100644
index 0000000..2afb1a0
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=c
+
+; Test const pointer refs & forward references
+
+@t3 = global i32* @t1           ; <i32**> [#uses=0]
+@t1 = global i32 4              ; <i32*> [#uses=1]
+
diff --git a/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll b/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll
new file mode 100644
index 0000000..b71cf07
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c
+
+global i32* bitcast (float* @2 to i32*)   ;; Forward numeric reference
+global float* @2                       ;; Duplicate forward numeric reference
+global float 0.0
+
+@array = constant [2 x i32] [ i32 12, i32 52 ]
+@arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0)
diff --git a/test/CodeGen/CBackend/2002-08-19-DataPointer.ll b/test/CodeGen/CBackend/2002-08-19-DataPointer.ll
new file mode 100644
index 0000000..b5a1f0b
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-19-DataPointer.ll
@@ -0,0 +1,4 @@
+; RUN: llc < %s -march=c
+
+@sptr1 = global [11 x i8]* @somestr         ;; Forward ref to a constant
+@somestr = constant [11 x i8] c"hello world"
diff --git a/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll b/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll
new file mode 100644
index 0000000..10b9fe2
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+@fptr = global void ()* @f       ;; Forward ref method defn
+declare void @f()               ;; External method
+
diff --git a/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll b/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll
new file mode 100644
index 0000000..0827423
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+@array = constant [2 x i32] [ i32 12, i32 52 ]          ; <[2 x i32]*> [#uses=1]
+@arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0)         ; <i32**> [#uses=0]
+
diff --git a/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll b/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll
new file mode 100644
index 0000000..3b2085c
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll
@@ -0,0 +1,3 @@
+; RUN: llc < %s -march=c
+
+@MyIntList = external global { \2*, i32 }
diff --git a/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll b/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll
new file mode 100644
index 0000000..59aafd5
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=c
+
+; The C Writer bombs on this testcase because it tries the print the prototype
+; for the test function, which tries to print the argument name.  The function
+; has not been incorporated into the slot calculator, so after it does the name
+; lookup, it tries a slot calculator lookup, which fails.
+
+define i32 @test(i32) {
+        ret i32 0
+}
diff --git a/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll b/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll
new file mode 100644
index 0000000..6c4d629
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s -march=c
+
+; Indirect function call test... found by Joel & Brian
+;
+
+@taskArray = external global i32*               ; <i32**> [#uses=1]
+
+define void @test(i32 %X) {
+        %Y = add i32 %X, -1             ; <i32> [#uses=1]
+        %cast100 = sext i32 %Y to i64           ; <i64> [#uses=1]
+        %gep100 = getelementptr i32** @taskArray, i64 %cast100          ; <i32**> [#uses=1]
+        %fooPtr = load i32** %gep100            ; <i32*> [#uses=1]
+        %cast101 = bitcast i32* %fooPtr to void (i32)*          ; <void (i32)*> [#uses=1]
+        call void %cast101( i32 1000 )
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll b/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll
new file mode 100644
index 0000000..1187a37
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c
+
+; This testcase fails because the C backend does not arrange to output the 
+; contents of a structure type before it outputs the structure type itself.
+
+@Y = external global { { i32 } }                ; <{ { i32 } }*> [#uses=0]
+@X = external global { float }          ; <{ float }*> [#uses=0]
+
diff --git a/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll b/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll
new file mode 100644
index 0000000..021adb9
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=c
+
+define void @test() {
+        %X = alloca [4 x i32]           ; <[4 x i32]*> [#uses=0]
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll b/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll
new file mode 100644
index 0000000..e915cd2
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll
@@ -0,0 +1,6 @@
+; RUN: llc < %s -march=c
+
+
+declare void @foo(...)
+
+
diff --git a/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll b/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll
new file mode 100644
index 0000000..2563d8c
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll
@@ -0,0 +1,6 @@
+; RUN: llc < %s -march=c
+
+%MPI_Comm = type %struct.Comm*
+%struct.Comm = type opaque
+@thing = global %MPI_Comm* null         ; <%MPI_Comm**> [#uses=0]
+
diff --git a/test/CodeGen/CBackend/2002-10-16-External.ll b/test/CodeGen/CBackend/2002-10-16-External.ll
new file mode 100644
index 0000000..2cdd15c
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-10-16-External.ll
@@ -0,0 +1,4 @@
+; RUN: llc < %s -march=c
+
+@bob = external global i32              ; <i32*> [#uses=0]
+
diff --git a/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll b/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll
new file mode 100644
index 0000000..54e0aa6
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=c
+
+        %BitField = type i32
+        %tokenptr = type i32*
+
+define void @test() {
+        %pmf1 = alloca %tokenptr (%tokenptr, i8*)*              ; <%tokenptr (%tokenptr, i8*)**> [#uses=0]
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll b/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll
new file mode 100644
index 0000000..82d594f
--- /dev/null
+++ b/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll
@@ -0,0 +1,11 @@
+; RUN: llc < %s -march=c
+
+@testString = internal constant [18 x i8] c"Escaped newline\5Cn\00"             ; <[18 x i8]*> [#uses=1]
+
+declare i32 @printf(i8*, ...)
+
+define i32 @main() {
+        call i32 (i8*, ...)* @printf( i8* getelementptr ([18 x i8]* @testString, i64 0, i64 0) )                ; <i32>:1 [#uses=0]
+        ret i32 0
+}
+
diff --git a/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll b/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll
new file mode 100644
index 0000000..92d582d
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c
+
+; Apparently this constant was unsigned in ISO C 90, but not in C 99.
+
+define i32 @foo() {
+        ret i32 -2147483648
+}
+
diff --git a/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll b/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll
new file mode 100644
index 0000000..a42dc27
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll
@@ -0,0 +1,11 @@
+; RUN: llc < %s -march=c
+
+; This testcase breaks the C backend, because gcc doesn't like (...) functions
+; with no arguments at all.
+
+define void @test(i64 %Ptr) {
+        %P = inttoptr i64 %Ptr to void (...)*           ; <void (...)*> [#uses=1]
+        call void (...)* %P( i64 %Ptr )
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll b/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll
new file mode 100644
index 0000000..19c7840
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+; The C backend was dying when there was no typename for a struct type!
+
+declare i32 @test(i32, { [32 x i32] }*)
diff --git a/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll b/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll
new file mode 100644
index 0000000..048e045
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s -march=c
+
+%X = type { i32, float }
+
+define void @test() {
+        getelementptr %X* null, i64 0, i32 1            ; <float*>:1 [#uses=0]
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2003-06-11-HexConstant.ll b/test/CodeGen/CBackend/2003-06-11-HexConstant.ll
new file mode 100644
index 0000000..6197b30
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-06-11-HexConstant.ll
@@ -0,0 +1,4 @@
+; RUN: llc < %s -march=c
+
+; Make sure hex constant does not continue into a valid hexadecimal letter/number
+@version = global [3 x i8] c"\001\00"
diff --git a/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll b/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll
new file mode 100644
index 0000000..f6177ea
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll
@@ -0,0 +1,3 @@
+; RUN: llc < %s -march=c
+
+@version = global [3 x i8] c"1\00\00"
diff --git a/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll b/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll
new file mode 100644
index 0000000..f0b1bbc
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s -march=c
+
+declare i32 @callee(i32, i32)
+
+define i32 @test(i32 %X) {
+; <label>:0
+        %A = invoke i32 @callee( i32 %X, i32 5 )
+                        to label %Ok unwind label %Threw                ; <i32> [#uses=1]
+
+Ok:             ; preds = %Threw, %0
+        %B = phi i32 [ %A, %0 ], [ -1, %Threw ]         ; <i32> [#uses=1]
+        ret i32 %B
+
+Threw:          ; preds = %0
+        br label %Ok
+}
+
diff --git a/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.ll b/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.ll
new file mode 100644
index 0000000..4bd1da2
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.ll
@@ -0,0 +1,3 @@
+; RUN: llc < %s -march=c | grep common | grep X
+
+@X = linkonce global i32 5
diff --git a/test/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll b/test/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll
new file mode 100644
index 0000000..0fbb3fe
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+; This is a non-normal FP value: it's a nan.
+@NAN = global { float } { float 0x7FF8000000000000 }            ; <{ float }*> [#uses=0]
+@NANs = global { float } { float 0x7FFC000000000000 }           ; <{ float }*> [#uses=0]
diff --git a/test/CodeGen/CBackend/2003-10-23-UnusedType.ll b/test/CodeGen/CBackend/2003-10-23-UnusedType.ll
new file mode 100644
index 0000000..9195634
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-10-23-UnusedType.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c
+
+%A = type { i32, i8*, { i32, i32, i32, i32, i32, i32, i32, i32 }*, i16 }
+
+define void @test(%A*) {
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2003-10-28-CastToPtrToStruct.ll b/test/CodeGen/CBackend/2003-10-28-CastToPtrToStruct.ll
new file mode 100644
index 0000000..b4389ff
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-10-28-CastToPtrToStruct.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -march=c
+
+; reduced from DOOM.
+        %union._XEvent = type { i32 }
+@.X_event_9 = global %union._XEvent zeroinitializer             ; <%union._XEvent*> [#uses=1]
+
+define void @I_InitGraphics() {
+shortcirc_next.3:
+        %tmp.319 = load i32* getelementptr ({ i32, i32 }* bitcast (%union._XEvent* @.X_event_9 to { i32, i32 }*), i64 0, i32 1)               ; <i32> [#uses=0]
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2003-11-21-ConstantShiftExpr.ll b/test/CodeGen/CBackend/2003-11-21-ConstantShiftExpr.ll
new file mode 100644
index 0000000..6a26291
--- /dev/null
+++ b/test/CodeGen/CBackend/2003-11-21-ConstantShiftExpr.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=c
+@y = weak global i8 0           ; <i8*> [#uses=1]
+
+define i32 @testcaseshr() {
+entry:
+        ret i32 lshr (i32 ptrtoint (i8* @y to i32), i32 4)
+}
+
+define i32 @testcaseshl() {
+entry:
+        ret i32 shl (i32 ptrtoint (i8* @y to i32), i32 4)
+}
+
diff --git a/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.ll b/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.ll
new file mode 100644
index 0000000..142fbd8
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.ll
@@ -0,0 +1,16 @@
+; RUN: llc < %s -march=c | grep builtin_return_address
+
+declare i8* @llvm.returnaddress(i32)
+
+declare i8* @llvm.frameaddress(i32)
+
+define i8* @test1() {
+        %X = call i8* @llvm.returnaddress( i32 0 )              ; <i8*> [#uses=1]
+        ret i8* %X
+}
+
+define i8* @test2() {
+        %X = call i8* @llvm.frameaddress( i32 0 )               ; <i8*> [#uses=1]
+        ret i8* %X
+}
+
diff --git a/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.ll b/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.ll
new file mode 100644
index 0000000..d1c6861
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.ll
@@ -0,0 +1,18 @@
+; The intrinsic lowering pass was lowering intrinsics like llvm.memcpy to 
+; explicitly specified prototypes, inserting a new function if the old one
+; didn't exist.  This caused there to be two external memcpy functions in 
+; this testcase for example, which caused the CBE to mangle one, screwing
+; everything up.  :(  Test that this does not happen anymore.
+;
+; RUN: llc < %s -march=c | not grep _memcpy
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+declare float* @memcpy(i32*, i32, i32)
+
+define i32 @test(i8* %A, i8* %B, i32* %C) {
+        call float* @memcpy( i32* %C, i32 4, i32 17 )           ; <float*>:1 [#uses=0]
+        call void @llvm.memcpy.i32( i8* %A, i8* %B, i32 123, i32 14 )
+        ret i32 7
+}
+
diff --git a/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.ll b/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.ll
new file mode 100644
index 0000000..6fceb08
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.ll
@@ -0,0 +1,11 @@
+; This is a non-normal FP value
+; RUN: llc < %s -march=c | grep FPConstant | grep static
+
+define float @func() {
+        ret float 0xFFF0000000000000
+}
+
+define double @func2() {
+        ret double 0xFF20000000000000
+}
+
diff --git a/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.ll b/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.ll
new file mode 100644
index 0000000..cf59634
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.ll
@@ -0,0 +1,6 @@
+; RUN: llc < %s -march=c | grep func1 | grep WEAK
+
+define linkonce i32 @func1() {
+        ret i32 5
+}
+
diff --git a/test/CodeGen/CBackend/2004-08-09-va-end-null.ll b/test/CodeGen/CBackend/2004-08-09-va-end-null.ll
new file mode 100644
index 0000000..3ee23d1
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-08-09-va-end-null.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=c
+
+declare void @llvm.va_end(i8*)
+
+define void @test() {
+        %va.upgrd.1 = bitcast i8* null to i8*           ; <i8*> [#uses=1]
+        call void @llvm.va_end( i8* %va.upgrd.1 )
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.ll b/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.ll
new file mode 100644
index 0000000..af8f441
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.ll
@@ -0,0 +1,12 @@
+; The CBE should not emit code that casts the function pointer.  This causes
+; GCC to get testy and insert trap instructions instead of doing the right
+; thing. :(
+; RUN: llc < %s -march=c
+
+declare void @external(i8*)
+
+define i32 @test(i32* %X) {
+        %RV = call i32 bitcast (void (i8*)* @external to i32 (i32*)*)( i32* %X )                ; <i32> [#uses=1]
+        ret i32 %RV
+}
+
diff --git a/test/CodeGen/CBackend/2004-12-03-ExternStatics.ll b/test/CodeGen/CBackend/2004-12-03-ExternStatics.ll
new file mode 100644
index 0000000..78e9bac
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-12-03-ExternStatics.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=c | not grep extern.*msg
+; PR472
+
+@msg = internal global [6 x i8] c"hello\00"             ; <[6 x i8]*> [#uses=1]
+
+define i8* @foo() {
+entry:
+        ret i8* getelementptr ([6 x i8]* @msg, i32 0, i32 0)
+}
+
diff --git a/test/CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll b/test/CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll
new file mode 100644
index 0000000..57a9adc
--- /dev/null
+++ b/test/CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+define i32 @foo() {
+        ret i32 and (i32 123456, i32 ptrtoint (i32 ()* @foo to i32))
+}
diff --git a/test/CodeGen/CBackend/2005-02-14-VolatileOperations.ll b/test/CodeGen/CBackend/2005-02-14-VolatileOperations.ll
new file mode 100644
index 0000000..dd505af
--- /dev/null
+++ b/test/CodeGen/CBackend/2005-02-14-VolatileOperations.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=c | grep volatile
+
+define void @test(i32* %P) {
+        %X = volatile load i32* %P              ; <i32> [#uses=1]
+        volatile store i32 %X, i32* %P
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll b/test/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll
new file mode 100644
index 0000000..1c5f506
--- /dev/null
+++ b/test/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=c
+
+        %JNIEnv = type %struct.JNINa*
+        %struct.JNINa = type { i8*, i8*, i8*, void (%JNIEnv*)* }
+
diff --git a/test/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll b/test/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll
new file mode 100644
index 0000000..808b8f9
--- /dev/null
+++ b/test/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll
@@ -0,0 +1,18 @@
+; RUN: llc < %s -march=c | not grep -- --65535
+; PR596
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+
+declare void @func(i32)
+
+define void @funcb() {
+entry:
+        %tmp.1 = sub i32 0, -65535              ; <i32> [#uses=1]
+        call void @func( i32 %tmp.1 )
+        br label %return
+
+return:         ; preds = %entry
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2005-08-23-Fmod.ll b/test/CodeGen/CBackend/2005-08-23-Fmod.ll
new file mode 100644
index 0000000..6e650eb
--- /dev/null
+++ b/test/CodeGen/CBackend/2005-08-23-Fmod.ll
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=c | grep fmod
+
+define double @test(double %A, double %B) {
+        %C = frem double %A, %B         ; <double> [#uses=1]
+        ret double %C
+}
+
diff --git a/test/CodeGen/CBackend/2005-09-27-VolatileFuncPtr.ll b/test/CodeGen/CBackend/2005-09-27-VolatileFuncPtr.ll
new file mode 100644
index 0000000..99de837
--- /dev/null
+++ b/test/CodeGen/CBackend/2005-09-27-VolatileFuncPtr.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=c | grep {\\* *volatile *\\*}
+
+@G = external global void ()*           ; <void ()**> [#uses=2]
+
+define void @test() {
+        volatile store void ()* @test, void ()** @G
+        volatile load void ()** @G              ; <void ()*>:1 [#uses=0]
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll b/test/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
new file mode 100644
index 0000000..c9df800
--- /dev/null
+++ b/test/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
@@ -0,0 +1,49 @@
+; RUN: llc < %s -march=c | \
+; RUN:   grep __BITCAST | count 14
+
+define i32 @test1(float %F) {
+        %X = bitcast float %F to i32            ; <i32> [#uses=1]
+        ret i32 %X
+}
+
+define float @test2(i32 %I) {
+        %X = bitcast i32 %I to float            ; <float> [#uses=1]
+        ret float %X
+}
+
+define i64 @test3(double %D) {
+        %X = bitcast double %D to i64           ; <i64> [#uses=1]
+        ret i64 %X
+}
+
+define double @test4(i64 %L) {
+        %X = bitcast i64 %L to double           ; <double> [#uses=1]
+        ret double %X
+}
+
+define double @test5(double %D) {
+        %X = bitcast double %D to double                ; <double> [#uses=1]
+        %Y = fadd double %X, 2.000000e+00                ; <double> [#uses=1]
+        %Z = bitcast double %Y to i64           ; <i64> [#uses=1]
+        %res = bitcast i64 %Z to double         ; <double> [#uses=1]
+        ret double %res
+}
+
+define float @test6(float %F) {
+        %X = bitcast float %F to float          ; <float> [#uses=1]
+        %Y = fadd float %X, 2.000000e+00         ; <float> [#uses=1]
+        %Z = bitcast float %Y to i32            ; <i32> [#uses=1]
+        %res = bitcast i32 %Z to float          ; <float> [#uses=1]
+        ret float %res
+}
+
+define i32 @main(i32 %argc, i8** %argv) {
+        %a = call i32 @test1( float 0x400921FB40000000 )                ; <i32> [#uses=2]
+        %b = call float @test2( i32 %a )                ; <float> [#uses=0]
+        %c = call i64 @test3( double 0x400921FB4D12D84A )               ; <i64> [#uses=1]
+        %d = call double @test4( i64 %c )               ; <double> [#uses=0]
+        %e = call double @test5( double 7.000000e+00 )          ; <double> [#uses=0]
+        %f = call float @test6( float 7.000000e+00 )            ; <float> [#uses=0]
+        ret i32 %a
+}
+
diff --git a/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll b/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll
new file mode 100644
index 0000000..da36e78
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll
@@ -0,0 +1,26 @@
+; For PR1099
+; RUN: llc < %s -march=c | grep {(llvm_cbe_tmp2 == llvm_cbe_b_2e_0_2e_0_2e_val)}
+
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+        %struct.Connector = type { i16, i16, i8, i8, %struct.Connector*, i8* }
+
+
+define i1 @prune_match_entry_2E_ce(%struct.Connector* %a, i16 %b.0.0.val) {
+newFuncRoot:
+        br label %entry.ce
+
+cond_next.exitStub:             ; preds = %entry.ce
+        ret i1 true
+
+entry.return_crit_edge.exitStub:                ; preds = %entry.ce
+        ret i1 false
+
+entry.ce:               ; preds = %newFuncRoot
+        %tmp1 = getelementptr %struct.Connector* %a, i32 0, i32 0                ; <i16*> [#uses=1]
+        %tmp2 = load i16* %tmp1           ; <i16> [#uses=1]
+        %tmp3 = icmp eq i16 %tmp2, %b.0.0.val             ; <i1> [#uses=1]
+        br i1 %tmp3, label %cond_next.exitStub, label %entry.return_crit_edge.exitStub
+}
+
+
diff --git a/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll b/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
new file mode 100644
index 0000000..8a5f253
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
@@ -0,0 +1,11 @@
+; PR918
+; RUN: llc < %s -march=c | not grep {l_structtype_s l_fixarray_array3}
+
+%structtype_s = type { i32 }
+%fixarray_array3 = type [3 x %structtype_s]
+
+define i32 @witness(%fixarray_array3* %p) {
+    %q = getelementptr %fixarray_array3* %p, i32 0, i32 0, i32 0
+    %v = load i32* %q
+    ret i32 %v
+}
diff --git a/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll b/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll
new file mode 100644
index 0000000..4f699b7
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -march=c | grep __builtin_stack_save
+; RUN: llc < %s -march=c | grep __builtin_stack_restore
+; PR1028
+
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8*)
+
+define i8* @test() {
+    %s = call i8* @llvm.stacksave()
+    call void @llvm.stackrestore(i8* %s)
+    ret i8* %s
+}
diff --git a/test/CodeGen/CBackend/2007-02-05-memset.ll b/test/CodeGen/CBackend/2007-02-05-memset.ll
new file mode 100644
index 0000000..7d508e4
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-02-05-memset.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=c
+; PR1181
+target datalayout = "e-p:64:64"
+target triple = "x86_64-apple-darwin8"
+
+
+declare void @llvm.memset.i64(i8*, i8, i64, i32)
+
+define fastcc void @InitUser_data_unregistered() {
+entry:
+        tail call void @llvm.memset.i64( i8* null, i8 0, i64 65496, i32 1 )
+        ret void
+}
diff --git a/test/CodeGen/CBackend/2007-02-23-NameConflicts.ll b/test/CodeGen/CBackend/2007-02-23-NameConflicts.ll
new file mode 100644
index 0000000..7e1ff2a
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-02-23-NameConflicts.ll
@@ -0,0 +1,14 @@
+; PR1164
+; RUN: llc < %s -march=c | grep {llvm_cbe_A = \\*llvm_cbe_G;}
+; RUN: llc < %s -march=c | grep {llvm_cbe_B = \\*(&ltmp_0_1);}
+; RUN: llc < %s -march=c | grep {return (((unsigned int )(((unsigned int )llvm_cbe_A) + ((unsigned int )llvm_cbe_B))));}
+
+@G = global i32 123
+@ltmp_0_1 = global i32 123
+
+define i32 @test(i32 *%G) {
+        %A = load i32* %G
+        %B = load i32* @ltmp_0_1
+        %C = add i32 %A, %B
+        ret i32 %C
+}
diff --git a/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll b/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll
new file mode 100644
index 0000000..c8bfdd6
--- /dev/null
+++ b/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s -march=c | grep {packed}
+
+	%struct.p = type <{ i16 }>
+
+define i32 @main() {
+entry:
+        %t = alloca %struct.p, align 2
+	ret i32 5
+}
diff --git a/test/CodeGen/CBackend/2008-02-01-UnalignedLoadStore.ll b/test/CodeGen/CBackend/2008-02-01-UnalignedLoadStore.ll
new file mode 100644
index 0000000..6e0cf68
--- /dev/null
+++ b/test/CodeGen/CBackend/2008-02-01-UnalignedLoadStore.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=c | \
+; RUN:          grep {struct __attribute__ ((packed, aligned(} | count 4
+
+define void @test(i32* %P) {
+        %X = load i32* %P, align 1
+        store i32 %X, i32* %P, align 1
+        ret void
+}
+
+define void @test2(i32* %P) {
+        %X = volatile load i32* %P, align 2
+        volatile store i32 %X, i32* %P, align 2
+        ret void
+}
+
diff --git a/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll b/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll
new file mode 100644
index 0000000..8db3167
--- /dev/null
+++ b/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -march=c
+
+declare {i32, i32} @foo()
+
+define i32 @test() {
+  %A = call {i32, i32} @foo()
+  %B = getresult {i32, i32} %A, 0
+  %C = getresult {i32, i32} %A, 1
+  %D = add i32 %B, %C
+  ret i32 %D
+}
+
+define i32 @test2() {
+  %A = call {i32, i32} asm sideeffect "...", "={cx},={di},~{dirflag},~{fpsr},~{flags},~{memory}"()
+  %B = getresult {i32, i32} %A, 0
+  %C = getresult {i32, i32} %A, 1
+  %D = add i32 %B, %C
+  ret i32 %D
+}
diff --git a/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll b/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll
new file mode 100644
index 0000000..e9fa552
--- /dev/null
+++ b/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll
@@ -0,0 +1,14 @@
+; RUN: llc < %s -march=c | grep {llvm_cbe_t.*&1}
+define i32 @test(i32 %r) {
+  %s = icmp eq i32 %r, 0
+  %t = add i1 %s, %s
+  %u = zext i1 %t to i32
+  br i1 %t, label %A, label %B
+A:
+
+  ret i32 %u
+B:
+
+  %v = select i1 %t, i32 %r, i32 %u
+  ret i32 %v
+}
diff --git a/test/CodeGen/CBackend/2008-06-04-IndirectMem.ll b/test/CodeGen/CBackend/2008-06-04-IndirectMem.ll
new file mode 100644
index 0000000..054a3ca
--- /dev/null
+++ b/test/CodeGen/CBackend/2008-06-04-IndirectMem.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -march=c | grep {"m"(llvm_cbe_newcw))}
+; PR2407
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define void @foo() {
+  %newcw = alloca i16             ; <i16*> [#uses=2]
+  call void asm sideeffect "fldcw $0", "*m,~{dirflag},~{fpsr},~{flags}"( i16*
+%newcw ) nounwind 
+  ret void
+}
diff --git a/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll b/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll
new file mode 100644
index 0000000..b72b573
--- /dev/null
+++ b/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll
@@ -0,0 +1,29 @@
+; RUN: llc < %s -march=c
+; PR2907
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin9.5"
+	%"struct.Point<0>" = type { %"struct.Tensor<1,0>" }
+	%"struct.QGauss2<1>" = type { %"struct.Quadrature<0>" }
+	%"struct.Quadrature<0>" = type { %struct.Subscriptor, i32, %"struct.std::vector<Point<0>,std::allocator<Point<0> > >", %"struct.std::vector<double,std::allocator<double> >" }
+	%struct.Subscriptor = type { i32 (...)**, i32, %"struct.std::type_info"* }
+	%"struct.Tensor<1,0>" = type { [1 x double] }
+	%"struct.std::_Vector_base<Point<0>,std::allocator<Point<0> > >" = type { %"struct.std::_Vector_base<Point<0>,std::allocator<Point<0> > >::_Vector_impl" }
+	%"struct.std::_Vector_base<Point<0>,std::allocator<Point<0> > >::_Vector_impl" = type { %"struct.Point<0>"*, %"struct.Point<0>"*, %"struct.Point<0>"* }
+	%"struct.std::_Vector_base<double,std::allocator<double> >" = type { %"struct.std::_Vector_base<double,std::allocator<double> >::_Vector_impl" }
+	%"struct.std::_Vector_base<double,std::allocator<double> >::_Vector_impl" = type { double*, double*, double* }
+	%"struct.std::type_info" = type { i32 (...)**, i8* }
+	%"struct.std::vector<Point<0>,std::allocator<Point<0> > >" = type { %"struct.std::_Vector_base<Point<0>,std::allocator<Point<0> > >" }
+	%"struct.std::vector<double,std::allocator<double> >" = type { %"struct.std::_Vector_base<double,std::allocator<double> >" }
+
+define fastcc void @_ZN6QGaussILi1EEC1Ej(%"struct.QGauss2<1>"* %this, i32 %n) {
+entry:
+	br label %bb4
+
+bb4:		; preds = %bb5.split, %bb4, %entry
+	%0 = fcmp ogt ppc_fp128 0xM00000000000000000000000000000000, select (i1 fcmp olt (ppc_fp128 fpext (double 0x3C447AE147AE147B to ppc_fp128), ppc_fp128 fmul (ppc_fp128 0xM00000000000000010000000000000000, ppc_fp128 0xM40140000000000000000000000000000)), ppc_fp128 fmul (ppc_fp128 0xM00000000000000010000000000000000, ppc_fp128 0xM40140000000000000000000000000000), ppc_fp128 fpext (double 0x3C447AE147AE147B to ppc_fp128))		; <i1> [#uses=1]
+	br i1 %0, label %bb4, label %bb5.split
+
+bb5.split:		; preds = %bb4
+	%1 = getelementptr double* null, i32 0		; <double*> [#uses=0]
+	br label %bb4
+}
diff --git a/test/CodeGen/CBackend/dg.exp b/test/CodeGen/CBackend/dg.exp
new file mode 100644
index 0000000..9d78940
--- /dev/null
+++ b/test/CodeGen/CBackend/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target CBackend] } {
+  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/CodeGen/CBackend/fneg.ll b/test/CodeGen/CBackend/fneg.ll
new file mode 100644
index 0000000..7dec3d9
--- /dev/null
+++ b/test/CodeGen/CBackend/fneg.ll
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=c
+
+define void @func() nounwind {
+  entry:
+  %0 = fsub double -0.0, undef
+  ret void
+}
diff --git a/test/CodeGen/CBackend/pr2408.ll b/test/CodeGen/CBackend/pr2408.ll
new file mode 100644
index 0000000..bf8477b
--- /dev/null
+++ b/test/CodeGen/CBackend/pr2408.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -march=c | grep {\\* ((unsigned int )}
+; PR2408
+
+define i32 @a(i32 %a) {
+entry:
+        %shr = ashr i32 %a, 0           ; <i32> [#uses=1]
+        %shr2 = ashr i32 2, 0           ; <i32> [#uses=1]
+        %mul = mul i32 %shr, %shr2              ; <i32> [#uses=1]
+        %shr4 = ashr i32 2, 0           ; <i32> [#uses=1]
+        %div = sdiv i32 %mul, %shr4             ; <i32> [#uses=1]
+        ret i32 %div
+}
diff --git a/test/CodeGen/CBackend/vectors.ll b/test/CodeGen/CBackend/vectors.ll
new file mode 100644
index 0000000..b7b7677
--- /dev/null
+++ b/test/CodeGen/CBackend/vectors.ll
@@ -0,0 +1,37 @@
+; RUN: llc < %s -march=c
+@.str15 = external global [2 x i8]
+
+define <4 x i32> @foo(<4 x i32> %a, i32 %b) {
+  %c = insertelement <4 x i32> %a, i32 1, i32 %b
+  
+  ret <4 x i32> %c
+}
+
+define i32 @test2(<4 x i32> %a, i32 %b) {
+  %c = extractelement <4 x i32> %a, i32 1
+  
+  ret i32 %c
+}
+
+define <4 x float> @test3(<4 x float> %Y) {
+	%Z = fadd <4 x float> %Y, %Y
+	%X = shufflevector <4 x float> zeroinitializer, <4 x float> %Z, <4 x i32> < i32 0, i32 5, i32 6, i32 7 >
+	ret <4 x float> %X
+}
+
+define void @test4() {
+	%x = alloca <4 x float>
+	%tmp3.i16 = getelementptr <4 x float>* %x, i32 0, i32 0
+	store float 1.0, float* %tmp3.i16
+	ret void
+}
+
+define i32* @test5({i32, i32} * %P) {
+	%x = getelementptr {i32, i32} * %P, i32 0, i32 1
+	ret i32* %x
+}
+
+define i8* @test6() {
+  ret i8* getelementptr ([2 x i8]* @.str15, i32 0, i32 0) 
+}
+