aboutsummaryrefslogtreecommitdiffstats
path: root/test/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'test/Bindings')
-rw-r--r--test/Bindings/llvm-c/calc.test15
-rw-r--r--test/Bindings/llvm-c/disassemble.test29
-rw-r--r--test/Bindings/llvm-c/functions.ll31
-rw-r--r--test/Bindings/llvm-c/globals.ll7
-rw-r--r--test/Bindings/llvm-c/lit.local.cfg3
5 files changed, 85 insertions, 0 deletions
diff --git a/test/Bindings/llvm-c/calc.test b/test/Bindings/llvm-c/calc.test
new file mode 100644
index 0000000..36a76e6
--- /dev/null
+++ b/test/Bindings/llvm-c/calc.test
@@ -0,0 +1,15 @@
+; RUN: llvm-c-test --calc <%s | FileCheck %s
+
+; constant folding
+test 100 200 +
+;CHECK: ModuleID = 'test'
+;CHECK: define i64 @test
+;CHECK: {
+;CHECK: ret i64 300
+;CHECK: }
+
+arg1 0 @ 0 @ * 1 @ 1 @ * +
+;CHECK: ModuleID = 'arg1'
+;CHECK: getelementptr
+;CHECK: load
+;CHECK: ret
diff --git a/test/Bindings/llvm-c/disassemble.test b/test/Bindings/llvm-c/disassemble.test
new file mode 100644
index 0000000..201e914
--- /dev/null
+++ b/test/Bindings/llvm-c/disassemble.test
@@ -0,0 +1,29 @@
+; RUN: llvm-c-test --disassemble < %s | FileCheck %s
+
+
+arm-linux-android 44 26 1f e5 0c 10 4b e2 02 20 81 e0
+;CHECK: triple: arm-linux-android
+;CHECK: ldr r2, [pc, #-1604]
+;CHECK: sub r1, r11, #12
+;CHECK: 02 20 81 e0
+;CHECK: add r2, r1, r2
+
+x86_64-linux-unknown 48 83 c4 38 5b 5d 41 5c 41 5d 41 5e 41 5f c3
+;CHECK: triple: x86_64-linux-unknown
+;CHECK: addq $56, %rsp
+;CHECK: popq %rbx
+;CHECK: popq %rbp
+;CHECK: popq %r12
+;CHECK: popq %r13
+;CHECK: popq %r14
+;CHECK: popq %r15
+;CHECK: ret
+
+i686-apple-darwin 0f b7 4c 24 0a e8 29 ce ff ff
+;CHECK: movzwl 10(%esp), %ecx
+;CHECK: calll -12759
+
+i686-linux-unknown dd 44 24 04 d9 e1 c3
+;CHECK: fldl 4(%esp)
+;CHECK: fabs
+;CHECK: ret
diff --git a/test/Bindings/llvm-c/functions.ll b/test/Bindings/llvm-c/functions.ll
new file mode 100644
index 0000000..4503fb1
--- /dev/null
+++ b/test/Bindings/llvm-c/functions.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | llvm-c-test --module-list-functions | FileCheck %s
+
+define i32 @X() {
+entry:
+ br label %l1
+
+l1:
+ br label %l2
+
+l2:
+ br label %l3
+
+l3:
+ ret i32 1234
+}
+;CHECK: FunctionDefinition: X [#bb=4]
+
+
+define i32 @Z(i32 %a) {
+entry:
+ %0 = tail call i32 @Y(i32 %a)
+ ret i32 %0
+}
+
+;CHECK: FunctionDefinition: Z [#bb=1]
+;CHECK: calls: Y
+;CHECK: #isn: 2
+
+declare i32 @Y(i32)
+;CHECK: FunctionDeclaration: Y
+
diff --git a/test/Bindings/llvm-c/globals.ll b/test/Bindings/llvm-c/globals.ll
new file mode 100644
index 0000000..a38f08b
--- /dev/null
+++ b/test/Bindings/llvm-c/globals.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llvm-c-test --module-list-globals | FileCheck %s
+
+@foo = constant [7 x i8] c"foobar\00", align 1
+;CHECK: GlobalDefinition: foo [7 x i8]*
+
+@bar = common global i32 0, align 4
+;CHECK: GlobalDefinition: bar i32*
diff --git a/test/Bindings/llvm-c/lit.local.cfg b/test/Bindings/llvm-c/lit.local.cfg
new file mode 100644
index 0000000..270a7f2
--- /dev/null
+++ b/test/Bindings/llvm-c/lit.local.cfg
@@ -0,0 +1,3 @@
+targets = set(config.root.targets_to_build.split())
+if not (targets & set(["X86", "ARM"])):
+ config.unsupported = True