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

Unified Diff: test/cctest/test-disasm-arm.cc

Issue 1776933003: [arm] Basic simulation of msr and mrs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « test/cctest/test-assembler-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-disasm-arm.cc
diff --git a/test/cctest/test-disasm-arm.cc b/test/cctest/test-disasm-arm.cc
index 74144f25c6054cc92a975dc7c1cd58ff75932f7d..aaec01fcd1586d5a1ffdf33ab9710b9d78726d37 100644
--- a/test/cctest/test-disasm-arm.cc
+++ b/test/cctest/test-disasm-arm.cc
@@ -453,6 +453,54 @@ TEST(Type3) {
}
+TEST(msr_mrs_disasm) {
+ SET_UP();
+
+ SRegisterFieldMask CPSR_all = CPSR_f | CPSR_s | CPSR_x | CPSR_c;
+ SRegisterFieldMask SPSR_all = SPSR_f | SPSR_s | SPSR_x | SPSR_c;
+
+ COMPARE(msr(CPSR_f, Operand(r0)), "e128f000 msr CPSR_f, r0");
+ COMPARE(msr(CPSR_s, Operand(r1)), "e124f001 msr CPSR_s, r1");
+ COMPARE(msr(CPSR_x, Operand(r2)), "e122f002 msr CPSR_x, r2");
+ COMPARE(msr(CPSR_c, Operand(r3)), "e121f003 msr CPSR_c, r3");
+ COMPARE(msr(CPSR_all, Operand(ip)), "e12ff00c msr CPSR_fsxc, ip");
+ COMPARE(msr(SPSR_f, Operand(r0)), "e168f000 msr SPSR_f, r0");
+ COMPARE(msr(SPSR_s, Operand(r1)), "e164f001 msr SPSR_s, r1");
+ COMPARE(msr(SPSR_x, Operand(r2)), "e162f002 msr SPSR_x, r2");
+ COMPARE(msr(SPSR_c, Operand(r3)), "e161f003 msr SPSR_c, r3");
+ COMPARE(msr(SPSR_all, Operand(ip)), "e16ff00c msr SPSR_fsxc, ip");
+ COMPARE(msr(CPSR_f, Operand(r0), eq), "0128f000 msreq CPSR_f, r0");
+ COMPARE(msr(CPSR_s, Operand(r1), ne), "1124f001 msrne CPSR_s, r1");
+ COMPARE(msr(CPSR_x, Operand(r2), cs), "2122f002 msrcs CPSR_x, r2");
+ COMPARE(msr(CPSR_c, Operand(r3), cc), "3121f003 msrcc CPSR_c, r3");
+ COMPARE(msr(CPSR_all, Operand(ip), mi), "412ff00c msrmi CPSR_fsxc, ip");
+ COMPARE(msr(SPSR_f, Operand(r0), pl), "5168f000 msrpl SPSR_f, r0");
+ COMPARE(msr(SPSR_s, Operand(r1), vs), "6164f001 msrvs SPSR_s, r1");
+ COMPARE(msr(SPSR_x, Operand(r2), vc), "7162f002 msrvc SPSR_x, r2");
+ COMPARE(msr(SPSR_c, Operand(r3), hi), "8161f003 msrhi SPSR_c, r3");
+ COMPARE(msr(SPSR_all, Operand(ip), ls), "916ff00c msrls SPSR_fsxc, ip");
+
+ // Other combinations of mask bits.
+ COMPARE(msr(CPSR_s | CPSR_x, Operand(r4)),
+ "e126f004 msr CPSR_sx, r4");
+ COMPARE(msr(SPSR_s | SPSR_x | SPSR_c, Operand(r5)),
+ "e167f005 msr SPSR_sxc, r5");
+ COMPARE(msr(SPSR_s | SPSR_c, Operand(r6)),
+ "e165f006 msr SPSR_sc, r6");
+ COMPARE(msr(SPSR_f | SPSR_c, Operand(r7)),
+ "e169f007 msr SPSR_fc, r7");
+ // MSR with no mask is UNPREDICTABLE, and checked by the assembler, but check
+ // that the disassembler does something sensible.
+ COMPARE(dd(0xe120f008), "e120f008 msr CPSR_(none), r8");
+
+ COMPARE(mrs(r0, CPSR), "e10f0000 mrs r0, CPSR");
+ COMPARE(mrs(r1, SPSR), "e14f1000 mrs r1, SPSR");
+ COMPARE(mrs(r2, CPSR, ge), "a10f2000 mrsge r2, CPSR");
+ COMPARE(mrs(r3, SPSR, lt), "b14f3000 mrslt r3, SPSR");
+
+ VERIFY_RUN();
+}
+
TEST(Vfp) {
SET_UP();
« no previous file with comments | « test/cctest/test-assembler-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698