OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 __ Bic(x7, x0, Operand(x1, ASR, 20)); | 839 __ Bic(x7, x0, Operand(x1, ASR, 20)); |
840 __ Bic(w8, w0, Operand(w1, ROR, 28)); | 840 __ Bic(w8, w0, Operand(w1, ROR, 28)); |
841 __ Bic(x9, x0, Operand(x1, ROR, 24)); | 841 __ Bic(x9, x0, Operand(x1, ROR, 24)); |
842 __ Bic(x10, x0, Operand(0x1f)); | 842 __ Bic(x10, x0, Operand(0x1f)); |
843 __ Bic(x11, x0, Operand(0x100)); | 843 __ Bic(x11, x0, Operand(0x100)); |
844 | 844 |
845 // Test bic into csp when the constant cannot be encoded in the immediate | 845 // Test bic into csp when the constant cannot be encoded in the immediate |
846 // field. | 846 // field. |
847 // Use x20 to preserve csp. We check for the result via x21 because the | 847 // Use x20 to preserve csp. We check for the result via x21 because the |
848 // test infrastructure requires that csp be restored to its original value. | 848 // test infrastructure requires that csp be restored to its original value. |
| 849 __ SetStackPointer(jssp); // Change stack pointer to avoid consistency check. |
849 __ Mov(x20, csp); | 850 __ Mov(x20, csp); |
850 __ Mov(x0, 0xffffff); | 851 __ Mov(x0, 0xffffff); |
851 __ Bic(csp, x0, Operand(0xabcdef)); | 852 __ Bic(csp, x0, Operand(0xabcdef)); |
852 __ Mov(x21, csp); | 853 __ Mov(x21, csp); |
853 __ Mov(csp, x20); | 854 __ Mov(csp, x20); |
| 855 __ SetStackPointer(csp); // Restore stack pointer. |
854 END(); | 856 END(); |
855 | 857 |
856 RUN(); | 858 RUN(); |
857 | 859 |
858 CHECK_EQUAL_64(0x0000ff00, x2); | 860 CHECK_EQUAL_64(0x0000ff00, x2); |
859 CHECK_EQUAL_64(0x0000f000, x3); | 861 CHECK_EQUAL_64(0x0000f000, x3); |
860 CHECK_EQUAL_64(0x0000f000, x4); | 862 CHECK_EQUAL_64(0x0000f000, x4); |
861 CHECK_EQUAL_64(0x0000ff80, x5); | 863 CHECK_EQUAL_64(0x0000ff80, x5); |
862 CHECK_EQUAL_64(0x000000f0, x6); | 864 CHECK_EQUAL_64(0x000000f0, x6); |
863 CHECK_EQUAL_64(0x0000f0f0, x7); | 865 CHECK_EQUAL_64(0x0000f0f0, x7); |
(...skipping 6282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7146 | 7148 |
7147 RUN(); | 7149 RUN(); |
7148 | 7150 |
7149 CHECK_EQUAL_64(0, x0); | 7151 CHECK_EQUAL_64(0, x0); |
7150 CHECK_EQUAL_64(0, x1); | 7152 CHECK_EQUAL_64(0, x1); |
7151 CHECK_EQUAL_64(0, x2); | 7153 CHECK_EQUAL_64(0, x2); |
7152 | 7154 |
7153 TEARDOWN(); | 7155 TEARDOWN(); |
7154 } | 7156 } |
7155 | 7157 |
| 7158 TEST(preshift_immediates) { |
| 7159 INIT_V8(); |
| 7160 SETUP(); |
| 7161 |
| 7162 START(); |
| 7163 // Test operations involving immediates that could be generated using a |
| 7164 // pre-shifted encodable immediate followed by a post-shift applied to |
| 7165 // the arithmetic or logical operation. |
| 7166 |
| 7167 // Save csp and change stack pointer to avoid consistency check. |
| 7168 __ SetStackPointer(jssp); |
| 7169 __ Mov(x29, csp); |
| 7170 |
| 7171 // Set the registers to known values. |
| 7172 __ Mov(x0, 0x1000); |
| 7173 __ Mov(csp, 0x1000); |
| 7174 |
| 7175 // Arithmetic ops. |
| 7176 __ Add(x1, x0, 0x1f7de); |
| 7177 __ Add(w2, w0, 0xffffff1); |
| 7178 __ Adds(x3, x0, 0x18001); |
| 7179 __ Adds(w4, w0, 0xffffff1); |
| 7180 __ Add(x5, x0, 0x10100); |
| 7181 __ Sub(w6, w0, 0xffffff1); |
| 7182 __ Subs(x7, x0, 0x18001); |
| 7183 __ Subs(w8, w0, 0xffffff1); |
| 7184 |
| 7185 // Logical ops. |
| 7186 __ And(x9, x0, 0x1f7de); |
| 7187 __ Orr(w10, w0, 0xffffff1); |
| 7188 __ Eor(x11, x0, 0x18001); |
| 7189 |
| 7190 // Ops using the stack pointer. |
| 7191 __ Add(csp, csp, 0x1f7f0); |
| 7192 __ Mov(x12, csp); |
| 7193 __ Mov(csp, 0x1000); |
| 7194 |
| 7195 __ Adds(x13, csp, 0x1f7f0); |
| 7196 |
| 7197 __ Orr(csp, x0, 0x1f7f0); |
| 7198 __ Mov(x14, csp); |
| 7199 __ Mov(csp, 0x1000); |
| 7200 |
| 7201 __ Add(csp, csp, 0x10100); |
| 7202 __ Mov(x15, csp); |
| 7203 |
| 7204 // Restore csp. |
| 7205 __ Mov(csp, x29); |
| 7206 __ SetStackPointer(csp); |
| 7207 END(); |
| 7208 |
| 7209 RUN(); |
| 7210 |
| 7211 CHECK_EQUAL_64(0x1000, x0); |
| 7212 CHECK_EQUAL_64(0x207de, x1); |
| 7213 CHECK_EQUAL_64(0x10000ff1, x2); |
| 7214 CHECK_EQUAL_64(0x19001, x3); |
| 7215 CHECK_EQUAL_64(0x10000ff1, x4); |
| 7216 CHECK_EQUAL_64(0x11100, x5); |
| 7217 CHECK_EQUAL_64(0xf000100f, x6); |
| 7218 CHECK_EQUAL_64(0xfffffffffffe8fff, x7); |
| 7219 CHECK_EQUAL_64(0xf000100f, x8); |
| 7220 CHECK_EQUAL_64(0x1000, x9); |
| 7221 CHECK_EQUAL_64(0xffffff1, x10); |
| 7222 CHECK_EQUAL_64(0x207f0, x12); |
| 7223 CHECK_EQUAL_64(0x207f0, x13); |
| 7224 CHECK_EQUAL_64(0x1f7f0, x14); |
| 7225 CHECK_EQUAL_64(0x11100, x15); |
| 7226 |
| 7227 TEARDOWN(); |
| 7228 } |
7156 | 7229 |
7157 TEST(claim_drop_zero) { | 7230 TEST(claim_drop_zero) { |
7158 INIT_V8(); | 7231 INIT_V8(); |
7159 SETUP(); | 7232 SETUP(); |
7160 | 7233 |
7161 START(); | 7234 START(); |
7162 | 7235 |
7163 Label start; | 7236 Label start; |
7164 __ Bind(&start); | 7237 __ Bind(&start); |
7165 __ Claim(0); | 7238 __ Claim(0); |
(...skipping 8270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15436 __ Mov(x0, 1); | 15509 __ Mov(x0, 1); |
15437 | 15510 |
15438 END(); | 15511 END(); |
15439 | 15512 |
15440 RUN(); | 15513 RUN(); |
15441 | 15514 |
15442 CHECK_EQUAL_64(0x1, x0); | 15515 CHECK_EQUAL_64(0x1, x0); |
15443 | 15516 |
15444 TEARDOWN(); | 15517 TEARDOWN(); |
15445 } | 15518 } |
OLD | NEW |