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

Unified Diff: tests_lit/llvm2ice_tests/mips-legalization.ll

Issue 2411193003: [SubZero] Legalize load, store for MIPS post lower (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addressed review comments Created 4 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
« no previous file with comments | « src/IceTargetLoweringMIPS32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/mips-legalization.ll
diff --git a/tests_lit/llvm2ice_tests/mips-legalization.ll b/tests_lit/llvm2ice_tests/mips-legalization.ll
new file mode 100644
index 0000000000000000000000000000000000000000..ba8f4e3583ea0ce902d64dba19af5ca327cd7d0e
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/mips-legalization.ll
@@ -0,0 +1,76 @@
+; This file checks support for legalization in MIPS.
+
+; RUN: %if --need=target_MIPS32 --need=allow_dump \
Jim Stichnoth 2016/10/13 17:15:29 Better to remove both instances of --need=allow_du
jaydeep.patil 2016/10/14 04:40:43 Done.
+; RUN: --command %p2i --filetype=asm --assemble --disassemble \
+; RUN: --target mips32 -i %s --args -O2 --skip-unimplemented \
Jim Stichnoth 2016/10/13 17:15:30 If possible, remove --skip-unimplemented and -allo
jaydeep.patil 2016/10/14 04:40:43 Done. We are also planning to remove --skip-unimpl
+; RUN: -allow-externally-defined-symbols \
+; RUN: | %if --need=target_MIPS32 --need=allow_dump \
+; RUN: --command FileCheck --check-prefix MIPS32 %s
+
+define internal i32 @legalization(i32 %a, i32 %b, i32 %c, i32 %d,
+ i32 %e, i32 %f) {
+entry:
+ %a.addr.i8 = alloca i8, i32 4, align 4
+ %b.addr.i8 = alloca i8, i32 4, align 4
+ %c.addr.i8 = alloca i8, i32 4, align 4
+ %d.addr.i8 = alloca i8, i32 4, align 4
+ %e.addr.i8 = alloca i8, i32 4, align 4
+ %f.addr.i8 = alloca i8, i32 4, align 4
+ %r1.i8 = alloca i8, i32 4, align 4
+ %r2.i8 = alloca i8, i32 4, align 4
+ %r3.i8 = alloca i8, i32 4, align 4
+ %a.addr = bitcast i8* %a.addr.i8 to i32*
+ %b.addr = bitcast i8* %b.addr.i8 to i32*
+ %c.addr = bitcast i8* %c.addr.i8 to i32*
+ %d.addr = bitcast i8* %d.addr.i8 to i32*
+ %e.addr = bitcast i8* %e.addr.i8 to i32*
+ %f.addr = bitcast i8* %f.addr.i8 to i32*
+ %r1 = bitcast i8* %r1.i8 to i32*
+ %r2 = bitcast i8* %r2.i8 to i32*
+ %r3 = bitcast i8* %r3.i8 to i32*
+ store i32 %a, i32* %a.addr, align 1
+ store i32 %b, i32* %b.addr, align 1
+ store i32 %c, i32* %c.addr, align 1
+ store i32 %d, i32* %d.addr, align 1
+ store i32 %e, i32* %e.addr, align 1
+ store i32 %f, i32* %f.addr, align 1
+ %0 = load i32, i32* %a.addr, align 1
+ %1 = load i32, i32* %f.addr, align 1
+ %add1 = add nsw i32 %0, %1
Jim Stichnoth 2016/10/13 17:15:29 "nsw" is not part of the PNaCl bitcode ABI, so tha
jaydeep.patil 2016/10/14 04:40:43 Done. Used pydir/build-pnacl-ir.py script to gener
+ store i32 %add1, i32* %r1, align 1
+ %2 = load i32, i32* %b.addr, align 1
+ %3 = load i32, i32* %e.addr, align 1
+ %add2 = add nsw i32 %2, %3
+ store i32 %add2, i32* %r2, align 1
+ %4 = load i32, i32* %r1, align 1
+ %5 = load i32, i32* %r2, align 1
+ %add3 = add nsw i32 %4, %5
+ store i32 %add3, i32* %r3, align 1
+ %6 = load i32, i32* %r3, align 1
+ ret i32 %6
+}
+; MIPS32-LABEL: legalization
+; MIPS32: addiu sp,sp,-48
Jim Stichnoth 2016/10/13 17:15:29 I would be a bit cautious about assuming specific
jaydeep.patil 2016/10/14 04:40:43 Acknowledged. The pre-colored registers (a0-a3 and
+; MIPS32: lw [[ARG_E:.*]],64(sp)
+; MIPS32: lw [[ARG_F:.*]],68(sp)
+; MIPS32: sw a0,0(sp)
+; MIPS32: sw a1,4(sp)
+; MIPS32: sw a2,8(sp)
+; MIPS32: sw a3,12(sp)
+; MIPS32: sw [[ARG_E]],16(sp)
+; MIPS32: sw [[ARG_F]],20(sp)
+; MIPS32: lw [[TMP_A:.*]],0(sp)
+; MIPS32: lw [[TMP_F:.*]],20(sp)
+; MIPS32: addu [[ADD1:.*]],[[TMP_A]],[[TMP_F]]
+; MIPS32: sw [[ADD1]],24(sp)
+; MIPS32: lw [[TMP_B:.*]],4(sp)
+; MIPS32: lw [[TMP_E:.*]],16(sp)
+; MIPS32: addu [[ADD2:.*]],[[TMP_B]],[[TMP_E]]
+; MIPS32: sw [[ADD2]],28(sp)
+; MIPS32: lw [[TMP_ADD1:.*]],24(sp)
+; MIPS32: lw [[TMP_ADD2:.*]],28(sp)
+; MIPS32: addu [[ADD3:.*]],[[TMP_ADD1]],[[TMP_ADD2]]
+; MIPS32: sw [[ADD3]],32(sp)
+; MIPS32: lw v0,32(sp)
+; MIPS32: addiu sp,sp,48
+; MIPS32: jr ra
« no previous file with comments | « src/IceTargetLoweringMIPS32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698