Ignore:
Timestamp:
Nov 5, 2009, 12:28:02 AM (16 years ago)
Author:
[email protected]
Message:

Use ARMv7 specific encoding for immediate constants on ARMv7 target
https://bugs.webkit.org/show_bug.cgi?id=31060

Patch by Gabor Loki <[email protected]> on 2009-11-05
Reviewed by Gavin Barraclough.

  • assembler/ARMAssembler.cpp:

(JSC::ARMAssembler::getOp2): Use INVALID_IMM
(JSC::ARMAssembler::getImm): Use encodeComplexImm for complex immediate
(JSC::ARMAssembler::moveImm): Ditto.
(JSC::ARMAssembler::encodeComplexImm): Encode a constant by one or two
instructions or a PC relative load.

  • assembler/ARMAssembler.h: Use INVALID_IMM if a constant cannot be

encoded as an immediate constant.
(JSC::ARMAssembler::):
(JSC::ARMAssembler::movw_r): 16-bit immediate load
(JSC::ARMAssembler::movt_r): High halfword 16-bit immediate load
(JSC::ARMAssembler::getImm16Op2): Encode immediate constant for
movw_r and mowt_r

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/ARMAssembler.h

    r48525 r50553  
    140140            BKPT = 0xe120070,
    141141#endif
     142#if ARM_ARCH_VERSION >= 7
     143            MOVW = 0x03000000,
     144            MOVT = 0x03400000,
     145#endif
    142146        };
    143147
     
    176180        };
    177181
     182        static const ARMWord INVALID_IMM = 0xf0000000;
     183
    178184        class JmpSrc {
    179185            friend class ARMAssembler;
     
    334340        }
    335341
     342#if ARM_ARCH_VERSION >= 7
     343        void movw_r(int rd, ARMWord op2, Condition cc = AL)
     344        {
     345            ASSERT((op2 | 0xf0fff) == 0xf0fff);
     346            m_buffer.putInt(static_cast<ARMWord>(cc) | MOVW | RD(rd) | op2);
     347        }
     348
     349        void movt_r(int rd, ARMWord op2, Condition cc = AL)
     350        {
     351            ASSERT((op2 | 0xf0fff) == 0xf0fff);
     352            m_buffer.putInt(static_cast<ARMWord>(cc) | MOVT | RD(rd) | op2);
     353        }
     354#endif
     355
    336356        void movs_r(int rd, ARMWord op2, Condition cc = AL)
    337357        {
     
    709729
    710730        static ARMWord getOp2(ARMWord imm);
     731
     732#if ARM_ARCH_VERSION >= 7
     733        static ARMWord getImm16Op2(ARMWord imm)
     734        {
     735            if (imm <= 0xffff)
     736                return (imm & 0xf000) << 4 | (imm & 0xfff);
     737            return INVALID_IMM;
     738        }
     739#endif
    711740        ARMWord getImm(ARMWord imm, int tmpReg, bool invert = false);
    712741        void moveImm(ARMWord imm, int dest);
     742        ARMWord encodeComplexImm(ARMWord imm, int dest);
    713743
    714744        // Memory load/store helpers
Note: See TracChangeset for help on using the changeset viewer.