OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 TEST(AssemblerIa326) { | 257 TEST(AssemblerIa326) { |
258 CcTest::InitializeVM(); | 258 CcTest::InitializeVM(); |
259 if (!CpuFeatures::IsSupported(SSE2)) return; | 259 if (!CpuFeatures::IsSupported(SSE2)) return; |
260 | 260 |
261 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 261 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
262 HandleScope scope(isolate); | 262 HandleScope scope(isolate); |
263 v8::internal::byte buffer[256]; | 263 v8::internal::byte buffer[256]; |
264 Assembler assm(isolate, buffer, sizeof buffer); | 264 Assembler assm(isolate, buffer, sizeof buffer); |
265 | 265 |
266 CpuFeatureScope fscope(&assm, SSE2); | 266 CpuFeatureScope fscope(&assm, SSE2); |
267 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); | 267 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); |
268 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize)); | 268 __ movsd(xmm1, Operand(esp, 3 * kPointerSize)); |
269 __ addsd(xmm0, xmm1); | 269 __ addsd(xmm0, xmm1); |
270 __ mulsd(xmm0, xmm1); | 270 __ mulsd(xmm0, xmm1); |
271 __ subsd(xmm0, xmm1); | 271 __ subsd(xmm0, xmm1); |
272 __ divsd(xmm0, xmm1); | 272 __ divsd(xmm0, xmm1); |
273 // Copy xmm0 to st(0) using eight bytes of stack. | 273 // Copy xmm0 to st(0) using eight bytes of stack. |
274 __ sub(esp, Immediate(8)); | 274 __ sub(esp, Immediate(8)); |
275 __ movdbl(Operand(esp, 0), xmm0); | 275 __ movsd(Operand(esp, 0), xmm0); |
276 __ fld_d(Operand(esp, 0)); | 276 __ fld_d(Operand(esp, 0)); |
277 __ add(esp, Immediate(8)); | 277 __ add(esp, Immediate(8)); |
278 __ ret(0); | 278 __ ret(0); |
279 | 279 |
280 CodeDesc desc; | 280 CodeDesc desc; |
281 assm.GetCode(&desc); | 281 assm.GetCode(&desc); |
282 Code* code = Code::cast(isolate->heap()->CreateCode( | 282 Code* code = Code::cast(isolate->heap()->CreateCode( |
283 desc, | 283 desc, |
284 Code::ComputeFlags(Code::STUB), | 284 Code::ComputeFlags(Code::STUB), |
285 Handle<Code>())->ToObjectChecked()); | 285 Handle<Code>())->ToObjectChecked()); |
(...skipping 20 matching lines...) Expand all Loading... |
306 | 306 |
307 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 307 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
308 HandleScope scope(isolate); | 308 HandleScope scope(isolate); |
309 v8::internal::byte buffer[256]; | 309 v8::internal::byte buffer[256]; |
310 Assembler assm(isolate, buffer, sizeof buffer); | 310 Assembler assm(isolate, buffer, sizeof buffer); |
311 CpuFeatureScope fscope(&assm, SSE2); | 311 CpuFeatureScope fscope(&assm, SSE2); |
312 __ mov(eax, Operand(esp, 4)); | 312 __ mov(eax, Operand(esp, 4)); |
313 __ cvtsi2sd(xmm0, eax); | 313 __ cvtsi2sd(xmm0, eax); |
314 // Copy xmm0 to st(0) using eight bytes of stack. | 314 // Copy xmm0 to st(0) using eight bytes of stack. |
315 __ sub(esp, Immediate(8)); | 315 __ sub(esp, Immediate(8)); |
316 __ movdbl(Operand(esp, 0), xmm0); | 316 __ movsd(Operand(esp, 0), xmm0); |
317 __ fld_d(Operand(esp, 0)); | 317 __ fld_d(Operand(esp, 0)); |
318 __ add(esp, Immediate(8)); | 318 __ add(esp, Immediate(8)); |
319 __ ret(0); | 319 __ ret(0); |
320 CodeDesc desc; | 320 CodeDesc desc; |
321 assm.GetCode(&desc); | 321 assm.GetCode(&desc); |
322 Code* code = Code::cast(isolate->heap()->CreateCode( | 322 Code* code = Code::cast(isolate->heap()->CreateCode( |
323 desc, | 323 desc, |
324 Code::ComputeFlags(Code::STUB), | 324 Code::ComputeFlags(Code::STUB), |
325 Handle<Code>())->ToObjectChecked()); | 325 Handle<Code>())->ToObjectChecked()); |
326 CHECK(code->IsCode()); | 326 CHECK(code->IsCode()); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 CcTest::InitializeVM(); | 568 CcTest::InitializeVM(); |
569 if (!CpuFeatures::IsSupported(SSE2) || | 569 if (!CpuFeatures::IsSupported(SSE2) || |
570 !CpuFeatures::IsSupported(SSE4_1)) return; | 570 !CpuFeatures::IsSupported(SSE4_1)) return; |
571 | 571 |
572 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 572 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
573 HandleScope scope(isolate); | 573 HandleScope scope(isolate); |
574 v8::internal::byte buffer[256]; | 574 v8::internal::byte buffer[256]; |
575 MacroAssembler assm(isolate, buffer, sizeof buffer); | 575 MacroAssembler assm(isolate, buffer, sizeof buffer); |
576 { CpuFeatureScope fscope2(&assm, SSE2); | 576 { CpuFeatureScope fscope2(&assm, SSE2); |
577 CpuFeatureScope fscope41(&assm, SSE4_1); | 577 CpuFeatureScope fscope41(&assm, SSE4_1); |
578 __ movdbl(xmm1, Operand(esp, 4)); | 578 __ movsd(xmm1, Operand(esp, 4)); |
579 __ extractps(eax, xmm1, 0x1); | 579 __ extractps(eax, xmm1, 0x1); |
580 __ ret(0); | 580 __ ret(0); |
581 } | 581 } |
582 | 582 |
583 CodeDesc desc; | 583 CodeDesc desc; |
584 assm.GetCode(&desc); | 584 assm.GetCode(&desc); |
585 Code* code = Code::cast(isolate->heap()->CreateCode( | 585 Code* code = Code::cast(isolate->heap()->CreateCode( |
586 desc, | 586 desc, |
587 Code::ComputeFlags(Code::STUB), | 587 Code::ComputeFlags(Code::STUB), |
588 Handle<Code>())->ToObjectChecked()); | 588 Handle<Code>())->ToObjectChecked()); |
589 CHECK(code->IsCode()); | 589 CHECK(code->IsCode()); |
590 #ifdef OBJECT_PRINT | 590 #ifdef OBJECT_PRINT |
591 Code::cast(code)->Print(); | 591 Code::cast(code)->Print(); |
592 #endif | 592 #endif |
593 | 593 |
594 F4 f = FUNCTION_CAST<F4>(Code::cast(code)->entry()); | 594 F4 f = FUNCTION_CAST<F4>(Code::cast(code)->entry()); |
595 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); | 595 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); |
596 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); | 596 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); |
597 uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678); | 597 uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678); |
598 CHECK_EQ(0x87654321, f(uint64_to_double(value2))); | 598 CHECK_EQ(0x87654321, f(uint64_to_double(value2))); |
599 } | 599 } |
600 | 600 |
601 | 601 |
602 #undef __ | 602 #undef __ |
OLD | NEW |