Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: test/NaCl/Bitcode/pnacl-bcdis/call.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/NaCl/Bitcode/pnacl-bcdis/br.ll ('k') | test/NaCl/Bitcode/pnacl-bcdis/casts.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/Bitcode/pnacl-bcdis/call.ll
diff --git a/test/NaCl/Bitcode/pnacl-bcdis/call.ll b/test/NaCl/Bitcode/pnacl-bcdis/call.ll
new file mode 100644
index 0000000000000000000000000000000000000000..55f76677832be9f3b2335033b89e17edcb7d4ce8
--- /dev/null
+++ b/test/NaCl/Bitcode/pnacl-bcdis/call.ll
@@ -0,0 +1,90 @@
+; Test call instructions
+
+; RUN: llvm-as < %s | pnacl-freeze | pnacl-bccompress --remove-abbreviations \
+; RUN: | pnacl-bcdis | FileCheck %s
+
+; CHECK: {{.*}}| 3: <7, 32> | @t0 = i32;
+; CHECK-NEXT: {{.*}}| 3: <2> | @t1 = void;
+; CHECK-NEXT: {{.*}}| 3: <3> | @t2 = float;
+
+
+; Test simple calls
+define void @foo(i32 %p0) {
+
+; CHECK: | | %b0:
+
+ %v0 = call i32 @bar(i32 %p0, i32 1)
+
+; CHECK-NEXT: {{.*}}| 3: <34, 0, 6, 2, 1> | %v0 = call i32
+; CHECK-NEXT: | | @f1(i32 %p0, i32 %c0);
+
+ %v1 = call float @bam(i32 %p0)
+
+; CHECK-NEXT: {{.*}}| 3: <34, 0, 6, 3> | %v1 = call float @f2(i32 %p0);
+
+ call void @huh()
+ ret void
+
+; CHECK-NEXT: {{.*}}| 3: <34, 0, 6> | call void @f3();
+; CHECK-NEXT: {{.*}}| 3: <10> | ret void;
+
+}
+
+define i32 @bar(i32 %p0, i32 %p1) {
+
+; CHECK: | | %b0:
+
+ %v0 = add i32 %p0, %p1
+ ret i32 %v0
+}
+
+define float @bam(i32 %p0) {
+
+; CHECK: | | %b0:
+
+ %v0 = sitofp i32 %p0 to float
+ ret float %v0
+}
+
+define void @huh() {
+
+; CHECK: | | %b0:
+
+ ret void
+}
+
+
+; Test indirect calls
+define void @IndirectTests(i32 %p0, i32 %p1) {
+
+; CHECK: | | %b0:
+
+ ; Simulates indirect call to @foo
+ %v0 = inttoptr i32 %p0 to void (i32)*
+ call void %v0(i32 %p1)
+
+; CHECK-NEXT: {{.*}}| 3: <44, 0, 3, 1, 2> | call void %p0(i32 %p1);
+
+ ; Simulates indirect call to @bar
+ %v1 = inttoptr i32 %p0 to i32 (i32, i32)*
+ %v2 = call i32 %v1(i32 %p1, i32 1)
+
+; CHECK-NEXT: {{.*}}| 3: <44, 0, 3, 0, 2, 1> | %v0 = call i32
+; CHECK-NEXT: | | %p0(i32 %p1, i32 %c0);
+
+ ; Simulates indirect call to @bam
+ %v3 = inttoptr i32 %p0 to float (i32)*
+ %v4 = call float %v3(i32 %p1)
+
+; CHECK-NEXT: {{.*}}| 3: <44, 0, 4, 2, 3> | %v1 = call float %p0(i32 %p1);
+
+ ; Simulates indirect call to @huh
+ %v5 = inttoptr i32 %p0 to void ()*
+ call void %v5()
+ ret void
+
+; CHECK-NEXT: {{.*}}| 3: <44, 0, 5, 1> | call void %p0();
+; CHECK-NEXT: {{.*}}| 3: <10> | ret void;
+
+}
+
« no previous file with comments | « test/NaCl/Bitcode/pnacl-bcdis/br.ll ('k') | test/NaCl/Bitcode/pnacl-bcdis/casts.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698