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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 #define INIT_V8() \ | 114 #define INIT_V8() \ |
115 CcTest::InitializeVM(); \ | 115 CcTest::InitializeVM(); \ |
116 | 116 |
117 #ifdef USE_SIMULATOR | 117 #ifdef USE_SIMULATOR |
118 | 118 |
119 // Run tests with the simulator. | 119 // Run tests with the simulator. |
120 #define SETUP_SIZE(buf_size) \ | 120 #define SETUP_SIZE(buf_size) \ |
121 Isolate* isolate = CcTest::i_isolate(); \ | 121 Isolate* isolate = CcTest::i_isolate(); \ |
122 HandleScope scope(isolate); \ | 122 HandleScope scope(isolate); \ |
123 DCHECK(isolate != NULL); \ | 123 CHECK(isolate != NULL); \ |
124 byte* buf = new byte[buf_size]; \ | 124 byte* buf = new byte[buf_size]; \ |
125 MacroAssembler masm(isolate, buf, buf_size, \ | 125 MacroAssembler masm(isolate, buf, buf_size, \ |
126 v8::internal::CodeObjectRequired::kYes); \ | 126 v8::internal::CodeObjectRequired::kYes); \ |
127 Decoder<DispatchingDecoderVisitor>* decoder = \ | 127 Decoder<DispatchingDecoderVisitor>* decoder = \ |
128 new Decoder<DispatchingDecoderVisitor>(); \ | 128 new Decoder<DispatchingDecoderVisitor>(); \ |
129 Simulator simulator(decoder); \ | 129 Simulator simulator(decoder); \ |
130 PrintDisassembler* pdis = NULL; \ | 130 PrintDisassembler* pdis = NULL; \ |
131 RegisterDump core; | 131 RegisterDump core; |
132 | 132 |
133 /* if (Cctest::trace_sim()) { \ | 133 /* if (Cctest::trace_sim()) { \ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 #define TEARDOWN() \ | 169 #define TEARDOWN() \ |
170 delete pdis; \ | 170 delete pdis; \ |
171 delete[] buf; | 171 delete[] buf; |
172 | 172 |
173 #else // ifdef USE_SIMULATOR. | 173 #else // ifdef USE_SIMULATOR. |
174 // Run the test on real hardware or models. | 174 // Run the test on real hardware or models. |
175 #define SETUP_SIZE(buf_size) \ | 175 #define SETUP_SIZE(buf_size) \ |
176 Isolate* isolate = CcTest::i_isolate(); \ | 176 Isolate* isolate = CcTest::i_isolate(); \ |
177 HandleScope scope(isolate); \ | 177 HandleScope scope(isolate); \ |
178 DCHECK(isolate != NULL); \ | 178 CHECK(isolate != NULL); \ |
179 byte* buf = new byte[buf_size]; \ | 179 byte* buf = new byte[buf_size]; \ |
180 MacroAssembler masm(isolate, buf, buf_size, \ | 180 MacroAssembler masm(isolate, buf, buf_size, \ |
181 v8::internal::CodeObjectRequired::kYes); \ | 181 v8::internal::CodeObjectRequired::kYes); \ |
182 RegisterDump core; | 182 RegisterDump core; |
183 | 183 |
184 #define RESET() \ | 184 #define RESET() \ |
185 __ Reset(); \ | 185 __ Reset(); \ |
186 /* Reset the machine state (like simulator.ResetState()). */ \ | 186 /* Reset the machine state (like simulator.ResetState()). */ \ |
187 __ Msr(NZCV, xzr); \ | 187 __ Msr(NZCV, xzr); \ |
188 __ Msr(FPCR, xzr); | 188 __ Msr(FPCR, xzr); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 #define CHECK_EQUAL_FP32(expected, result) \ | 227 #define CHECK_EQUAL_FP32(expected, result) \ |
228 CHECK(EqualFP32(expected, &core, result)) | 228 CHECK(EqualFP32(expected, &core, result)) |
229 | 229 |
230 #define CHECK_EQUAL_64(expected, result) \ | 230 #define CHECK_EQUAL_64(expected, result) \ |
231 CHECK(Equal64(expected, &core, result)) | 231 CHECK(Equal64(expected, &core, result)) |
232 | 232 |
233 #define CHECK_EQUAL_FP64(expected, result) \ | 233 #define CHECK_EQUAL_FP64(expected, result) \ |
234 CHECK(EqualFP64(expected, &core, result)) | 234 CHECK(EqualFP64(expected, &core, result)) |
235 | 235 |
236 #ifdef DEBUG | 236 #ifdef DEBUG |
237 #define DCHECK_LITERAL_POOL_SIZE(expected) \ | 237 #define CHECK_LITERAL_POOL_SIZE(expected) \ |
238 CHECK((expected) == (__ LiteralPoolSize())) | 238 CHECK((expected) == (__ LiteralPoolSize())) |
239 #else | 239 #else |
240 #define DCHECK_LITERAL_POOL_SIZE(expected) \ | 240 #define CHECK_LITERAL_POOL_SIZE(expected) ((void)0) |
241 ((void) 0) | |
242 #endif | 241 #endif |
243 | 242 |
244 | 243 |
245 TEST(stack_ops) { | 244 TEST(stack_ops) { |
246 INIT_V8(); | 245 INIT_V8(); |
247 SETUP(); | 246 SETUP(); |
248 | 247 |
249 START(); | 248 START(); |
250 // save csp. | 249 // save csp. |
251 __ Mov(x29, csp); | 250 __ Mov(x29, csp); |
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3297 CHECK_EQUAL_FP64(1.234, d13); | 3296 CHECK_EQUAL_FP64(1.234, d13); |
3298 CHECK_EQUAL_FP32(2.5, s25); | 3297 CHECK_EQUAL_FP32(2.5, s25); |
3299 | 3298 |
3300 TEARDOWN(); | 3299 TEARDOWN(); |
3301 } | 3300 } |
3302 | 3301 |
3303 | 3302 |
3304 static void LdrLiteralRangeHelper(ptrdiff_t range_, | 3303 static void LdrLiteralRangeHelper(ptrdiff_t range_, |
3305 LiteralPoolEmitOption option, | 3304 LiteralPoolEmitOption option, |
3306 bool expect_dump) { | 3305 bool expect_dump) { |
3307 DCHECK(range_ > 0); | 3306 CHECK(range_ > 0); |
3308 SETUP_SIZE(range_ + 1024); | 3307 SETUP_SIZE(range_ + 1024); |
3309 | 3308 |
3310 Label label_1, label_2; | 3309 Label label_1, label_2; |
3311 | 3310 |
3312 size_t range = static_cast<size_t>(range_); | 3311 size_t range = static_cast<size_t>(range_); |
3313 size_t code_size = 0; | 3312 size_t code_size = 0; |
3314 size_t pool_guard_size; | 3313 size_t pool_guard_size; |
3315 | 3314 |
3316 if (option == NoJumpRequired) { | 3315 if (option == NoJumpRequired) { |
3317 // Space for an explicit branch. | 3316 // Space for an explicit branch. |
3318 pool_guard_size = sizeof(Instr); | 3317 pool_guard_size = sizeof(Instr); |
3319 } else { | 3318 } else { |
3320 pool_guard_size = 0; | 3319 pool_guard_size = 0; |
3321 } | 3320 } |
3322 | 3321 |
3323 START(); | 3322 START(); |
3324 // Force a pool dump so the pool starts off empty. | 3323 // Force a pool dump so the pool starts off empty. |
3325 __ EmitLiteralPool(JumpRequired); | 3324 __ EmitLiteralPool(JumpRequired); |
3326 DCHECK_LITERAL_POOL_SIZE(0); | 3325 CHECK_LITERAL_POOL_SIZE(0); |
3327 | 3326 |
3328 __ Ldr(x0, 0x1234567890abcdefUL); | 3327 __ Ldr(x0, 0x1234567890abcdefUL); |
3329 __ Ldr(w1, 0xfedcba09); | 3328 __ Ldr(w1, 0xfedcba09); |
3330 __ Ldr(d0, 1.234); | 3329 __ Ldr(d0, 1.234); |
3331 __ Ldr(s1, 2.5); | 3330 __ Ldr(s1, 2.5); |
3332 DCHECK_LITERAL_POOL_SIZE(4); | 3331 CHECK_LITERAL_POOL_SIZE(4); |
3333 | 3332 |
3334 code_size += 4 * sizeof(Instr); | 3333 code_size += 4 * sizeof(Instr); |
3335 | 3334 |
3336 // Check that the requested range (allowing space for a branch over the pool) | 3335 // Check that the requested range (allowing space for a branch over the pool) |
3337 // can be handled by this test. | 3336 // can be handled by this test. |
3338 DCHECK((code_size + pool_guard_size) <= range); | 3337 CHECK((code_size + pool_guard_size) <= range); |
3339 | 3338 |
3340 // Emit NOPs up to 'range', leaving space for the pool guard. | 3339 // Emit NOPs up to 'range', leaving space for the pool guard. |
3341 while ((code_size + pool_guard_size) < range) { | 3340 while ((code_size + pool_guard_size) < range) { |
3342 __ Nop(); | 3341 __ Nop(); |
3343 code_size += sizeof(Instr); | 3342 code_size += sizeof(Instr); |
3344 } | 3343 } |
3345 | 3344 |
3346 // Emit the guard sequence before the literal pool. | 3345 // Emit the guard sequence before the literal pool. |
3347 if (option == NoJumpRequired) { | 3346 if (option == NoJumpRequired) { |
3348 __ B(&label_1); | 3347 __ B(&label_1); |
3349 code_size += sizeof(Instr); | 3348 code_size += sizeof(Instr); |
3350 } | 3349 } |
3351 | 3350 |
3352 DCHECK(code_size == range); | 3351 CHECK(code_size == range); |
3353 DCHECK_LITERAL_POOL_SIZE(4); | 3352 CHECK_LITERAL_POOL_SIZE(4); |
3354 | 3353 |
3355 // Possibly generate a literal pool. | 3354 // Possibly generate a literal pool. |
3356 __ CheckLiteralPool(option); | 3355 __ CheckLiteralPool(option); |
3357 __ Bind(&label_1); | 3356 __ Bind(&label_1); |
3358 if (expect_dump) { | 3357 if (expect_dump) { |
3359 DCHECK_LITERAL_POOL_SIZE(0); | 3358 CHECK_LITERAL_POOL_SIZE(0); |
3360 } else { | 3359 } else { |
3361 DCHECK_LITERAL_POOL_SIZE(4); | 3360 CHECK_LITERAL_POOL_SIZE(4); |
3362 } | 3361 } |
3363 | 3362 |
3364 // Force a pool flush to check that a second pool functions correctly. | 3363 // Force a pool flush to check that a second pool functions correctly. |
3365 __ EmitLiteralPool(JumpRequired); | 3364 __ EmitLiteralPool(JumpRequired); |
3366 DCHECK_LITERAL_POOL_SIZE(0); | 3365 CHECK_LITERAL_POOL_SIZE(0); |
3367 | 3366 |
3368 // These loads should be after the pool (and will require a new one). | 3367 // These loads should be after the pool (and will require a new one). |
3369 __ Ldr(x4, 0x34567890abcdef12UL); | 3368 __ Ldr(x4, 0x34567890abcdef12UL); |
3370 __ Ldr(w5, 0xdcba09fe); | 3369 __ Ldr(w5, 0xdcba09fe); |
3371 __ Ldr(d4, 123.4); | 3370 __ Ldr(d4, 123.4); |
3372 __ Ldr(s5, 250.0); | 3371 __ Ldr(s5, 250.0); |
3373 DCHECK_LITERAL_POOL_SIZE(4); | 3372 CHECK_LITERAL_POOL_SIZE(4); |
3374 END(); | 3373 END(); |
3375 | 3374 |
3376 RUN(); | 3375 RUN(); |
3377 | 3376 |
3378 // Check that the literals loaded correctly. | 3377 // Check that the literals loaded correctly. |
3379 CHECK_EQUAL_64(0x1234567890abcdefUL, x0); | 3378 CHECK_EQUAL_64(0x1234567890abcdefUL, x0); |
3380 CHECK_EQUAL_64(0xfedcba09, x1); | 3379 CHECK_EQUAL_64(0xfedcba09, x1); |
3381 CHECK_EQUAL_FP64(1.234, d0); | 3380 CHECK_EQUAL_FP64(1.234, d0); |
3382 CHECK_EQUAL_FP32(2.5, s1); | 3381 CHECK_EQUAL_FP32(2.5, s1); |
3383 CHECK_EQUAL_64(0x34567890abcdef12UL, x4); | 3382 CHECK_EQUAL_64(0x34567890abcdef12UL, x4); |
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5441 | 5440 |
5442 TEST(fmadd_fmsub_double_nans) { | 5441 TEST(fmadd_fmsub_double_nans) { |
5443 INIT_V8(); | 5442 INIT_V8(); |
5444 // Make sure that NaN propagation works correctly. | 5443 // Make sure that NaN propagation works correctly. |
5445 double s1 = rawbits_to_double(0x7ff5555511111111); | 5444 double s1 = rawbits_to_double(0x7ff5555511111111); |
5446 double s2 = rawbits_to_double(0x7ff5555522222222); | 5445 double s2 = rawbits_to_double(0x7ff5555522222222); |
5447 double sa = rawbits_to_double(0x7ff55555aaaaaaaa); | 5446 double sa = rawbits_to_double(0x7ff55555aaaaaaaa); |
5448 double q1 = rawbits_to_double(0x7ffaaaaa11111111); | 5447 double q1 = rawbits_to_double(0x7ffaaaaa11111111); |
5449 double q2 = rawbits_to_double(0x7ffaaaaa22222222); | 5448 double q2 = rawbits_to_double(0x7ffaaaaa22222222); |
5450 double qa = rawbits_to_double(0x7ffaaaaaaaaaaaaa); | 5449 double qa = rawbits_to_double(0x7ffaaaaaaaaaaaaa); |
5451 DCHECK(IsSignallingNaN(s1)); | 5450 CHECK(IsSignallingNaN(s1)); |
5452 DCHECK(IsSignallingNaN(s2)); | 5451 CHECK(IsSignallingNaN(s2)); |
5453 DCHECK(IsSignallingNaN(sa)); | 5452 CHECK(IsSignallingNaN(sa)); |
5454 DCHECK(IsQuietNaN(q1)); | 5453 CHECK(IsQuietNaN(q1)); |
5455 DCHECK(IsQuietNaN(q2)); | 5454 CHECK(IsQuietNaN(q2)); |
5456 DCHECK(IsQuietNaN(qa)); | 5455 CHECK(IsQuietNaN(qa)); |
5457 | 5456 |
5458 // The input NaNs after passing through ProcessNaN. | 5457 // The input NaNs after passing through ProcessNaN. |
5459 double s1_proc = rawbits_to_double(0x7ffd555511111111); | 5458 double s1_proc = rawbits_to_double(0x7ffd555511111111); |
5460 double s2_proc = rawbits_to_double(0x7ffd555522222222); | 5459 double s2_proc = rawbits_to_double(0x7ffd555522222222); |
5461 double sa_proc = rawbits_to_double(0x7ffd5555aaaaaaaa); | 5460 double sa_proc = rawbits_to_double(0x7ffd5555aaaaaaaa); |
5462 double q1_proc = q1; | 5461 double q1_proc = q1; |
5463 double q2_proc = q2; | 5462 double q2_proc = q2; |
5464 double qa_proc = qa; | 5463 double qa_proc = qa; |
5465 DCHECK(IsQuietNaN(s1_proc)); | 5464 CHECK(IsQuietNaN(s1_proc)); |
5466 DCHECK(IsQuietNaN(s2_proc)); | 5465 CHECK(IsQuietNaN(s2_proc)); |
5467 DCHECK(IsQuietNaN(sa_proc)); | 5466 CHECK(IsQuietNaN(sa_proc)); |
5468 DCHECK(IsQuietNaN(q1_proc)); | 5467 CHECK(IsQuietNaN(q1_proc)); |
5469 DCHECK(IsQuietNaN(q2_proc)); | 5468 CHECK(IsQuietNaN(q2_proc)); |
5470 DCHECK(IsQuietNaN(qa_proc)); | 5469 CHECK(IsQuietNaN(qa_proc)); |
5471 | 5470 |
5472 // Negated NaNs as it would be done on ARMv8 hardware. | 5471 // Negated NaNs as it would be done on ARMv8 hardware. |
5473 double s1_proc_neg = rawbits_to_double(0xfffd555511111111); | 5472 double s1_proc_neg = rawbits_to_double(0xfffd555511111111); |
5474 double sa_proc_neg = rawbits_to_double(0xfffd5555aaaaaaaa); | 5473 double sa_proc_neg = rawbits_to_double(0xfffd5555aaaaaaaa); |
5475 double q1_proc_neg = rawbits_to_double(0xfffaaaaa11111111); | 5474 double q1_proc_neg = rawbits_to_double(0xfffaaaaa11111111); |
5476 double qa_proc_neg = rawbits_to_double(0xfffaaaaaaaaaaaaa); | 5475 double qa_proc_neg = rawbits_to_double(0xfffaaaaaaaaaaaaa); |
5477 DCHECK(IsQuietNaN(s1_proc_neg)); | 5476 CHECK(IsQuietNaN(s1_proc_neg)); |
5478 DCHECK(IsQuietNaN(sa_proc_neg)); | 5477 CHECK(IsQuietNaN(sa_proc_neg)); |
5479 DCHECK(IsQuietNaN(q1_proc_neg)); | 5478 CHECK(IsQuietNaN(q1_proc_neg)); |
5480 DCHECK(IsQuietNaN(qa_proc_neg)); | 5479 CHECK(IsQuietNaN(qa_proc_neg)); |
5481 | 5480 |
5482 // Quiet NaNs are propagated. | 5481 // Quiet NaNs are propagated. |
5483 FmaddFmsubHelper(q1, 0, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); | 5482 FmaddFmsubHelper(q1, 0, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); |
5484 FmaddFmsubHelper(0, q2, 0, q2_proc, q2_proc, q2_proc, q2_proc); | 5483 FmaddFmsubHelper(0, q2, 0, q2_proc, q2_proc, q2_proc, q2_proc); |
5485 FmaddFmsubHelper(0, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5484 FmaddFmsubHelper(0, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5486 FmaddFmsubHelper(q1, q2, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); | 5485 FmaddFmsubHelper(q1, q2, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); |
5487 FmaddFmsubHelper(0, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5486 FmaddFmsubHelper(0, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5488 FmaddFmsubHelper(q1, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5487 FmaddFmsubHelper(q1, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5489 FmaddFmsubHelper(q1, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5488 FmaddFmsubHelper(q1, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5490 | 5489 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5524 | 5523 |
5525 TEST(fmadd_fmsub_float_nans) { | 5524 TEST(fmadd_fmsub_float_nans) { |
5526 INIT_V8(); | 5525 INIT_V8(); |
5527 // Make sure that NaN propagation works correctly. | 5526 // Make sure that NaN propagation works correctly. |
5528 float s1 = rawbits_to_float(0x7f951111); | 5527 float s1 = rawbits_to_float(0x7f951111); |
5529 float s2 = rawbits_to_float(0x7f952222); | 5528 float s2 = rawbits_to_float(0x7f952222); |
5530 float sa = rawbits_to_float(0x7f95aaaa); | 5529 float sa = rawbits_to_float(0x7f95aaaa); |
5531 float q1 = rawbits_to_float(0x7fea1111); | 5530 float q1 = rawbits_to_float(0x7fea1111); |
5532 float q2 = rawbits_to_float(0x7fea2222); | 5531 float q2 = rawbits_to_float(0x7fea2222); |
5533 float qa = rawbits_to_float(0x7feaaaaa); | 5532 float qa = rawbits_to_float(0x7feaaaaa); |
5534 DCHECK(IsSignallingNaN(s1)); | 5533 CHECK(IsSignallingNaN(s1)); |
5535 DCHECK(IsSignallingNaN(s2)); | 5534 CHECK(IsSignallingNaN(s2)); |
5536 DCHECK(IsSignallingNaN(sa)); | 5535 CHECK(IsSignallingNaN(sa)); |
5537 DCHECK(IsQuietNaN(q1)); | 5536 CHECK(IsQuietNaN(q1)); |
5538 DCHECK(IsQuietNaN(q2)); | 5537 CHECK(IsQuietNaN(q2)); |
5539 DCHECK(IsQuietNaN(qa)); | 5538 CHECK(IsQuietNaN(qa)); |
5540 | 5539 |
5541 // The input NaNs after passing through ProcessNaN. | 5540 // The input NaNs after passing through ProcessNaN. |
5542 float s1_proc = rawbits_to_float(0x7fd51111); | 5541 float s1_proc = rawbits_to_float(0x7fd51111); |
5543 float s2_proc = rawbits_to_float(0x7fd52222); | 5542 float s2_proc = rawbits_to_float(0x7fd52222); |
5544 float sa_proc = rawbits_to_float(0x7fd5aaaa); | 5543 float sa_proc = rawbits_to_float(0x7fd5aaaa); |
5545 float q1_proc = q1; | 5544 float q1_proc = q1; |
5546 float q2_proc = q2; | 5545 float q2_proc = q2; |
5547 float qa_proc = qa; | 5546 float qa_proc = qa; |
5548 DCHECK(IsQuietNaN(s1_proc)); | 5547 CHECK(IsQuietNaN(s1_proc)); |
5549 DCHECK(IsQuietNaN(s2_proc)); | 5548 CHECK(IsQuietNaN(s2_proc)); |
5550 DCHECK(IsQuietNaN(sa_proc)); | 5549 CHECK(IsQuietNaN(sa_proc)); |
5551 DCHECK(IsQuietNaN(q1_proc)); | 5550 CHECK(IsQuietNaN(q1_proc)); |
5552 DCHECK(IsQuietNaN(q2_proc)); | 5551 CHECK(IsQuietNaN(q2_proc)); |
5553 DCHECK(IsQuietNaN(qa_proc)); | 5552 CHECK(IsQuietNaN(qa_proc)); |
5554 | 5553 |
5555 // Negated NaNs as it would be done on ARMv8 hardware. | 5554 // Negated NaNs as it would be done on ARMv8 hardware. |
5556 float s1_proc_neg = rawbits_to_float(0xffd51111); | 5555 float s1_proc_neg = rawbits_to_float(0xffd51111); |
5557 float sa_proc_neg = rawbits_to_float(0xffd5aaaa); | 5556 float sa_proc_neg = rawbits_to_float(0xffd5aaaa); |
5558 float q1_proc_neg = rawbits_to_float(0xffea1111); | 5557 float q1_proc_neg = rawbits_to_float(0xffea1111); |
5559 float qa_proc_neg = rawbits_to_float(0xffeaaaaa); | 5558 float qa_proc_neg = rawbits_to_float(0xffeaaaaa); |
5560 DCHECK(IsQuietNaN(s1_proc_neg)); | 5559 CHECK(IsQuietNaN(s1_proc_neg)); |
5561 DCHECK(IsQuietNaN(sa_proc_neg)); | 5560 CHECK(IsQuietNaN(sa_proc_neg)); |
5562 DCHECK(IsQuietNaN(q1_proc_neg)); | 5561 CHECK(IsQuietNaN(q1_proc_neg)); |
5563 DCHECK(IsQuietNaN(qa_proc_neg)); | 5562 CHECK(IsQuietNaN(qa_proc_neg)); |
5564 | 5563 |
5565 // Quiet NaNs are propagated. | 5564 // Quiet NaNs are propagated. |
5566 FmaddFmsubHelper(q1, 0, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); | 5565 FmaddFmsubHelper(q1, 0, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); |
5567 FmaddFmsubHelper(0, q2, 0, q2_proc, q2_proc, q2_proc, q2_proc); | 5566 FmaddFmsubHelper(0, q2, 0, q2_proc, q2_proc, q2_proc, q2_proc); |
5568 FmaddFmsubHelper(0, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5567 FmaddFmsubHelper(0, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5569 FmaddFmsubHelper(q1, q2, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); | 5568 FmaddFmsubHelper(q1, q2, 0, q1_proc, q1_proc_neg, q1_proc_neg, q1_proc); |
5570 FmaddFmsubHelper(0, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5569 FmaddFmsubHelper(0, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5571 FmaddFmsubHelper(q1, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5570 FmaddFmsubHelper(q1, 0, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5572 FmaddFmsubHelper(q1, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); | 5571 FmaddFmsubHelper(q1, q2, qa, qa_proc, qa_proc, qa_proc_neg, qa_proc_neg); |
5573 | 5572 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5771 | 5770 |
5772 TEST(fmax_fmin_d) { | 5771 TEST(fmax_fmin_d) { |
5773 INIT_V8(); | 5772 INIT_V8(); |
5774 // Use non-standard NaNs to check that the payload bits are preserved. | 5773 // Use non-standard NaNs to check that the payload bits are preserved. |
5775 double snan = rawbits_to_double(0x7ff5555512345678); | 5774 double snan = rawbits_to_double(0x7ff5555512345678); |
5776 double qnan = rawbits_to_double(0x7ffaaaaa87654321); | 5775 double qnan = rawbits_to_double(0x7ffaaaaa87654321); |
5777 | 5776 |
5778 double snan_processed = rawbits_to_double(0x7ffd555512345678); | 5777 double snan_processed = rawbits_to_double(0x7ffd555512345678); |
5779 double qnan_processed = qnan; | 5778 double qnan_processed = qnan; |
5780 | 5779 |
5781 DCHECK(IsSignallingNaN(snan)); | 5780 CHECK(IsSignallingNaN(snan)); |
5782 DCHECK(IsQuietNaN(qnan)); | 5781 CHECK(IsQuietNaN(qnan)); |
5783 DCHECK(IsQuietNaN(snan_processed)); | 5782 CHECK(IsQuietNaN(snan_processed)); |
5784 DCHECK(IsQuietNaN(qnan_processed)); | 5783 CHECK(IsQuietNaN(qnan_processed)); |
5785 | 5784 |
5786 // Bootstrap tests. | 5785 // Bootstrap tests. |
5787 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0); | 5786 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0); |
5788 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1); | 5787 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1); |
5789 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity, | 5788 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity, |
5790 kFP64NegativeInfinity, kFP64PositiveInfinity, | 5789 kFP64NegativeInfinity, kFP64PositiveInfinity, |
5791 kFP64NegativeInfinity, kFP64PositiveInfinity); | 5790 kFP64NegativeInfinity, kFP64PositiveInfinity); |
5792 FminFmaxDoubleHelper(snan, 0, | 5791 FminFmaxDoubleHelper(snan, 0, |
5793 snan_processed, snan_processed, | 5792 snan_processed, snan_processed, |
5794 snan_processed, snan_processed); | 5793 snan_processed, snan_processed); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5856 | 5855 |
5857 TEST(fmax_fmin_s) { | 5856 TEST(fmax_fmin_s) { |
5858 INIT_V8(); | 5857 INIT_V8(); |
5859 // Use non-standard NaNs to check that the payload bits are preserved. | 5858 // Use non-standard NaNs to check that the payload bits are preserved. |
5860 float snan = rawbits_to_float(0x7f951234); | 5859 float snan = rawbits_to_float(0x7f951234); |
5861 float qnan = rawbits_to_float(0x7fea8765); | 5860 float qnan = rawbits_to_float(0x7fea8765); |
5862 | 5861 |
5863 float snan_processed = rawbits_to_float(0x7fd51234); | 5862 float snan_processed = rawbits_to_float(0x7fd51234); |
5864 float qnan_processed = qnan; | 5863 float qnan_processed = qnan; |
5865 | 5864 |
5866 DCHECK(IsSignallingNaN(snan)); | 5865 CHECK(IsSignallingNaN(snan)); |
5867 DCHECK(IsQuietNaN(qnan)); | 5866 CHECK(IsQuietNaN(qnan)); |
5868 DCHECK(IsQuietNaN(snan_processed)); | 5867 CHECK(IsQuietNaN(snan_processed)); |
5869 DCHECK(IsQuietNaN(qnan_processed)); | 5868 CHECK(IsQuietNaN(qnan_processed)); |
5870 | 5869 |
5871 // Bootstrap tests. | 5870 // Bootstrap tests. |
5872 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0); | 5871 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0); |
5873 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1); | 5872 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1); |
5874 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity, | 5873 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity, |
5875 kFP32NegativeInfinity, kFP32PositiveInfinity, | 5874 kFP32NegativeInfinity, kFP32PositiveInfinity, |
5876 kFP32NegativeInfinity, kFP32PositiveInfinity); | 5875 kFP32NegativeInfinity, kFP32PositiveInfinity); |
5877 FminFmaxFloatHelper(snan, 0, | 5876 FminFmaxFloatHelper(snan, 0, |
5878 snan_processed, snan_processed, | 5877 snan_processed, snan_processed, |
5879 snan_processed, snan_processed); | 5878 snan_processed, snan_processed); |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6831 {rawbits_to_double(0x7ff02468bfffffff), rawbits_to_float(0x7fc12345)}, | 6830 {rawbits_to_double(0x7ff02468bfffffff), rawbits_to_float(0x7fc12345)}, |
6832 {rawbits_to_double(0x7ff000001fffffff), rawbits_to_float(0x7fc00000)}, | 6831 {rawbits_to_double(0x7ff000001fffffff), rawbits_to_float(0x7fc00000)}, |
6833 }; | 6832 }; |
6834 int count = sizeof(test) / sizeof(test[0]); | 6833 int count = sizeof(test) / sizeof(test[0]); |
6835 | 6834 |
6836 for (int i = 0; i < count; i++) { | 6835 for (int i = 0; i < count; i++) { |
6837 double in = test[i].in; | 6836 double in = test[i].in; |
6838 float expected = test[i].expected; | 6837 float expected = test[i].expected; |
6839 | 6838 |
6840 // We only expect positive input. | 6839 // We only expect positive input. |
6841 DCHECK(std::signbit(in) == 0); | 6840 CHECK(std::signbit(in) == 0); |
6842 DCHECK(std::signbit(expected) == 0); | 6841 CHECK(std::signbit(expected) == 0); |
6843 | 6842 |
6844 SETUP(); | 6843 SETUP(); |
6845 START(); | 6844 START(); |
6846 | 6845 |
6847 __ Fmov(d10, in); | 6846 __ Fmov(d10, in); |
6848 __ Fcvt(s20, d10); | 6847 __ Fcvt(s20, d10); |
6849 | 6848 |
6850 __ Fmov(d11, -in); | 6849 __ Fmov(d11, -in); |
6851 __ Fcvt(s21, d11); | 6850 __ Fcvt(s21, d11); |
6852 | 6851 |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8543 __ Claim(4); | 8542 __ Claim(4); |
8544 | 8543 |
8545 // Mix with other stack operations. | 8544 // Mix with other stack operations. |
8546 // After this section: | 8545 // After this section: |
8547 // x0-x3 should be unchanged. | 8546 // x0-x3 should be unchanged. |
8548 // x6 should match x1[31:0]:x0[63:32] | 8547 // x6 should match x1[31:0]:x0[63:32] |
8549 // w7 should match x1[15:0]:x0[63:48] | 8548 // w7 should match x1[15:0]:x0[63:48] |
8550 __ Poke(x1, 8); | 8549 __ Poke(x1, 8); |
8551 __ Poke(x0, 0); | 8550 __ Poke(x0, 0); |
8552 { | 8551 { |
8553 DCHECK(__ StackPointer().Is(csp)); | 8552 CHECK(__ StackPointer().Is(csp)); |
8554 __ Mov(x4, __ StackPointer()); | 8553 __ Mov(x4, __ StackPointer()); |
8555 __ SetStackPointer(x4); | 8554 __ SetStackPointer(x4); |
8556 | 8555 |
8557 __ Poke(wzr, 0); // Clobber the space we're about to drop. | 8556 __ Poke(wzr, 0); // Clobber the space we're about to drop. |
8558 __ Drop(1, kWRegSize); | 8557 __ Drop(1, kWRegSize); |
8559 __ Peek(x6, 0); | 8558 __ Peek(x6, 0); |
8560 __ Claim(1); | 8559 __ Claim(1); |
8561 __ Peek(w7, 10); | 8560 __ Peek(w7, 10); |
8562 __ Poke(x3, 28); | 8561 __ Poke(x3, 28); |
8563 __ Poke(xzr, 0); // Clobber the space we're about to drop. | 8562 __ Poke(xzr, 0); // Clobber the space we're about to drop. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8640 allowed); | 8639 allowed); |
8641 | 8640 |
8642 // The literal base is chosen to have two useful properties: | 8641 // The literal base is chosen to have two useful properties: |
8643 // * When multiplied by small values (such as a register index), this value | 8642 // * When multiplied by small values (such as a register index), this value |
8644 // is clearly readable in the result. | 8643 // is clearly readable in the result. |
8645 // * The value is not formed from repeating fixed-size smaller values, so it | 8644 // * The value is not formed from repeating fixed-size smaller values, so it |
8646 // can be used to detect endianness-related errors. | 8645 // can be used to detect endianness-related errors. |
8647 uint64_t literal_base = 0x0100001000100101UL; | 8646 uint64_t literal_base = 0x0100001000100101UL; |
8648 | 8647 |
8649 { | 8648 { |
8650 DCHECK(__ StackPointer().Is(csp)); | 8649 CHECK(__ StackPointer().Is(csp)); |
8651 __ Mov(jssp, __ StackPointer()); | 8650 __ Mov(jssp, __ StackPointer()); |
8652 __ SetStackPointer(jssp); | 8651 __ SetStackPointer(jssp); |
8653 | 8652 |
8654 int i; | 8653 int i; |
8655 | 8654 |
8656 // Initialize the registers. | 8655 // Initialize the registers. |
8657 for (i = 0; i < reg_count; i++) { | 8656 for (i = 0; i < reg_count; i++) { |
8658 // Always write into the X register, to ensure that the upper word is | 8657 // Always write into the X register, to ensure that the upper word is |
8659 // properly ignored by Push when testing W registers. | 8658 // properly ignored by Push when testing W registers. |
8660 if (!x[i].IsZero()) { | 8659 if (!x[i].IsZero()) { |
8661 __ Mov(x[i], literal_base * i); | 8660 __ Mov(x[i], literal_base * i); |
8662 } | 8661 } |
8663 } | 8662 } |
8664 | 8663 |
8665 // Claim memory first, as requested. | 8664 // Claim memory first, as requested. |
8666 __ Claim(claim, kByteSizeInBytes); | 8665 __ Claim(claim, kByteSizeInBytes); |
8667 | 8666 |
8668 switch (push_method) { | 8667 switch (push_method) { |
8669 case PushPopByFour: | 8668 case PushPopByFour: |
8670 // Push high-numbered registers first (to the highest addresses). | 8669 // Push high-numbered registers first (to the highest addresses). |
8671 for (i = reg_count; i >= 4; i -= 4) { | 8670 for (i = reg_count; i >= 4; i -= 4) { |
8672 __ Push(r[i-1], r[i-2], r[i-3], r[i-4]); | 8671 __ Push(r[i-1], r[i-2], r[i-3], r[i-4]); |
8673 } | 8672 } |
8674 // Finish off the leftovers. | 8673 // Finish off the leftovers. |
8675 switch (i) { | 8674 switch (i) { |
8676 case 3: __ Push(r[2], r[1], r[0]); break; | 8675 case 3: __ Push(r[2], r[1], r[0]); break; |
8677 case 2: __ Push(r[1], r[0]); break; | 8676 case 2: __ Push(r[1], r[0]); break; |
8678 case 1: __ Push(r[0]); break; | 8677 case 1: __ Push(r[0]); break; |
8679 default: DCHECK(i == 0); break; | 8678 default: |
| 8679 CHECK(i == 0); |
| 8680 break; |
8680 } | 8681 } |
8681 break; | 8682 break; |
8682 case PushPopRegList: | 8683 case PushPopRegList: |
8683 __ PushSizeRegList(list, reg_size); | 8684 __ PushSizeRegList(list, reg_size); |
8684 break; | 8685 break; |
8685 } | 8686 } |
8686 | 8687 |
8687 // Clobber all the registers, to ensure that they get repopulated by Pop. | 8688 // Clobber all the registers, to ensure that they get repopulated by Pop. |
8688 Clobber(&masm, list); | 8689 Clobber(&masm, list); |
8689 | 8690 |
8690 switch (pop_method) { | 8691 switch (pop_method) { |
8691 case PushPopByFour: | 8692 case PushPopByFour: |
8692 // Pop low-numbered registers first (from the lowest addresses). | 8693 // Pop low-numbered registers first (from the lowest addresses). |
8693 for (i = 0; i <= (reg_count-4); i += 4) { | 8694 for (i = 0; i <= (reg_count-4); i += 4) { |
8694 __ Pop(r[i], r[i+1], r[i+2], r[i+3]); | 8695 __ Pop(r[i], r[i+1], r[i+2], r[i+3]); |
8695 } | 8696 } |
8696 // Finish off the leftovers. | 8697 // Finish off the leftovers. |
8697 switch (reg_count - i) { | 8698 switch (reg_count - i) { |
8698 case 3: __ Pop(r[i], r[i+1], r[i+2]); break; | 8699 case 3: __ Pop(r[i], r[i+1], r[i+2]); break; |
8699 case 2: __ Pop(r[i], r[i+1]); break; | 8700 case 2: __ Pop(r[i], r[i+1]); break; |
8700 case 1: __ Pop(r[i]); break; | 8701 case 1: __ Pop(r[i]); break; |
8701 default: DCHECK(i == reg_count); break; | 8702 default: |
| 8703 CHECK(i == reg_count); |
| 8704 break; |
8702 } | 8705 } |
8703 break; | 8706 break; |
8704 case PushPopRegList: | 8707 case PushPopRegList: |
8705 __ PopSizeRegList(list, reg_size); | 8708 __ PopSizeRegList(list, reg_size); |
8706 break; | 8709 break; |
8707 } | 8710 } |
8708 | 8711 |
8709 // Drop memory to restore jssp. | 8712 // Drop memory to restore jssp. |
8710 __ Drop(claim, kByteSizeInBytes); | 8713 __ Drop(claim, kByteSizeInBytes); |
8711 | 8714 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8822 // The literal base is chosen to have two useful properties: | 8825 // The literal base is chosen to have two useful properties: |
8823 // * When multiplied (using an integer) by small values (such as a register | 8826 // * When multiplied (using an integer) by small values (such as a register |
8824 // index), this value is clearly readable in the result. | 8827 // index), this value is clearly readable in the result. |
8825 // * The value is not formed from repeating fixed-size smaller values, so it | 8828 // * The value is not formed from repeating fixed-size smaller values, so it |
8826 // can be used to detect endianness-related errors. | 8829 // can be used to detect endianness-related errors. |
8827 // * It is never a floating-point NaN, and will therefore always compare | 8830 // * It is never a floating-point NaN, and will therefore always compare |
8828 // equal to itself. | 8831 // equal to itself. |
8829 uint64_t literal_base = 0x0100001000100101UL; | 8832 uint64_t literal_base = 0x0100001000100101UL; |
8830 | 8833 |
8831 { | 8834 { |
8832 DCHECK(__ StackPointer().Is(csp)); | 8835 CHECK(__ StackPointer().Is(csp)); |
8833 __ Mov(jssp, __ StackPointer()); | 8836 __ Mov(jssp, __ StackPointer()); |
8834 __ SetStackPointer(jssp); | 8837 __ SetStackPointer(jssp); |
8835 | 8838 |
8836 int i; | 8839 int i; |
8837 | 8840 |
8838 // Initialize the registers, using X registers to load the literal. | 8841 // Initialize the registers, using X registers to load the literal. |
8839 __ Mov(x0, 0); | 8842 __ Mov(x0, 0); |
8840 __ Mov(x1, literal_base); | 8843 __ Mov(x1, literal_base); |
8841 for (i = 0; i < reg_count; i++) { | 8844 for (i = 0; i < reg_count; i++) { |
8842 // Always write into the D register, to ensure that the upper word is | 8845 // Always write into the D register, to ensure that the upper word is |
(...skipping 10 matching lines...) Expand all Loading... |
8853 case PushPopByFour: | 8856 case PushPopByFour: |
8854 // Push high-numbered registers first (to the highest addresses). | 8857 // Push high-numbered registers first (to the highest addresses). |
8855 for (i = reg_count; i >= 4; i -= 4) { | 8858 for (i = reg_count; i >= 4; i -= 4) { |
8856 __ Push(v[i-1], v[i-2], v[i-3], v[i-4]); | 8859 __ Push(v[i-1], v[i-2], v[i-3], v[i-4]); |
8857 } | 8860 } |
8858 // Finish off the leftovers. | 8861 // Finish off the leftovers. |
8859 switch (i) { | 8862 switch (i) { |
8860 case 3: __ Push(v[2], v[1], v[0]); break; | 8863 case 3: __ Push(v[2], v[1], v[0]); break; |
8861 case 2: __ Push(v[1], v[0]); break; | 8864 case 2: __ Push(v[1], v[0]); break; |
8862 case 1: __ Push(v[0]); break; | 8865 case 1: __ Push(v[0]); break; |
8863 default: DCHECK(i == 0); break; | 8866 default: |
| 8867 CHECK(i == 0); |
| 8868 break; |
8864 } | 8869 } |
8865 break; | 8870 break; |
8866 case PushPopRegList: | 8871 case PushPopRegList: |
8867 __ PushSizeRegList(list, reg_size, CPURegister::kFPRegister); | 8872 __ PushSizeRegList(list, reg_size, CPURegister::kFPRegister); |
8868 break; | 8873 break; |
8869 } | 8874 } |
8870 | 8875 |
8871 // Clobber all the registers, to ensure that they get repopulated by Pop. | 8876 // Clobber all the registers, to ensure that they get repopulated by Pop. |
8872 ClobberFP(&masm, list); | 8877 ClobberFP(&masm, list); |
8873 | 8878 |
8874 switch (pop_method) { | 8879 switch (pop_method) { |
8875 case PushPopByFour: | 8880 case PushPopByFour: |
8876 // Pop low-numbered registers first (from the lowest addresses). | 8881 // Pop low-numbered registers first (from the lowest addresses). |
8877 for (i = 0; i <= (reg_count-4); i += 4) { | 8882 for (i = 0; i <= (reg_count-4); i += 4) { |
8878 __ Pop(v[i], v[i+1], v[i+2], v[i+3]); | 8883 __ Pop(v[i], v[i+1], v[i+2], v[i+3]); |
8879 } | 8884 } |
8880 // Finish off the leftovers. | 8885 // Finish off the leftovers. |
8881 switch (reg_count - i) { | 8886 switch (reg_count - i) { |
8882 case 3: __ Pop(v[i], v[i+1], v[i+2]); break; | 8887 case 3: __ Pop(v[i], v[i+1], v[i+2]); break; |
8883 case 2: __ Pop(v[i], v[i+1]); break; | 8888 case 2: __ Pop(v[i], v[i+1]); break; |
8884 case 1: __ Pop(v[i]); break; | 8889 case 1: __ Pop(v[i]); break; |
8885 default: DCHECK(i == reg_count); break; | 8890 default: |
| 8891 CHECK(i == reg_count); |
| 8892 break; |
8886 } | 8893 } |
8887 break; | 8894 break; |
8888 case PushPopRegList: | 8895 case PushPopRegList: |
8889 __ PopSizeRegList(list, reg_size, CPURegister::kFPRegister); | 8896 __ PopSizeRegList(list, reg_size, CPURegister::kFPRegister); |
8890 break; | 8897 break; |
8891 } | 8898 } |
8892 | 8899 |
8893 // Drop memory to restore jssp. | 8900 // Drop memory to restore jssp. |
8894 __ Drop(claim, kByteSizeInBytes); | 8901 __ Drop(claim, kByteSizeInBytes); |
8895 | 8902 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8999 | 9006 |
9000 // The literal base is chosen to have two useful properties: | 9007 // The literal base is chosen to have two useful properties: |
9001 // * When multiplied by small values (such as a register index), this value | 9008 // * When multiplied by small values (such as a register index), this value |
9002 // is clearly readable in the result. | 9009 // is clearly readable in the result. |
9003 // * The value is not formed from repeating fixed-size smaller values, so it | 9010 // * The value is not formed from repeating fixed-size smaller values, so it |
9004 // can be used to detect endianness-related errors. | 9011 // can be used to detect endianness-related errors. |
9005 uint64_t literal_base = 0x0100001000100101UL; | 9012 uint64_t literal_base = 0x0100001000100101UL; |
9006 | 9013 |
9007 START(); | 9014 START(); |
9008 { | 9015 { |
9009 DCHECK(__ StackPointer().Is(csp)); | 9016 CHECK(__ StackPointer().Is(csp)); |
9010 __ Mov(jssp, __ StackPointer()); | 9017 __ Mov(jssp, __ StackPointer()); |
9011 __ SetStackPointer(jssp); | 9018 __ SetStackPointer(jssp); |
9012 | 9019 |
9013 // Claim memory first, as requested. | 9020 // Claim memory first, as requested. |
9014 __ Claim(claim, kByteSizeInBytes); | 9021 __ Claim(claim, kByteSizeInBytes); |
9015 | 9022 |
9016 __ Mov(x[3], literal_base * 3); | 9023 __ Mov(x[3], literal_base * 3); |
9017 __ Mov(x[2], literal_base * 2); | 9024 __ Mov(x[2], literal_base * 2); |
9018 __ Mov(x[1], literal_base * 1); | 9025 __ Mov(x[1], literal_base * 1); |
9019 __ Mov(x[0], literal_base * 0); | 9026 __ Mov(x[0], literal_base * 0); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9104 // is clearly readable in the result. | 9111 // is clearly readable in the result. |
9105 // * The value is not formed from repeating fixed-size smaller values, so it | 9112 // * The value is not formed from repeating fixed-size smaller values, so it |
9106 // can be used to detect endianness-related errors. | 9113 // can be used to detect endianness-related errors. |
9107 static uint64_t const literal_base = 0x0100001000100101UL; | 9114 static uint64_t const literal_base = 0x0100001000100101UL; |
9108 static uint64_t const literal_base_hi = literal_base >> 32; | 9115 static uint64_t const literal_base_hi = literal_base >> 32; |
9109 static uint64_t const literal_base_lo = literal_base & 0xffffffff; | 9116 static uint64_t const literal_base_lo = literal_base & 0xffffffff; |
9110 static uint64_t const literal_base_w = literal_base & 0xffffffff; | 9117 static uint64_t const literal_base_w = literal_base & 0xffffffff; |
9111 | 9118 |
9112 START(); | 9119 START(); |
9113 { | 9120 { |
9114 DCHECK(__ StackPointer().Is(csp)); | 9121 CHECK(__ StackPointer().Is(csp)); |
9115 __ Mov(jssp, __ StackPointer()); | 9122 __ Mov(jssp, __ StackPointer()); |
9116 __ SetStackPointer(jssp); | 9123 __ SetStackPointer(jssp); |
9117 | 9124 |
9118 // Initialize the registers. | 9125 // Initialize the registers. |
9119 for (int i = 0; i < reg_count; i++) { | 9126 for (int i = 0; i < reg_count; i++) { |
9120 // Always write into the X register, to ensure that the upper word is | 9127 // Always write into the X register, to ensure that the upper word is |
9121 // properly ignored by Push when testing W registers. | 9128 // properly ignored by Push when testing W registers. |
9122 if (!x[i].IsZero()) { | 9129 if (!x[i].IsZero()) { |
9123 __ Mov(x[i], literal_base * i); | 9130 __ Mov(x[i], literal_base * i); |
9124 } | 9131 } |
(...skipping 27 matching lines...) Expand all Loading... |
9152 // where i is the register number. | 9159 // where i is the register number. |
9153 // Registers are popped starting with the higher numbers one-by-one, | 9160 // Registers are popped starting with the higher numbers one-by-one, |
9154 // alternating between x and w registers, but only popping one at a time. | 9161 // alternating between x and w registers, but only popping one at a time. |
9155 // | 9162 // |
9156 // This pattern provides a wide variety of alignment effects and overlaps. | 9163 // This pattern provides a wide variety of alignment effects and overlaps. |
9157 | 9164 |
9158 // ---- Push ---- | 9165 // ---- Push ---- |
9159 | 9166 |
9160 int active_w_slots = 0; | 9167 int active_w_slots = 0; |
9161 for (int i = 0; active_w_slots < requested_w_slots; i++) { | 9168 for (int i = 0; active_w_slots < requested_w_slots; i++) { |
9162 DCHECK(i < reg_count); | 9169 CHECK(i < reg_count); |
9163 // In order to test various arguments to PushMultipleTimes, and to try to | 9170 // In order to test various arguments to PushMultipleTimes, and to try to |
9164 // exercise different alignment and overlap effects, we push each | 9171 // exercise different alignment and overlap effects, we push each |
9165 // register a different number of times. | 9172 // register a different number of times. |
9166 int times = i % 4 + 1; | 9173 int times = i % 4 + 1; |
9167 if (i & 1) { | 9174 if (i & 1) { |
9168 // Push odd-numbered registers as W registers. | 9175 // Push odd-numbered registers as W registers. |
9169 if (i & 2) { | 9176 if (i & 2) { |
9170 __ PushMultipleTimes(w[i], times); | 9177 __ PushMultipleTimes(w[i], times); |
9171 } else { | 9178 } else { |
9172 // Use a register to specify the count. | 9179 // Use a register to specify the count. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9225 for (int i = reg_count-1; i >= 0; i--) { | 9232 for (int i = reg_count-1; i >= 0; i--) { |
9226 if (next_is_64) { | 9233 if (next_is_64) { |
9227 __ Pop(x[i]); | 9234 __ Pop(x[i]); |
9228 active_w_slots -= 2; | 9235 active_w_slots -= 2; |
9229 } else { | 9236 } else { |
9230 __ Pop(w[i]); | 9237 __ Pop(w[i]); |
9231 active_w_slots -= 1; | 9238 active_w_slots -= 1; |
9232 } | 9239 } |
9233 next_is_64 = !next_is_64; | 9240 next_is_64 = !next_is_64; |
9234 } | 9241 } |
9235 DCHECK(active_w_slots == 0); | 9242 CHECK(active_w_slots == 0); |
9236 | 9243 |
9237 // Drop memory to restore jssp. | 9244 // Drop memory to restore jssp. |
9238 __ Drop(claim, kByteSizeInBytes); | 9245 __ Drop(claim, kByteSizeInBytes); |
9239 | 9246 |
9240 __ Mov(csp, __ StackPointer()); | 9247 __ Mov(csp, __ StackPointer()); |
9241 __ SetStackPointer(csp); | 9248 __ SetStackPointer(csp); |
9242 } | 9249 } |
9243 | 9250 |
9244 END(); | 9251 END(); |
9245 | 9252 |
(...skipping 15 matching lines...) Expand all Loading... |
9261 } | 9268 } |
9262 | 9269 |
9263 // Always use CHECK_EQUAL_64, even when testing W registers, so we can | 9270 // Always use CHECK_EQUAL_64, even when testing W registers, so we can |
9264 // test that the upper word was properly cleared by Pop. | 9271 // test that the upper word was properly cleared by Pop. |
9265 if (x[i].IsZero()) { | 9272 if (x[i].IsZero()) { |
9266 CHECK_EQUAL_64(0, x[i]); | 9273 CHECK_EQUAL_64(0, x[i]); |
9267 } else { | 9274 } else { |
9268 CHECK_EQUAL_64(expected, x[i]); | 9275 CHECK_EQUAL_64(expected, x[i]); |
9269 } | 9276 } |
9270 } | 9277 } |
9271 DCHECK(slot == requested_w_slots); | 9278 CHECK(slot == requested_w_slots); |
9272 | 9279 |
9273 TEARDOWN(); | 9280 TEARDOWN(); |
9274 } | 9281 } |
9275 | 9282 |
9276 | 9283 |
9277 TEST(push_pop_jssp_wx_overlap) { | 9284 TEST(push_pop_jssp_wx_overlap) { |
9278 INIT_V8(); | 9285 INIT_V8(); |
9279 for (int claim = 0; claim <= 8; claim++) { | 9286 for (int claim = 0; claim <= 8; claim++) { |
9280 for (int count = 1; count <= 8; count++) { | 9287 for (int count = 1; count <= 8; count++) { |
9281 PushPopJsspWXOverlapHelper(count, claim); | 9288 PushPopJsspWXOverlapHelper(count, claim); |
9282 PushPopJsspWXOverlapHelper(count, claim); | 9289 PushPopJsspWXOverlapHelper(count, claim); |
9283 PushPopJsspWXOverlapHelper(count, claim); | 9290 PushPopJsspWXOverlapHelper(count, claim); |
9284 PushPopJsspWXOverlapHelper(count, claim); | 9291 PushPopJsspWXOverlapHelper(count, claim); |
9285 } | 9292 } |
9286 // Test with the maximum number of registers. | 9293 // Test with the maximum number of registers. |
9287 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 9294 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
9288 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 9295 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
9289 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 9296 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
9290 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 9297 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
9291 } | 9298 } |
9292 } | 9299 } |
9293 | 9300 |
9294 | 9301 |
9295 TEST(push_pop_csp) { | 9302 TEST(push_pop_csp) { |
9296 INIT_V8(); | 9303 INIT_V8(); |
9297 SETUP(); | 9304 SETUP(); |
9298 | 9305 |
9299 START(); | 9306 START(); |
9300 | 9307 |
9301 DCHECK(csp.Is(__ StackPointer())); | 9308 CHECK(csp.Is(__ StackPointer())); |
9302 | 9309 |
9303 __ Mov(x3, 0x3333333333333333UL); | 9310 __ Mov(x3, 0x3333333333333333UL); |
9304 __ Mov(x2, 0x2222222222222222UL); | 9311 __ Mov(x2, 0x2222222222222222UL); |
9305 __ Mov(x1, 0x1111111111111111UL); | 9312 __ Mov(x1, 0x1111111111111111UL); |
9306 __ Mov(x0, 0x0000000000000000UL); | 9313 __ Mov(x0, 0x0000000000000000UL); |
9307 __ Claim(2); | 9314 __ Claim(2); |
9308 __ PushXRegList(x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit()); | 9315 __ PushXRegList(x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit()); |
9309 __ Push(x3, x2); | 9316 __ Push(x3, x2); |
9310 __ PopXRegList(x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit()); | 9317 __ PopXRegList(x0.Bit() | x1.Bit() | x2.Bit() | x3.Bit()); |
9311 __ Push(x2, x1, x3, x0); | 9318 __ Push(x2, x1, x3, x0); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9380 TEARDOWN(); | 9387 TEARDOWN(); |
9381 } | 9388 } |
9382 | 9389 |
9383 | 9390 |
9384 TEST(push_queued) { | 9391 TEST(push_queued) { |
9385 INIT_V8(); | 9392 INIT_V8(); |
9386 SETUP(); | 9393 SETUP(); |
9387 | 9394 |
9388 START(); | 9395 START(); |
9389 | 9396 |
9390 DCHECK(__ StackPointer().Is(csp)); | 9397 CHECK(__ StackPointer().Is(csp)); |
9391 __ Mov(jssp, __ StackPointer()); | 9398 __ Mov(jssp, __ StackPointer()); |
9392 __ SetStackPointer(jssp); | 9399 __ SetStackPointer(jssp); |
9393 | 9400 |
9394 MacroAssembler::PushPopQueue queue(&masm); | 9401 MacroAssembler::PushPopQueue queue(&masm); |
9395 | 9402 |
9396 // Queue up registers. | 9403 // Queue up registers. |
9397 queue.Queue(x0); | 9404 queue.Queue(x0); |
9398 queue.Queue(x1); | 9405 queue.Queue(x1); |
9399 queue.Queue(x2); | 9406 queue.Queue(x2); |
9400 queue.Queue(x3); | 9407 queue.Queue(x3); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9455 TEARDOWN(); | 9462 TEARDOWN(); |
9456 } | 9463 } |
9457 | 9464 |
9458 | 9465 |
9459 TEST(pop_queued) { | 9466 TEST(pop_queued) { |
9460 INIT_V8(); | 9467 INIT_V8(); |
9461 SETUP(); | 9468 SETUP(); |
9462 | 9469 |
9463 START(); | 9470 START(); |
9464 | 9471 |
9465 DCHECK(__ StackPointer().Is(csp)); | 9472 CHECK(__ StackPointer().Is(csp)); |
9466 __ Mov(jssp, __ StackPointer()); | 9473 __ Mov(jssp, __ StackPointer()); |
9467 __ SetStackPointer(jssp); | 9474 __ SetStackPointer(jssp); |
9468 | 9475 |
9469 MacroAssembler::PushPopQueue queue(&masm); | 9476 MacroAssembler::PushPopQueue queue(&masm); |
9470 | 9477 |
9471 __ Mov(x0, 0x1234000000000000); | 9478 __ Mov(x0, 0x1234000000000000); |
9472 __ Mov(x1, 0x1234000100010001); | 9479 __ Mov(x1, 0x1234000100010001); |
9473 __ Mov(x2, 0x1234000200020002); | 9480 __ Mov(x2, 0x1234000200020002); |
9474 __ Mov(x3, 0x1234000300030003); | 9481 __ Mov(x3, 0x1234000300030003); |
9475 __ Mov(w4, 0x12340004); | 9482 __ Mov(w4, 0x12340004); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10076 __ Printf("Test %%s: %s\n", x2); | 10083 __ Printf("Test %%s: %s\n", x2); |
10077 __ Printf("w3(uint32): %" PRIu32 "\nw4(int32): %" PRId32 "\n" | 10084 __ Printf("w3(uint32): %" PRIu32 "\nw4(int32): %" PRId32 "\n" |
10078 "x5(uint64): %" PRIu64 "\nx6(int64): %" PRId64 "\n", | 10085 "x5(uint64): %" PRIu64 "\nx6(int64): %" PRId64 "\n", |
10079 w3, w4, x5, x6); | 10086 w3, w4, x5, x6); |
10080 __ Printf("%%f: %f\n%%g: %g\n%%e: %e\n%%E: %E\n", s1, s2, d3, d4); | 10087 __ Printf("%%f: %f\n%%g: %g\n%%e: %e\n%%E: %E\n", s1, s2, d3, d4); |
10081 __ Printf("0x%" PRIx32 ", 0x%" PRIx64 "\n", w28, x28); | 10088 __ Printf("0x%" PRIx32 ", 0x%" PRIx64 "\n", w28, x28); |
10082 __ Printf("%g\n", d10); | 10089 __ Printf("%g\n", d10); |
10083 __ Printf("%%%%%s%%%c%%\n", x2, w13); | 10090 __ Printf("%%%%%s%%%c%%\n", x2, w13); |
10084 | 10091 |
10085 // Print the stack pointer (csp). | 10092 // Print the stack pointer (csp). |
10086 DCHECK(csp.Is(__ StackPointer())); | 10093 CHECK(csp.Is(__ StackPointer())); |
10087 __ Printf("StackPointer(csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", | 10094 __ Printf("StackPointer(csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", |
10088 __ StackPointer(), __ StackPointer().W()); | 10095 __ StackPointer(), __ StackPointer().W()); |
10089 | 10096 |
10090 // Test with a different stack pointer. | 10097 // Test with a different stack pointer. |
10091 const Register old_stack_pointer = __ StackPointer(); | 10098 const Register old_stack_pointer = __ StackPointer(); |
10092 __ Mov(x29, old_stack_pointer); | 10099 __ Mov(x29, old_stack_pointer); |
10093 __ SetStackPointer(x29); | 10100 __ SetStackPointer(x29); |
10094 // Print the stack pointer (not csp). | 10101 // Print the stack pointer (not csp). |
10095 __ Printf("StackPointer(not csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", | 10102 __ Printf("StackPointer(not csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", |
10096 __ StackPointer(), __ StackPointer().W()); | 10103 __ StackPointer(), __ StackPointer().W()); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10329 | 10336 |
10330 TEARDOWN(); | 10337 TEARDOWN(); |
10331 } | 10338 } |
10332 | 10339 |
10333 | 10340 |
10334 TEST(process_nan_double) { | 10341 TEST(process_nan_double) { |
10335 INIT_V8(); | 10342 INIT_V8(); |
10336 // Make sure that NaN propagation works correctly. | 10343 // Make sure that NaN propagation works correctly. |
10337 double sn = rawbits_to_double(0x7ff5555511111111); | 10344 double sn = rawbits_to_double(0x7ff5555511111111); |
10338 double qn = rawbits_to_double(0x7ffaaaaa11111111); | 10345 double qn = rawbits_to_double(0x7ffaaaaa11111111); |
10339 DCHECK(IsSignallingNaN(sn)); | 10346 CHECK(IsSignallingNaN(sn)); |
10340 DCHECK(IsQuietNaN(qn)); | 10347 CHECK(IsQuietNaN(qn)); |
10341 | 10348 |
10342 // The input NaNs after passing through ProcessNaN. | 10349 // The input NaNs after passing through ProcessNaN. |
10343 double sn_proc = rawbits_to_double(0x7ffd555511111111); | 10350 double sn_proc = rawbits_to_double(0x7ffd555511111111); |
10344 double qn_proc = qn; | 10351 double qn_proc = qn; |
10345 DCHECK(IsQuietNaN(sn_proc)); | 10352 CHECK(IsQuietNaN(sn_proc)); |
10346 DCHECK(IsQuietNaN(qn_proc)); | 10353 CHECK(IsQuietNaN(qn_proc)); |
10347 | 10354 |
10348 SETUP(); | 10355 SETUP(); |
10349 START(); | 10356 START(); |
10350 | 10357 |
10351 // Execute a number of instructions which all use ProcessNaN, and check that | 10358 // Execute a number of instructions which all use ProcessNaN, and check that |
10352 // they all handle the NaN correctly. | 10359 // they all handle the NaN correctly. |
10353 __ Fmov(d0, sn); | 10360 __ Fmov(d0, sn); |
10354 __ Fmov(d10, qn); | 10361 __ Fmov(d10, qn); |
10355 | 10362 |
10356 // Operations that always propagate NaNs unchanged, even signalling NaNs. | 10363 // Operations that always propagate NaNs unchanged, even signalling NaNs. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10405 | 10412 |
10406 TEARDOWN(); | 10413 TEARDOWN(); |
10407 } | 10414 } |
10408 | 10415 |
10409 | 10416 |
10410 TEST(process_nan_float) { | 10417 TEST(process_nan_float) { |
10411 INIT_V8(); | 10418 INIT_V8(); |
10412 // Make sure that NaN propagation works correctly. | 10419 // Make sure that NaN propagation works correctly. |
10413 float sn = rawbits_to_float(0x7f951111); | 10420 float sn = rawbits_to_float(0x7f951111); |
10414 float qn = rawbits_to_float(0x7fea1111); | 10421 float qn = rawbits_to_float(0x7fea1111); |
10415 DCHECK(IsSignallingNaN(sn)); | 10422 CHECK(IsSignallingNaN(sn)); |
10416 DCHECK(IsQuietNaN(qn)); | 10423 CHECK(IsQuietNaN(qn)); |
10417 | 10424 |
10418 // The input NaNs after passing through ProcessNaN. | 10425 // The input NaNs after passing through ProcessNaN. |
10419 float sn_proc = rawbits_to_float(0x7fd51111); | 10426 float sn_proc = rawbits_to_float(0x7fd51111); |
10420 float qn_proc = qn; | 10427 float qn_proc = qn; |
10421 DCHECK(IsQuietNaN(sn_proc)); | 10428 CHECK(IsQuietNaN(sn_proc)); |
10422 DCHECK(IsQuietNaN(qn_proc)); | 10429 CHECK(IsQuietNaN(qn_proc)); |
10423 | 10430 |
10424 SETUP(); | 10431 SETUP(); |
10425 START(); | 10432 START(); |
10426 | 10433 |
10427 // Execute a number of instructions which all use ProcessNaN, and check that | 10434 // Execute a number of instructions which all use ProcessNaN, and check that |
10428 // they all handle the NaN correctly. | 10435 // they all handle the NaN correctly. |
10429 __ Fmov(s0, sn); | 10436 __ Fmov(s0, sn); |
10430 __ Fmov(s10, qn); | 10437 __ Fmov(s10, qn); |
10431 | 10438 |
10432 // Operations that always propagate NaNs unchanged, even signalling NaNs. | 10439 // Operations that always propagate NaNs unchanged, even signalling NaNs. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10477 CHECK_EQUAL_FP32(qn_proc, s14); | 10484 CHECK_EQUAL_FP32(qn_proc, s14); |
10478 CHECK_EQUAL_FP32(qn_proc, s15); | 10485 CHECK_EQUAL_FP32(qn_proc, s15); |
10479 CHECK_EQUAL_FP32(qn_proc, s16); | 10486 CHECK_EQUAL_FP32(qn_proc, s16); |
10480 CHECK_EQUAL_FP32(qn_proc, s17); | 10487 CHECK_EQUAL_FP32(qn_proc, s17); |
10481 | 10488 |
10482 TEARDOWN(); | 10489 TEARDOWN(); |
10483 } | 10490 } |
10484 | 10491 |
10485 | 10492 |
10486 static void ProcessNaNsHelper(double n, double m, double expected) { | 10493 static void ProcessNaNsHelper(double n, double m, double expected) { |
10487 DCHECK(std::isnan(n) || std::isnan(m)); | 10494 CHECK(std::isnan(n) || std::isnan(m)); |
10488 DCHECK(std::isnan(expected)); | 10495 CHECK(std::isnan(expected)); |
10489 | 10496 |
10490 SETUP(); | 10497 SETUP(); |
10491 START(); | 10498 START(); |
10492 | 10499 |
10493 // Execute a number of instructions which all use ProcessNaNs, and check that | 10500 // Execute a number of instructions which all use ProcessNaNs, and check that |
10494 // they all propagate NaNs correctly. | 10501 // they all propagate NaNs correctly. |
10495 __ Fmov(d0, n); | 10502 __ Fmov(d0, n); |
10496 __ Fmov(d1, m); | 10503 __ Fmov(d1, m); |
10497 | 10504 |
10498 __ Fadd(d2, d0, d1); | 10505 __ Fadd(d2, d0, d1); |
(...skipping 17 matching lines...) Expand all Loading... |
10516 } | 10523 } |
10517 | 10524 |
10518 | 10525 |
10519 TEST(process_nans_double) { | 10526 TEST(process_nans_double) { |
10520 INIT_V8(); | 10527 INIT_V8(); |
10521 // Make sure that NaN propagation works correctly. | 10528 // Make sure that NaN propagation works correctly. |
10522 double sn = rawbits_to_double(0x7ff5555511111111); | 10529 double sn = rawbits_to_double(0x7ff5555511111111); |
10523 double sm = rawbits_to_double(0x7ff5555522222222); | 10530 double sm = rawbits_to_double(0x7ff5555522222222); |
10524 double qn = rawbits_to_double(0x7ffaaaaa11111111); | 10531 double qn = rawbits_to_double(0x7ffaaaaa11111111); |
10525 double qm = rawbits_to_double(0x7ffaaaaa22222222); | 10532 double qm = rawbits_to_double(0x7ffaaaaa22222222); |
10526 DCHECK(IsSignallingNaN(sn)); | 10533 CHECK(IsSignallingNaN(sn)); |
10527 DCHECK(IsSignallingNaN(sm)); | 10534 CHECK(IsSignallingNaN(sm)); |
10528 DCHECK(IsQuietNaN(qn)); | 10535 CHECK(IsQuietNaN(qn)); |
10529 DCHECK(IsQuietNaN(qm)); | 10536 CHECK(IsQuietNaN(qm)); |
10530 | 10537 |
10531 // The input NaNs after passing through ProcessNaN. | 10538 // The input NaNs after passing through ProcessNaN. |
10532 double sn_proc = rawbits_to_double(0x7ffd555511111111); | 10539 double sn_proc = rawbits_to_double(0x7ffd555511111111); |
10533 double sm_proc = rawbits_to_double(0x7ffd555522222222); | 10540 double sm_proc = rawbits_to_double(0x7ffd555522222222); |
10534 double qn_proc = qn; | 10541 double qn_proc = qn; |
10535 double qm_proc = qm; | 10542 double qm_proc = qm; |
10536 DCHECK(IsQuietNaN(sn_proc)); | 10543 CHECK(IsQuietNaN(sn_proc)); |
10537 DCHECK(IsQuietNaN(sm_proc)); | 10544 CHECK(IsQuietNaN(sm_proc)); |
10538 DCHECK(IsQuietNaN(qn_proc)); | 10545 CHECK(IsQuietNaN(qn_proc)); |
10539 DCHECK(IsQuietNaN(qm_proc)); | 10546 CHECK(IsQuietNaN(qm_proc)); |
10540 | 10547 |
10541 // Quiet NaNs are propagated. | 10548 // Quiet NaNs are propagated. |
10542 ProcessNaNsHelper(qn, 0, qn_proc); | 10549 ProcessNaNsHelper(qn, 0, qn_proc); |
10543 ProcessNaNsHelper(0, qm, qm_proc); | 10550 ProcessNaNsHelper(0, qm, qm_proc); |
10544 ProcessNaNsHelper(qn, qm, qn_proc); | 10551 ProcessNaNsHelper(qn, qm, qn_proc); |
10545 | 10552 |
10546 // Signalling NaNs are propagated, and made quiet. | 10553 // Signalling NaNs are propagated, and made quiet. |
10547 ProcessNaNsHelper(sn, 0, sn_proc); | 10554 ProcessNaNsHelper(sn, 0, sn_proc); |
10548 ProcessNaNsHelper(0, sm, sm_proc); | 10555 ProcessNaNsHelper(0, sm, sm_proc); |
10549 ProcessNaNsHelper(sn, sm, sn_proc); | 10556 ProcessNaNsHelper(sn, sm, sn_proc); |
10550 | 10557 |
10551 // Signalling NaNs take precedence over quiet NaNs. | 10558 // Signalling NaNs take precedence over quiet NaNs. |
10552 ProcessNaNsHelper(sn, qm, sn_proc); | 10559 ProcessNaNsHelper(sn, qm, sn_proc); |
10553 ProcessNaNsHelper(qn, sm, sm_proc); | 10560 ProcessNaNsHelper(qn, sm, sm_proc); |
10554 ProcessNaNsHelper(sn, sm, sn_proc); | 10561 ProcessNaNsHelper(sn, sm, sn_proc); |
10555 } | 10562 } |
10556 | 10563 |
10557 | 10564 |
10558 static void ProcessNaNsHelper(float n, float m, float expected) { | 10565 static void ProcessNaNsHelper(float n, float m, float expected) { |
10559 DCHECK(std::isnan(n) || std::isnan(m)); | 10566 CHECK(std::isnan(n) || std::isnan(m)); |
10560 DCHECK(std::isnan(expected)); | 10567 CHECK(std::isnan(expected)); |
10561 | 10568 |
10562 SETUP(); | 10569 SETUP(); |
10563 START(); | 10570 START(); |
10564 | 10571 |
10565 // Execute a number of instructions which all use ProcessNaNs, and check that | 10572 // Execute a number of instructions which all use ProcessNaNs, and check that |
10566 // they all propagate NaNs correctly. | 10573 // they all propagate NaNs correctly. |
10567 __ Fmov(s0, n); | 10574 __ Fmov(s0, n); |
10568 __ Fmov(s1, m); | 10575 __ Fmov(s1, m); |
10569 | 10576 |
10570 __ Fadd(s2, s0, s1); | 10577 __ Fadd(s2, s0, s1); |
(...skipping 17 matching lines...) Expand all Loading... |
10588 } | 10595 } |
10589 | 10596 |
10590 | 10597 |
10591 TEST(process_nans_float) { | 10598 TEST(process_nans_float) { |
10592 INIT_V8(); | 10599 INIT_V8(); |
10593 // Make sure that NaN propagation works correctly. | 10600 // Make sure that NaN propagation works correctly. |
10594 float sn = rawbits_to_float(0x7f951111); | 10601 float sn = rawbits_to_float(0x7f951111); |
10595 float sm = rawbits_to_float(0x7f952222); | 10602 float sm = rawbits_to_float(0x7f952222); |
10596 float qn = rawbits_to_float(0x7fea1111); | 10603 float qn = rawbits_to_float(0x7fea1111); |
10597 float qm = rawbits_to_float(0x7fea2222); | 10604 float qm = rawbits_to_float(0x7fea2222); |
10598 DCHECK(IsSignallingNaN(sn)); | 10605 CHECK(IsSignallingNaN(sn)); |
10599 DCHECK(IsSignallingNaN(sm)); | 10606 CHECK(IsSignallingNaN(sm)); |
10600 DCHECK(IsQuietNaN(qn)); | 10607 CHECK(IsQuietNaN(qn)); |
10601 DCHECK(IsQuietNaN(qm)); | 10608 CHECK(IsQuietNaN(qm)); |
10602 | 10609 |
10603 // The input NaNs after passing through ProcessNaN. | 10610 // The input NaNs after passing through ProcessNaN. |
10604 float sn_proc = rawbits_to_float(0x7fd51111); | 10611 float sn_proc = rawbits_to_float(0x7fd51111); |
10605 float sm_proc = rawbits_to_float(0x7fd52222); | 10612 float sm_proc = rawbits_to_float(0x7fd52222); |
10606 float qn_proc = qn; | 10613 float qn_proc = qn; |
10607 float qm_proc = qm; | 10614 float qm_proc = qm; |
10608 DCHECK(IsQuietNaN(sn_proc)); | 10615 CHECK(IsQuietNaN(sn_proc)); |
10609 DCHECK(IsQuietNaN(sm_proc)); | 10616 CHECK(IsQuietNaN(sm_proc)); |
10610 DCHECK(IsQuietNaN(qn_proc)); | 10617 CHECK(IsQuietNaN(qn_proc)); |
10611 DCHECK(IsQuietNaN(qm_proc)); | 10618 CHECK(IsQuietNaN(qm_proc)); |
10612 | 10619 |
10613 // Quiet NaNs are propagated. | 10620 // Quiet NaNs are propagated. |
10614 ProcessNaNsHelper(qn, 0, qn_proc); | 10621 ProcessNaNsHelper(qn, 0, qn_proc); |
10615 ProcessNaNsHelper(0, qm, qm_proc); | 10622 ProcessNaNsHelper(0, qm, qm_proc); |
10616 ProcessNaNsHelper(qn, qm, qn_proc); | 10623 ProcessNaNsHelper(qn, qm, qn_proc); |
10617 | 10624 |
10618 // Signalling NaNs are propagated, and made quiet. | 10625 // Signalling NaNs are propagated, and made quiet. |
10619 ProcessNaNsHelper(sn, 0, sn_proc); | 10626 ProcessNaNsHelper(sn, 0, sn_proc); |
10620 ProcessNaNsHelper(0, sm, sm_proc); | 10627 ProcessNaNsHelper(0, sm, sm_proc); |
10621 ProcessNaNsHelper(sn, sm, sn_proc); | 10628 ProcessNaNsHelper(sn, sm, sn_proc); |
10622 | 10629 |
10623 // Signalling NaNs take precedence over quiet NaNs. | 10630 // Signalling NaNs take precedence over quiet NaNs. |
10624 ProcessNaNsHelper(sn, qm, sn_proc); | 10631 ProcessNaNsHelper(sn, qm, sn_proc); |
10625 ProcessNaNsHelper(qn, sm, sm_proc); | 10632 ProcessNaNsHelper(qn, sm, sm_proc); |
10626 ProcessNaNsHelper(sn, sm, sn_proc); | 10633 ProcessNaNsHelper(sn, sm, sn_proc); |
10627 } | 10634 } |
10628 | 10635 |
10629 | 10636 |
10630 static void DefaultNaNHelper(float n, float m, float a) { | 10637 static void DefaultNaNHelper(float n, float m, float a) { |
10631 DCHECK(std::isnan(n) || std::isnan(m) || std::isnan(a)); | 10638 CHECK(std::isnan(n) || std::isnan(m) || std::isnan(a)); |
10632 | 10639 |
10633 bool test_1op = std::isnan(n); | 10640 bool test_1op = std::isnan(n); |
10634 bool test_2op = std::isnan(n) || std::isnan(m); | 10641 bool test_2op = std::isnan(n) || std::isnan(m); |
10635 | 10642 |
10636 SETUP(); | 10643 SETUP(); |
10637 START(); | 10644 START(); |
10638 | 10645 |
10639 // Enable Default-NaN mode in the FPCR. | 10646 // Enable Default-NaN mode in the FPCR. |
10640 __ Mrs(x0, FPCR); | 10647 __ Mrs(x0, FPCR); |
10641 __ Orr(x1, x0, DN_mask); | 10648 __ Orr(x1, x0, DN_mask); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10714 | 10721 |
10715 | 10722 |
10716 TEST(default_nan_float) { | 10723 TEST(default_nan_float) { |
10717 INIT_V8(); | 10724 INIT_V8(); |
10718 float sn = rawbits_to_float(0x7f951111); | 10725 float sn = rawbits_to_float(0x7f951111); |
10719 float sm = rawbits_to_float(0x7f952222); | 10726 float sm = rawbits_to_float(0x7f952222); |
10720 float sa = rawbits_to_float(0x7f95aaaa); | 10727 float sa = rawbits_to_float(0x7f95aaaa); |
10721 float qn = rawbits_to_float(0x7fea1111); | 10728 float qn = rawbits_to_float(0x7fea1111); |
10722 float qm = rawbits_to_float(0x7fea2222); | 10729 float qm = rawbits_to_float(0x7fea2222); |
10723 float qa = rawbits_to_float(0x7feaaaaa); | 10730 float qa = rawbits_to_float(0x7feaaaaa); |
10724 DCHECK(IsSignallingNaN(sn)); | 10731 CHECK(IsSignallingNaN(sn)); |
10725 DCHECK(IsSignallingNaN(sm)); | 10732 CHECK(IsSignallingNaN(sm)); |
10726 DCHECK(IsSignallingNaN(sa)); | 10733 CHECK(IsSignallingNaN(sa)); |
10727 DCHECK(IsQuietNaN(qn)); | 10734 CHECK(IsQuietNaN(qn)); |
10728 DCHECK(IsQuietNaN(qm)); | 10735 CHECK(IsQuietNaN(qm)); |
10729 DCHECK(IsQuietNaN(qa)); | 10736 CHECK(IsQuietNaN(qa)); |
10730 | 10737 |
10731 // - Signalling NaNs | 10738 // - Signalling NaNs |
10732 DefaultNaNHelper(sn, 0.0f, 0.0f); | 10739 DefaultNaNHelper(sn, 0.0f, 0.0f); |
10733 DefaultNaNHelper(0.0f, sm, 0.0f); | 10740 DefaultNaNHelper(0.0f, sm, 0.0f); |
10734 DefaultNaNHelper(0.0f, 0.0f, sa); | 10741 DefaultNaNHelper(0.0f, 0.0f, sa); |
10735 DefaultNaNHelper(sn, sm, 0.0f); | 10742 DefaultNaNHelper(sn, sm, 0.0f); |
10736 DefaultNaNHelper(0.0f, sm, sa); | 10743 DefaultNaNHelper(0.0f, sm, sa); |
10737 DefaultNaNHelper(sn, 0.0f, sa); | 10744 DefaultNaNHelper(sn, 0.0f, sa); |
10738 DefaultNaNHelper(sn, sm, sa); | 10745 DefaultNaNHelper(sn, sm, sa); |
10739 // - Quiet NaNs | 10746 // - Quiet NaNs |
10740 DefaultNaNHelper(qn, 0.0f, 0.0f); | 10747 DefaultNaNHelper(qn, 0.0f, 0.0f); |
10741 DefaultNaNHelper(0.0f, qm, 0.0f); | 10748 DefaultNaNHelper(0.0f, qm, 0.0f); |
10742 DefaultNaNHelper(0.0f, 0.0f, qa); | 10749 DefaultNaNHelper(0.0f, 0.0f, qa); |
10743 DefaultNaNHelper(qn, qm, 0.0f); | 10750 DefaultNaNHelper(qn, qm, 0.0f); |
10744 DefaultNaNHelper(0.0f, qm, qa); | 10751 DefaultNaNHelper(0.0f, qm, qa); |
10745 DefaultNaNHelper(qn, 0.0f, qa); | 10752 DefaultNaNHelper(qn, 0.0f, qa); |
10746 DefaultNaNHelper(qn, qm, qa); | 10753 DefaultNaNHelper(qn, qm, qa); |
10747 // - Mixed NaNs | 10754 // - Mixed NaNs |
10748 DefaultNaNHelper(qn, sm, sa); | 10755 DefaultNaNHelper(qn, sm, sa); |
10749 DefaultNaNHelper(sn, qm, sa); | 10756 DefaultNaNHelper(sn, qm, sa); |
10750 DefaultNaNHelper(sn, sm, qa); | 10757 DefaultNaNHelper(sn, sm, qa); |
10751 DefaultNaNHelper(qn, qm, sa); | 10758 DefaultNaNHelper(qn, qm, sa); |
10752 DefaultNaNHelper(sn, qm, qa); | 10759 DefaultNaNHelper(sn, qm, qa); |
10753 DefaultNaNHelper(qn, sm, qa); | 10760 DefaultNaNHelper(qn, sm, qa); |
10754 DefaultNaNHelper(qn, qm, qa); | 10761 DefaultNaNHelper(qn, qm, qa); |
10755 } | 10762 } |
10756 | 10763 |
10757 | 10764 |
10758 static void DefaultNaNHelper(double n, double m, double a) { | 10765 static void DefaultNaNHelper(double n, double m, double a) { |
10759 DCHECK(std::isnan(n) || std::isnan(m) || std::isnan(a)); | 10766 CHECK(std::isnan(n) || std::isnan(m) || std::isnan(a)); |
10760 | 10767 |
10761 bool test_1op = std::isnan(n); | 10768 bool test_1op = std::isnan(n); |
10762 bool test_2op = std::isnan(n) || std::isnan(m); | 10769 bool test_2op = std::isnan(n) || std::isnan(m); |
10763 | 10770 |
10764 SETUP(); | 10771 SETUP(); |
10765 START(); | 10772 START(); |
10766 | 10773 |
10767 // Enable Default-NaN mode in the FPCR. | 10774 // Enable Default-NaN mode in the FPCR. |
10768 __ Mrs(x0, FPCR); | 10775 __ Mrs(x0, FPCR); |
10769 __ Orr(x1, x0, DN_mask); | 10776 __ Orr(x1, x0, DN_mask); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10842 | 10849 |
10843 | 10850 |
10844 TEST(default_nan_double) { | 10851 TEST(default_nan_double) { |
10845 INIT_V8(); | 10852 INIT_V8(); |
10846 double sn = rawbits_to_double(0x7ff5555511111111); | 10853 double sn = rawbits_to_double(0x7ff5555511111111); |
10847 double sm = rawbits_to_double(0x7ff5555522222222); | 10854 double sm = rawbits_to_double(0x7ff5555522222222); |
10848 double sa = rawbits_to_double(0x7ff55555aaaaaaaa); | 10855 double sa = rawbits_to_double(0x7ff55555aaaaaaaa); |
10849 double qn = rawbits_to_double(0x7ffaaaaa11111111); | 10856 double qn = rawbits_to_double(0x7ffaaaaa11111111); |
10850 double qm = rawbits_to_double(0x7ffaaaaa22222222); | 10857 double qm = rawbits_to_double(0x7ffaaaaa22222222); |
10851 double qa = rawbits_to_double(0x7ffaaaaaaaaaaaaa); | 10858 double qa = rawbits_to_double(0x7ffaaaaaaaaaaaaa); |
10852 DCHECK(IsSignallingNaN(sn)); | 10859 CHECK(IsSignallingNaN(sn)); |
10853 DCHECK(IsSignallingNaN(sm)); | 10860 CHECK(IsSignallingNaN(sm)); |
10854 DCHECK(IsSignallingNaN(sa)); | 10861 CHECK(IsSignallingNaN(sa)); |
10855 DCHECK(IsQuietNaN(qn)); | 10862 CHECK(IsQuietNaN(qn)); |
10856 DCHECK(IsQuietNaN(qm)); | 10863 CHECK(IsQuietNaN(qm)); |
10857 DCHECK(IsQuietNaN(qa)); | 10864 CHECK(IsQuietNaN(qa)); |
10858 | 10865 |
10859 // - Signalling NaNs | 10866 // - Signalling NaNs |
10860 DefaultNaNHelper(sn, 0.0, 0.0); | 10867 DefaultNaNHelper(sn, 0.0, 0.0); |
10861 DefaultNaNHelper(0.0, sm, 0.0); | 10868 DefaultNaNHelper(0.0, sm, 0.0); |
10862 DefaultNaNHelper(0.0, 0.0, sa); | 10869 DefaultNaNHelper(0.0, 0.0, sa); |
10863 DefaultNaNHelper(sn, sm, 0.0); | 10870 DefaultNaNHelper(sn, sm, 0.0); |
10864 DefaultNaNHelper(0.0, sm, sa); | 10871 DefaultNaNHelper(0.0, sm, sa); |
10865 DefaultNaNHelper(sn, 0.0, sa); | 10872 DefaultNaNHelper(sn, 0.0, sa); |
10866 DefaultNaNHelper(sn, sm, sa); | 10873 DefaultNaNHelper(sn, sm, sa); |
10867 // - Quiet NaNs | 10874 // - Quiet NaNs |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11085 CodeDesc desc; | 11092 CodeDesc desc; |
11086 masm.GetCode(&desc); | 11093 masm.GetCode(&desc); |
11087 Handle<Code> code = isolate->factory()->NewCode(desc, 0, masm.CodeObject()); | 11094 Handle<Code> code = isolate->factory()->NewCode(desc, 0, masm.CodeObject()); |
11088 | 11095 |
11089 unsigned pool_count = 0; | 11096 unsigned pool_count = 0; |
11090 int pool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | | 11097 int pool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
11091 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); | 11098 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
11092 for (RelocIterator it(*code, pool_mask); !it.done(); it.next()) { | 11099 for (RelocIterator it(*code, pool_mask); !it.done(); it.next()) { |
11093 RelocInfo* info = it.rinfo(); | 11100 RelocInfo* info = it.rinfo(); |
11094 if (RelocInfo::IsConstPool(info->rmode())) { | 11101 if (RelocInfo::IsConstPool(info->rmode())) { |
11095 DCHECK(info->data() == constant_pool_size); | 11102 CHECK(info->data() == constant_pool_size); |
11096 ++pool_count; | 11103 ++pool_count; |
11097 } | 11104 } |
11098 if (RelocInfo::IsVeneerPool(info->rmode())) { | 11105 if (RelocInfo::IsVeneerPool(info->rmode())) { |
11099 DCHECK(info->data() == veneer_pool_size); | 11106 CHECK(info->data() == veneer_pool_size); |
11100 ++pool_count; | 11107 ++pool_count; |
11101 } | 11108 } |
11102 } | 11109 } |
11103 | 11110 |
11104 DCHECK(pool_count == 2); | 11111 CHECK(pool_count == 2); |
11105 | 11112 |
11106 TEARDOWN(); | 11113 TEARDOWN(); |
11107 } | 11114 } |
11108 | 11115 |
11109 | 11116 |
11110 TEST(jump_tables_forward) { | 11117 TEST(jump_tables_forward) { |
11111 // Test jump tables with forward jumps. | 11118 // Test jump tables with forward jumps. |
11112 const int kNumCases = 512; | 11119 const int kNumCases = 512; |
11113 | 11120 |
11114 INIT_V8(); | 11121 INIT_V8(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11268 __ Mov(x0, 1); | 11275 __ Mov(x0, 1); |
11269 | 11276 |
11270 END(); | 11277 END(); |
11271 | 11278 |
11272 RUN(); | 11279 RUN(); |
11273 | 11280 |
11274 CHECK_EQUAL_64(0x1, x0); | 11281 CHECK_EQUAL_64(0x1, x0); |
11275 | 11282 |
11276 TEARDOWN(); | 11283 TEARDOWN(); |
11277 } | 11284 } |
OLD | NEW |