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

Changeset 181570 in webkit


Ignore:
Timestamp:
Mar 16, 2015, 11:44:46 AM (11 years ago)
Author:
Csaba Osztrogonác
Message:

[ARM] Enable generating idiv instructions if it is supported
https://bugs.webkit.org/show_bug.cgi?id=142725

Reviewed by Michael Saboff.

Source/JavaScriptCore:

  • assembler/ARMAssembler.h: Added sdiv and udiv implementation for ARM Traditional instruction set.

(JSC::ARMAssembler::sdiv):
(JSC::ARMAssembler::udiv):

  • assembler/ARMv7Assembler.h: Use HAVE(ARM_IDIV_INSTRUCTIONS) instead of CPU(APPLE_ARMV7S).
  • assembler/AbstractMacroAssembler.h:

(JSC::isARMv7IDIVSupported):
(JSC::optimizeForARMv7IDIVSupported):
(JSC::isARMv7s): Renamed to isARMv7IDIVSupported().
(JSC::optimizeForARMv7s): Renamed to optimizeForARMv7IDIVSupported().

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileArithDiv):
(JSC::DFG::SpeculativeJIT::compileArithMod):

Source/WTF:

  • wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r181563 r181570  
     12015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
     2
     3        [ARM] Enable generating idiv instructions if it is supported
     4        https://bugs.webkit.org/show_bug.cgi?id=142725
     5
     6        Reviewed by Michael Saboff.
     7
     8        * assembler/ARMAssembler.h: Added sdiv and udiv implementation for ARM Traditional instruction set.
     9        (JSC::ARMAssembler::sdiv):
     10        (JSC::ARMAssembler::udiv):
     11        * assembler/ARMv7Assembler.h: Use HAVE(ARM_IDIV_INSTRUCTIONS) instead of CPU(APPLE_ARMV7S).
     12        * assembler/AbstractMacroAssembler.h:
     13        (JSC::isARMv7IDIVSupported):
     14        (JSC::optimizeForARMv7IDIVSupported):
     15        (JSC::isARMv7s): Renamed to isARMv7IDIVSupported().
     16        (JSC::optimizeForARMv7s): Renamed to optimizeForARMv7IDIVSupported().
     17        * dfg/DFGFixupPhase.cpp:
     18        (JSC::DFG::FixupPhase::fixupNode):
     19        * dfg/DFGSpeculativeJIT.cpp:
     20        (JSC::DFG::SpeculativeJIT::compileArithDiv):
     21        (JSC::DFG::SpeculativeJIT::compileArithMod):
     22
    1232015-03-15  Filip Pizlo  <fpizlo@apple.com>
    224
  • trunk/Source/JavaScriptCore/assembler/ARMAssembler.h

    r176072 r181570  
    217217            NOP = 0xe1a00000,
    218218            DMB_SY = 0xf57ff05f,
     219#if HAVE(ARM_IDIV_INSTRUCTIONS)
     220            SDIV = 0x0710f010,
     221            UDIV = 0x0730f010,
     222#endif
    219223        };
    220224
     
    478482        }
    479483
     484#if HAVE(ARM_IDIV_INSTRUCTIONS)
     485        template<int datasize>
     486        void sdiv(int rd, int rn, int rm, Condition cc = AL)
     487        {
     488            static_assert(datasize == 32, "sdiv datasize must be 32 for armv7s");
     489            ASSERT(rd != ARMRegisters::pc);
     490            ASSERT(rn != ARMRegisters::pc);
     491            ASSERT(rm != ARMRegisters::pc);
     492            m_buffer.putInt(toARMWord(cc) | SDIV | RN(rd) | RM(rn) | RS(rm));
     493        }
     494
     495        void udiv(int rd, int rn, int rm, Condition cc = AL)
     496        {
     497            ASSERT(rd != ARMRegisters::pc);
     498            ASSERT(rn != ARMRegisters::pc);
     499            ASSERT(rm != ARMRegisters::pc);
     500            m_buffer.putInt(toARMWord(cc) | UDIV | RN(rd) | RM(rn) | RS(rm));
     501        }
     502#endif
     503
    480504        void vmov_f64(int dd, int dm, Condition cc = AL)
    481505        {
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r179187 r181570  
    709709        OP_CLZ          = 0xFAB0,
    710710        OP_SMULL_T1     = 0xFB80,
    711 #if CPU(APPLE_ARMV7S)
     711#if HAVE(ARM_IDIV_INSTRUCTIONS)
    712712        OP_SDIV_T1      = 0xFB90,
    713713        OP_UDIV_T1      = 0xFBB0,
     
    15001500    }
    15011501
    1502 #if CPU(APPLE_ARMV7S)
     1502#if HAVE(ARM_IDIV_INSTRUCTIONS)
    15031503    template<int datasize>
    15041504    ALWAYS_INLINE void sdiv(RegisterID rd, RegisterID rn, RegisterID rm)
     
    18481848    }
    18491849
    1850 #if CPU(APPLE_ARMV7S)
     1850#if HAVE(ARM_IDIV_INSTRUCTIONS)
    18511851    ALWAYS_INLINE void udiv(RegisterID rd, RegisterID rn, RegisterID rm)
    18521852    {
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r176233 r181570  
    4040namespace JSC {
    4141
    42 inline bool isARMv7s()
     42inline bool isARMv7IDIVSupported()
    4343{
    44 #if CPU(APPLE_ARMV7S)
     44#if HAVE(ARM_IDIV_INSTRUCTIONS)
    4545    return true;
    4646#else
     
    6767}
    6868
    69 inline bool optimizeForARMv7s()
     69inline bool optimizeForARMv7IDIVSupported()
    7070{
    71     return isARMv7s() && Options::enableArchitectureSpecificOptimizations();
     71    return isARMv7IDIVSupported() && Options::enableArchitectureSpecificOptimizations();
    7272}
    7373
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r181466 r181570  
    274274            if (Node::shouldSpeculateInt32OrBooleanForArithmetic(node->child1().node(), node->child2().node())
    275275                && node->canSpeculateInt32(FixupPass)) {
    276                 if (optimizeForX86() || optimizeForARM64() || optimizeForARMv7s()) {
     276                if (optimizeForX86() || optimizeForARM64() || optimizeForARMv7IDIVSupported()) {
    277277                    fixIntOrBooleanEdge(node->child1());
    278278                    fixIntOrBooleanEdge(node->child2());
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r181035 r181570  
    31993199        done.link(&m_jit);
    32003200        int32Result(eax.gpr(), node);
    3201 #elif CPU(APPLE_ARMV7S) || CPU(ARM64)
     3201#elif HAVE(ARM_IDIV_INSTRUCTIONS) || CPU(ARM64)
    32023202        SpeculateInt32Operand op1(this, node->child1());
    32033203        SpeculateInt32Operand op2(this, node->child2());
     
    34523452        int32Result(edx.gpr(), node);
    34533453
    3454 #elif CPU(ARM64) || CPU(APPLE_ARMV7S)
     3454#elif HAVE(ARM_IDIV_INSTRUCTIONS) || CPU(ARM64)
    34553455        GPRTemporary temp(this);
    34563456        GPRTemporary quotientThenRemainder(this);
     
    34773477        // https://bugs.webkit.org/show_bug.cgi?id=126444
    34783478        speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchMul32(JITCompiler::Overflow, quotientThenRemainderGPR, divisorGPR, multiplyAnswerGPR));
    3479 #if CPU(APPLE_ARMV7S)
     3479#if HAVE(ARM_IDIV_INSTRUCTIONS)
    34803480        m_jit.assembler().sub(quotientThenRemainderGPR, dividendGPR, multiplyAnswerGPR);
    34813481#else
  • trunk/Source/WTF/ChangeLog

    r181558 r181570  
     12015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
     2
     3        [ARM] Enable generating idiv instructions if it is supported
     4        https://bugs.webkit.org/show_bug.cgi?id=142725
     5
     6        Reviewed by Michael Saboff.
     7
     8        * wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.
     9
    1102015-03-16  Benjamin Poulain  <benjamin@webkit.org>
    211
  • trunk/Source/WTF/wtf/Platform.h

    r181501 r181570  
    335335#endif
    336336
     337#if defined(__ARM_ARCH_EXT_IDIV__) || CPU(APPLE_ARMV7S)
     338#define HAVE_ARM_IDIV_INSTRUCTIONS 1
     339#endif
     340
    337341#endif /* ARM */
    338342
Note: See TracChangeset for help on using the changeset viewer.