New test case

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-07-22 05:00:34 +00:00
parent aceb9132b7
commit 90147816f6
2 changed files with 50 additions and 0 deletions

11
test/combinations.c Normal file
View File

@ -0,0 +1,11 @@
void combinations(unsigned int n, unsigned *A) {
unsigned int i, t = 1;
A[0] = A[n] = 1;
for (i = 1; i <= n/2; i++) {
t = (t * (n+1-i)) / i;
A[i] = A[n-i] = t;
}
}

39
test/combinations.ll Normal file
View File

@ -0,0 +1,39 @@
implementation
;; Emitting: void combinations(unsigned int, unsigned int*)
void "combinations"(uint %n, uint* %A)
begin
bb1: ;;<label>
%reg111 = shl uint %n, ubyte 2 ;;<uint>
%cast112 = cast uint %reg111 to uint* ;;<uint*>
%reg113 = add uint* %A, %cast112 ;;<uint*>
store uint 1, uint* %reg113 ;;<void>
store uint 1, uint* %A ;;<void>
%reg128 = shr uint %n, ubyte 1 ;;<uint>:(unsigned operands)
%cond105 = setgt uint 1, %reg128 ;;<bool>:(unsigned operands)
br bool %cond105, label %bb3, label %bb2 ;;<void>
bb2: ;;<label>
%reg129 = phi uint [ %reg131, %bb2 ], [ 1, %bb1 ] ;;<uint>
%reg130 = phi uint [ %reg132, %bb2 ], [ 1, %bb1 ] ;;<uint>
%reg117 = sub uint %n, %reg130 ;;<uint>
%reg118 = add uint %reg117, 1 ;;<uint>
%reg119 = mul uint %reg129, %reg118 ;;<uint>
%reg131 = div uint %reg119, %reg130 ;;<uint>:(unsigned operands)
%reg120 = shl uint %reg130, ubyte 2 ;;<uint>
%cast121 = cast uint %reg120 to uint* ;;<uint*>
%reg122 = add uint* %A, %cast121 ;;<uint*>
%reg124 = shl uint %reg117, ubyte 2 ;;<uint>
%cast125 = cast uint %reg124 to uint* ;;<uint*>
%reg126 = add uint* %A, %cast125 ;;<uint*>
store uint %reg131, uint* %reg126 ;;<void>
store uint %reg131, uint* %reg122 ;;<void>
%reg132 = add uint %reg130, 1 ;;<uint>
%cond47 = setle uint %reg132, %reg128 ;;<bool>:(unsigned operands)
br bool %cond47, label %bb2, label %bb3 ;;<void>
bb3: ;;<label>
ret void ;;<void>
end
declare void "_Z12combinationsjPj" (uint, uint*) ;; Prototype for: void combinations(unsigned int, unsigned int*)