⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243293 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 9:29:32 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[JSC][x86] Drop support for x87 floating point
https://bugs.webkit.org/show_bug.cgi?id=194853

Patch by Xan Lopez <Xan Lopez> on 2019-03-21
Reviewed by Don Olmstead.

Source/JavaScriptCore:

Require SSE2 throughout the codebase, and remove x87 support where
it was optionally available. SSE2 detection happens at compile
time through a static_assert.

  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::storeDouble):
(JSC::MacroAssemblerX86::moveDoubleToInts):
(JSC::MacroAssemblerX86::supportsFloatingPoint):
(JSC::MacroAssemblerX86::supportsFloatingPointTruncate):
(JSC::MacroAssemblerX86::supportsFloatingPointSqrt):
(JSC::MacroAssemblerX86::supportsFloatingPointAbs):

  • assembler/MacroAssemblerX86Common.cpp:
  • assembler/MacroAssemblerX86Common.h:

(JSC::MacroAssemblerX86Common::moveDouble):
(JSC::MacroAssemblerX86Common::loadDouble):
(JSC::MacroAssemblerX86Common::loadFloat):
(JSC::MacroAssemblerX86Common::storeDouble):
(JSC::MacroAssemblerX86Common::storeFloat):
(JSC::MacroAssemblerX86Common::convertDoubleToFloat):
(JSC::MacroAssemblerX86Common::convertFloatToDouble):
(JSC::MacroAssemblerX86Common::addDouble):
(JSC::MacroAssemblerX86Common::addFloat):
(JSC::MacroAssemblerX86Common::divDouble):
(JSC::MacroAssemblerX86Common::divFloat):
(JSC::MacroAssemblerX86Common::subDouble):
(JSC::MacroAssemblerX86Common::subFloat):
(JSC::MacroAssemblerX86Common::mulDouble):
(JSC::MacroAssemblerX86Common::mulFloat):
(JSC::MacroAssemblerX86Common::convertInt32ToDouble):
(JSC::MacroAssemblerX86Common::convertInt32ToFloat):
(JSC::MacroAssemblerX86Common::branchDouble):
(JSC::MacroAssemblerX86Common::branchFloat):
(JSC::MacroAssemblerX86Common::compareDouble):
(JSC::MacroAssemblerX86Common::compareFloat):
(JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
(JSC::MacroAssemblerX86Common::truncateDoubleToInt32):
(JSC::MacroAssemblerX86Common::truncateFloatToInt32):
(JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32):
(JSC::MacroAssemblerX86Common::branchDoubleNonZero):
(JSC::MacroAssemblerX86Common::branchDoubleZeroOrNaN):
(JSC::MacroAssemblerX86Common::lshiftPacked):
(JSC::MacroAssemblerX86Common::rshiftPacked):
(JSC::MacroAssemblerX86Common::orPacked):
(JSC::MacroAssemblerX86Common::move32ToFloat):
(JSC::MacroAssemblerX86Common::moveFloatTo32):
(JSC::MacroAssemblerX86Common::moveConditionallyDouble):
(JSC::MacroAssemblerX86Common::moveConditionallyFloat):

  • offlineasm/x86.rb:
  • runtime/MathCommon.cpp:

(JSC::operationMathPow):

Tools:

Force SSE2 on x86/32bit builds.

  • Scripts/webkitdirs.pm:

(generateBuildSystemFromCMakeProject):

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r243289 r243293  
     12019-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
    1592019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    260
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h

    r235018 r243293  
    141141    void storeDouble(FPRegisterID src, TrustedImmPtr address)
    142142    {
    143         ASSERT(isSSE2Present());
    144143        ASSERT(address.m_value);
    145144        m_assembler.movsd_rm(src, address.asPtr());
     
    174173    void moveDoubleToInts(FPRegisterID src, RegisterID dest1, RegisterID dest2)
    175174    {
    176         ASSERT(isSSE2Present());
    177175        m_assembler.pextrw_irr(3, src, dest1);
    178176        m_assembler.pextrw_irr(2, src, dest2);
     
    295293    }
    296294
    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; }
    301299
    302300    template<PtrTag resultTag, PtrTag locationTag>
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

    r236450 r243293  
    168168static_assert(sizeof(Probe::State) == PROBE_SIZE, "Probe::State::size's matches ctiMasmProbeTrampoline");
    169169static_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.
     173static_assert(isSSE2Present(), "SSE2 support is required in JavaScriptCore");
     174#endif
    170175
    171176#undef PROBE_OFFSETOF
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r242252 r243293  
    14521452    // Floating-point operation:
    14531453    //
    1454     // Presently only supports SSE, not x87 floating point.
    1455 
    14561454    void moveDouble(FPRegisterID src, FPRegisterID dest)
    14571455    {
    1458         ASSERT(isSSE2Present());
    14591456        if (src != dest)
    14601457            m_assembler.movaps_rr(src, dest);
     
    14641461    {
    14651462#if CPU(X86)
    1466         ASSERT(isSSE2Present());
    14671463        m_assembler.movsd_mr(address.asPtr(), dest);
    14681464#else
     
    14741470    void loadDouble(ImplicitAddress address, FPRegisterID dest)
    14751471    {
    1476         ASSERT(isSSE2Present());
    14771472        m_assembler.movsd_mr(address.offset, address.base, dest);
    14781473    }
     
    14801475    void loadDouble(BaseIndex address, FPRegisterID dest)
    14811476    {
    1482         ASSERT(isSSE2Present());
    14831477        m_assembler.movsd_mr(address.offset, address.base, address.index, address.scale, dest);
    14841478    }
     
    14871481    {
    14881482#if CPU(X86)
    1489         ASSERT(isSSE2Present());
    14901483        m_assembler.movss_mr(address.asPtr(), dest);
    14911484#else
     
    14971490    void loadFloat(ImplicitAddress address, FPRegisterID dest)
    14981491    {
    1499         ASSERT(isSSE2Present());
    15001492        m_assembler.movss_mr(address.offset, address.base, dest);
    15011493    }
     
    15031495    void loadFloat(BaseIndex address, FPRegisterID dest)
    15041496    {
    1505         ASSERT(isSSE2Present());
    15061497        m_assembler.movss_mr(address.offset, address.base, address.index, address.scale, dest);
    15071498    }
     
    15091500    void storeDouble(FPRegisterID src, ImplicitAddress address)
    15101501    {
    1511         ASSERT(isSSE2Present());
    15121502        m_assembler.movsd_rm(src, address.offset, address.base);
    15131503    }
     
    15151505    void storeDouble(FPRegisterID src, BaseIndex address)
    15161506    {
    1517         ASSERT(isSSE2Present());
    15181507        m_assembler.movsd_rm(src, address.offset, address.base, address.index, address.scale);
    15191508    }
     
    15211510    void storeFloat(FPRegisterID src, ImplicitAddress address)
    15221511    {
    1523         ASSERT(isSSE2Present());
    15241512        m_assembler.movss_rm(src, address.offset, address.base);
    15251513    }
     
    15271515    void storeFloat(FPRegisterID src, BaseIndex address)
    15281516    {
    1529         ASSERT(isSSE2Present());
    15301517        m_assembler.movss_rm(src, address.offset, address.base, address.index, address.scale);
    15311518    }
     
    15331520    void convertDoubleToFloat(FPRegisterID src, FPRegisterID dst)
    15341521    {
    1535         ASSERT(isSSE2Present());
    15361522        m_assembler.cvtsd2ss_rr(src, dst);
    15371523    }
     
    15391525    void convertDoubleToFloat(Address address, FPRegisterID dst)
    15401526    {
    1541         ASSERT(isSSE2Present());
    15421527        m_assembler.cvtsd2ss_mr(address.offset, address.base, dst);
    15431528    }
     
    15451530    void convertFloatToDouble(FPRegisterID src, FPRegisterID dst)
    15461531    {
    1547         ASSERT(isSSE2Present());
    15481532        m_assembler.cvtss2sd_rr(src, dst);
    15491533    }
     
    15511535    void convertFloatToDouble(Address address, FPRegisterID dst)
    15521536    {
    1553         ASSERT(isSSE2Present());
    15541537        m_assembler.cvtss2sd_mr(address.offset, address.base, dst);
    15551538    }
     
    15651548            m_assembler.vaddsd_rr(op1, op2, dest);
    15661549        else {
    1567             ASSERT(isSSE2Present());
    15681550            if (op1 == dest)
    15691551                m_assembler.addsd_rr(op2, dest);
     
    15851567            m_assembler.vaddsd_mr(op1.offset, op1.base, op2, dest);
    15861568        else {
    1587             ASSERT(isSSE2Present());
    15881569            if (op2 == dest) {
    15891570                m_assembler.addsd_mr(op1.offset, op1.base, dest);
     
    16061587            m_assembler.vaddsd_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest);
    16071588        else {
    1608             ASSERT(isSSE2Present());
    16091589            if (op2 == dest) {
    16101590                m_assembler.addsd_mr(op1.offset, op1.base, op1.index, op1.scale, dest);
     
    16311611            m_assembler.vaddss_rr(op1, op2, dest);
    16321612        else {
    1633             ASSERT(isSSE2Present());
    16341613            if (op1 == dest)
    16351614                m_assembler.addss_rr(op2, dest);
     
    16461625            m_assembler.vaddss_mr(op1.offset, op1.base, op2, dest);
    16471626        else {
    1648             ASSERT(isSSE2Present());
    16491627            if (op2 == dest) {
    16501628                m_assembler.addss_mr(op1.offset, op1.base, dest);
     
    16671645            m_assembler.vaddss_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest);
    16681646        else {
    1669             ASSERT(isSSE2Present());
    16701647            if (op2 == dest) {
    16711648                m_assembler.addss_mr(op1.offset, op1.base, op1.index, op1.scale, dest);
     
    16791656    void divDouble(FPRegisterID src, FPRegisterID dest)
    16801657    {
    1681         ASSERT(isSSE2Present());
    16821658        m_assembler.divsd_rr(src, dest);
    16831659    }
     
    16941670    void divDouble(Address src, FPRegisterID dest)
    16951671    {
    1696         ASSERT(isSSE2Present());
    16971672        m_assembler.divsd_mr(src.offset, src.base, dest);
    16981673    }
     
    17001675    void divFloat(FPRegisterID src, FPRegisterID dest)
    17011676    {
    1702         ASSERT(isSSE2Present());
    17031677        m_assembler.divss_rr(src, dest);
    17041678    }
     
    17061680    void divFloat(Address src, FPRegisterID dest)
    17071681    {
    1708         ASSERT(isSSE2Present());
    17091682        m_assembler.divss_mr(src.offset, src.base, dest);
    17101683    }
     
    17201693            m_assembler.vsubsd_rr(op1, op2, dest);
    17211694        else {
    1722             ASSERT(isSSE2Present());
    1723 
    17241695            // B := A - B is invalid.
    17251696            ASSERT(op1 == dest || op2 != dest);
     
    17641735            m_assembler.vsubss_rr(op1, op2, dest);
    17651736        else {
    1766             ASSERT(isSSE2Present());
    17671737            // B := A - B is invalid.
    17681738            ASSERT(op1 == dest || op2 != dest);
     
    18071777            m_assembler.vmulsd_rr(op1, op2, dest);
    18081778        else {
    1809             ASSERT(isSSE2Present());
    18101779            if (op1 == dest)
    18111780                m_assembler.mulsd_rr(op2, dest);
     
    18271796            m_assembler.vmulsd_mr(op1.offset, op1.base, op2, dest);
    18281797        else {
    1829             ASSERT(isSSE2Present());
    18301798            if (op2 == dest) {
    18311799                m_assembler.mulsd_mr(op1.offset, op1.base, dest);
     
    18471815            m_assembler.vmulsd_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest);
    18481816        else {
    1849             ASSERT(isSSE2Present());
    18501817            if (op2 == dest) {
    18511818                m_assembler.mulsd_mr(op1.offset, op1.base, op1.index, op1.scale, dest);
     
    18721839            m_assembler.vmulss_rr(op1, op2, dest);
    18731840        else {
    1874             ASSERT(isSSE2Present());
    18751841            if (op1 == dest)
    18761842                m_assembler.mulss_rr(op2, dest);
     
    18871853            m_assembler.vmulss_mr(op1.offset, op1.base, op2, dest);
    18881854        else {
    1889             ASSERT(isSSE2Present());
    18901855            if (op2 == dest) {
    18911856                m_assembler.mulss_mr(op1.offset, op1.base, dest);
     
    19071872            m_assembler.vmulss_mr(op1.offset, op1.base, op1.index, op1.scale, op2, dest);
    19081873        else {
    1909             ASSERT(isSSE2Present());
    19101874            if (op2 == dest) {
    19111875                m_assembler.mulss_mr(op1.offset, op1.base, op1.index, op1.scale, dest);
     
    20101974    void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
    20111975    {
    2012         ASSERT(isSSE2Present());
    20131976        m_assembler.cvtsi2sd_rr(src, dest);
    20141977    }
     
    20161979    void convertInt32ToDouble(Address src, FPRegisterID dest)
    20171980    {
    2018         ASSERT(isSSE2Present());
    20191981        m_assembler.cvtsi2sd_mr(src.offset, src.base, dest);
    20201982    }
     
    20221984    void convertInt32ToFloat(RegisterID src, FPRegisterID dest)
    20231985    {
    2024         ASSERT(isSSE2Present());
    20251986        m_assembler.cvtsi2ss_rr(src, dest);
    20261987    }
     
    20281989    void convertInt32ToFloat(Address src, FPRegisterID dest)
    20291990    {
    2030         ASSERT(isSSE2Present());
    20311991        m_assembler.cvtsi2ss_mr(src.offset, src.base, dest);
    20321992    }
     
    20341994    Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
    20351995    {
    2036         ASSERT(isSSE2Present());
    2037 
    20381996        if (cond & DoubleConditionBitInvert)
    20391997            m_assembler.ucomisd_rr(left, right);
     
    20452003    Jump branchFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
    20462004    {
    2047         ASSERT(isSSE2Present());
    2048 
    20492005        if (cond & DoubleConditionBitInvert)
    20502006            m_assembler.ucomiss_rr(left, right);
     
    20562012    void compareDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID dest)
    20572013    {
    2058         ASSERT(isSSE2Present());
    20592014        floatingPointCompare(cond, left, right, dest, [this] (FPRegisterID arg1, FPRegisterID arg2) {
    20602015            m_assembler.ucomisd_rr(arg1, arg2);
     
    20642019    void compareFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID dest)
    20652020    {
    2066         ASSERT(isSSE2Present());
    20672021        floatingPointCompare(cond, left, right, dest, [this] (FPRegisterID arg1, FPRegisterID arg2) {
    20682022            m_assembler.ucomiss_rr(arg1, arg2);
     
    20772031    Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed)
    20782032    {
    2079         ASSERT(isSSE2Present());
    20802033        m_assembler.cvttsd2si_rr(src, dest);
    20812034        return branch32(branchType ? NotEqual : Equal, dest, TrustedImm32(0x80000000));
     
    20842037    void truncateDoubleToInt32(FPRegisterID src, RegisterID dest)
    20852038    {
    2086         ASSERT(isSSE2Present());
    20872039        m_assembler.cvttsd2si_rr(src, dest);
    20882040    }
     
    20902042    void truncateFloatToInt32(FPRegisterID src, RegisterID dest)
    20912043    {
    2092         ASSERT(isSSE2Present());
    20932044        m_assembler.cvttss2si_rr(src, dest);
    20942045    }
     
    21002051    void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp, bool negZeroCheck = true)
    21012052    {
    2102         ASSERT(isSSE2Present());
    21032053        m_assembler.cvttsd2si_rr(src, dest);
    21042054
     
    21302080    Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch)
    21312081    {
    2132         ASSERT(isSSE2Present());
    21332082        m_assembler.xorpd_rr(scratch, scratch);
    21342083        return branchDouble(DoubleNotEqual, reg, scratch);
     
    21372086    Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch)
    21382087    {
    2139         ASSERT(isSSE2Present());
    21402088        m_assembler.xorpd_rr(scratch, scratch);
    21412089        return branchDouble(DoubleEqualOrUnordered, reg, scratch);
     
    21442092    void lshiftPacked(TrustedImm32 imm, XMMRegisterID reg)
    21452093    {
    2146         ASSERT(isSSE2Present());
    21472094        m_assembler.psllq_i8r(imm.m_value, reg);
    21482095    }
     
    21502097    void rshiftPacked(TrustedImm32 imm, XMMRegisterID reg)
    21512098    {
    2152         ASSERT(isSSE2Present());
    21532099        m_assembler.psrlq_i8r(imm.m_value, reg);
    21542100    }
     
    21562102    void orPacked(XMMRegisterID src, XMMRegisterID dst)
    21572103    {
    2158         ASSERT(isSSE2Present());
    21592104        m_assembler.por_rr(src, dst);
    21602105    }
     
    21622107    void move32ToFloat(RegisterID src, XMMRegisterID dst)
    21632108    {
    2164         ASSERT(isSSE2Present());
    21652109        m_assembler.movd_rr(src, dst);
    21662110    }
     
    21682112    void moveFloatTo32(XMMRegisterID src, RegisterID dst)
    21692113    {
    2170         ASSERT(isSSE2Present());
    21712114        m_assembler.movd_rr(src, dst);
    21722115    }
     
    22532196    void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest)
    22542197    {
    2255         ASSERT(isSSE2Present());
    2256 
    22572198        if (cond & DoubleConditionBitInvert)
    22582199            m_assembler.ucomisd_rr(left, right);
     
    22642205    void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID thenCase, RegisterID elseCase, RegisterID dest)
    22652206    {
    2266         ASSERT(isSSE2Present());
    2267 
    22682207        if (thenCase != dest && elseCase != dest) {
    22692208            move(elseCase, dest);
     
    22882227    void moveConditionallyFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest)
    22892228    {
    2290         ASSERT(isSSE2Present());
    2291 
    22922229        if (cond & DoubleConditionBitInvert)
    22932230            m_assembler.ucomiss_rr(left, right);
     
    22992236    void moveConditionallyFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID thenCase, RegisterID elseCase, RegisterID dest)
    23002237    {
    2301         ASSERT(isSSE2Present());
    2302 
    23032238        if (thenCase != dest && elseCase != dest) {
    23042239            move(elseCase, dest);
     
    23852320    void moveConditionallyDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest)
    23862321    {
    2387         ASSERT(isSSE2Present());
    2388 
    23892322        if (cond & DoubleConditionBitInvert)
    23902323            m_assembler.ucomisd_rr(left, right);
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r240241 r243293  
    111111end
    112112
    113 def useX87
    114     case $activeBackend
    115     when "X86"
    116         true
    117     when "X86_WIN"
    118         true
    119     when "X86_64"
    120         false
    121     when "X86_64_WIN"
    122         false
    123     else
    124         raise "bad value for $activeBackend: #{$activeBackend}"
    125     end
    126 end
    127 
    128113def isMSVC
    129114    $options.has_key?(:assembler) && $options[:assembler] == "MASM"
     
    342327    def x86Operand(kind)
    343328        raise unless kind == :double
    344         raise if useX87
    345329        case name
    346330        when "ft0", "fa0", "fr"
     
    359343            raise "Bad register #{name} for X86 at #{codeOriginString}"
    360344        end
    361     end
    362     def x87DefaultStackPosition
    363         case name
    364         when "ft0", "fr"
    365             0
    366         when "ft1"
    367             1
    368         when "ft2", "ft3", "ft4", "ft5"
    369             raise "Unimplemented register #{name} for X86 at #{codeOriginString}"
    370         else
    371             raise "Bad register #{name} for X86 at #{codeOriginString}"
    372         end
    373     end
    374     def x87Operand(offset)
    375         raise unless useX87
    376         raise unless offset == 0 or offset == 1
    377         "#{register("st")}(#{x87DefaultStackPosition + offset})"
    378345    end
    379346    def x86CallOperand(kind)
     
    562529            isX64 ? "q" : raise
    563530        when :double
    564             not useX87 ? "sd" : raise
     531            "sd"
    565532        else
    566533            raise
     
    634601   
    635602    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
    647610        end
    648611        $asm.puts "#{branchOpcode} #{operands[2].asmLabel}"
     
    859822                $asm.puts "mov#{x86Suffix(:ptr)} #{x86Operands(:ptr, :ptr)}"
    860823            end
    861         end
    862     end
    863 
    864     def handleX87Compare(mode)
    865         floatingPointCompareImplicitOperand = getImplicitOperandString
    866         case mode
    867         when :normal
    868             if (operands[0].x87DefaultStackPosition == 0)
    869                 $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"
    870             else
    871                 $asm.puts "fld #{operands[0].x87Operand(0)}"
    872                 $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"
    873             end
    874         when :reverse
    875             if (operands[1].x87DefaultStackPosition == 0)
    876                 $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"
    877             else
    878                 $asm.puts "fld #{operands[1].x87Operand(0)}"
    879                 $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
    880             end
    881         else
    882             raise mode.inspect
    883         end
    884     end
    885 
    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 !isIntelSyntax
    891                 $asm.puts "#{opcodereverse} #{register("st")}, #{operands[1].x87Operand(0)}"
    892             else
    893                 $asm.puts "#{opcode} #{operands[1].x87Operand(0)}, #{register("st")}"
    894             end
    895         else
    896             $asm.puts "fld #{operands[0].x87Operand(0)}"
    897             $asm.puts "#{opcodereverse}p #{orderOperands(register("st"), operands[1].x87Operand(1))}"
    898824        end
    899825    end
     
    1040966            $asm.puts "mov#{x86Suffix(:byte)} #{x86Operands(:byte, :byte)}"
    1041967        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)}"
    1052969        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)}"
    1063971        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)}"
    1078973        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)}"
    1084975        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)}"
    1090977        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)}"
    1096979        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)}"
    1102981        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)}"
    1110983        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))}"
    1119985        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))}"
    1125987            if operands[0] == operands[1]
    1126988                # This is just a jump ordered, which is a jnp.
     
    11451007            handleX86DoubleBranch("je", :normal)
    11461008        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))}"
    11521010            if operands[0] == operands[1]
    11531011                # This is just a jump unordered, which is a jp.
     
    11711029            handleX86DoubleBranch("jbe", :normal)
    11721030        when "btd2i"
    1173             # FIXME: unused and unimplemented for x87
    1174             raise if useX87
    11751031            $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}"
    11761032            $asm.puts "cmpl $0x80000000 #{operands[1].x86Operand(:int)}"
    11771033            $asm.puts "je #{operands[2].asmLabel}"
    11781034        when "td2i"
    1179             # FIXME: unused and unimplemented for x87
    1180             raise if useX87
    11811035            $asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}"
    11821036        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}"
    12081044        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)}"
    12151046        when "pop"
    12161047            operands.each {
     
    13921223            $asm.puts "int #{const(3)}"
    13931224        when "call"
    1394             if useX87
    1395                 2.times {
    1396                     | offset |
    1397                     $asm.puts "ffree #{register("st")}(#{offset})"
    1398                 }
    1399             end
    14001225            op = operands[0].x86CallOperand(:ptr)
    14011226            if operands[0].is_a? LabelReference
     
    15181343            $asm.puts "idiv#{x86Suffix(:int)} #{operands[0].x86Operand(:int)}"
    15191344        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)}"
    15321349        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)}"
    15491354        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)}"
    15631361            end
    15641362        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)}"
    15821369            end
    15831370        when "bo"
  • trunk/Source/JavaScriptCore/runtime/MathCommon.cpp

    r237266 r243293  
    438438    if (static_cast<double>(yAsInt) == y && yAsInt >= 0 && yAsInt <= maxExponentForIntegerMathPow) {
    439439        // 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;
    454442        while (yAsInt) {
    455443            if (yAsInt & 1)
  • trunk/Tools/ChangeLog

    r243289 r243293  
     12019-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
    1132019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/Tools/Scripts/webkitdirs.pm

    r243179 r243293  
    22782278
    22792279    # 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.
    22812283    if ((architecture() eq "i686" || (architecture() eq "x86_64" && shouldBuild32Bit())) && !isCrossCompilation() && !isAnyWindows()) {
    22822284        $ENV{'CFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . ($ENV{'CFLAGS'} || "");
Note: See TracChangeset for help on using the changeset viewer.