diff options
Diffstat (limited to 'test/CodeGen/CBackend')
51 files changed, 531 insertions, 0 deletions
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..249927d --- /dev/null +++ b/test/CodeGen/CBackend/2002-05-16-NameCollide.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; Make sure that global variables do not collide if they have the same name, +; but different types. + +%X = global int 5 +%X = global long 7 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..775a762 --- /dev/null +++ b/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll @@ -0,0 +1,17 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -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. +; +void "test"() { + br label %BB1 +BB2: + br label %BB2 +BB1: + 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..c8d1201 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; Test const pointer refs & forward references + +%t3 = global int * %t1 ;; Forward reference +%t1 = global int 4 + 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..2842faa --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +global int* cast (float* %0 to int*) ;; Forward numeric reference +global float* %0 ;; Duplicate forward numeric reference +global float 0.0 + +%array = constant [2 x int] [ int 12, int 52 ] +%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ;; int* &%array[0][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..ca2af79 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-19-DataPointer.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%sptr1 = global [11x sbyte]* %somestr ;; Forward ref to a constant +%somestr = constant [11x sbyte] 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..baf7d78 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -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..51bc950 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%array = constant [2 x int] [ int 12, int 52 ] ; <[2 x int]*> [#uses=1] +%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ; <int**> [#uses=1] + 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..fdcdeed --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll @@ -0,0 +1,4 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%MyIntList = uninitialized global { \2 *, int } + 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..3ec23fb --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -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. + +int %test(int) { + ret int 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..4a977e8 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll @@ -0,0 +1,16 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; Indirect function call test... found by Joel & Brian +; + +%taskArray = uninitialized global int* + +void %test(int %X) { + %Y = add int %X, -1 ; <int>:1 [#uses=3] + %cast100 = cast int %Y to long ; <uint> [#uses=1] + %gep100 = getelementptr int** %taskArray, long %cast100 ; <int**> [#uses=1] + %fooPtr = load int** %gep100 ; <int*> [#uses=1] + %cast101 = cast int* %fooPtr to void (int)* ; <void (int)*> [#uses=1] + call void %cast101( int 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..d8477d5 --- /dev/null +++ b/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -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 = uninitialized global { {int } } +%X = uninitialized global { float } 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..6158b2f --- /dev/null +++ b/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + + +implementation + +void %test() { + %X = alloca [4xint] + 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..f3841f4 --- /dev/null +++ b/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -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..1a9cdb7 --- /dev/null +++ b/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + %MPI_Comm = type %struct.Comm* + %struct.Comm = type opaque +%thing = global %MPI_Comm* null ; <%MPI_Comm**> [#uses=0] + +implementation ; Functions: 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..d60a3d8 --- /dev/null +++ b/test/CodeGen/CBackend/2002-10-16-External.ll @@ -0,0 +1,4 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%bob = external global int ; <int*> [#uses=2] + 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..b887488 --- /dev/null +++ b/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + + %BitField = type int + %tokenptr = type %BitField* + +implementation + +void %test() { + %pmf1 = alloca %tokenptr (%tokenptr, sbyte*)* + 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..62c0e27 --- /dev/null +++ b/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%testString = internal constant [18 x sbyte] c "Escaped newline\n\00" + +implementation + +declare int %printf(sbyte*, ...) + +int %main() { + call int (sbyte*, ...)* %printf( sbyte* getelementptr ([18 x sbyte]* %testString, long 0, long 0)) + ret int 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..2c6a596 --- /dev/null +++ b/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; Apparently this constant was unsigned in ISO C 90, but not in C 99. + +int %foo() { + ret int -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..1e08b2d --- /dev/null +++ b/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; This testcase breaks the C backend, because gcc doesn't like (...) functions +; with no arguments at all. + +void %test(long %Ptr) { + %P = cast long %Ptr to void(...) * + call void(...)* %P(long %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..567d8e4 --- /dev/null +++ b/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; The C backend was dying when there was no typename for a struct type! + +declare int %test(int,{ [32 x int] }*) + 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..224ba15 --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + +%X = type { int, float } + +void %test() { + getelementptr %X* null, long 0, uint 1 + 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..bc5691f --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-11-HexConstant.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; Make sure hex constant does not continue into a valid hexadecimal letter/number +%version = global [3 x sbyte] 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..7af255b --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + +%version = global [3 x sbyte] c"1\00\00" + diff --git a/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx b/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx new file mode 100644 index 0000000..d7f8e56 --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx @@ -0,0 +1,16 @@ + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c > %t1.cbe.c +; RUN: gcc -B/usr/bin/ %t1.cbe.c -o %t1.cbe +; RUN: %t1.cbe + +bool %doTest(ubyte %x) { + %dec.0 = add ubyte %x, 255 + %tmp.1001 = trunc ubyte %dec.0 to bool + ret bool %tmp.1001 +} + +int %main () { + %result = call bool %doTest(ubyte 1) + %p = cast bool %result to int + ret int %p +} 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..f69c7dc --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + +declare int %callee(int, int) + + +int %test(int %X) { + %A = invoke int %callee(int %X, int 5) to label %Ok except label %Threw +Ok: + %B = phi int [%A, %0], [-1, %Threw] + ret int %B +Threw: + br label %Ok +} diff --git a/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.llx b/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.llx new file mode 100644 index 0000000..75e223d --- /dev/null +++ b/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.llx @@ -0,0 +1,4 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep common | grep X + +%X = linkonce global int 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..a82d7e5 --- /dev/null +++ b/test/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; This is a non-normal FP value: it's a nan. +%NAN = global { float } { float 0x7FF8000000000000 } +%NANs = global { float } { float 0x7FF4000000000000 } 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..e073928 --- /dev/null +++ b/test/CodeGen/CBackend/2003-10-23-UnusedType.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + + +%A = type { uint, sbyte*, { uint, uint, uint, uint, uint, uint, uint, uint }*, ushort } + +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..4c7ab32 --- /dev/null +++ b/test/CodeGen/CBackend/2003-10-28-CastToPtrToStruct.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +; reduced from DOOM. +%union._XEvent = type { int } +%.X_event_9 = global %union._XEvent zeroinitializer + +implementation ; Functions: +void %I_InitGraphics() { +shortcirc_next.3: ; preds = %no_exit.1 + %tmp.319 = load int* getelementptr ({ int, int }* cast (%union._XEvent* %.X_event_9 to { int, int }*), long 0, uint 1) ; <int> [#uses=1] + 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..3866200 --- /dev/null +++ b/test/CodeGen/CBackend/2003-11-21-ConstantShiftExpr.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%y = weak global sbyte 0 +implementation +uint %testcaseshr() { +entry: + ret uint shr (uint cast (sbyte* %y to uint), ubyte 4) +} +uint %testcaseshl() { +entry: + ret uint shl (uint cast (sbyte* %y to uint), ubyte 4) +} diff --git a/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.llx b/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.llx new file mode 100644 index 0000000..973e6d8 --- /dev/null +++ b/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.llx @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep builtin_return_address + +declare sbyte* %llvm.returnaddress(uint) +declare sbyte* %llvm.frameaddress(uint) + +sbyte *%test1() { + %X = call sbyte* %llvm.returnaddress(uint 0) + ret sbyte* %X +} + +sbyte *%test2() { + %X = call sbyte* %llvm.frameaddress(uint 0) + ret sbyte* %X +} diff --git a/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.llx b/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.llx new file mode 100644 index 0000000..1afa47b --- /dev/null +++ b/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.llx @@ -0,0 +1,16 @@ +; 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: llvm-upgrade < %s | llvm-as | llc -march=c | not grep _memcpy + +declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint,uint) +declare float* %memcpy(int*, uint,int) + +int %test(sbyte *%A, sbyte* %B, int* %C) { + call float* %memcpy(int* %C, uint 4, int 17) + call void %llvm.memcpy.i32(sbyte* %A, sbyte* %B, uint 123, uint 14) + ret int 7 +} diff --git a/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.llx b/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.llx new file mode 100644 index 0000000..87a642b --- /dev/null +++ b/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.llx @@ -0,0 +1,10 @@ +; This is a non-normal FP value +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep FPConstant | grep static + +float %func () { + ret float 0xFFF0000000000000 ; -inf +} + +double %func2() { + ret double 0xFF20000000000000 ; -inf +} diff --git a/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.llx b/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.llx new file mode 100644 index 0000000..997f1c9 --- /dev/null +++ b/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.llx @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep func1 | grep WEAK + +implementation + +linkonce int %func1 () { + ret int 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..f8e8fe5 --- /dev/null +++ b/test/CodeGen/CBackend/2004-08-09-va-end-null.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +declare void %llvm.va_end(sbyte*) + +void %test() { + call void %llvm.va_end( sbyte* null ) + ret void +} + diff --git a/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.llx b/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.llx new file mode 100644 index 0000000..99bb602 --- /dev/null +++ b/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.llx @@ -0,0 +1,17 @@ +; 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: llvm-upgrade < %s | llvm-as | llc -march=c + +implementation + +declare void %external(sbyte*) + +int %test(int *%X) { + %RV = call int (int*)* cast (void(sbyte*)* %external to int(int*)*)(int* %X) + ret int %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..a285dae --- /dev/null +++ b/test/CodeGen/CBackend/2004-12-03-ExternStatics.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | not grep extern.*msg + +; This is PR472 + +%msg = internal global [6 x sbyte] c"hello\00" + +implementation ; Functions: + +sbyte* %foo() { +entry: + ret sbyte* getelementptr ([6 x sbyte]* %msg, int 0, int 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..ebe4566 --- /dev/null +++ b/test/CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +int %foo() { + ret int and (int 123456, int cast (int()* %foo to int)) +} 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..e161e46 --- /dev/null +++ b/test/CodeGen/CBackend/2005-02-14-VolatileOperations.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep volatile + +void %test(int* %P) { + %X = volatile load int*%P + volatile store int %X, int* %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..5349488 --- /dev/null +++ b/test/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c + +%JNIEnv = type %struct.JNINa* +%struct.JNINa = type { sbyte*, sbyte*, sbyte*, 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..e73eb63 --- /dev/null +++ b/test/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | not grep -- --65535 +; PR596 + +target endian = little +target pointersize = 32 +target triple = "i686-pc-linux-gnu" + +implementation ; Functions: + +declare void %func(int) + +void %funcb() { +entry: + %tmp.1 = sub int 0, -65535 ; <int> [#uses=1] + call void %func( int %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..5ce1e96 --- /dev/null +++ b/test/CodeGen/CBackend/2005-08-23-Fmod.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep fmod + +double %test(double %A, double %B) { + %C = rem double %A, %B + 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..32a7088 --- /dev/null +++ b/test/CodeGen/CBackend/2005-09-27-VolatileFuncPtr.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep {\\* *volatile *\\*} + +%G = external global void()* + +void %test() { + volatile store void()* %test, void()** %G + volatile load void()** %G + 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..5c6babf --- /dev/null +++ b/test/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll @@ -0,0 +1,48 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | \ +; RUN: grep __BITCAST | wc -l | grep 14 + +int %test1(float %F) { + %X = bitcast float %F to int + ret int %X +} + +float %test2(int %I) { + %X = bitcast int %I to float + ret float %X +} + +long %test3(double %D) { + %X = bitcast double %D to long + ret long %X +} + +double %test4(long %L) { + %X = bitcast long %L to double + ret double %X +} + +double %test5(double %D) { + %X = bitcast double %D to double + %Y = add double %X, 2.0 + %Z = bitcast double %Y to long + %res = bitcast long %Z to double + ret double %res +} + +float %test6(float %F) { + %X = bitcast float %F to float + %Y = add float %X, 2.0 + %Z = bitcast float %Y to int + %res = bitcast int %Z to float + ret float %res +} + +int %main(int %argc, sbyte** %argv) { + %a = call int %test1(float 3.1415926) + %b = call float %test2(int %a) + %c = call long %test3(double 3.1415926) + %d = call double %test4(long %c) + %e = call double %test5(double 7.0) + %f = call float %test6(float 7.0) + ret int %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..359feba --- /dev/null +++ b/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll @@ -0,0 +1,27 @@ +; For PR1099 +; RUN: llvm-as < %s | llc -march=c | \ +; RUN: grep {return ((((llvm_cbe_tmp2 == llvm_cbe_b_0_0_val)) ? (1) : (0)))} + +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..a9eeff3 --- /dev/null +++ b/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll @@ -0,0 +1,11 @@ +; PR918 +; RUN: llvm-as < %s | llc -march=c | not grep 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..8fe06b7 --- /dev/null +++ b/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=c | grep __builtin_stack_save +; RUN: llvm-as < %s | llc -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..f253b30 --- /dev/null +++ b/test/CodeGen/CBackend/2007-02-05-memset.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -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..2bc4d51 --- /dev/null +++ b/test/CodeGen/CBackend/2007-02-23-NameConflicts.ll @@ -0,0 +1,13 @@ +; PR1164 +; RUN: llvm-as < %s | llc -march=c | grep {llvm_cbe_A = \\*llvm_cbe_G;} +; RUN: llvm-as < %s | llc -march=c | grep {llvm_cbe_B = \\*(<mp_0_1);} +; RUN: llvm-as < %s | llc -march=c | grep {return (llvm_cbe_A + 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..6057616 --- /dev/null +++ b/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -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/dg.exp b/test/CodeGen/CBackend/dg.exp new file mode 100644 index 0000000..304b90f --- /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,llx,c,cpp,tr}]] +} |