OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void CpuFeatures::ProbeImpl(bool cross_compile) { | 53 void CpuFeatures::ProbeImpl(bool cross_compile) { |
54 base::CPU cpu; | 54 base::CPU cpu; |
55 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. | 55 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. |
56 CHECK(cpu.has_cmov()); // CMOV support is mandatory. | 56 CHECK(cpu.has_cmov()); // CMOV support is mandatory. |
57 | 57 |
58 // Only use statically determined features for cross compile (snapshot). | 58 // Only use statically determined features for cross compile (snapshot). |
59 if (cross_compile) return; | 59 if (cross_compile) return; |
60 | 60 |
61 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; | 61 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; |
62 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; | 62 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; |
| 63 if (cpu.has_avx() && FLAG_enable_avx) supported_ |= 1u << AVX; |
| 64 if (cpu.has_fma3() && FLAG_enable_fma3) supported_ |= 1u << FMA3; |
63 } | 65 } |
64 | 66 |
65 | 67 |
66 void CpuFeatures::PrintTarget() { } | 68 void CpuFeatures::PrintTarget() { } |
67 void CpuFeatures::PrintFeatures() { } | 69 void CpuFeatures::PrintFeatures() { |
| 70 printf("SSE3=%d SSE4_1=%d AVX=%d FMA3=%d\n", CpuFeatures::IsSupported(SSE3), |
| 71 CpuFeatures::IsSupported(SSE4_1), CpuFeatures::IsSupported(AVX), |
| 72 CpuFeatures::IsSupported(FMA3)); |
| 73 } |
68 | 74 |
69 | 75 |
70 // ----------------------------------------------------------------------------- | 76 // ----------------------------------------------------------------------------- |
71 // Implementation of Displacement | 77 // Implementation of Displacement |
72 | 78 |
73 void Displacement::init(Label* L, Type type) { | 79 void Displacement::init(Label* L, Type type) { |
74 DCHECK(!L->is_bound()); | 80 DCHECK(!L->is_bound()); |
75 int next = 0; | 81 int next = 0; |
76 if (L->is_linked()) { | 82 if (L->is_linked()) { |
77 next = L->pos(); | 83 next = L->pos(); |
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 EnsureSpace ensure_space(this); | 2436 EnsureSpace ensure_space(this); |
2431 EMIT(0x66); | 2437 EMIT(0x66); |
2432 EMIT(0x0F); | 2438 EMIT(0x0F); |
2433 EMIT(0x3A); | 2439 EMIT(0x3A); |
2434 EMIT(0x22); | 2440 EMIT(0x22); |
2435 emit_sse_operand(dst, src); | 2441 emit_sse_operand(dst, src); |
2436 EMIT(offset); | 2442 EMIT(offset); |
2437 } | 2443 } |
2438 | 2444 |
2439 | 2445 |
| 2446 void Assembler::vsd(byte op, XMMRegister dst, XMMRegister src1, |
| 2447 const Operand& src2) { |
| 2448 DCHECK(IsEnabled(AVX)); |
| 2449 EnsureSpace ensure_space(this); |
| 2450 emit_vex_prefix(src1, kLIG, kF2, k0F, kWIG); |
| 2451 EMIT(op); |
| 2452 emit_sse_operand(dst, src2); |
| 2453 } |
| 2454 |
| 2455 |
2440 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { | 2456 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { |
2441 Register ireg = { reg.code() }; | 2457 Register ireg = { reg.code() }; |
2442 emit_operand(ireg, adr); | 2458 emit_operand(ireg, adr); |
2443 } | 2459 } |
2444 | 2460 |
2445 | 2461 |
2446 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { | 2462 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { |
2447 EMIT(0xC0 | dst.code() << 3 | src.code()); | 2463 EMIT(0xC0 | dst.code() << 3 | src.code()); |
2448 } | 2464 } |
2449 | 2465 |
2450 | 2466 |
2451 void Assembler::emit_sse_operand(Register dst, XMMRegister src) { | 2467 void Assembler::emit_sse_operand(Register dst, XMMRegister src) { |
2452 EMIT(0xC0 | dst.code() << 3 | src.code()); | 2468 EMIT(0xC0 | dst.code() << 3 | src.code()); |
2453 } | 2469 } |
2454 | 2470 |
2455 | 2471 |
2456 void Assembler::emit_sse_operand(XMMRegister dst, Register src) { | 2472 void Assembler::emit_sse_operand(XMMRegister dst, Register src) { |
2457 EMIT(0xC0 | (dst.code() << 3) | src.code()); | 2473 EMIT(0xC0 | (dst.code() << 3) | src.code()); |
2458 } | 2474 } |
2459 | 2475 |
2460 | 2476 |
| 2477 void Assembler::emit_vex_prefix(XMMRegister vreg, VectorLength l, SIMDPrefix pp, |
| 2478 LeadingOpcode mm, VexW w) { |
| 2479 if (mm != k0F || w != kW0) { |
| 2480 EMIT(0xc4); |
| 2481 EMIT(0xc0 | mm); |
| 2482 EMIT(w | ((~vreg.code() & 0xf) << 3) | l | pp); |
| 2483 } else { |
| 2484 EMIT(0xc5); |
| 2485 EMIT(((~vreg.code()) << 3) | l | pp); |
| 2486 } |
| 2487 } |
| 2488 |
| 2489 |
2461 void Assembler::RecordJSReturn() { | 2490 void Assembler::RecordJSReturn() { |
2462 positions_recorder()->WriteRecordedPositions(); | 2491 positions_recorder()->WriteRecordedPositions(); |
2463 EnsureSpace ensure_space(this); | 2492 EnsureSpace ensure_space(this); |
2464 RecordRelocInfo(RelocInfo::JS_RETURN); | 2493 RecordRelocInfo(RelocInfo::JS_RETURN); |
2465 } | 2494 } |
2466 | 2495 |
2467 | 2496 |
2468 void Assembler::RecordDebugBreakSlot() { | 2497 void Assembler::RecordDebugBreakSlot() { |
2469 positions_recorder()->WriteRecordedPositions(); | 2498 positions_recorder()->WriteRecordedPositions(); |
2470 EnsureSpace ensure_space(this); | 2499 EnsureSpace ensure_space(this); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 fprintf(coverage_log, "%s\n", file_line); | 2680 fprintf(coverage_log, "%s\n", file_line); |
2652 fflush(coverage_log); | 2681 fflush(coverage_log); |
2653 } | 2682 } |
2654 } | 2683 } |
2655 | 2684 |
2656 #endif | 2685 #endif |
2657 | 2686 |
2658 } } // namespace v8::internal | 2687 } } // namespace v8::internal |
2659 | 2688 |
2660 #endif // V8_TARGET_ARCH_IA32 | 2689 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |