VirtualBox

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


Ignore:
Timestamp:
Mar 10, 2024 8:12:55 PM (9 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement some ofthe amd64 emitters for SSE/AVX, bugref:10614

File:
1 edited

Legend:

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

    r103739 r103750  
    57455745            case kIemNativeGstSimdRegLdStSz_256:
    57465746                off = iemNativeEmitSimdLoadVecRegFromVecRegU256(pReNative, off, idxHstSimdRegDst, idxHstSimdRegSrc);
     5747                break;
    57475748            case kIemNativeGstSimdRegLdStSz_Low128:
    57485749                off = iemNativeEmitSimdLoadVecRegFromVecRegU128(pReNative, off, idxHstSimdRegDst, idxHstSimdRegSrc);
     5750                break;
    57495751            case kIemNativeGstSimdRegLdStSz_High128:
    57505752                off = iemNativeEmitSimdLoadVecRegFromVecRegU128(pReNative, off, idxHstSimdRegDst + 1, idxHstSimdRegSrc + 1);
     5753                break;
    57515754            default:
    57525755                AssertFailedStmt(IEMNATIVE_DO_LONGJMP(pReNative, VERR_IPE_NOT_REACHED_DEFAULT_CASE));
     
    59775980
    59785981#ifdef RT_ARCH_AMD64
    5979 # error "Port me"
     5982    if (IEMNATIVE_SIMD_REG_STATE_IS_DIRTY_LO_U128(pReNative, idxGstSimdReg))
     5983    {
     5984        Assert(   pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_256
     5985               || pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_Low128);
     5986        off = iemNativeEmitSimdStoreVecRegToVCpuU128(pReNative, off, idxHstSimdReg, g_aGstSimdShadowInfo[idxGstSimdReg].offXmm);
     5987    }
     5988
     5989    if (IEMNATIVE_SIMD_REG_STATE_IS_DIRTY_HI_U128(pReNative, idxGstSimdReg))
     5990    {
     5991        Assert(   pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_256
     5992               || pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_High128);
     5993        AssertReleaseFailed();
     5994        //off = iemNativeEmitSimdStoreVecRegToVCpuU128(pReNative, off, idxHstSimdReg, g_aGstSimdShadowInfo[idxGstSimdReg].offYmm);
     5995    }
    59805996#elif defined(RT_ARCH_ARM64)
    59815997    /* ASSUMING there are two consecutive host registers to store the potential 256-bit guest register. */
     
    59916007    {
    59926008        Assert(   pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_256
    5993                || pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_Low128);
     6009               || pReNative->Core.aHstSimdRegs[idxHstSimdReg].enmLoaded == kIemNativeGstSimdRegLdStSz_High128);
    59946010        off = iemNativeEmitSimdStoreVecRegToVCpuU128(pReNative, off, idxHstSimdReg + 1, g_aGstSimdShadowInfo[idxGstSimdReg].offYmm);
    59956011    }
     
    63946410{
    63956411#  ifdef RT_ARCH_AMD64
    6396 #   error "Port me!"
     6412    Assert(enmLoadSz == kIemNativeGstSimdRegLdStSz_Low128); /** @todo 256-bit variant. */
     6413
     6414    /* movdqa vectmp0, idxSimdReg */
     6415    off = iemNativeEmitSimdLoadVecRegFromVecRegU128(pReNative, off, IEMNATIVE_SIMD_REG_FIXED_TMP0, idxSimdReg);
     6416
     6417    uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 44);
     6418
     6419    /* pcmpeqq vectmp0, [gstreg] (ASSUMES SSE4.1) */
     6420    pbCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     6421    if (idxSimdReg >= 8)
     6422        pbCodeBuf[off++] = X86_OP_REX_R;
     6423    pbCodeBuf[off++] = 0x0f;
     6424    pbCodeBuf[off++] = 0x38;
     6425    pbCodeBuf[off++] = 0x29;
     6426    off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, idxSimdReg, g_aGstSimdShadowInfo[enmGstSimdReg].offXmm);
     6427
     6428    /* pextrq tmp0, vectmp0, #0 (ASSUMES SSE4.1). */
     6429    pbCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     6430    pbCodeBuf[off++] =   X86_OP_REX_W
     6431                       | (IEMNATIVE_SIMD_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_R)
     6432                       | (IEMNATIVE_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_B);
     6433    pbCodeBuf[off++] = 0x0f;
     6434    pbCodeBuf[off++] = 0x3a;
     6435    pbCodeBuf[off++] = 0x16;
     6436    pbCodeBuf[off++] = 0xeb;
     6437    pbCodeBuf[off++] = 0x00;
     6438
     6439    /* test tmp0, 0xffffffff. */
     6440    pbCodeBuf[off++] = X86_OP_REX_W | (IEMNATIVE_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_B);
     6441    pbCodeBuf[off++] = 0xf7;
     6442    pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, IEMNATIVE_REG_FIXED_TMP0 & 7);
     6443    pbCodeBuf[off++] = 0xff;
     6444    pbCodeBuf[off++] = 0xff;
     6445    pbCodeBuf[off++] = 0xff;
     6446    pbCodeBuf[off++] = 0xff;
     6447
     6448    /* je/jz +1 */
     6449    pbCodeBuf[off++] = 0x74;
     6450    pbCodeBuf[off++] = 0x01;
     6451
     6452    /* int3 */
     6453    pbCodeBuf[off++] = 0xcc;
     6454
     6455    /* pextrq tmp0, vectmp0, #1 (ASSUMES SSE4.1). */
     6456    pbCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     6457    pbCodeBuf[off++] =   X86_OP_REX_W
     6458                       | (IEMNATIVE_SIMD_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_R)
     6459                       | (IEMNATIVE_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_B);
     6460    pbCodeBuf[off++] = 0x0f;
     6461    pbCodeBuf[off++] = 0x3a;
     6462    pbCodeBuf[off++] = 0x16;
     6463    pbCodeBuf[off++] = 0xeb;
     6464    pbCodeBuf[off++] = 0x01;
     6465
     6466    /* test tmp0, 0xffffffff. */
     6467    pbCodeBuf[off++] = X86_OP_REX_W | (IEMNATIVE_REG_FIXED_TMP0 < 8 ? 0 : X86_OP_REX_B);
     6468    pbCodeBuf[off++] = 0xf7;
     6469    pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, IEMNATIVE_REG_FIXED_TMP0 & 7);
     6470    pbCodeBuf[off++] = 0xff;
     6471    pbCodeBuf[off++] = 0xff;
     6472    pbCodeBuf[off++] = 0xff;
     6473    pbCodeBuf[off++] = 0xff;
     6474
     6475    /* je/jz +1 */
     6476    pbCodeBuf[off++] = 0x74;
     6477    pbCodeBuf[off++] = 0x01;
     6478
     6479    /* int3 */
     6480    pbCodeBuf[off++] = 0xcc;
     6481
    63976482#  elif defined(RT_ARCH_ARM64)
    63986483    /* mov vectmp0, [gstreg] */
     
    64136498        /* brk #0x1000+enmGstReg */
    64146499        pu32CodeBuf[off++] = Armv8A64MkInstrBrk((uint32_t)enmGstSimdReg | UINT32_C(0x1000));
    6415         IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
    64166500    }
    64176501
     
    64306514        /* brk #0x1000+enmGstReg */
    64316515        pu32CodeBuf[off++] = Armv8A64MkInstrBrk((uint32_t)enmGstSimdReg | UINT32_C(0x1000));
    6432         IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
    64336516    }
    64346517
     
    64366519#   error "Port me!"
    64376520#  endif
     6521
     6522    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
    64386523    return off;
    64396524}
     
    81698254    uint8_t const idxLabelRaiseNm = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseNm);
    81708255    uint8_t const idxLabelRaiseUd = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseUd);
    8171 
    8172 #if 1
    8173     off = iemNativeEmitBrk(pReNative, off, 0x4223); /** @todo Test this when AVX gets actually available. */
    8174 #endif
    81758256
    81768257    /** @todo r=aeichner Optimize this more later to have less compares and branches,
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