Changeset 103758 in vbox for trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
- Timestamp:
- Mar 11, 2024 11:01:51 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
r103750 r103758 6828 6828 */ 6829 6829 DECL_FORCE_INLINE_THROW(uint32_t) 6830 iemNativeEmitSimdStoreVecRegToVCpu U128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu)6830 iemNativeEmitSimdStoreVecRegToVCpuLowU128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6831 6831 { 6832 6832 #ifdef RT_ARCH_AMD64 … … 6852 6852 */ 6853 6853 DECL_INLINE_THROW(uint32_t) 6854 iemNativeEmitSimdStoreVecRegToVCpuU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6855 { 6856 #ifdef RT_ARCH_AMD64 6857 off = iemNativeEmitSimdStoreVecRegToVCpuU128Ex(iemNativeInstrBufEnsure(pReNative, off, 9), off, iVecReg, offVCpu); 6858 #elif defined(RT_ARCH_ARM64) 6859 off = iemNativeEmitSimdStoreVecRegToVCpuU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg, offVCpu); 6854 iemNativeEmitSimdStoreVecRegToVCpuLowU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6855 { 6856 #ifdef RT_ARCH_AMD64 6857 off = iemNativeEmitSimdStoreVecRegToVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 9), off, iVecReg, offVCpu); 6858 #elif defined(RT_ARCH_ARM64) 6859 off = iemNativeEmitSimdStoreVecRegToVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg, offVCpu); 6860 #else 6861 # error "port me" 6862 #endif 6863 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 6864 return off; 6865 } 6866 6867 6868 /** 6869 * Emits a high 128-bit vector register store to a VCpu value. 6870 */ 6871 DECL_FORCE_INLINE_THROW(uint32_t) 6872 iemNativeEmitSimdStoreVecRegToVCpuHighU128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6873 { 6874 #ifdef RT_ARCH_AMD64 6875 /* vextracti128 mem128, reg128, 1 */ /* ASSUMES AVX2 support. */ 6876 pCodeBuf[off++] = X86_OP_VEX3; 6877 if (iVecReg >= 8) 6878 pCodeBuf[off++] = 0x63; 6879 else 6880 pCodeBuf[off++] = 0xe3; 6881 pCodeBuf[off++] = 0x7d; 6882 pCodeBuf[off++] = 0x39; 6883 off = iemNativeEmitGprByVCpuDisp(pCodeBuf, off, iVecReg, offVCpu); 6884 pCodeBuf[off++] = 0x01; /* Immediate */ 6885 #elif defined(RT_ARCH_ARM64) 6886 off = iemNativeEmitGprByVCpuLdStEx(pCodeBuf, off, iVecReg, offVCpu, kArmv8A64InstrLdStType_St_Vr_128, sizeof(RTUINT128U)); 6887 #else 6888 # error "port me" 6889 #endif 6890 return off; 6891 } 6892 6893 6894 /** 6895 * Emits a high 128-bit vector register load of a VCpu value. 6896 */ 6897 DECL_INLINE_THROW(uint32_t) 6898 iemNativeEmitSimdStoreVecRegToVCpuHighU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6899 { 6900 #ifdef RT_ARCH_AMD64 6901 off = iemNativeEmitSimdStoreVecRegToVCpuHighU128Ex(iemNativeInstrBufEnsure(pReNative, off, 10), off, iVecReg, offVCpu); 6902 #elif defined(RT_ARCH_ARM64) 6903 /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */ 6904 Assert(!(iVecReg & 0x1)); 6905 off = iemNativeEmitSimdStoreVecRegToVCpuHighU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg + 1, offVCpu); 6860 6906 #else 6861 6907 # error "port me" … … 6870 6916 */ 6871 6917 DECL_FORCE_INLINE_THROW(uint32_t) 6872 iemNativeEmitSimdLoadVecRegFromVCpu U128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu)6918 iemNativeEmitSimdLoadVecRegFromVCpuLowU128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6873 6919 { 6874 6920 #ifdef RT_ARCH_AMD64 … … 6894 6940 */ 6895 6941 DECL_INLINE_THROW(uint32_t) 6896 iemNativeEmitSimdLoadVecRegFromVCpuU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6897 { 6898 #ifdef RT_ARCH_AMD64 6899 off = iemNativeEmitSimdLoadVecRegFromVCpuU128Ex(iemNativeInstrBufEnsure(pReNative, off, 9), off, iVecReg, offVCpu); 6900 #elif defined(RT_ARCH_ARM64) 6901 off = iemNativeEmitSimdLoadVecRegFromVCpuU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg, offVCpu); 6902 #else 6903 # error "port me" 6904 #endif 6905 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 6906 return off; 6907 } 6908 6909 6910 #if 0 /* unused */ 6911 /** 6912 * Emits a 256-bit vector register store to a VCpu value. 6942 iemNativeEmitSimdLoadVecRegFromVCpuLowU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6943 { 6944 #ifdef RT_ARCH_AMD64 6945 off = iemNativeEmitSimdLoadVecRegFromVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 9), off, iVecReg, offVCpu); 6946 #elif defined(RT_ARCH_ARM64) 6947 off = iemNativeEmitSimdLoadVecRegFromVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg, offVCpu); 6948 #else 6949 # error "port me" 6950 #endif 6951 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 6952 return off; 6953 } 6954 6955 6956 /** 6957 * Emits a 128-bit vector register load of a VCpu value. 6913 6958 */ 6914 6959 DECL_FORCE_INLINE_THROW(uint32_t) 6915 iemNativeEmitSimdStoreVecRegToVCpuU256(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpuLow, uint32_t offVCpuHigh) 6916 { 6917 #ifdef RT_ARCH_AMD64 6918 AssertReleaseFailed(); 6960 iemNativeEmitSimdLoadVecRegFromVCpuHighU128Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6961 { 6962 #ifdef RT_ARCH_AMD64 6963 /* vinserti128 ymm, ymm, mem128, 1. */ /* ASSUMES AVX2 support */ 6964 pCodeBuf[off++] = X86_OP_VEX3; 6965 if (iVecReg >= 8) 6966 pCodeBuf[off++] = 0x63; 6967 else 6968 pCodeBuf[off++] = 0xe3; 6969 pCodeBuf[off++] = X86_OP_VEX3_BYTE3_MAKE(false, iVecReg, true, X86_OP_VEX3_BYTE3_P_066H); 6970 pCodeBuf[off++] = 0x38; 6971 off = iemNativeEmitGprByVCpuDisp(pCodeBuf, off, iVecReg, offVCpu); 6972 pCodeBuf[off++] = 0x01; /* Immediate */ 6973 #elif defined(RT_ARCH_ARM64) 6974 off = iemNativeEmitGprByVCpuLdStEx(pCodeBuf, off, iVecReg, offVCpu, kArmv8A64InstrLdStType_Ld_Vr_128, sizeof(RTUINT128U)); 6975 #else 6976 # error "port me" 6977 #endif 6978 return off; 6979 } 6980 6981 6982 /** 6983 * Emits a 128-bit vector register load of a VCpu value. 6984 */ 6985 DECL_INLINE_THROW(uint32_t) 6986 iemNativeEmitSimdLoadVecRegFromVCpuHighU128(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpu) 6987 { 6988 #ifdef RT_ARCH_AMD64 6989 off = iemNativeEmitSimdLoadVecRegFromVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 10), off, iVecReg, offVCpu); 6919 6990 #elif defined(RT_ARCH_ARM64) 6920 6991 /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */ 6921 6992 Assert(!(iVecReg & 0x1)); 6922 off = iemNativeEmitSimdStoreVecRegToVCpuU128(pReNative, off, iVecReg, offVCpuLow); 6923 off = iemNativeEmitSimdStoreVecRegToVCpuU128(pReNative, off, iVecReg + 1, offVCpuHigh); 6924 #else 6925 # error "port me" 6926 #endif 6927 return off; 6928 } 6929 #endif 6930 6931 6932 /** 6933 * Emits a 256-bit vector register load of a VCpu value. 6934 */ 6935 DECL_FORCE_INLINE_THROW(uint32_t) 6936 iemNativeEmitSimdLoadVecRegFromVCpuU256(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint32_t offVCpuLow, uint32_t offVCpuHigh) 6937 { 6938 #ifdef RT_ARCH_AMD64 6939 AssertReleaseFailed(); 6940 RT_NOREF(pReNative, off, iVecReg, offVCpuLow, offVCpuHigh); 6941 #elif defined(RT_ARCH_ARM64) 6942 /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */ 6943 Assert(!(iVecReg & 0x1)); 6944 off = iemNativeEmitSimdLoadVecRegFromVCpuU128(pReNative, off, iVecReg, offVCpuLow); 6945 off = iemNativeEmitSimdLoadVecRegFromVCpuU128(pReNative, off, iVecReg + 1, offVCpuHigh); 6946 #else 6947 # error "port me" 6948 #endif 6993 off = iemNativeEmitSimdLoadVecRegFromVCpuLowU128Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg + 1, offVCpu); 6994 #else 6995 # error "port me" 6996 #endif 6997 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 6949 6998 return off; 6950 6999 } … … 7009 7058 if (iVecRegDst >= 8 && iVecRegSrc >= 8) 7010 7059 { 7011 pbCodeBuf[off++] = 0xc4;7060 pbCodeBuf[off++] = X86_OP_VEX3; 7012 7061 pbCodeBuf[off++] = 0x41; 7013 7062 pbCodeBuf[off++] = 0x7d; … … 7017 7066 else 7018 7067 { 7019 pbCodeBuf[off++] = 0xc5; /* Two byte VEX prefix */7068 pbCodeBuf[off++] = X86_OP_VEX2; 7020 7069 pbCodeBuf[off++] = (iVecRegSrc >= 8 || iVecRegDst >= 8) ? 0x7d : 0xfd; 7021 7070 pbCodeBuf[off++] = iVecRegSrc >= 8 ? 0x7f : 0x6f;
Note:
See TracChangeset
for help on using the changeset viewer.