mirror of
https://github.com/libretro/Play-.git
synced 2025-01-25 10:37:56 +00:00
MacOSX fixes
git-svn-id: http://svn.purei.org/purei/trunk@257 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
04b028a19d
commit
a933684023
@ -197,48 +197,7 @@
|
||||
<key>Notifications</key>
|
||||
<array/>
|
||||
<key>OpenEditors</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Content</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>7E47E3120D6DE90C003F7AC1</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>Lesson34Controller.h</string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>7E47E3130D6DE90C003F7AC1</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>Lesson34Controller.h</string>
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>7E47E3510D6DEB38003F7AC1</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>7E47E3140D6DE90C003F7AC1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>StatusBarVisibility</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>Geometry</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 20}, {1129, 580}}</string>
|
||||
<key>PBXModuleWindowStatusBarHidden2</key>
|
||||
<false/>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>15 152 1129 621 0 0 1280 778 </string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<array/>
|
||||
<key>PerspectiveWidths</key>
|
||||
<array>
|
||||
<integer>-1</integer>
|
||||
@ -308,19 +267,20 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
|
||||
<array>
|
||||
<string>29B97314FDCFA39411CA2CEA</string>
|
||||
<string>080E96DDFE201D6D7F000001</string>
|
||||
<string>7E8987060D08B4480077F9ED</string>
|
||||
<string>1C37FAAC04509CD000000102</string>
|
||||
<string>1CC0EA4004350EF90041110B</string>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
<integer>20</integer>
|
||||
<integer>10</integer>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 228}, {186, 571}}</string>
|
||||
<string>{{0, 2121}, {186, 571}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@ -357,7 +317,7 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>1CE0B20306471E060097A5F4</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>MainWindow.mm</string>
|
||||
<string>CodeGen_MD.cpp</string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
@ -365,15 +325,14 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>1CE0B20406471E060097A5F4</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>MainWindow.mm</string>
|
||||
<string>CodeGen_MD.cpp</string>
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>7E47E3500D6DEB38003F7AC1</string>
|
||||
<string>7E224E2D0D77A8A6000FAD0C</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>7EE1BCFD0D4D895300B502BD</string>
|
||||
<string>7EE362DF0D60753D00C21032</string>
|
||||
<string>7E9178490D64F5C00025E2C0</string>
|
||||
<string>7E91784A0D64F5C00025E2C0</string>
|
||||
<string>7E19A9A30D6C8A2D00B0C6A6</string>
|
||||
@ -392,7 +351,11 @@
|
||||
<string>7E47E32E0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E32F0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E34C0D6DEB38003F7AC1</string>
|
||||
<string>7E47E34D0D6DEB38003F7AC1</string>
|
||||
<string>7E224DFF0D77A2B9000FAD0C</string>
|
||||
<string>7E224E110D77A6D4000FAD0C</string>
|
||||
<string>7E224E120D77A6D4000FAD0C</string>
|
||||
<string>7E224E2B0D77A8A6000FAD0C</string>
|
||||
<string>7E224E270D77A807000FAD0C</string>
|
||||
</array>
|
||||
<key>prevStack</key>
|
||||
<array>
|
||||
@ -411,44 +374,18 @@
|
||||
<string>7E19A9C80D6C8BC900B0C6A6</string>
|
||||
<string>7ED0A4F40D6D28A1008D30EA</string>
|
||||
<string>7E47E3040D6DE90C003F7AC1</string>
|
||||
<string>7E47E3050D6DE90C003F7AC1</string>
|
||||
<string>7E47E3060D6DE90C003F7AC1</string>
|
||||
<string>7E47E3070D6DE90C003F7AC1</string>
|
||||
<string>7E47E3080D6DE90C003F7AC1</string>
|
||||
<string>7E47E3090D6DE90C003F7AC1</string>
|
||||
<string>7E47E30A0D6DE90C003F7AC1</string>
|
||||
<string>7E47E30B0D6DE90C003F7AC1</string>
|
||||
<string>7E47E30C0D6DE90C003F7AC1</string>
|
||||
<string>7E47E30D0D6DE90C003F7AC1</string>
|
||||
<string>7E47E30E0D6DE90C003F7AC1</string>
|
||||
<string>7E47E30F0D6DE90C003F7AC1</string>
|
||||
<string>7E47E3100D6DE90C003F7AC1</string>
|
||||
<string>7E47E31A0D6DE93C003F7AC1</string>
|
||||
<string>7E47E3320D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3330D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3340D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3350D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3360D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3370D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3380D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3390D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33A0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33B0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33C0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33D0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33E0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E33F0D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3400D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3410D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3420D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3430D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3440D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3450D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3460D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3470D6DEAF2003F7AC1</string>
|
||||
<string>7E47E3480D6DEAF2003F7AC1</string>
|
||||
<string>7E47E34E0D6DEB38003F7AC1</string>
|
||||
<string>7E47E34F0D6DEB38003F7AC1</string>
|
||||
<string>7E224E000D77A2B9000FAD0C</string>
|
||||
<string>7E224E140D77A6D4000FAD0C</string>
|
||||
<string>7E224E150D77A6D4000FAD0C</string>
|
||||
<string>7E224E160D77A6D4000FAD0C</string>
|
||||
<string>7E224E280D77A807000FAD0C</string>
|
||||
<string>7E224E2C0D77A8A6000FAD0C</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
@ -506,9 +443,9 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>7E47E2EE0D6DDDEB003F7AC1</string>
|
||||
<string>7E224E020D77A2B9000FAD0C</string>
|
||||
<string>1CE0B1FE06471DED0097A5F4</string>
|
||||
<string>7E47E2EF0D6DDDEB003F7AC1</string>
|
||||
<string>7E224E030D77A2B9000FAD0C</string>
|
||||
<string>1CE0B20306471E060097A5F4</string>
|
||||
<string>1CE0B20506471E060097A5F4</string>
|
||||
</array>
|
||||
@ -642,13 +579,12 @@
|
||||
<integer>5</integer>
|
||||
<key>WindowOrderList</key>
|
||||
<array>
|
||||
<string>7E47E31E0D6DE93C003F7AC1</string>
|
||||
<string>7E47E31F0D6DE93C003F7AC1</string>
|
||||
<string>7E47E3200D6DE93C003F7AC1</string>
|
||||
<string>1C78EAAD065D492600B07095</string>
|
||||
<string>7E224E190D77A6D4000FAD0C</string>
|
||||
<string>7E224E1A0D77A6D4000FAD0C</string>
|
||||
<string>7E224E1B0D77A6D4000FAD0C</string>
|
||||
<string>7E8986E20D08A40C0077F9ED</string>
|
||||
<string>1C78EAAD065D492600B07095</string>
|
||||
<string>1CD10A99069EF8BA00B06720</string>
|
||||
<string>7E47E3120D6DE90C003F7AC1</string>
|
||||
<string>/Users/jpd001/Projects/Purei/Purei.xcodeproj</string>
|
||||
</array>
|
||||
<key>WindowString</key>
|
||||
@ -668,12 +604,14 @@
|
||||
<key>Dock</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BecomeActive</key>
|
||||
<true/>
|
||||
<key>ContentConfiguration</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>1CD0528F0623707200166675</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string></string>
|
||||
<string>CodeGen_MD.cpp</string>
|
||||
<key>StatusBarVisibility</key>
|
||||
<true/>
|
||||
</dict>
|
||||
@ -729,7 +667,7 @@
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>7E8986E20D08A40C0077F9ED</string>
|
||||
<string>7E47E3180D6DE90C003F7AC1</string>
|
||||
<string>7E224DF80D77A2B7000FAD0C</string>
|
||||
<string>1CD0528F0623707200166675</string>
|
||||
<string>XCMainBuildResultsModuleGUID</string>
|
||||
</array>
|
||||
@ -849,13 +787,13 @@
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>1CD10A99069EF8BA00B06720</string>
|
||||
<string>7E47E2F00D6DDDEB003F7AC1</string>
|
||||
<string>7E224DF90D77A2B7000FAD0C</string>
|
||||
<string>1C162984064C10D400B95A72</string>
|
||||
<string>7E47E2F10D6DDDEB003F7AC1</string>
|
||||
<string>7E47E2F20D6DDDEB003F7AC1</string>
|
||||
<string>7E47E2F30D6DDDEB003F7AC1</string>
|
||||
<string>7E47E2F40D6DDDEB003F7AC1</string>
|
||||
<string>7E47E2F50D6DDDEB003F7AC1</string>
|
||||
<string>7E224DFA0D77A2B7000FAD0C</string>
|
||||
<string>7E224DFB0D77A2B7000FAD0C</string>
|
||||
<string>7E224DFC0D77A2B7000FAD0C</string>
|
||||
<string>7E224DFD0D77A2B7000FAD0C</string>
|
||||
<string>7E224DFE0D77A2B7000FAD0C</string>
|
||||
</array>
|
||||
<key>ToolbarConfiguration</key>
|
||||
<string>xcode.toolbar.config.debugV3</string>
|
||||
@ -982,6 +920,8 @@
|
||||
<key>Dock</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BecomeActive</key>
|
||||
<true/>
|
||||
<key>ContentConfiguration</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
@ -1017,7 +957,7 @@
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>1C78EAAD065D492600B07095</string>
|
||||
<string>7E47E31D0D6DE93C003F7AC1</string>
|
||||
<string>7E224E180D77A6D4000FAD0C</string>
|
||||
<string>1C78EAAC065D492600B07095</string>
|
||||
</array>
|
||||
<key>ToolbarConfiguration</key>
|
||||
@ -1027,7 +967,7 @@
|
||||
<key>WindowToolGUID</key>
|
||||
<string>1C78EAAD065D492600B07095</string>
|
||||
<key>WindowToolIsVisible</key>
|
||||
<false/>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -986,6 +986,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
__STDC_LIMIT_MACROS,
|
||||
DEBUGGER_INCLUDED,
|
||||
MACOSX,
|
||||
_DEBUG,
|
||||
@ -1011,7 +1012,10 @@
|
||||
i386,
|
||||
ppc,
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = MACOSX;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
__STDC_LIMIT_MACROS,
|
||||
MACOSX,
|
||||
);
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
@ -1,44 +1,44 @@
|
||||
#include "CodeGen.h"
|
||||
#include "CodeGen_StackPatterns.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool CCodeGen::Register128HasNextUse(XMMREGISTER registerId)
|
||||
{
|
||||
unsigned int nCount = m_Shadow.GetCount();
|
||||
|
||||
for(unsigned int i = 0; i < nCount; i += 2)
|
||||
{
|
||||
if(m_Shadow.GetAt(i) == REGISTER128)
|
||||
{
|
||||
if(m_Shadow.GetAt(i + 1) == registerId) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCodeGen::CopyRegister128(XMMREGISTER destination, XMMREGISTER source)
|
||||
{
|
||||
m_Assembler.MovapsVo(CX86Assembler::MakeXmmRegisterAddress(destination),
|
||||
source);
|
||||
}
|
||||
|
||||
void CCodeGen::LoadRelative128InRegister(XMMREGISTER registerId, uint32 offset)
|
||||
{
|
||||
m_Assembler.MovapsVo(registerId,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, offset));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushRel(size_t offset)
|
||||
{
|
||||
m_Shadow.Push(static_cast<uint32>(offset));
|
||||
m_Shadow.Push(RELATIVE128);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushRelExpand(size_t offset)
|
||||
{
|
||||
//Need to convert to a register
|
||||
#include "CodeGen.h"
|
||||
#include "CodeGen_StackPatterns.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool CCodeGen::Register128HasNextUse(XMMREGISTER registerId)
|
||||
{
|
||||
unsigned int nCount = m_Shadow.GetCount();
|
||||
|
||||
for(unsigned int i = 0; i < nCount; i += 2)
|
||||
{
|
||||
if(m_Shadow.GetAt(i) == REGISTER128)
|
||||
{
|
||||
if(m_Shadow.GetAt(i + 1) == registerId) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCodeGen::CopyRegister128(XMMREGISTER destination, XMMREGISTER source)
|
||||
{
|
||||
m_Assembler.MovapsVo(CX86Assembler::MakeXmmRegisterAddress(destination),
|
||||
source);
|
||||
}
|
||||
|
||||
void CCodeGen::LoadRelative128InRegister(XMMREGISTER registerId, uint32 offset)
|
||||
{
|
||||
m_Assembler.MovapsVo(registerId,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, offset));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushRel(size_t offset)
|
||||
{
|
||||
m_Shadow.Push(static_cast<uint32>(offset));
|
||||
m_Shadow.Push(RELATIVE128);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushRelExpand(size_t offset)
|
||||
{
|
||||
//Need to convert to a register
|
||||
|
||||
XMMREGISTER valueRegister = AllocateXmmRegister();
|
||||
m_Assembler.MovssEd(valueRegister,
|
||||
@ -47,29 +47,29 @@ void CCodeGen::MD_PushRelExpand(size_t offset)
|
||||
CX86Assembler::MakeXmmRegisterAddress(valueRegister), 0x00);
|
||||
|
||||
MD_PushReg(valueRegister);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PullRel(size_t offset)
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
m_Assembler.MovdquVo(CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, static_cast<uint32>(offset)),
|
||||
valueRegister);
|
||||
FreeXmmRegister(valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PullRel(size_t offset0, size_t offset1, size_t offset2, size_t offset3)
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PullRel(size_t offset)
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
m_Assembler.MovdquVo(CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, static_cast<uint32>(offset)),
|
||||
valueRegister);
|
||||
FreeXmmRegister(valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PullRel(size_t offset0, size_t offset1, size_t offset2, size_t offset3)
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
|
||||
if(
|
||||
offset0 != SIZE_MAX &&
|
||||
offset1 != SIZE_MAX &&
|
||||
@ -80,7 +80,7 @@ void CCodeGen::MD_PullRel(size_t offset0, size_t offset1, size_t offset2, size_t
|
||||
//All elements are non-null
|
||||
if((offset1 == offset0 + 4) && (offset2 == offset1 + 4) && (offset3 == offset2 + 4))
|
||||
{
|
||||
m_Assembler.MovapsVo(CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, static_cast<uint32>(offset0)),
|
||||
m_Assembler.MovapsVo(CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, static_cast<uint32>(offset0)),
|
||||
valueRegister);
|
||||
}
|
||||
}
|
||||
@ -107,390 +107,390 @@ void CCodeGen::MD_PullRel(size_t offset0, size_t offset1, size_t offset2, size_t
|
||||
m_Assembler.MovssEd(CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, static_cast<uint32>(offset[i])),
|
||||
valueRegister);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeXmmRegister(valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushReg(XMMREGISTER registerId)
|
||||
{
|
||||
m_Shadow.Push(registerId);
|
||||
m_Shadow.Push(REGISTER128);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericPackedShift(const PackedShiftFunction& instruction, uint8 amount)
|
||||
{
|
||||
if(FitsPattern<SingleRelative128>())
|
||||
{
|
||||
SingleRelative128::PatternValue op(GetPattern<SingleRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, op);
|
||||
instruction(resultRegister, amount);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericTwoOperand(const MdTwoOperandFunction& instruction)
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.first);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.second));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else if(FitsPattern<RelativeRegister128>())
|
||||
{
|
||||
RelativeRegister128::PatternValue ops(GetPattern<RelativeRegister128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(ops.second);
|
||||
LoadRelative128InRegister(resultRegister, ops.first);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(valueRegister));
|
||||
if(!Register128HasNextUse(valueRegister))
|
||||
{
|
||||
FreeXmmRegister(valueRegister);
|
||||
}
|
||||
}
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericTwoOperandReversed(const MdTwoOperandFunction& instruction)
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.second);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.first));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PaddwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddWUS()
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
unsigned int tempRegister = AllocateRegister();
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
for(int i = 3; i >= 0; i--)
|
||||
{
|
||||
CX86Assembler::LABEL overflowLabel = m_Assembler.CreateLabel();
|
||||
CX86Assembler::LABEL doneLabel = m_Assembler.CreateLabel();
|
||||
m_Assembler.MovEd(m_nRegisterLookupEx[tempRegister],
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.first + (i * 4)));
|
||||
m_Assembler.AddEd(m_nRegisterLookupEx[tempRegister],
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.second + (i * 4)));
|
||||
m_Assembler.JcJb(overflowLabel);
|
||||
m_Assembler.PushEd(CX86Assembler::MakeRegisterAddress(m_nRegisterLookupEx[tempRegister]));
|
||||
m_Assembler.JmpJb(doneLabel);
|
||||
m_Assembler.MarkLabel(overflowLabel);
|
||||
m_Assembler.PushId(0xFFFFFFFF);
|
||||
m_Assembler.MarkLabel(doneLabel);
|
||||
}
|
||||
FreeRegister(tempRegister);
|
||||
m_Assembler.ResolveLabelReferences();
|
||||
m_Assembler.MovdquVo(resultRegister,
|
||||
CX86Assembler::MakeIndRegAddress(CX86Assembler::rSP));
|
||||
m_Assembler.AddId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP),
|
||||
0x10);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::AddpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_And()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PandVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_CmpGtH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PcmpgtwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_IsNegative()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
XMMREGISTER resultRegister;
|
||||
if(Register128HasNextUse(valueRegister))
|
||||
{
|
||||
resultRegister = AllocateXmmRegister();
|
||||
CopyRegister128(resultRegister, valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultRegister = valueRegister;
|
||||
}
|
||||
XMMREGISTER maskRegister = AllocateXmmRegister();
|
||||
m_Assembler.PcmpeqdVo(maskRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PslldVo(maskRegister, 31);
|
||||
m_Assembler.PandVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
FreeXmmRegister(maskRegister);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_IsZero()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
XMMREGISTER resultRegister;
|
||||
if(Register128HasNextUse(valueRegister))
|
||||
{
|
||||
resultRegister = AllocateXmmRegister();
|
||||
CopyRegister128(resultRegister, valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultRegister = valueRegister;
|
||||
}
|
||||
XMMREGISTER zeroRegister = AllocateXmmRegister();
|
||||
m_Assembler.PandnVo(zeroRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(zeroRegister));
|
||||
m_Assembler.PcmpeqdVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(zeroRegister));
|
||||
FreeXmmRegister(zeroRegister);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MaxH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PmaxswVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MinH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PminswVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MulS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::MulpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Not()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER resultRegister(static_cast<XMMREGISTER>(GetPattern<SingleRegister128>()));
|
||||
assert(!Register128HasNextUse(resultRegister));
|
||||
XMMREGISTER tempRegister = AllocateXmmRegister();
|
||||
m_Assembler.PcmpeqdVo(tempRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
m_Assembler.PxorVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Or()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PorVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PackHB()
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
XMMREGISTER tempRegister = AllocateXmmRegister();
|
||||
XMMREGISTER maskRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.second);
|
||||
LoadRelative128InRegister(tempRegister, ops.first);
|
||||
|
||||
//Generate mask (0x00FF x8)
|
||||
m_Assembler.PcmpeqdVo(maskRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PsrlwVo(maskRegister, 0x08);
|
||||
|
||||
//Mask both operands
|
||||
m_Assembler.PandVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PandVo(tempRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
|
||||
//Pack
|
||||
m_Assembler.Packuswb(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
|
||||
FreeXmmRegister(maskRegister);
|
||||
FreeXmmRegister(tempRegister);
|
||||
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SllH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsllwVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SraH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsrawVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SrlH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsrlwVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Srl256()
|
||||
{
|
||||
if(m_Shadow.Pull() != RELATIVE) assert(0);
|
||||
uint32 shiftAmount = m_Shadow.Pull();
|
||||
if(m_Shadow.Pull() != RELATIVE128) assert(0);
|
||||
uint32 operand2 = m_Shadow.Pull();
|
||||
if(m_Shadow.Pull() != RELATIVE128) assert(0);
|
||||
uint32 operand1 = m_Shadow.Pull();
|
||||
|
||||
assert(m_nRegisterAllocated[1] == false); //eCX
|
||||
assert(m_nRegisterAllocated[4] == false); //eSI
|
||||
assert(m_nRegisterAllocated[5] == false); //eDI
|
||||
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
|
||||
//Copy both registers on the stack
|
||||
//-----------------------------
|
||||
m_Assembler.SubId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP), 0x30);
|
||||
m_Assembler.MovGd(CX86Assembler::MakeRegisterAddress(CX86Assembler::rDI), CX86Assembler::rSP);
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, operand2));
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
m_Assembler.RepMovsb();
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, operand1));
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
m_Assembler.RepMovsb();
|
||||
|
||||
//Setup SA
|
||||
//-----------------------------
|
||||
m_Assembler.MovEd(CX86Assembler::rAX, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, shiftAmount));
|
||||
m_Assembler.AndId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rAX), 0x7F);
|
||||
m_Assembler.ShrEd(CX86Assembler::MakeRegisterAddress(CX86Assembler::rAX), 0x03);
|
||||
|
||||
//Setup ESI
|
||||
//-----------------------------
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI,
|
||||
CX86Assembler::MakeBaseIndexScaleAddress(CX86Assembler::rSP, CX86Assembler::rAX, 1));
|
||||
|
||||
//Setup ECX
|
||||
//-----------------------------
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
|
||||
//Generate result
|
||||
//-----------------------------
|
||||
m_Assembler.RepMovsb();
|
||||
|
||||
//Load result and free Stack
|
||||
//-----------------------------
|
||||
m_Assembler.MovdquVo(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(CX86Assembler::rSP, 0x20));
|
||||
m_Assembler.AddId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP), 0x30);
|
||||
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubB()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PsubbVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubW()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PsubdVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::SubpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerBH()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpcklbwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerHW()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpcklwdVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerWD()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckldqVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackUpperBH()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckhbwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackUpperWD()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckhdqVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Xor()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PxorVo, m_Assembler, _1, _2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PushReg(XMMREGISTER registerId)
|
||||
{
|
||||
m_Shadow.Push(registerId);
|
||||
m_Shadow.Push(REGISTER128);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericPackedShift(const PackedShiftFunction& instruction, uint8 amount)
|
||||
{
|
||||
if(FitsPattern<SingleRelative128>())
|
||||
{
|
||||
SingleRelative128::PatternValue op(GetPattern<SingleRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, op);
|
||||
instruction(resultRegister, amount);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericTwoOperand(const MdTwoOperandFunction& instruction)
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.first);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.second));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else if(FitsPattern<RelativeRegister128>())
|
||||
{
|
||||
RelativeRegister128::PatternValue ops(GetPattern<RelativeRegister128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(ops.second);
|
||||
LoadRelative128InRegister(resultRegister, ops.first);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(valueRegister));
|
||||
if(!Register128HasNextUse(valueRegister))
|
||||
{
|
||||
FreeXmmRegister(valueRegister);
|
||||
}
|
||||
}
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_GenericTwoOperandReversed(const MdTwoOperandFunction& instruction)
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.second);
|
||||
instruction(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.first));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PaddwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddWUS()
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
unsigned int tempRegister = AllocateRegister();
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
for(int i = 3; i >= 0; i--)
|
||||
{
|
||||
CX86Assembler::LABEL overflowLabel = m_Assembler.CreateLabel();
|
||||
CX86Assembler::LABEL doneLabel = m_Assembler.CreateLabel();
|
||||
m_Assembler.MovEd(m_nRegisterLookupEx[tempRegister],
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.first + (i * 4)));
|
||||
m_Assembler.AddEd(m_nRegisterLookupEx[tempRegister],
|
||||
CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, ops.second + (i * 4)));
|
||||
m_Assembler.JcJb(overflowLabel);
|
||||
m_Assembler.PushEd(CX86Assembler::MakeRegisterAddress(m_nRegisterLookupEx[tempRegister]));
|
||||
m_Assembler.JmpJb(doneLabel);
|
||||
m_Assembler.MarkLabel(overflowLabel);
|
||||
m_Assembler.PushId(0xFFFFFFFF);
|
||||
m_Assembler.MarkLabel(doneLabel);
|
||||
}
|
||||
FreeRegister(tempRegister);
|
||||
m_Assembler.ResolveLabelReferences();
|
||||
m_Assembler.MovdquVo(resultRegister,
|
||||
CX86Assembler::MakeIndRegAddress(CX86Assembler::rSP));
|
||||
m_Assembler.AddId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP),
|
||||
0x10);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_AddS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::AddpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_And()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PandVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_CmpGtH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PcmpgtwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_IsNegative()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
XMMREGISTER resultRegister;
|
||||
if(Register128HasNextUse(valueRegister))
|
||||
{
|
||||
resultRegister = AllocateXmmRegister();
|
||||
CopyRegister128(resultRegister, valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultRegister = valueRegister;
|
||||
}
|
||||
XMMREGISTER maskRegister = AllocateXmmRegister();
|
||||
m_Assembler.PcmpeqdVo(maskRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PslldVo(maskRegister, 31);
|
||||
m_Assembler.PandVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
FreeXmmRegister(maskRegister);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_IsZero()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER valueRegister = static_cast<XMMREGISTER>(GetPattern<SingleRegister128>());
|
||||
XMMREGISTER resultRegister;
|
||||
if(Register128HasNextUse(valueRegister))
|
||||
{
|
||||
resultRegister = AllocateXmmRegister();
|
||||
CopyRegister128(resultRegister, valueRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultRegister = valueRegister;
|
||||
}
|
||||
XMMREGISTER zeroRegister = AllocateXmmRegister();
|
||||
m_Assembler.PandnVo(zeroRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(zeroRegister));
|
||||
m_Assembler.PcmpeqdVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(zeroRegister));
|
||||
FreeXmmRegister(zeroRegister);
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MaxH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PmaxswVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MinH()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PminswVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_MulS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::MulpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Not()
|
||||
{
|
||||
if(FitsPattern<SingleRegister128>())
|
||||
{
|
||||
XMMREGISTER resultRegister(static_cast<XMMREGISTER>(GetPattern<SingleRegister128>()));
|
||||
assert(!Register128HasNextUse(resultRegister));
|
||||
XMMREGISTER tempRegister = AllocateXmmRegister();
|
||||
m_Assembler.PcmpeqdVo(tempRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
m_Assembler.PxorVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Or()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PorVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_PackHB()
|
||||
{
|
||||
if(FitsPattern<RelativeRelative128>())
|
||||
{
|
||||
RelativeRelative128::PatternValue ops(GetPattern<RelativeRelative128>());
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
XMMREGISTER tempRegister = AllocateXmmRegister();
|
||||
XMMREGISTER maskRegister = AllocateXmmRegister();
|
||||
LoadRelative128InRegister(resultRegister, ops.second);
|
||||
LoadRelative128InRegister(tempRegister, ops.first);
|
||||
|
||||
//Generate mask (0x00FF x8)
|
||||
m_Assembler.PcmpeqdVo(maskRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PsrlwVo(maskRegister, 0x08);
|
||||
|
||||
//Mask both operands
|
||||
m_Assembler.PandVo(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
m_Assembler.PandVo(tempRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(maskRegister));
|
||||
|
||||
//Pack
|
||||
m_Assembler.Packuswb(resultRegister,
|
||||
CX86Assembler::MakeXmmRegisterAddress(tempRegister));
|
||||
|
||||
FreeXmmRegister(maskRegister);
|
||||
FreeXmmRegister(tempRegister);
|
||||
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw exception();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SllH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsllwVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SraH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsrawVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SrlH(uint8 amount)
|
||||
{
|
||||
MD_GenericPackedShift(bind(&CX86Assembler::PsrlwVo, &m_Assembler, _1, _2), amount);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Srl256()
|
||||
{
|
||||
if(m_Shadow.Pull() != RELATIVE) assert(0);
|
||||
uint32 shiftAmount = m_Shadow.Pull();
|
||||
if(m_Shadow.Pull() != RELATIVE128) assert(0);
|
||||
uint32 operand2 = m_Shadow.Pull();
|
||||
if(m_Shadow.Pull() != RELATIVE128) assert(0);
|
||||
uint32 operand1 = m_Shadow.Pull();
|
||||
|
||||
assert(m_nRegisterAllocated[1] == false); //eCX
|
||||
assert(m_nRegisterAllocated[4] == false); //eSI
|
||||
assert(m_nRegisterAllocated[5] == false); //eDI
|
||||
|
||||
XMMREGISTER resultRegister = AllocateXmmRegister();
|
||||
|
||||
//Copy both registers on the stack
|
||||
//-----------------------------
|
||||
m_Assembler.SubId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP), 0x30);
|
||||
m_Assembler.MovGd(CX86Assembler::MakeRegisterAddress(CX86Assembler::rDI), CX86Assembler::rSP);
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, operand2));
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
m_Assembler.RepMovsb();
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, operand1));
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
m_Assembler.RepMovsb();
|
||||
|
||||
//Setup SA
|
||||
//-----------------------------
|
||||
m_Assembler.MovEd(CX86Assembler::rAX, CX86Assembler::MakeIndRegOffAddress(g_nBaseRegister, shiftAmount));
|
||||
m_Assembler.AndId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rAX), 0x7F);
|
||||
m_Assembler.ShrEd(CX86Assembler::MakeRegisterAddress(CX86Assembler::rAX), 0x03);
|
||||
|
||||
//Setup ESI
|
||||
//-----------------------------
|
||||
m_Assembler.LeaGd(CX86Assembler::rSI,
|
||||
CX86Assembler::MakeBaseIndexScaleAddress(CX86Assembler::rSP, CX86Assembler::rAX, 1));
|
||||
|
||||
//Setup ECX
|
||||
//-----------------------------
|
||||
m_Assembler.MovId(CX86Assembler::rCX, 0x10);
|
||||
|
||||
//Generate result
|
||||
//-----------------------------
|
||||
m_Assembler.RepMovsb();
|
||||
|
||||
//Load result and free Stack
|
||||
//-----------------------------
|
||||
m_Assembler.MovdquVo(resultRegister,
|
||||
CX86Assembler::MakeIndRegOffAddress(CX86Assembler::rSP, 0x20));
|
||||
m_Assembler.AddId(CX86Assembler::MakeRegisterAddress(CX86Assembler::rSP), 0x30);
|
||||
|
||||
MD_PushReg(resultRegister);
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubB()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PsubbVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubW()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PsubdVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_SubS()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::SubpsVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerBH()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpcklbwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerHW()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpcklwdVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackLowerWD()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckldqVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackUpperBH()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckhbwVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_UnpackUpperWD()
|
||||
{
|
||||
MD_GenericTwoOperandReversed(bind(&CX86Assembler::PunpckhdqVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
||||
void CCodeGen::MD_Xor()
|
||||
{
|
||||
MD_GenericTwoOperand(bind(&CX86Assembler::PxorVo, m_Assembler, _1, _2));
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ __attribute__((aligned(16)))
|
||||
//COP2
|
||||
#ifdef WIN32
|
||||
__declspec(align(16))
|
||||
#else
|
||||
__attribute__((aligned(16)))
|
||||
#endif
|
||||
uint128 nCOP2[32];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user