diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/X86/test-hidden.ll | 19 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-1.ll | 18 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-2.ll | 17 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-3.ll | 14 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-4.ll | 21 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-5.ll | 13 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-cpool.ll | 13 | ||||
-rw-r--r-- | test/CodeGen/X86/test-pic-jtbl.ll | 57 |
8 files changed, 172 insertions, 0 deletions
diff --git a/test/CodeGen/X86/test-hidden.ll b/test/CodeGen/X86/test-hidden.ll new file mode 100644 index 0000000..f3a3d9c --- /dev/null +++ b/test/CodeGen/X86/test-hidden.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l | grep 2 + +%struct.Person = type { i32 } +%a = hidden global i32 0 +%b = external global i32 + +implementation ; Functions: + +define weak hidden void %_ZN6Person13privateMethodEv(%struct.Person* %this) { + ret void +} + +declare void %function(i32) + +define weak void %_ZN6PersonC1Ei(%struct.Person* %this, i32 %_c) { + ret void +} + diff --git a/test/CodeGen/X86/test-pic-1.ll b/test/CodeGen/X86/test-pic-1.ll new file mode 100644 index 0000000..a12e742 --- /dev/null +++ b/test/CodeGen/X86/test-pic-1.ll @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOT | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 0 + +%ptr = external global i32* +%dst = external global i32 +%src = external global i32 + +define void %foo() { +entry: + store i32* %dst, i32** %ptr + %tmp.s = load i32* %src + store i32 %tmp.s, i32* %dst + ret void +} + diff --git a/test/CodeGen/X86/test-pic-2.ll b/test/CodeGen/X86/test-pic-2.ll new file mode 100644 index 0000000..04fdbda --- /dev/null +++ b/test/CodeGen/X86/test-pic-2.ll @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 4 + +%ptr = internal global i32* null +%dst = internal global i32 0 +%src = internal global i32 0 + +define void %foo() { +entry: + store i32* %dst, i32** %ptr + %tmp.s = load i32* %src + store i32 %tmp.s, i32* %dst + ret void +} + diff --git a/test/CodeGen/X86/test-pic-3.ll b/test/CodeGen/X86/test-pic-3.ll new file mode 100644 index 0000000..726a53b --- /dev/null +++ b/test/CodeGen/X86/test-pic-3.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 + +define void %bar() { +entry: + call void(...)* %foo() + br label %return +return: + ret void +} + +declare void %foo(...) diff --git a/test/CodeGen/X86/test-pic-4.ll b/test/CodeGen/X86/test-pic-4.ll new file mode 100644 index 0000000..13abb2e --- /dev/null +++ b/test/CodeGen/X86/test-pic-4.ll @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep "GOT" | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep "GOTOFF" | wc -l | grep 0 + +%pfoo = external global void(...)* + +define void %bar() { +entry: + %tmp = call void(...)*(...)* %afoo() + store void(...)* %tmp, void(...)** %pfoo + %tmp1 = load void(...)** %pfoo + call void(...)* %tmp1() + br label %return +return: + ret void +} + +declare void(...)* %afoo(...) diff --git a/test/CodeGen/X86/test-pic-5.ll b/test/CodeGen/X86/test-pic-5.ll new file mode 100644 index 0000000..4517e09 --- /dev/null +++ b/test/CodeGen/X86/test-pic-5.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 + +%ptr = external global i32* + +define void %foo() { +entry: + %ptr = malloc i32, i32 10 + ret void +} + diff --git a/test/CodeGen/X86/test-pic-cpool.ll b/test/CodeGen/X86/test-pic-cpool.ll new file mode 100644 index 0000000..7a9df53 --- /dev/null +++ b/test/CodeGen/X86/test-pic-cpool.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep CPI | wc -l | grep 4 + +define double %foo(i32 %a.u) { +entry: + %tmp = icmp eq i32 %a.u,0 + %retval = select bool %tmp, double 4.561230e+02, double 1.234560e+02 + ret double %retval +} + diff --git a/test/CodeGen/X86/test-pic-jtbl.ll b/test/CodeGen/X86/test-pic-jtbl.ll new file mode 100644 index 0000000..ff3c4d6 --- /dev/null +++ b/test/CodeGen/X86/test-pic-jtbl.ll @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 13 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep JTI | wc -l | grep 15 + +define void %bar(i32 %n.u) { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...)* %foo1() + ret void +bb1: + tail call void(...)* %foo2() + ret void +bb2: + tail call void(...)* %foo6() + ret void +bb3: + tail call void(...)* %foo3() + ret void +bb4: + tail call void(...)* %foo4() + ret void +bb5: + tail call void(...)* %foo5() + ret void +bb6: + tail call void(...)* %foo1() + ret void +bb7: + tail call void(...)* %foo2() + ret void +bb8: + tail call void(...)* %foo6() + ret void +bb9: + tail call void(...)* %foo3() + ret void +bb10: + tail call void(...)* %foo4() + ret void +bb11: + tail call void(...)* %foo5() + ret void +bb12: + tail call void(...)* %foo6() + ret void +} + +declare void %foo1(...) +declare void %foo2(...) +declare void %foo6(...) +declare void %foo3(...) +declare void %foo4(...) +declare void %foo5(...) |