summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Feature/allocatest2.ll8
-rw-r--r--test/Feature/globalvars.ll2
-rw-r--r--test/Feature/opaquetypes.ll6
-rw-r--r--test/Feature/recursivetype.ll7
-rw-r--r--test/Feature/testalloca.ll10
-rw-r--r--test/Feature/testconstants.ll23
-rw-r--r--test/Feature/testmemory.ll16
-rw-r--r--test/Linker/testlink1.ll4
-rw-r--r--test/Linker/testlink2.ll2
-rw-r--r--test/ackermann.ll92
-rw-r--r--test/fib.ll52
-rw-r--r--test/fib2.ll69
12 files changed, 35 insertions, 256 deletions
diff --git a/test/Feature/allocatest2.ll b/test/Feature/allocatest2.ll
index 2775f0129e..7c93215a6e 100644
--- a/test/Feature/allocatest2.ll
+++ b/test/Feature/allocatest2.ll
@@ -8,8 +8,8 @@ void "_Z17UseAllocaFunctionj"(uint %n)
begin
bb1: ;;<label>
%reg110 = shl uint %n, ubyte 2 ;;<uint>
- %reg108 = alloca [ubyte], uint %reg110 ;;<ubyte*>
- %cast1000 = cast [ubyte]* %reg108 to uint* ;;<uint*>
+ %reg108 = alloca ubyte, uint %reg110 ;;<ubyte*>
+ %cast1000 = cast ubyte* %reg108 to uint* ;;<uint*>
call void %_Z12combinationsjPj(uint %n, uint* %cast1000) ;;<void>
%cast113 = cast uint %reg110 to ulong* ;;<ulong*>
cast uint 7 to ulong *
@@ -17,8 +17,8 @@ bb1: ;;<label>
%reg115 = shr ulong* %reg114, ubyte 3 ;;<ulong*>:(uns ops)
%reg117 = shl ulong* %reg115, ubyte 3 ;;<ulong*>
%cast1001 = cast ulong* %reg117 to uint ;;<uint>
- %reg118 = alloca [ubyte], uint %cast1001 ;;<ubyte*>
- %cast1002 = cast [ubyte]* %reg118 to uint* ;;<uint*>
+ %reg118 = alloca ubyte, uint %cast1001 ;;<ubyte*>
+ %cast1002 = cast ubyte* %reg118 to uint* ;;<uint*>
call void %_Z12combinationsjPj(uint %n, uint* %cast1002) ;;<void>
ret void ;;<void>
end
diff --git a/test/Feature/globalvars.ll b/test/Feature/globalvars.ll
index 3914efc3e4..b243ba58d8 100644
--- a/test/Feature/globalvars.ll
+++ b/test/Feature/globalvars.ll
@@ -12,7 +12,7 @@ implementation
int "foo"(int %blah)
begin
store int 5, int *%MyVar
- store int 12, { \2 *, int } * %MyIntList, ubyte 1
+ store int 12, { \2 *, int } * %MyIntList, uint 0, ubyte 1
ret int %blah
end
diff --git a/test/Feature/opaquetypes.ll b/test/Feature/opaquetypes.ll
index fcd0999d4a..271493f222 100644
--- a/test/Feature/opaquetypes.ll
+++ b/test/Feature/opaquetypes.ll
@@ -10,7 +10,7 @@
%CCC = type { \2* }
%BBB = type { \2*, \2 * }
-%AAA = type { \2*, {\2*}, [{\2*}], {[1x{\2*}]} }
+%AAA = type { \2*, {\2*}, [12x{\2*}], {[1x{\2*}]} }
; Test numbered types
type %CCC
@@ -35,7 +35,7 @@ type %BBB
; A complex recursive type...
%Y = type { {%Y*}, %Y* }
-%Z = type { { %Z * }, [%Z] *, {{{ %Z * }}} }
+%Z = type { { %Z * }, [12x%Z] *, {{{ %Z * }}} }
; More ridiculous test cases...
%A = type [ 123x %A*]
@@ -49,7 +49,7 @@ type %BBB
; Test the parser for unnamed recursive types...
%P1 = type \1 *
%Y1 = type { { \3 * }, \2 * }
-%Z1 = type { { \3 * }, [\3] *, { { { \5 * } } } }
+%Z1 = type { { \3 * }, [12x\3] *, { { { \5 * } } } }
implementation
diff --git a/test/Feature/recursivetype.ll b/test/Feature/recursivetype.ll
index ce8214507c..60ffc510d5 100644
--- a/test/Feature/recursivetype.ll
+++ b/test/Feature/recursivetype.ll
@@ -85,11 +85,10 @@ bb2:
br bool %cond1011, label %bb4, label %bb3
bb3:
- %cast1015 = cast ulong 0 to %list* ;;<%list*>
- ret %list* %cast1015
+ ret %list* null
bb4:
- %reg111 = load %list* %reg115, ubyte 1 ;;<int>
+ %reg111 = load %list* %reg115, uint 0, ubyte 1 ;;<int>
%cond1013 = setne int %reg111, %Data ;;<bool>
br bool %cond1013, label %bb6, label %bb5
@@ -97,6 +96,6 @@ bb5:
ret %list* %reg115
bb6:
- %reg116 = load %list* %reg115, ubyte 0 ;;<%list*>
+ %reg116 = load %list* %reg115, uint 0, ubyte 0 ;;<%list*>
br label %bb2
end
diff --git a/test/Feature/testalloca.ll b/test/Feature/testalloca.ll
index cb867c06ba..9b0630aa7f 100644
--- a/test/Feature/testalloca.ll
+++ b/test/Feature/testalloca.ll
@@ -5,17 +5,17 @@ implementation
int "test function"(int %i0, int %j0)
begin
- alloca [ubyte], uint 5
+ alloca ubyte, uint 5
%ptr = alloca int ; yields {int*}:ptr
store int 3, int* %ptr ; yields {void}
%val = load int* %ptr ; yields {int}:val = int %3
%sptr = alloca %struct ; yields {%struct*}:sptr
- %nsptr = getelementptr %struct * %sptr, ubyte 1 ; yields {inners*}:nsptr
- %ubsptr = getelementptr %inners * %nsptr, ubyte 1 ; yields {{ubyte}*}:ubsptr
- store ubyte 4, {ubyte} * %ubsptr, ubyte 0
+ %nsptr = getelementptr %struct * %sptr, uint 0, ubyte 1 ; yields {inners*}:nsptr
+ %ubsptr = getelementptr %inners * %nsptr, uint 0, ubyte 1 ; yields {{ubyte}*}:ubsptr
+ store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
- %fptr = getelementptr %struct * %sptr, ubyte 1, ubyte 0 ; yields {float*}:fptr
+ %fptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 0 ; yields {float*}:fptr
store float 4.0, float * %fptr
ret int 3
diff --git a/test/Feature/testconstants.ll b/test/Feature/testconstants.ll
index a894c3d2a3..baf1c1d5ff 100644
--- a/test/Feature/testconstants.ll
+++ b/test/Feature/testconstants.ll
@@ -1,29 +1,22 @@
-%somestr = constant [sbyte] c"hello world"
%somestr = constant [11x sbyte] c"hello world"
-%array = constant [[2 x int]] [ [2 x int] [ int 12, int 52 ] ]
+%array = constant [2 x int] [ int 12, int 52 ]
constant { int, int } { int 4, int 3 }
implementation
-[[2 x int]]* "test function"(int %i0, int %j0)
+[2 x int]* "test function"(int %i0, int %j0)
begin
- ret [[2x int]]* %array
+ ret [2x int]* %array
end
-[sbyte]* "other func"(int, double)
+sbyte* "other func"(int, double)
begin
- ret [sbyte]* %somestr
+ %somestr = getelementptr [11x sbyte]* %somestr, uint 0, uint 0
+ ret sbyte* %somestr
end
-[sbyte]* "yet another func"(int, double)
+sbyte* "yet another func"(int, double)
begin
- ret [sbyte]* null ; Test null
-end
-
-
-[sbyte]* "again"(float)
-begin
- %cast = cast [11x sbyte]* %somestr to [sbyte]*
- ret [sbyte]* %cast
+ ret sbyte* null ; Test null
end
diff --git a/test/Feature/testmemory.ll b/test/Feature/testmemory.ll
index b65c4f3fcb..b2cf0518cc 100644
--- a/test/Feature/testmemory.ll
+++ b/test/Feature/testmemory.ll
@@ -1,5 +1,5 @@
%struct = type { int , {float, {ubyte } } , ulong }
-%complexty = type [{int, {[4 x sbyte *], float}, double}]
+%complexty = type {int, {[4 x sbyte *], float}, double}
implementation
@@ -13,13 +13,13 @@ int "testfunction"(uint %i0, uint %j0)
begin
%array0 = malloc [4 x ubyte] ; yields {[4 x ubyte]*}:array0
%size = add uint 2, 2 ; yields {uint}:size = uint %4
- %array1 = malloc [ubyte], uint 4 ; yields {[ubyte]*}:array1
- %array2 = malloc [ubyte], uint %size ; yields {[ubyte]*}:array2
+ %array1 = malloc ubyte, uint 4 ; yields {ubyte*}:array1
+ %array2 = malloc ubyte, uint %size ; yields {ubyte*}:array2
- store ubyte 123, [4 x ubyte]* %array0, uint 2
+ store ubyte 123, [4 x ubyte]* %array0, uint 0, uint 2
free [4x ubyte]* %array0
- free [ubyte]* %array1
- free [ubyte]* %array2
+ free ubyte* %array1
+ free ubyte* %array2
%aa = alloca %complexty, uint 5
@@ -30,8 +30,8 @@ begin
%val = load int* %ptr ; yields {int}:val = int %3
%sptr = alloca %struct ; yields {%struct*}:sptr
- %ubsptr = getelementptr %struct * %sptr, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
- store ubyte 4, {ubyte} * %ubsptr, ubyte 0
+ %ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
+ store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
ret int 3
end
diff --git a/test/Linker/testlink1.ll b/test/Linker/testlink1.ll
index cf757f100e..12cf652d15 100644
--- a/test/Linker/testlink1.ll
+++ b/test/Linker/testlink1.ll
@@ -22,7 +22,7 @@ begin
%v1 = load int* %MyVar
call void %print(int %v1) ;; Should start out 4
- %v2 = load { \2 *, int }* %MyIntList, ubyte 1
+ %v2 = load { \2 *, int }* %MyIntList, uint 0, ubyte 1
call void %print(int %v2) ;; Should start out 17
call int %foo(int 5) ;; Modify global variablesx
@@ -30,7 +30,7 @@ begin
%v3 = load int* %MyVar
call void %print(int %v3) ;; Should now be 5
- %v4 = load { \2 *, int }* %MyIntList, ubyte 1
+ %v4 = load { \2 *, int }* %MyIntList, uint 0, ubyte 1
call void %print(int %v4) ;; Should start out 12
ret void
diff --git a/test/Linker/testlink2.ll b/test/Linker/testlink2.ll
index 056daaff09..5aacf1a95b 100644
--- a/test/Linker/testlink2.ll
+++ b/test/Linker/testlink2.ll
@@ -17,7 +17,7 @@ implementation
int "foo"(int %blah)
begin
store int %blah, int *%MyVar
- store int 12, { \2 *, int } * %MyIntList, ubyte 1
+ store int 12, { \2 *, int } * %MyIntList, uint 0, ubyte 1
%ack = load int * %0 ;; Load from the unnamed constant
%fzo = add int %ack, %blah
diff --git a/test/ackermann.ll b/test/ackermann.ll
deleted file mode 100644
index 541ccdea07..0000000000
--- a/test/ackermann.ll
+++ /dev/null
@@ -1,92 +0,0 @@
-%__intern_LC0 = global [sbyte] c"Ack(3, \00"
-%__intern_LC1 = global [sbyte] c") = \00"
-%__intern_LC2 = global [sbyte] c"\0A\00" ; <[15 x sbyte] *> [#uses=1]
-implementation
-
-declare void "__main"()
-
-declare void "printVal"([sbyte] *)
-declare void "printInt"(int)
-
-declare int "atoi"(sbyte *)
-
-int "main"(int %argc, sbyte * * %argv)
-begin
-bb1: ;[#uses=1]
- call void () * %__main( )
- %cond1002 = setne int %argc, 2 ; <bool> [#uses=1]
- br bool %cond1002, label %bb4, label %bb2
-
-bb2: ;[#uses=2]
- %cast1010 = cast ulong 8 to sbyte * * ; <sbyte * *> [#uses=1]
- %reg1003 = add sbyte * * %argv, %cast1010 ; <sbyte * *> [#uses=1]
- %reg110 = load sbyte * * %reg1003 ; <sbyte *> [#uses=1]
- %reg109 = call int (sbyte *) * %atoi( sbyte * %reg110 ) ; <int> [#uses=1]
- br label %bb4
-
-bb4: ;[#uses=2]
- %reg132 = phi int [ %reg109, %bb2 ], [ 5, %bb1 ] ; <int> [#uses=4]
- %cond1004 = setne ulong 3, 0 ; <bool> [#uses=1]
- br bool %cond1004, label %bb6, label %bb5
-
-bb5: ;[#uses=2]
- %reg115 = add int %reg132, 1 ; <int> [#uses=1]
- br label %bb9
-
-bb6: ;[#uses=1]
- %cond1005 = setne int %reg132, 0 ; <bool> [#uses=1]
- br bool %cond1005, label %bb8, label %bb7
-
-bb7: ;[#uses=2]
- %cast1006 = cast ulong 1 to int ; <int> [#uses=1]
- %cast1007 = cast ulong 2 to int ; <int> [#uses=1]
- %reg119 = call int (int, int) * %Ack( int %cast1007, int %cast1006 ) ; <int> [#uses=1]
- br label %bb9
-
-bb8: ;[#uses=2]
- %reg121 = add int %reg132, -1 ; <int> [#uses=1]
- %cast1008 = cast ulong 3 to int ; <int> [#uses=1]
- %reg122 = call int (int, int) * %Ack( int %cast1008, int %reg121 ) ; <int> [#uses=1]
- %cast1009 = cast ulong 2 to int ; <int> [#uses=1]
- %reg124 = call int (int, int) * %Ack( int %cast1009, int %reg122 ) ; <int> [#uses=1]
- br label %bb9
-
-bb9: ;[#uses=3]
- %reg135 = phi int [ %reg124, %bb8 ], [ %reg119, %bb7 ], [ %reg115, %bb5 ] ; <int> [#uses=1]
- call void %printVal([sbyte] *%__intern_LC0)
- call void %printInt(int %reg132)
- call void %printVal([sbyte] *%__intern_LC1)
- call void %printInt(int %reg135)
- call void %printVal([sbyte] *%__intern_LC2)
- ret int 0
-end
-
-int "Ack"(int %M, int %N)
-begin
-bb1: ;[#uses=2]
- br label %bb2
-
-bb2: ;[#uses=3]
- %reg121 = phi int [ %reg117, %bb6 ], [ 1, %bb5 ], [ %N, %bb1 ] ; <int> [#uses=3]
- %reg122 = phi int [ %reg115, %bb6 ], [ %reg123, %bb5 ], [ %M, %bb1 ] ; <int> [#uses=4]
- %cond1000 = setne int %reg122, 0 ; <bool> [#uses=1]
- br bool %cond1000, label %bb4, label %bb3
-
-bb3: ;[#uses=1]
- %reg109 = add int %reg121, 1 ; <int> [#uses=1]
- ret int %reg109
-
-bb4: ;[#uses=1]
- %cond1001 = setne int %reg121, 0 ; <bool> [#uses=1]
- br bool %cond1001, label %bb6, label %bb5
-
-bb5: ;[#uses=3]
- %reg123 = add int %reg122, -1 ; <int> [#uses=1]
- br label %bb2
-
-bb6: ;[#uses=3]
- %reg115 = add int %reg122, -1 ; <int> [#uses=1]
- %reg116 = add int %reg121, -1 ; <int> [#uses=1]
- %reg117 = call int (int, int) * %Ack( int %reg122, int %reg116 ) ; <int> [#uses=1]
- br label %bb2
-end
diff --git a/test/fib.ll b/test/fib.ll
deleted file mode 100644
index 6d81174d6e..0000000000
--- a/test/fib.ll
+++ /dev/null
@@ -1,52 +0,0 @@
-%FmtString1 = constant [ubyte] c"fib = \00"
-%FmtString2 = constant [ubyte] c"\0A\00"
-
-declare int "atoi"(sbyte *)
-declare void "printInt"(int)
-declare void "printString"([ubyte]*)
-
-implementation
-
-ulong "fib"(ulong %n)
-begin
- setlt ulong %n, 2 ; {bool}:0
- br bool %0, label %BaseCase, label %RecurseCase
-
-BaseCase:
- ret ulong 1
-
-RecurseCase:
- %n2 = sub ulong %n, 2
- %n1 = sub ulong %n, 1
- %f2 = call ulong(ulong) * %fib(ulong %n2)
- %f1 = call ulong(ulong) * %fib(ulong %n1)
- %result = add ulong %f2, %f1
- ret ulong %result
-end
-
-ulong "realmain"(int %argc, sbyte ** %argv)
-begin
- seteq int %argc, 2 ; {bool}:0
- br bool %0, label %HasArg, label %Continue
-HasArg:
- ; %n1 = atoi(argv[1])
- %n1 = add int 1, 1
- br label %Continue
-
-Continue:
- %n = phi int [%n1, %HasArg], [1, %0]
- %N = cast int %n to ulong
- %F = call ulong(ulong) *%fib(ulong %N)
- ret ulong %F
-end
-
-int "main"()
-begin
- %Result = call ulong %fib(ulong 10)
- %Result = cast ulong %Result to int
- call void %printString([ubyte]* %FmtString1)
- call void %printInt(int %Result)
- call void %printString([ubyte]* %FmtString2)
- ret int %Result
-end
-
diff --git a/test/fib2.ll b/test/fib2.ll
deleted file mode 100644
index 2adb8f1609..0000000000
--- a/test/fib2.ll
+++ /dev/null
@@ -1,69 +0,0 @@
-%__intern_LC0 = constant [sbyte] c"fib returned: \00"
-%__intern_LC1 = constant [sbyte] c"\0A\00"
-
-implementation
-
-declare void "__main"()
-
-declare int "atoi"(sbyte *)
-
-declare void "printVal"([sbyte] *)
-declare void "printUInt"(uint)
-
-int "main"(int %argc, sbyte * * %argv)
-begin
-bb1: ;[#uses=1]
- call void () * %__main( )
- %cond1003 = setne int %argc, 2 ; <bool> [#uses=1]
- br bool %cond1003, label %bb4, label %bb2
-
-bb2: ;[#uses=2]
- %cast1006 = cast ulong 8 to sbyte * * ; <sbyte * *> [#uses=1]
- %reg1004 = add sbyte * * %argv, %cast1006 ; <sbyte * *> [#uses=1]
- %reg110 = load sbyte * * %reg1004 ; <sbyte *> [#uses=1]
- %reg109 = call int (sbyte *) * %atoi( sbyte * %reg110 ) ; <int> [#uses=1]
- br label %bb4
-
-bb4: ;[#uses=3]
- %reg126 = phi int [ %reg109, %bb2 ], [ 15, %bb1 ] ; <int> [#uses=3]
- %cast1007 = cast int %reg126 to uint ; <uint> [#uses=1]
- %cond1005 = setgt uint %cast1007, 1 ; <bool> [#uses=1]
- br bool %cond1005, label %bb6, label %bb7
-
-bb6: ;[#uses=2]
- %reg115 = add int %reg126, -2 ; <int> [#uses=1]
- %cast1008 = cast int %reg115 to uint ; <uint> [#uses=1]
- %reg116 = call uint (uint) * %fib( uint %cast1008 ) ; <uint> [#uses=1]
- %reg118 = add int %reg126, -1 ; <int> [#uses=1]
- %cast1009 = cast int %reg118 to uint ; <uint> [#uses=1]
- %reg119 = call uint (uint) * %fib( uint %cast1009 ) ; <uint> [#uses=1]
- %reg127 = add uint %reg116, %reg119 ; <uint> [#uses=1]
- br label %bb7
-
-bb7: ;[#uses=2]
- %reg128 = phi uint [ %reg127, %bb6 ], [ 1, %bb4 ] ; <uint> [#uses=1]
- call void %printVal([sbyte] * %__intern_LC0)
- call void %printUInt(uint %reg128 )
- call void %printVal([sbyte] * %__intern_LC1)
- ret int 0
-end
-
-uint "fib"(uint %n)
-begin
-bb1: ;[#uses=0]
- %cond1000 = setgt uint %n, 1 ; <bool> [#uses=1]
- br bool %cond1000, label %bb3, label %bb2
-
-bb2: ;[#uses=1]
- ret uint 1
-
-bb3: ;[#uses=1]
- %cast1001 = cast long -2 to uint ; <uint> [#uses=1]
- %reg112 = add uint %n, %cast1001 ; <uint> [#uses=1]
- %reg113 = call uint (uint) * %fib( uint %reg112 ) ; <uint> [#uses=1]
- %cast1002 = cast long -1 to uint ; <uint> [#uses=1]
- %reg115 = add uint %n, %cast1002 ; <uint> [#uses=1]
- %reg116 = call uint (uint) * %fib( uint %reg115 ) ; <uint> [#uses=1]
- %reg110 = add uint %reg113, %reg116 ; <uint> [#uses=1]
- ret uint %reg110
-end