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

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

Issue 1517863002: Add translation of REV in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reformat source. Created 5 years 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 | « src/IceInstARM32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/assembler/arm32/rev.ll
diff --git a/tests_lit/assembler/arm32/rev.ll b/tests_lit/assembler/arm32/rev.ll
new file mode 100644
index 0000000000000000000000000000000000000000..6a873b6861da2c8f12d1e818117c8cdcf0b9ece8
--- /dev/null
+++ b/tests_lit/assembler/arm32/rev.ll
@@ -0,0 +1,49 @@
+; Show that we know how to translate rev (used in bswap).
+
+; 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
+
+declare i16 @llvm.bswap.i16(i16)
+
+define internal i32 @_Z10test_rev(i32 %a) {
Jim Stichnoth 2015/12/11 16:51:23 Friendlier function name?
Karl 2015/12/11 17:32:41 Done.
+; ASM-LABEL:_Z10test_rev:
+; DIS-LABEL:00000000 <_Z10test_rev>:
+; IASM-LABEL:_Z10test_rev:
+
+entry:
+; ASM-NEXT:.L_Z10test_rev$entry:
+; IASM-NEXT:.L_Z10test_rev$entry:
+
+ %a.arg_trunc = trunc i32 %a to i16
+ %v = tail call i16 @llvm.bswap.i16(i16 %a.arg_trunc)
+
+; ***** Example of rev instruction. *****
+; ASM-NEXT: rev r0, r0
+; DIS-NEXT: 0: e6bf0f30
+; IASM-NEXT: .byte 0x30
+; IASM-NEXT: .byte 0xf
+; IASM-NEXT: .byte 0xbf
+; IASM-NEXT: .byte 0xe6
+
+; ASM-NEXT: lsr r0, r0, #16
+
+ %.ret_ext = zext i16 %v to i32
+ ret i32 %.ret_ext
+}
« no previous file with comments | « src/IceInstARM32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698