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

Unified Diff: tests_lit/assembler/arm32/global-load-store.ll

Issue 1418523002: Add hybrid assembler concept to ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 2 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
Index: tests_lit/assembler/arm32/global-load-store.ll
diff --git a/tests_lit/assembler/arm32/global-load-store.ll b/tests_lit/assembler/arm32/global-load-store.ll
new file mode 100644
index 0000000000000000000000000000000000000000..461b49b21dcc5073699f38d3881b83a040383570
--- /dev/null
+++ b/tests_lit/assembler/arm32/global-load-store.ll
@@ -0,0 +1,66 @@
+; TODO(kschimpf): Show that we can handle global variable loads/stores.
+
+; REQUIRES: allow_dump
+
+; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \
+; RUN: | FileCheck %s --check-prefix=ASM
+; RUN: %p2i --filetype=hasm -i %s --target=arm32 --args -O2 \
+; RUN: | FileCheck %s --check-prefix=IASM
+
+@global1 = internal global [4 x i8] zeroinitializer, align 4
+
+; ASM-LABEL: global1:
+; ASM-NEXT: .zero 4
+; ASM-NEXT: .size global1, 4
+; ASM-NEXT: .text
+; ASM-NEXT: .p2alignl 4,0xe7fedef0
+
+; IASM-LABEL:global1:
+; IASM-NEXT: .zero 4
+; IASM-NEXT: .size global1, 4
+; IASM-NEXT: .text
+; IASM-NEXT: .p2alignl 4,0xe7fedef0
+
+define internal i32 @load() {
+ %addr = bitcast [4 x i8]* @global1 to i32*
+ %v = load i32, i32* %addr, align 1
+ ret i32 %v
+}
+
+; ASM-LABEL: load:
+; ASM-NEXT: .Lload$__0:
+; ASM-NEXT: movw r0, #:lower16:global1
+; ASM-NEXT: movt r0, #:upper16:global1
+; ASM-NEXT: ldr r0, [r0]
+; ASM-NEXT: bx lr
+
+; IASM-LABEL:load:
+; IASM-NEXT: movw r0, #:lower16:global1
+; IASM-NEXT: movt r0, #:upper16:global1
+; IASM-NEXT: ldr r0, [r0]
+; IASM-NEXT: .byte 0x1e
+; IASM-NEXT: .byte 0xff
+; IASM-NEXT: .byte 0x2f
+; IASM-NEXT: .byte 0xe1
+
+define internal void @store(i32 %v) {
+ %addr = bitcast [4 x i8]* @global1 to i32*
+ store i32 %v, i32* %addr, align 1
+ ret void
+}
+
+; ASM-LABEL:store:
+; ASM-NEXT: .Lstore$__0:
+; ASM-NEXT: movw r1, #:lower16:global1
+; ASM-NEXT: movt r1, #:upper16:global1
+; ASM-NEXT: str r0, [r1]
+; ASM-NEXT: bx lr
+
+; IASM-LABEL:store:
+; IASM-NEXT: movw r1, #:lower16:global1
+; IASM-NEXT: movt r1, #:upper16:global1
+; IASM-NEXT: str r0, [r1]
+; IASM-NEXT: .byte 0x1e
+; IASM-NEXT: .byte 0xff
+; IASM-NEXT: .byte 0x2f
+; IASM-NEXT: .byte 0xe1

Powered by Google App Engine
This is Rietveld 408576698