diff options
-rw-r--r-- | test/Feature/allocatest2.ll | 25 | ||||
-rw-r--r-- | test/exprtest.ll | 32 |
2 files changed, 57 insertions, 0 deletions
diff --git a/test/Feature/allocatest2.ll b/test/Feature/allocatest2.ll new file mode 100644 index 0000000..8500d9f --- /dev/null +++ b/test/Feature/allocatest2.ll @@ -0,0 +1,25 @@ + +implementation + +declare void "_Z12combinationsjPj" (uint, uint*) ;; Prototype for: void combinations(unsigned int, unsigned int*) + +;; Emitting: void UseAllocaFunction(unsigned int) +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*> + call void(uint, uint*) %_Z12combinationsjPj(uint %n, uint* %cast1000) ;;<void> + %cast113 = cast uint %reg110 to ulong* ;;<ulong*> + cast uint 7 to ulong * + %reg114 = add ulong* %cast113, %0 ;;<ulong*> + %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*> + call void(uint, uint*) %_Z12combinationsjPj(uint %n, uint* %cast1002) ;;<void> + ret void ;;<void> +end + diff --git a/test/exprtest.ll b/test/exprtest.ll new file mode 100644 index 0000000..d7fb15c --- /dev/null +++ b/test/exprtest.ll @@ -0,0 +1,32 @@ +implementation +int "testExpressions"(int %N, int* %A) +begin + %N1 = add int %N, 12 + %N2 = mul int %N, 7 + %N3 = add int %N1, %N2 ;; Should equal 8*N+12 + %N4 = shl int %N3, ubyte 3 ;; Should equal 64*N + 96 + %N5 = mul int %N4, 0 ;; 0 + br label %1 + + %C = cast int 264 to ubyte ;; 8 + %C1 = add ubyte 252, %C ;; 4 + %C2 = cast ubyte %C1 to ulong ;; 4 + %C3 = add ulong 12345678901, %C2 ;; 12345678905 + %C4 = cast ulong %C3 to sbyte * ;; 12345678905 + br label %2 + + %A1 = cast int 4 to int * + %A2 = add int *%A, %A1 ;; %A+4 + %A3 = cast int 8 to int * + %A4 = add int *%A, %A3 ;; %A+8 + %X = sub int *%A4, %A2 ;; Should equal 4 + br label %3 + + %Z1 = cast int 400 to int * + %Z2 = cast sbyte 2 to int * + %Z3 = add int* %Z1, %Z2 + %Z4 = cast int* %Z3 to ubyte + + ret int %N4 +end + |