Changeset 243293 in webkit
- Timestamp:
- Mar 21, 2019, 9:29:32 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/assembler/MacroAssemblerX86.h (modified) (3 diffs)
-
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp (modified) (1 diff)
-
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h (modified) (57 diffs)
-
Source/JavaScriptCore/offlineasm/x86.rb (modified) (11 diffs)
-
Source/JavaScriptCore/runtime/MathCommon.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Scripts/webkitdirs.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243289 r243293 1 2019-03-21 Xan Lopez <xan@igalia.com> 2 3 [JSC][x86] Drop support for x87 floating point 4 https://bugs.webkit.org/show_bug.cgi?id=194853 5 6 Reviewed by Don Olmstead. 7 8 Require SSE2 throughout the codebase, and remove x87 support where 9 it was optionally available. SSE2 detection happens at compile 10 time through a static_assert. 11 12 * assembler/MacroAssemblerX86.h: 13 (JSC::MacroAssemblerX86::storeDouble): 14 (JSC::MacroAssemblerX86::moveDoubleToInts): 15 (JSC::MacroAssemblerX86::supportsFloatingPoint): 16 (JSC::MacroAssemblerX86::supportsFloatingPointTruncate): 17 (JSC::MacroAssemblerX86::supportsFloatingPointSqrt): 18 (JSC::MacroAssemblerX86::supportsFloatingPointAbs): 19 * assembler/MacroAssemblerX86Common.cpp: 20 * assembler/MacroAssemblerX86Common.h: 21 (JSC::MacroAssemblerX86Common::moveDouble): 22 (JSC::MacroAssemblerX86Common::loadDouble): 23 (JSC::MacroAssemblerX86Common::loadFloat): 24 (JSC::MacroAssemblerX86Common::storeDouble): 25 (JSC::MacroAssemblerX86Common::storeFloat): 26 (JSC::MacroAssemblerX86Common::convertDoubleToFloat): 27 (JSC::MacroAssemblerX86Common::convertFloatToDouble): 28 (JSC::MacroAssemblerX86Common::addDouble): 29 (JSC::MacroAssemblerX86Common::addFloat): 30 (JSC::MacroAssemblerX86Common::divDouble): 31 (JSC::MacroAssemblerX86Common::divFloat): 32 (JSC::MacroAssemblerX86Common::subDouble): 33 (JSC::MacroAssemblerX86Common::subFloat): 34 (JSC::MacroAssemblerX86Common::mulDouble): 35 (JSC::MacroAssemblerX86Common::mulFloat): 36 (JSC::MacroAssemblerX86Common::convertInt32ToDouble): 37 (JSC::MacroAssemblerX86Common::convertInt32ToFloat): 38 (JSC::MacroAssemblerX86Common::branchDouble): 39 (JSC::MacroAssemblerX86Common::branchFloat): 40 (JSC::MacroAssemblerX86Common::compareDouble): 41 (JSC::MacroAssemblerX86Common::compareFloat): 42 (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32): 43 (JSC::MacroAssemblerX86Common::truncateDoubleToInt32): 44 (JSC::MacroAssemblerX86Common::truncateFloatToInt32): 45 (JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32): 46 (JSC::MacroAssemblerX86Common::branchDoubleNonZero): 47 (JSC::MacroAssemblerX86Common::branchDoubleZeroOrNaN): 48 (JSC::MacroAssemblerX86Common::lshiftPacked): 49 (JSC::MacroAssemblerX86Common::rshiftPacked): 50 (JSC::MacroAssemblerX86Common::orPacked): 51 (JSC::MacroAssemblerX86Common::move32ToFloat): 52 (JSC::MacroAssemblerX86Common::moveFloatTo32): 53 (JSC::MacroAssemblerX86Common::moveConditionallyDouble): 54 (JSC::MacroAssemblerX86Common::moveConditionallyFloat): 55 * offlineasm/x86.rb: 56 * runtime/MathCommon.cpp: 57 (JSC::operationMathPow): 58 1 59 2019-03-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 60 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
r235018 r243293 141 141 void storeDouble(FPRegisterID src, TrustedImmPtr address) 142 142 { 143 ASSERT(isSSE2Present());144 143 ASSERT(address.m_value); 145 144 m_assembler.movsd_rm(src, address.asPtr()); … … 174 173 void moveDoubleToInts(FPRegisterID src, RegisterID dest1, RegisterID dest2) 175 174 { 176 ASSERT(isSSE2Present());177 175 m_assembler.pextrw_irr(3, src, dest1); 178 176 m_assembler.pextrw_irr(2, src, dest2); … … 295 293 } 296 294 297 static bool supportsFloatingPoint() { return isSSE2Present(); }298 static bool supportsFloatingPointTruncate() { return isSSE2Present(); }299 static bool supportsFloatingPointSqrt() { return isSSE2Present(); }300 static bool supportsFloatingPointAbs() { return isSSE2Present(); }295 static bool supportsFloatingPoint() { return true; } 296 static bool supportsFloatingPointTruncate() { return true; } 297 static bool supportsFloatingPointSqrt() { return true; } 298 static bool supportsFloatingPointAbs() { return true; } 301 299 302 300 template<PtrTag resultTag, PtrTag locationTag> -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r236450 r243293 168 168 static_assert(sizeof(Probe::State) == PROBE_SIZE, "Probe::State::size's matches ctiMasmProbeTrampoline"); 169 169 static_assert((PROBE_EXECUTOR_OFFSET + PTR_SIZE) <= (PROBE_SIZE + OUT_SIZE), "Must have room after ProbeContext to stash the probe handler"); 170 171 #if CPU(X86) 172 // SSE2 is a hard requirement on x86. 173 static_assert(isSSE2Present(), "SSE2 support is required in JavaScriptCore"); 174 #endif 170 175 171 176 #undef PROBE_OFFSETOF -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r242252 r243293 1452 1452 // Floating-point operation: 1453 1453 // 1454 // Presently only supports SSE, not x87 floating point.1455 1456 1454 void moveDouble(FPRegisterID src, FPRegisterID dest) 1457 1455 { 1458 ASSERT(isSSE2Present());1459 1456 if (src != dest) 1460 1457 m_assembler.movaps_rr(src, dest); … … 1464 1461 { 1465 1462 #if CPU(X86) 1466 ASSERT(isSSE2Present());1467 1463 m_assembler.movsd_mr(address.asPtr(), dest); 1468 1464 #else … … 1474 1470 void loadDouble(ImplicitAddress address, FPRegisterID dest) 1475 1471 { 1476 ASSERT(isSSE2Present());1477 1472 m_assembler.movsd_mr(address.offset, address.base, dest); 1478 1473 } … … 1480 1475 void loadDouble(BaseIndex address, FPRegisterID dest) 1481 1476 { 1482 ASSERT(isSSE2Present());1483 1477 m_assembler.movsd_mr(address.offset, address.base, address.index, address.scale, dest); 1484 1478 } … … 1487 1481 { 1488 1482 #if CPU(X86) 1489 ASSERT(isSSE2Present());1490 1483 m_assembler.movss_mr(address.asPtr(), dest); 1491 1484 #else … … 1497 1490 void loadFloat(ImplicitAddress address, FPRegisterID dest) 1498 1491 { 1499 ASSERT(isSSE2Present());1500 1492 m_assembler.movss_mr(address.offset, address.base, dest); 1501 1493 } … … 1503 1495 void loadFloat(BaseIndex address, FPRegisterID dest) 1504 1496 { 1505 ASSERT(isSSE2Present());1506 1497 m_assembler.movss_mr(address.offset, address.base, address.index, address.scale, dest); 1507 1498 } … … 1509 1500 void storeDouble(FPRegisterID src, ImplicitAddress address) 1510 1501 { 1511 ASSERT(isSSE2Present());1512 1502 m_assembler.movsd_rm(src, address.offset, address.base); 1513 1503 } … … 1515 1505 void storeDouble(FPRegisterID src, BaseIndex address) 1516 1506 { 1517 ASSERT(isSSE2Present());1518 1507 m_assembler.movsd_rm(src, address.offset, address.base, address.index, address.scale); 1519 1508 } … … 1521 1510 void storeFloat(FPRegisterID src, ImplicitAddress address) 1522 1511 { 1523 ASSERT(isSSE2Present());1524 1512 m_assembler.movss_rm(src, address.offset, address.base); 1525 1513 } … … 1527 1515 void storeFloat(FPRegisterID src, BaseIndex address) 1528 1516 { 1529 ASSERT(isSSE2Present());1530 1517 m_assembler.movss_rm(src, address.offset, address.base, address.index, address.scale); 1531 1518 } … … 1533 1520 void convertDoubleToFloat(FPRegisterID src, FPRegisterID dst) 1534 1521 { 1535 ASSERT(isSSE2Present());1536 1522 m_assembler.cvtsd2ss_rr(src, dst); 1537 1523 } … … 1539 1525 void convertDoubleToFloat(Address address, FPRegisterID dst) 1540 1526 { 1541 ASSERT(isSSE2Present());1542 1527 m_assembler.cvtsd2ss_mr(address.offset, address.base, dst); 1543 1528 } … … 1545 1530 void convertFloatToDouble(FPRegisterID src, FPRegisterID dst) 1546 1531 { 1547 ASSERT(isSSE2Present());1548 1532 m_assembler.cvtss2sd_rr(src, dst); 1549 1533 } … … 1551 1535 void convertFloatToDouble(Address address, FPRegisterID dst) 1552 1536 { 1553 ASSERT(isSSE2Present());1554 1537 m_assembler.cvtss2sd_mr(address.offset, address.base, dst); 1555 1538 } … … 1565 1548 m_assembler.vaddsd_rr(op1, op2, dest); 1566 1549 else { 1567 ASSERT(isSSE2Present());1568 1550 if (op1 == dest) 1569 1551 m_assembler.addsd_rr(op2, dest); … … 1585 1567 m_assembler.vaddsd_mr(op1.offset, op1.base, op2, dest); 1586 1568 else { 1587 ASSERT(isSSE2Present());1588 1569 if (op2 == dest) { 1589 1570 m_assembler.addsd_mr(op1.offset, op1.base, dest); … … 1606 1587 m_assembler.vaddsd_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest); 1607 1588 else { 1608 ASSERT(isSSE2Present());1609 1589 if (op2 == dest) { 1610 1590 m_assembler.addsd_mr(op1.offset, op1.base, op1.index, op1.scale, dest); … … 1631 1611 m_assembler.vaddss_rr(op1, op2, dest); 1632 1612 else { 1633 ASSERT(isSSE2Present());1634 1613 if (op1 == dest) 1635 1614 m_assembler.addss_rr(op2, dest); … … 1646 1625 m_assembler.vaddss_mr(op1.offset, op1.base, op2, dest); 1647 1626 else { 1648 ASSERT(isSSE2Present());1649 1627 if (op2 == dest) { 1650 1628 m_assembler.addss_mr(op1.offset, op1.base, dest); … … 1667 1645 m_assembler.vaddss_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest); 1668 1646 else { 1669 ASSERT(isSSE2Present());1670 1647 if (op2 == dest) { 1671 1648 m_assembler.addss_mr(op1.offset, op1.base, op1.index, op1.scale, dest); … … 1679 1656 void divDouble(FPRegisterID src, FPRegisterID dest) 1680 1657 { 1681 ASSERT(isSSE2Present());1682 1658 m_assembler.divsd_rr(src, dest); 1683 1659 } … … 1694 1670 void divDouble(Address src, FPRegisterID dest) 1695 1671 { 1696 ASSERT(isSSE2Present());1697 1672 m_assembler.divsd_mr(src.offset, src.base, dest); 1698 1673 } … … 1700 1675 void divFloat(FPRegisterID src, FPRegisterID dest) 1701 1676 { 1702 ASSERT(isSSE2Present());1703 1677 m_assembler.divss_rr(src, dest); 1704 1678 } … … 1706 1680 void divFloat(Address src, FPRegisterID dest) 1707 1681 { 1708 ASSERT(isSSE2Present());1709 1682 m_assembler.divss_mr(src.offset, src.base, dest); 1710 1683 } … … 1720 1693 m_assembler.vsubsd_rr(op1, op2, dest); 1721 1694 else { 1722 ASSERT(isSSE2Present());1723 1724 1695 // B := A - B is invalid. 1725 1696 ASSERT(op1 == dest || op2 != dest); … … 1764 1735 m_assembler.vsubss_rr(op1, op2, dest); 1765 1736 else { 1766 ASSERT(isSSE2Present());1767 1737 // B := A - B is invalid. 1768 1738 ASSERT(op1 == dest || op2 != dest); … … 1807 1777 m_assembler.vmulsd_rr(op1, op2, dest); 1808 1778 else { 1809 ASSERT(isSSE2Present());1810 1779 if (op1 == dest) 1811 1780 m_assembler.mulsd_rr(op2, dest); … … 1827 1796 m_assembler.vmulsd_mr(op1.offset, op1.base, op2, dest); 1828 1797 else { 1829 ASSERT(isSSE2Present());1830 1798 if (op2 == dest) { 1831 1799 m_assembler.mulsd_mr(op1.offset, op1.base, dest); … … 1847 1815 m_assembler.vmulsd_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest); 1848 1816 else { 1849 ASSERT(isSSE2Present());1850 1817 if (op2 == dest) { 1851 1818 m_assembler.mulsd_mr(op1.offset, op1.base, op1.index, op1.scale, dest); … … 1872 1839 m_assembler.vmulss_rr(op1, op2, dest); 1873 1840 else { 1874 ASSERT(isSSE2Present());1875 1841 if (op1 == dest) 1876 1842 m_assembler.mulss_rr(op2, dest); … … 1887 1853 m_assembler.vmulss_mr(op1.offset, op1.base, op2, dest); 1888 1854 else { 1889 ASSERT(isSSE2Present());1890 1855 if (op2 == dest) { 1891 1856 m_assembler.mulss_mr(op1.offset, op1.base, dest); … … 1907 1872 m_assembler.vmulss_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest); 1908 1873 else { 1909 ASSERT(isSSE2Present());1910 1874 if (op2 == dest) { 1911 1875 m_assembler.mulss_mr(op1.offset, op1.base, op1.index, op1.scale, dest); … … 2010 1974 void convertInt32ToDouble(RegisterID src, FPRegisterID dest) 2011 1975 { 2012 ASSERT(isSSE2Present());2013 1976 m_assembler.cvtsi2sd_rr(src, dest); 2014 1977 } … … 2016 1979 void convertInt32ToDouble(Address src, FPRegisterID dest) 2017 1980 { 2018 ASSERT(isSSE2Present());2019 1981 m_assembler.cvtsi2sd_mr(src.offset, src.base, dest); 2020 1982 } … … 2022 1984 void convertInt32ToFloat(RegisterID src, FPRegisterID dest) 2023 1985 { 2024 ASSERT(isSSE2Present());2025 1986 m_assembler.cvtsi2ss_rr(src, dest); 2026 1987 } … … 2028 1989 void convertInt32ToFloat(Address src, FPRegisterID dest) 2029 1990 { 2030 ASSERT(isSSE2Present());2031 1991 m_assembler.cvtsi2ss_mr(src.offset, src.base, dest); 2032 1992 } … … 2034 1994 Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) 2035 1995 { 2036 ASSERT(isSSE2Present());2037 2038 1996 if (cond & DoubleConditionBitInvert) 2039 1997 m_assembler.ucomisd_rr(left, right); … … 2045 2003 Jump branchFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right) 2046 2004 { 2047 ASSERT(isSSE2Present());2048 2049 2005 if (cond & DoubleConditionBitInvert) 2050 2006 m_assembler.ucomiss_rr(left, right); … … 2056 2012 void compareDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID dest) 2057 2013 { 2058 ASSERT(isSSE2Present());2059 2014 floatingPointCompare(cond, left, right, dest, [this] (FPRegisterID arg1, FPRegisterID arg2) { 2060 2015 m_assembler.ucomisd_rr(arg1, arg2); … … 2064 2019 void compareFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID dest) 2065 2020 { 2066 ASSERT(isSSE2Present());2067 2021 floatingPointCompare(cond, left, right, dest, [this] (FPRegisterID arg1, FPRegisterID arg2) { 2068 2022 m_assembler.ucomiss_rr(arg1, arg2); … … 2077 2031 Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed) 2078 2032 { 2079 ASSERT(isSSE2Present());2080 2033 m_assembler.cvttsd2si_rr(src, dest); 2081 2034 return branch32(branchType ? NotEqual : Equal, dest, TrustedImm32(0x80000000)); … … 2084 2037 void truncateDoubleToInt32(FPRegisterID src, RegisterID dest) 2085 2038 { 2086 ASSERT(isSSE2Present());2087 2039 m_assembler.cvttsd2si_rr(src, dest); 2088 2040 } … … 2090 2042 void truncateFloatToInt32(FPRegisterID src, RegisterID dest) 2091 2043 { 2092 ASSERT(isSSE2Present());2093 2044 m_assembler.cvttss2si_rr(src, dest); 2094 2045 } … … 2100 2051 void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp, bool negZeroCheck = true) 2101 2052 { 2102 ASSERT(isSSE2Present());2103 2053 m_assembler.cvttsd2si_rr(src, dest); 2104 2054 … … 2130 2080 Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch) 2131 2081 { 2132 ASSERT(isSSE2Present());2133 2082 m_assembler.xorpd_rr(scratch, scratch); 2134 2083 return branchDouble(DoubleNotEqual, reg, scratch); … … 2137 2086 Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch) 2138 2087 { 2139 ASSERT(isSSE2Present());2140 2088 m_assembler.xorpd_rr(scratch, scratch); 2141 2089 return branchDouble(DoubleEqualOrUnordered, reg, scratch); … … 2144 2092 void lshiftPacked(TrustedImm32 imm, XMMRegisterID reg) 2145 2093 { 2146 ASSERT(isSSE2Present());2147 2094 m_assembler.psllq_i8r(imm.m_value, reg); 2148 2095 } … … 2150 2097 void rshiftPacked(TrustedImm32 imm, XMMRegisterID reg) 2151 2098 { 2152 ASSERT(isSSE2Present());2153 2099 m_assembler.psrlq_i8r(imm.m_value, reg); 2154 2100 } … … 2156 2102 void orPacked(XMMRegisterID src, XMMRegisterID dst) 2157 2103 { 2158 ASSERT(isSSE2Present());2159 2104 m_assembler.por_rr(src, dst); 2160 2105 } … … 2162 2107 void move32ToFloat(RegisterID src, XMMRegisterID dst) 2163 2108 { 2164 ASSERT(isSSE2Present());2165 2109 m_assembler.movd_rr(src, dst); 2166 2110 } … … 2168 2112 void moveFloatTo32(XMMRegisterID src, RegisterID dst) 2169 2113 { 2170 ASSERT(isSSE2Present());2171 2114 m_assembler.movd_rr(src, dst); 2172 2115 } … … 2253 2196 void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest) 2254 2197 { 2255 ASSERT(isSSE2Present());2256 2257 2198 if (cond & DoubleConditionBitInvert) 2258 2199 m_assembler.ucomisd_rr(left, right); … … 2264 2205 void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID thenCase, RegisterID elseCase, RegisterID dest) 2265 2206 { 2266 ASSERT(isSSE2Present());2267 2268 2207 if (thenCase != dest && elseCase != dest) { 2269 2208 move(elseCase, dest); … … 2288 2227 void moveConditionallyFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest) 2289 2228 { 2290 ASSERT(isSSE2Present());2291 2292 2229 if (cond & DoubleConditionBitInvert) 2293 2230 m_assembler.ucomiss_rr(left, right); … … 2299 2236 void moveConditionallyFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID thenCase, RegisterID elseCase, RegisterID dest) 2300 2237 { 2301 ASSERT(isSSE2Present());2302 2303 2238 if (thenCase != dest && elseCase != dest) { 2304 2239 move(elseCase, dest); … … 2385 2320 void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest) 2386 2321 { 2387 ASSERT(isSSE2Present());2388 2389 2322 if (cond & DoubleConditionBitInvert) 2390 2323 m_assembler.ucomisd_rr(left, right); -
trunk/Source/JavaScriptCore/offlineasm/x86.rb
r240241 r243293 111 111 end 112 112 113 def useX87114 case $activeBackend115 when "X86"116 true117 when "X86_WIN"118 true119 when "X86_64"120 false121 when "X86_64_WIN"122 false123 else124 raise "bad value for $activeBackend: #{$activeBackend}"125 end126 end127 128 113 def isMSVC 129 114 $options.has_key?(:assembler) && $options[:assembler] == "MASM" … … 342 327 def x86Operand(kind) 343 328 raise unless kind == :double 344 raise if useX87345 329 case name 346 330 when "ft0", "fa0", "fr" … … 359 343 raise "Bad register #{name} for X86 at #{codeOriginString}" 360 344 end 361 end362 def x87DefaultStackPosition363 case name364 when "ft0", "fr"365 0366 when "ft1"367 1368 when "ft2", "ft3", "ft4", "ft5"369 raise "Unimplemented register #{name} for X86 at #{codeOriginString}"370 else371 raise "Bad register #{name} for X86 at #{codeOriginString}"372 end373 end374 def x87Operand(offset)375 raise unless useX87376 raise unless offset == 0 or offset == 1377 "#{register("st")}(#{x87DefaultStackPosition + offset})"378 345 end 379 346 def x86CallOperand(kind) … … 562 529 isX64 ? "q" : raise 563 530 when :double 564 not useX87 ? "sd" : raise531 "sd" 565 532 else 566 533 raise … … 634 601 635 602 def handleX86DoubleBranch(branchOpcode, mode) 636 if useX87 637 handleX87Compare(mode) 638 else 639 case mode 640 when :normal 641 $asm.puts "ucomisd #{orderOperands(operands[1].x86Operand(:double), operands[0].x86Operand(:double))}" 642 when :reverse 643 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 644 else 645 raise mode.inspect 646 end 603 case mode 604 when :normal 605 $asm.puts "ucomisd #{orderOperands(operands[1].x86Operand(:double), operands[0].x86Operand(:double))}" 606 when :reverse 607 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 608 else 609 raise mode.inspect 647 610 end 648 611 $asm.puts "#{branchOpcode} #{operands[2].asmLabel}" … … 859 822 $asm.puts "mov#{x86Suffix(:ptr)} #{x86Operands(:ptr, :ptr)}" 860 823 end 861 end862 end863 864 def handleX87Compare(mode)865 floatingPointCompareImplicitOperand = getImplicitOperandString866 case mode867 when :normal868 if (operands[0].x87DefaultStackPosition == 0)869 $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"870 else871 $asm.puts "fld #{operands[0].x87Operand(0)}"872 $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"873 end874 when :reverse875 if (operands[1].x87DefaultStackPosition == 0)876 $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"877 else878 $asm.puts "fld #{operands[1].x87Operand(0)}"879 $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"880 end881 else882 raise mode.inspect883 end884 end885 886 def handleX87BinOp(opcode, opcodereverse)887 if (operands[1].x87DefaultStackPosition == 0)888 $asm.puts "#{opcode} #{orderOperands(operands[0].x87Operand(0), register("st"))}"889 elsif (operands[0].x87DefaultStackPosition == 0)890 if !isIntelSyntax891 $asm.puts "#{opcodereverse} #{register("st")}, #{operands[1].x87Operand(0)}"892 else893 $asm.puts "#{opcode} #{operands[1].x87Operand(0)}, #{register("st")}"894 end895 else896 $asm.puts "fld #{operands[0].x87Operand(0)}"897 $asm.puts "#{opcodereverse}p #{orderOperands(register("st"), operands[1].x87Operand(1))}"898 824 end 899 825 end … … 1040 966 $asm.puts "mov#{x86Suffix(:byte)} #{x86Operands(:byte, :byte)}" 1041 967 when "loadd" 1042 if useX87 1043 if !isIntelSyntax 1044 $asm.puts "fldl #{operands[0].x86Operand(:double)}" 1045 else 1046 $asm.puts "fld #{operands[0].x86Operand(:double)}" 1047 end 1048 $asm.puts "fstp #{operands[1].x87Operand(1)}" 1049 else 1050 $asm.puts "movsd #{x86Operands(:double, :double)}" 1051 end 968 $asm.puts "movsd #{x86Operands(:double, :double)}" 1052 969 when "moved" 1053 if useX87 1054 if (operands[0].x87DefaultStackPosition == 0) 1055 $asm.puts "fst #{operands[1].x87Operand(0)}" 1056 else 1057 $asm.puts "fld #{operands[0].x87Operand(0)}" 1058 $asm.puts "fstp #{operands[1].x87Operand(1)}" 1059 end 1060 else 1061 $asm.puts "movsd #{x86Operands(:double, :double)}" 1062 end 970 $asm.puts "movsd #{x86Operands(:double, :double)}" 1063 971 when "stored" 1064 if useX87 1065 if (operands[0].x87DefaultStackPosition == 0) 1066 $asm.puts "fst#{x86Suffix(:int)} #{operands[1].x86Operand(:double)}" 1067 else 1068 $asm.puts "fld #{operands[0].x87Operand(0)}" 1069 if !isIntelSyntax 1070 $asm.puts "fstpl #{operands[1].x86Operand(:double)}" 1071 else 1072 $asm.puts "fstp #{operands[1].x86Operand(:double)}" 1073 end 1074 end 1075 else 1076 $asm.puts "movsd #{x86Operands(:double, :double)}" 1077 end 972 $asm.puts "movsd #{x86Operands(:double, :double)}" 1078 973 when "addd" 1079 if useX87 1080 handleX87BinOp("fadd", "fadd") 1081 else 1082 $asm.puts "addsd #{x86Operands(:double, :double)}" 1083 end 974 $asm.puts "addsd #{x86Operands(:double, :double)}" 1084 975 when "muld" 1085 if useX87 1086 handleX87BinOp("fmul", "fmul") 1087 else 1088 $asm.puts "mulsd #{x86Operands(:double, :double)}" 1089 end 976 $asm.puts "mulsd #{x86Operands(:double, :double)}" 1090 977 when "subd" 1091 if useX87 1092 handleX87BinOp("fsub", "fsubr") 1093 else 1094 $asm.puts "subsd #{x86Operands(:double, :double)}" 1095 end 978 $asm.puts "subsd #{x86Operands(:double, :double)}" 1096 979 when "divd" 1097 if useX87 1098 handleX87BinOp("fdiv", "fdivr") 1099 else 1100 $asm.puts "divsd #{x86Operands(:double, :double)}" 1101 end 980 $asm.puts "divsd #{x86Operands(:double, :double)}" 1102 981 when "sqrtd" 1103 if useX87 1104 $asm.puts "fld #{operands[0].x87Operand(0)}" 1105 $asm.puts "fsqrtl" 1106 $asm.puts "fstp #{operands[1].x87Operand(1)}" 1107 else 1108 $asm.puts "sqrtsd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:double)}" 1109 end 982 $asm.puts "sqrtsd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:double)}" 1110 983 when "ci2d" 1111 if useX87 1112 sp = RegisterID.new(nil, "sp") 1113 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(operands[0].x86Operand(:int), offsetRegister(-4, sp.x86Operand(:ptr)))}" 1114 $asm.puts "fild#{x86Suffix(:ptr)} #{getSizeString(:ptr)}#{offsetRegister(-4, sp.x86Operand(:ptr))}" 1115 $asm.puts "fstp #{operands[1].x87Operand(1)}" 1116 else 1117 $asm.puts "cvtsi2sd #{orderOperands(operands[0].x86Operand(:int), operands[1].x86Operand(:double))}" 1118 end 984 $asm.puts "cvtsi2sd #{orderOperands(operands[0].x86Operand(:int), operands[1].x86Operand(:double))}" 1119 985 when "bdeq" 1120 if useX87 1121 handleX87Compare(:normal) 1122 else 1123 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 1124 end 986 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 1125 987 if operands[0] == operands[1] 1126 988 # This is just a jump ordered, which is a jnp. … … 1145 1007 handleX86DoubleBranch("je", :normal) 1146 1008 when "bdnequn" 1147 if useX87 1148 handleX87Compare(:normal) 1149 else 1150 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 1151 end 1009 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}" 1152 1010 if operands[0] == operands[1] 1153 1011 # This is just a jump unordered, which is a jp. … … 1171 1029 handleX86DoubleBranch("jbe", :normal) 1172 1030 when "btd2i" 1173 # FIXME: unused and unimplemented for x871174 raise if useX871175 1031 $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1176 1032 $asm.puts "cmpl $0x80000000 #{operands[1].x86Operand(:int)}" 1177 1033 $asm.puts "je #{operands[2].asmLabel}" 1178 1034 when "td2i" 1179 # FIXME: unused and unimplemented for x871180 raise if useX871181 1035 $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1182 1036 when "bcd2i" 1183 if useX87 1184 floatingPointCompareImplicitOperand = getImplicitOperandString 1185 sp = RegisterID.new(nil, "sp") 1186 if (operands[0].x87DefaultStackPosition == 0) 1187 $asm.puts "fistl -4(#{sp.x86Operand(:ptr)})" 1188 else 1189 $asm.puts "fld #{operands[0].x87Operand(0)}" 1190 $asm.puts "fistp#{x86Suffix(:ptr)} #{getSizeString(:ptr)}#{offsetRegister(-4, sp.x86Operand(:ptr))}" 1191 end 1192 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(offsetRegister(-4, sp.x86Operand(:ptr)), operands[1].x86Operand(:int))}" 1193 $asm.puts "test#{x86Suffix(:int)} #{operands[1].x86Operand(:int)}, #{operands[1].x86Operand(:int)}" 1194 $asm.puts "je #{operands[2].asmLabel}" 1195 $asm.puts "fild#{x86Suffix(:int)} #{getSizeString(:int)}#{offsetRegister(-4, sp.x86Operand(:ptr))}" 1196 $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}" 1197 $asm.puts "jp #{operands[2].asmLabel}" 1198 $asm.puts "jne #{operands[2].asmLabel}" 1199 else 1200 $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1201 $asm.puts "test#{x86Suffix(:int)} #{operands[1].x86Operand(:int)}, #{operands[1].x86Operand(:int)}" 1202 $asm.puts "je #{operands[2].asmLabel}" 1203 $asm.puts "cvtsi2sd #{operands[1].x86Operand(:int)}, %xmm7" 1204 $asm.puts "ucomisd #{operands[0].x86Operand(:double)}, %xmm7" 1205 $asm.puts "jp #{operands[2].asmLabel}" 1206 $asm.puts "jne #{operands[2].asmLabel}" 1207 end 1037 $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1038 $asm.puts "test#{x86Suffix(:int)} #{operands[1].x86Operand(:int)}, #{operands[1].x86Operand(:int)}" 1039 $asm.puts "je #{operands[2].asmLabel}" 1040 $asm.puts "cvtsi2sd #{operands[1].x86Operand(:int)}, %xmm7" 1041 $asm.puts "ucomisd #{operands[0].x86Operand(:double)}, %xmm7" 1042 $asm.puts "jp #{operands[2].asmLabel}" 1043 $asm.puts "jne #{operands[2].asmLabel}" 1208 1044 when "movdz" 1209 if useX87 1210 $asm.puts "fldzl" 1211 $asm.puts "fstp #{operands[0].x87Operand(1)}" 1212 else 1213 $asm.puts "xorpd #{operands[0].x86Operand(:double)}, #{operands[0].x86Operand(:double)}" 1214 end 1045 $asm.puts "xorpd #{operands[0].x86Operand(:double)}, #{operands[0].x86Operand(:double)}" 1215 1046 when "pop" 1216 1047 operands.each { … … 1392 1223 $asm.puts "int #{const(3)}" 1393 1224 when "call" 1394 if useX871395 2.times {1396 | offset |1397 $asm.puts "ffree #{register("st")}(#{offset})"1398 }1399 end1400 1225 op = operands[0].x86CallOperand(:ptr) 1401 1226 if operands[0].is_a? LabelReference … … 1518 1343 $asm.puts "idiv#{x86Suffix(:int)} #{operands[0].x86Operand(:int)}" 1519 1344 when "fii2d" 1520 if useX87 1521 sp = RegisterID.new(nil, "sp") 1522 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(operands[0].x86Operand(:int), offsetRegister(-8, sp.x86Operand(:ptr)))}" 1523 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(operands[1].x86Operand(:int), offsetRegister(-4, sp.x86Operand(:ptr)))}" 1524 $asm.puts "fld#{x86Suffix(:ptr)} #{getSizeString(:double)}#{offsetRegister(-8, sp.x86Operand(:ptr))}" 1525 $asm.puts "fstp #{operands[2].x87Operand(1)}" 1526 else 1527 $asm.puts "movd #{operands[0].x86Operand(:int)}, #{operands[2].x86Operand(:double)}" 1528 $asm.puts "movd #{operands[1].x86Operand(:int)}, %xmm7" 1529 $asm.puts "psllq $32, %xmm7" 1530 $asm.puts "por %xmm7, #{operands[2].x86Operand(:double)}" 1531 end 1345 $asm.puts "movd #{operands[0].x86Operand(:int)}, #{operands[2].x86Operand(:double)}" 1346 $asm.puts "movd #{operands[1].x86Operand(:int)}, %xmm7" 1347 $asm.puts "psllq $32, %xmm7" 1348 $asm.puts "por %xmm7, #{operands[2].x86Operand(:double)}" 1532 1349 when "fd2ii" 1533 if useX87 1534 sp = RegisterID.new(nil, "sp") 1535 if (operands[0].x87DefaultStackPosition == 0) 1536 $asm.puts "fst#{x86Suffix(:ptr)} #{getSizeString(:double)}#{offsetRegister(-8, sp.x86Operand(:ptr))}" 1537 else 1538 $asm.puts "fld #{operands[0].x87Operand(0)}" 1539 $asm.puts "fstpl -8(#{sp.x86Operand(:ptr)})" 1540 end 1541 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(offsetRegister(-8, sp.x86Operand(:ptr)), operands[1].x86Operand(:int))}" 1542 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(offsetRegister(-4, sp.x86Operand(:ptr)), operands[2].x86Operand(:int))}" 1543 else 1544 $asm.puts "movd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1545 $asm.puts "movsd #{operands[0].x86Operand(:double)}, %xmm7" 1546 $asm.puts "psrlq $32, %xmm7" 1547 $asm.puts "movd %xmm7, #{operands[2].x86Operand(:int)}" 1548 end 1350 $asm.puts "movd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}" 1351 $asm.puts "movsd #{operands[0].x86Operand(:double)}, %xmm7" 1352 $asm.puts "psrlq $32, %xmm7" 1353 $asm.puts "movd %xmm7, #{operands[2].x86Operand(:int)}" 1549 1354 when "fq2d" 1550 if useX87 1551 sp = RegisterID.new(nil, "sp") 1552 $asm.puts "movq #{operands[0].x86Operand(:quad)}, -8(#{sp.x86Operand(:ptr)})" 1553 $asm.puts "fldl -8(#{sp.x86Operand(:ptr)})" 1554 $asm.puts "fstp #{operands[1].x87Operand(1)}" 1555 else 1556 if !isIntelSyntax 1557 $asm.puts "movq #{operands[0].x86Operand(:quad)}, #{operands[1].x86Operand(:double)}" 1558 else 1559 # MASM does not accept register operands with movq. 1560 # Debugging shows that movd actually moves a qword when using MASM. 1561 $asm.puts "movd #{operands[1].x86Operand(:double)}, #{operands[0].x86Operand(:quad)}" 1562 end 1355 if !isIntelSyntax 1356 $asm.puts "movq #{operands[0].x86Operand(:quad)}, #{operands[1].x86Operand(:double)}" 1357 else 1358 # MASM does not accept register operands with movq. 1359 # Debugging shows that movd actually moves a qword when using MASM. 1360 $asm.puts "movd #{operands[1].x86Operand(:double)}, #{operands[0].x86Operand(:quad)}" 1563 1361 end 1564 1362 when "fd2q" 1565 if useX87 1566 sp = RegisterID.new(nil, "sp") 1567 if (operands[0].x87DefaultStackPosition == 0) 1568 $asm.puts "fst#{x86Suffix(:int)} #{getSizeString(:int)}#{offsetRegister(-8, sp.x86Operand(:ptr))}" 1569 else 1570 $asm.puts "fld #{operands[0].x87Operand(0)}" 1571 $asm.puts "fstpl -8(#{sp.x86Operand(:ptr)})" 1572 end 1573 $asm.puts "movq -8(#{sp.x86Operand(:ptr)}), #{operands[1].x86Operand(:quad)}" 1574 else 1575 if !isIntelSyntax 1576 $asm.puts "movq #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:quad)}" 1577 else 1578 # MASM does not accept register operands with movq. 1579 # Debugging shows that movd actually moves a qword when using MASM. 1580 $asm.puts "movd #{operands[1].x86Operand(:quad)}, #{operands[0].x86Operand(:double)}" 1581 end 1363 if !isIntelSyntax 1364 $asm.puts "movq #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:quad)}" 1365 else 1366 # MASM does not accept register operands with movq. 1367 # Debugging shows that movd actually moves a qword when using MASM. 1368 $asm.puts "movd #{operands[1].x86Operand(:quad)}, #{operands[0].x86Operand(:double)}" 1582 1369 end 1583 1370 when "bo" -
trunk/Source/JavaScriptCore/runtime/MathCommon.cpp
r237266 r243293 438 438 if (static_cast<double>(yAsInt) == y && yAsInt >= 0 && yAsInt <= maxExponentForIntegerMathPow) { 439 439 // If the exponent is a small positive int32 integer, we do a fast exponentiation 440 441 // Do not use x87 values for accumulation. x87 values has 80bit precision. 442 // The result produced by x87's 80bit double precision differs from the one calculated with SSE2 in DFG. 443 // Using volatile double is workaround for this problem. By specifying volatile, we expect that `result` and `xd` 444 // are stored in the stack. And at that time, we expect that they are rounded by fst/fstp[1, 2]. 445 // [1]: https://gcc.gnu.org/wiki/x87note 446 // [2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 447 #if !CPU(X86) || (defined(__SSE2_MATH__) && defined(__SSE2__)) 448 typedef double DoubleValue; 449 #else 450 typedef volatile double DoubleValue; 451 #endif 452 DoubleValue result = 1; 453 DoubleValue xd = x; 440 double result = 1; 441 double xd = x; 454 442 while (yAsInt) { 455 443 if (yAsInt & 1) -
trunk/Tools/ChangeLog
r243289 r243293 1 2019-03-21 Xan Lopez <xan@igalia.com> 2 3 [JSC][x86] Drop support for x87 floating point 4 https://bugs.webkit.org/show_bug.cgi?id=194853 5 6 Reviewed by Don Olmstead. 7 8 Force SSE2 on x86/32bit builds. 9 10 * Scripts/webkitdirs.pm: 11 (generateBuildSystemFromCMakeProject): 12 1 13 2019-03-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/Tools/Scripts/webkitdirs.pm
r243179 r243293 2278 2278 2279 2279 # Compiler options to keep floating point values consistent 2280 # between 32-bit and 64-bit architectures. 2280 # between 32-bit and 64-bit architectures. This makes us use SSE 2281 # when our architecture is 32-bit ('i686') or when it's not but 2282 # the user has requested a 32-bit build. 2281 2283 if ((architecture() eq "i686" || (architecture() eq "x86_64" && shouldBuild32Bit())) && !isCrossCompilation() && !isAnyWindows()) { 2282 2284 $ENV{'CFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . ($ENV{'CFLAGS'} || "");
Note:
See TracChangeset
for help on using the changeset viewer.