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

Unified Diff: test/cctest/test-assembler-arm64.cc

Issue 2922173004: [arm64] Fix pre-shifted immediate generation involving csp. (Closed)
Patch Set: Created 3 years, 6 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/arm64/macro-assembler-arm64.cc ('k') | test/mjsunit/regress/regress-725858.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-arm64.cc
diff --git a/test/cctest/test-assembler-arm64.cc b/test/cctest/test-assembler-arm64.cc
index 145849e376dcbc4fb6915c95f34325a563614c41..3c0d8bc0de47e793822b520e599cd326cbca5827 100644
--- a/test/cctest/test-assembler-arm64.cc
+++ b/test/cctest/test-assembler-arm64.cc
@@ -7153,6 +7153,70 @@ TEST(add_sub_zero) {
TEARDOWN();
}
+TEST(preshift_immediates) {
+ INIT_V8();
+ SETUP();
+
+ START();
+ // Test operations involving immediates that could be generated using a
+ // pre-shifted encodable immediate followed by a post-shift applied to
+ // the arithmetic or logical operation.
+
+ // Save csp.
+ __ Mov(x29, csp);
+
+ // Set the registers to known values.
+ __ Mov(x0, 0x1000);
+ __ Mov(csp, 0x1000);
+
+ // Arithmetic ops.
+ __ Add(x1, x0, 0x1f7de);
Tobias Tebbi 2017/06/08 10:27:51 How are these constants encodable with a shift? Th
martyn.capewell 2017/06/08 10:37:17 In order to improve "encodability", ones are inser
+ __ Add(w2, w0, 0xffffff1);
+ __ Adds(x3, x0, 0x18001);
+ __ Adds(w4, w0, 0xffffff1);
+ __ Sub(x5, x0, 0x1f7de);
+ __ Sub(w6, w0, 0xffffff1);
+ __ Subs(x7, x0, 0x18001);
+ __ Subs(w8, w0, 0xffffff1);
+
+ // Logical ops.
+ __ And(x9, x0, 0x1f7de);
+ __ Orr(w10, w0, 0xffffff1);
+ __ Eor(x11, x0, 0x18001);
+
+ // Ops using the stack pointer.
+ __ Add(csp, csp, 0x1f7f0);
+ __ Mov(x12, csp);
+ __ Mov(csp, 0x1000);
+
+ __ Adds(x13, csp, 0x1f7f0);
+
+ __ Orr(csp, x0, 0x1f7f0);
+ __ Mov(x14, csp);
+
+ // Restore csp.
+ __ Mov(csp, x29);
+ END();
+
+ RUN();
+
+ CHECK_EQUAL_64(0x1000, x0);
+ CHECK_EQUAL_64(0x207de, x1);
+ CHECK_EQUAL_64(0x10000ff1, x2);
+ CHECK_EQUAL_64(0x19001, x3);
+ CHECK_EQUAL_64(0x10000ff1, x4);
+ CHECK_EQUAL_64(0xfffffffffffe1822, x5);
+ CHECK_EQUAL_64(0xf000100f, x6);
+ CHECK_EQUAL_64(0xfffffffffffe8fff, x7);
+ CHECK_EQUAL_64(0xf000100f, x8);
+ CHECK_EQUAL_64(0x1000, x9);
+ CHECK_EQUAL_64(0xffffff1, x10);
+ CHECK_EQUAL_64(0x207f0, x12);
+ CHECK_EQUAL_64(0x207f0, x13);
+ CHECK_EQUAL_64(0x1f7f0, x14);
+
+ TEARDOWN();
+}
TEST(claim_drop_zero) {
INIT_V8();
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | test/mjsunit/regress/regress-725858.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698