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

Unified Diff: tests_lit/assembler/arm32/blx.ll

Issue 1452293003: Add BL (immediate) and BLX (register) to ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 1 month 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/blx.ll
diff --git a/tests_lit/assembler/arm32/blx.ll b/tests_lit/assembler/arm32/blx.ll
new file mode 100644
index 0000000000000000000000000000000000000000..0c4f38820c87018022e7e1b6a88b785f04f0deeb
--- /dev/null
+++ b/tests_lit/assembler/arm32/blx.ll
@@ -0,0 +1,64 @@
+; Show that we know how to translate add.
Jim Stichnoth 2015/11/22 03:27:03 add?
Karl 2015/11/30 16:54:35 Replaced with blx.
+
+; NOTE: We use -O2 to get rid of memory stores.
+
+; REQUIRES: allow_dump
+
+; Compile using standalone assembler.
+; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \
+; RUN: | FileCheck %s --check-prefix=ASM
+
+; Show bytes in assembled standalone code.
+; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
+; RUN: --args -O2 | FileCheck %s --check-prefix=DIS
+
+; Compile using integrated assembler.
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
+; RUN: | FileCheck %s --check-prefix=IASM
+
+; Show bytes in assembled integrated code.
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
+; RUN: --args -O2 | FileCheck %s --check-prefix=DIS
+
+define internal void @callIndirect(i32 %addr) {
+; ASM-LABEL:callIndirect:
+; DIS-LABEL:00000000 <callIndirect>:
+; IASM-LABEL:callIndirect:
+
+entry:
+; ASM-NEXT:.LcallIndirect$entry:
+; IASM-NEXT:.LcallIndirect$entry:
+; ASM-NEXT: push {lr}
+; DIS-NEXT: 0: e52de004
+; IASM-NEXT: .byte 0x4
+; IASM-NEXT: .byte 0xe0
+; IASM-NEXT: .byte 0x2d
+; IASM-NEXT: .byte 0xe5
+
+; ASM-NEXT: sub sp, sp, #12
+; DIS-NEXT: 4: e24dd00c
+; IASM-NEXT: .byte 0xc
+; IASM-NEXT: .byte 0xd0
+; IASM-NEXT: .byte 0x4d
+; IASM-NEXT: .byte 0xe2
+
+ %calladdr = inttoptr i32 %addr to void (i32)*
+
+; ASM-NEXT: mov r1, r0
+; DIS-NEXT: 8: e1a01000
+; IASM-NEXT: .byte 0x0
+; IASM-NEXT: .byte 0x10
+; IASM-NEXT: .byte 0xa0
+; IASM-NEXT: .byte 0xe1
+
+ call void %calladdr(i32 %addr)
+
+; ASM-NEXT: blx r1
+; DIS-NEXT: c: e12fff31
+; IASM-NEXT: .byte 0x31
+; IASM-NEXT: .byte 0xff
+; IASM-NEXT: .byte 0x2f
+; IASM-NEXT: .byte 0xe1
+
+ ret void
+}

Powered by Google App Engine
This is Rietveld 408576698