VirtualBox

Changeset 104348 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Apr 17, 2024 2:41:37 PM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement native emitters for pcmpeqb, pcmpeqw and pcmpeqd (pcmpeqb is used quite a bit with an OL 9.2 amd64 guest), bugref:10652

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstTwoByte0f.cpp.h

    r104339 r104348  
    68086808{
    68096809    IEMOP_MNEMONIC2(RM, PCMPEQB, pcmpeqb, Vx, Wx, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    6810     return FNIEMOP_CALL_1(iemOpCommonSse2Opt_FullFull_To_Full, iemAImpl_pcmpeqb_u128);
     6810    SSE2_OPT_BODY_FullFull_To_Full(pcmpeqb, iemAImpl_pcmpeqb_u128, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    68116811}
    68126812
     
    68286828{
    68296829    IEMOP_MNEMONIC2(RM, PCMPEQW, pcmpeqw, Vx, Wx, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    6830     return FNIEMOP_CALL_1(iemOpCommonSse2Opt_FullFull_To_Full, iemAImpl_pcmpeqw_u128);
     6830    SSE2_OPT_BODY_FullFull_To_Full(pcmpeqw, iemAImpl_pcmpeqw_u128, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    68316831}
    68326832
     
    68486848{
    68496849    IEMOP_MNEMONIC2(RM, PCMPEQD, pcmpeqd, Vx, Wx, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    6850     return FNIEMOP_CALL_1(iemOpCommonSse2Opt_FullFull_To_Full, iemAImpl_pcmpeqd_u128);
     6850    SSE2_OPT_BODY_FullFull_To_Full(pcmpeqd, iemAImpl_pcmpeqd_u128, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    68516851}
    68526852
  • trunk/src/VBox/VMM/VMMAll/target-x86/IEMAllN8veEmit-x86.h

    r104339 r104348  
    22512251IEMNATIVE_NATIVE_EMIT_ADD_SUB_U128(psubq, true  /*a_fSub*/, kArmv8VecInstrArithSz_64, 0xfb);
    22522252
     2253
     2254/**
     2255 * Common emitter for the pcmpeqb/pcmpeqw/pcmpeqd instructions.
     2256 */
     2257#ifdef RT_ARCH_AMD64
     2258# define IEMNATIVE_NATIVE_EMIT_PCMP_U128(a_Instr, a_enmOp, a_ArmElemSz, a_bOpcX86) \
     2259    DECL_INLINE_THROW(uint32_t) \
     2260    RT_CONCAT3(iemNativeEmit_,a_Instr,_rr_u128)(PIEMRECOMPILERSTATE pReNative, uint32_t off, \
     2261                                                uint8_t const idxSimdGstRegDst, uint8_t const idxSimdGstRegSrc) \
     2262    { \
     2263        uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegDst), \
     2264                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); \
     2265        uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegSrc), \
     2266                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); \
     2267        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5); \
     2268        pCodeBuf[off++] = X86_OP_PRF_SIZE_OP; \
     2269        if (idxSimdRegDst >= 8 || idxSimdRegSrc >= 8) \
     2270            pCodeBuf[off++] =   (idxSimdRegSrc >= 8 ? X86_OP_REX_B : 0) \
     2271                              | (idxSimdRegDst >= 8 ? X86_OP_REX_R : 0); \
     2272        pCodeBuf[off++] = 0x0f; \
     2273        pCodeBuf[off++] = (a_bOpcX86); \
     2274        pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, idxSimdRegDst & 7, idxSimdRegSrc & 7); \
     2275        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst); \
     2276        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegSrc); \
     2277        IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); \
     2278        return off; \
     2279    } \
     2280    DECL_INLINE_THROW(uint32_t) \
     2281    RT_CONCAT3(iemNativeEmit_,a_Instr,_rv_u128)(PIEMRECOMPILERSTATE pReNative, uint32_t off, \
     2282                                                uint8_t const idxSimdGstRegDst, uint8_t const idxVarSrc) \
     2283    { \
     2284        uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegDst), \
     2285                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); \
     2286        uint8_t const idxSimdRegSrc = iemNativeVarSimdRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/); \
     2287        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5); \
     2288        pCodeBuf[off++] = X86_OP_PRF_SIZE_OP; \
     2289        if (idxSimdRegDst >= 8 || idxSimdRegSrc >= 8) \
     2290            pCodeBuf[off++] =   (idxSimdRegSrc >= 8 ? X86_OP_REX_B : 0) \
     2291                              | (idxSimdRegDst >= 8 ? X86_OP_REX_R : 0); \
     2292        pCodeBuf[off++] = 0x0f; \
     2293        pCodeBuf[off++] = (a_bOpcX86); \
     2294        pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, idxSimdRegDst & 7, idxSimdRegSrc & 7); \
     2295        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst); \
     2296        iemNativeVarRegisterRelease(pReNative, idxVarSrc); \
     2297        IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); \
     2298        return off; \
     2299    } \
     2300    typedef int ignore_semicolon
     2301#elif defined(RT_ARCH_ARM64)
     2302# define IEMNATIVE_NATIVE_EMIT_PCMP_U128(a_Instr, a_enmOp, a_ArmElemSz, a_bOpcX86) \
     2303    DECL_INLINE_THROW(uint32_t) \
     2304    RT_CONCAT3(iemNativeEmit_,a_Instr,_rr_u128)(PIEMRECOMPILERSTATE pReNative, uint32_t off, \
     2305                                                uint8_t const idxSimdGstRegDst, uint8_t const idxSimdGstRegSrc) \
     2306    { \
     2307        uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegDst), \
     2308                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); \
     2309        uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegSrc), \
     2310                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); \
     2311        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); \
     2312        pCodeBuf[off++] = Armv8A64MkVecInstrCmp((a_enmOp), idxSimdRegDst, idxSimdRegDst, idxSimdRegSrc, (a_ArmElemSz)); \
     2313        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst); \
     2314        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegSrc); \
     2315        IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); \
     2316        return off; \
     2317    } \
     2318    DECL_INLINE_THROW(uint32_t) \
     2319    RT_CONCAT3(iemNativeEmit_,a_Instr,_rv_u128)(PIEMRECOMPILERSTATE pReNative, uint32_t off, \
     2320                                                uint8_t const idxSimdGstRegDst, uint8_t const idxVarSrc) \
     2321    { \
     2322        uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(idxSimdGstRegDst), \
     2323                                                                              kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); \
     2324        uint8_t const idxSimdRegSrc = iemNativeVarSimdRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/); \
     2325        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); \
     2326        pCodeBuf[off++] = Armv8A64MkVecInstrCmp((a_enmOp), idxSimdRegDst, idxSimdRegDst, idxSimdRegSrc, (a_ArmElemSz)); \
     2327        iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst); \
     2328        iemNativeVarRegisterRelease(pReNative, idxVarSrc); \
     2329        IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); \
     2330        return off; \
     2331    } \
     2332    typedef int ignore_semicolon
     2333#else
     2334# error "Port me"
     2335#endif
     2336
     2337IEMNATIVE_NATIVE_EMIT_PCMP_U128(pcmpeqb, kArmv8VecInstrCmpOp_Eq, kArmv8VecInstrArithSz_8,  0x74);
     2338IEMNATIVE_NATIVE_EMIT_PCMP_U128(pcmpeqw, kArmv8VecInstrCmpOp_Eq, kArmv8VecInstrArithSz_16, 0x75);
     2339IEMNATIVE_NATIVE_EMIT_PCMP_U128(pcmpeqd, kArmv8VecInstrCmpOp_Eq, kArmv8VecInstrArithSz_32, 0x76);
     2340
    22532341#endif /* IEMNATIVE_WITH_SIMD_REG_ALLOCATOR */
    22542342
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette