[PATCH] D95924: [Example][NFC} Add testcase for BrainF HelloWorld
Shivam Gupta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 21:38:12 PST 2021
xgupta created this revision.
xgupta added reviewers: jyknight, fpichet, chapuni.
xgupta requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95924
Files:
llvm/test/Examples/BrainF/HelloWorld.ll
llvm/test/Examples/BrainF/HelloWorld.test
Index: llvm/test/Examples/BrainF/HelloWorld.test
===================================================================
--- /dev/null
+++ llvm/test/Examples/BrainF/HelloWorld.test
@@ -0,0 +1,3 @@
+# RUN: BrainF %s -o - | lli 2>&1 | FileCheck %s
+++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
+# CHECK: Hello World!
Index: llvm/test/Examples/BrainF/HelloWorld.ll
===================================================================
--- /dev/null
+++ llvm/test/Examples/BrainF/HelloWorld.ll
@@ -0,0 +1,27 @@
+; RUN: BrainF %s -o - | llvm-dis | FileCheck %s
+++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
+
+# CHECK: define void @brainf() {
+# CHECK-NEXT: brainf:
+# CHECK-NEXT: %malloccall = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i32), i32 65536))
+# CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* %malloccall, i8 0, i32 65536, i1 false)
+# CHECK-NEXT: %head = getelementptr i8, i8* %malloccall, i32 32768
+# CHECK-NEXT: %tape = load i8, i8* %head, align 1
+
+# CHECK: store i8 %tape2, i8* %head, align 1
+# CHECK: br label %brainf3
+
+# CHECK: brainf1: ; preds = %brainf55
+# CHECK-NEXT: tail call void @free(i8* %malloccall)
+# CHECK-NEXT: ret void
+# CHECK: }
+
+# CHECK: declare noalias i8* @malloc(i32)
+
+# CHECK: declare void @free(i8*)
+
+# CHECK: define i32 @main(i32 %argc, i8** %argv) {
+# CHECK-NEXT: main.0:
+# CHECK-NEXT: call void @brainf()
+# CHECK-NEXT: ret i32 0
+# CHECK }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95924.320998.patch
Type: text/x-patch
Size: 1732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210203/c525c952/attachment.bin>
More information about the llvm-commits
mailing list