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

Unified Diff: tests_lit/reader_tests/alloc.ll

Issue 545623005: Add alloca instruction to Subzero bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 3 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
« src/PNaClTranslator.cpp ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/reader_tests/alloc.ll
diff --git a/tests_lit/reader_tests/alloc.ll b/tests_lit/reader_tests/alloc.ll
new file mode 100644
index 0000000000000000000000000000000000000000..f3db361bc38a1128df257045a0d474b949e20728
--- /dev/null
+++ b/tests_lit/reader_tests/alloc.ll
@@ -0,0 +1,66 @@
+; Test if we can read alloca instructions.
+
+; RUN: llvm-as < %s | pnacl-freeze \
+; RUN: | %llvm2ice -notranslate -verbose=inst -build-on-read \
+; RUN: -allow-pnacl-reader-error-recovery \
+; RUN: | FileCheck %s
+
Karl 2014/09/08 21:16:23 Added case of alignment == 0, since it is allowed.
+define i32 @AllocaA1(i32 %n) {
+ %array = alloca i8, i32 %n, align 1
+ %addr = ptrtoint i8* %array to i32
+ ret i32 %addr
+}
+
+; CHECK: define i32 @AllocaA1(i32 %__0) {
+; CHECK-NEXT: __0:
+; CHECK-NEXT: %__1 = alloca i8, i32 %__0, align 1
+; CHECK-NEXT: ret i32 %__1
+; CHECK-NEXT: }
+
+define i32 @AllocaA2(i32 %n) {
+ %array = alloca i8, i32 %n, align 2
+ %addr = ptrtoint i8* %array to i32
+ ret i32 %addr
+}
+
+; CHECK-NEXT: define i32 @AllocaA2(i32 %__0) {
+; CHECK-NEXT: __0:
+; CHECK-NEXT: %__1 = alloca i8, i32 %__0, align 2
+; CHECK-NEXT: ret i32 %__1
+; CHECK-NEXT: }
+
+define i32 @AllocaA4(i32 %n) {
+ %array = alloca i8, i32 %n, align 4
+ %addr = ptrtoint i8* %array to i32
+ ret i32 %addr
+}
+
+; CHECK-NEXT: define i32 @AllocaA4(i32 %__0) {
+; CHECK-NEXT: __0:
+; CHECK-NEXT: %__1 = alloca i8, i32 %__0, align 4
+; CHECK-NEXT: ret i32 %__1
+; CHECK-NEXT: }
+
+define i32 @AllocaA8(i32 %n) {
+ %array = alloca i8, i32 %n, align 8
+ %addr = ptrtoint i8* %array to i32
+ ret i32 %addr
+}
+
+; CHECK-NEXT: define i32 @AllocaA8(i32 %__0) {
+; CHECK-NEXT: __0:
+; CHECK-NEXT: %__1 = alloca i8, i32 %__0, align 8
+; CHECK-NEXT: ret i32 %__1
+; CHECK-NEXT: }
+
+define i32 @AllocaA16(i32 %n) {
+ %array = alloca i8, i32 %n, align 16
jvoung (off chromium) 2014/09/05 16:55:04 Once you have the constants block would be good to
Karl 2014/09/08 21:16:23 Done.
+ %addr = ptrtoint i8* %array to i32
+ ret i32 %addr
+}
+
+; CHECK-NEXT: define i32 @AllocaA16(i32 %__0) {
+; CHECK-NEXT: __0:
+; CHECK-NEXT: %__1 = alloca i8, i32 %__0, align 16
+; CHECK-NEXT: ret i32 %__1
+; CHECK-NEXT: }
« src/PNaClTranslator.cpp ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698