mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-19 19:44:55 +00:00
Modify operand order for Create{Sign,Zero}ExtensionInstructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3960 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -497,10 +497,10 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(const TargetMachine& target,
|
|||||||
{ // sign- or zero-extend respectively
|
{ // sign- or zero-extend respectively
|
||||||
storeVal = new TmpInstruction(storeType, val);
|
storeVal = new TmpInstruction(storeType, val);
|
||||||
if (val->getType()->isSigned())
|
if (val->getType()->isSigned())
|
||||||
CreateSignExtensionInstructions(target, F, val, 8*srcSize, storeVal,
|
CreateSignExtensionInstructions(target, F, val, storeVal, 8*srcSize,
|
||||||
mvec, mcfi);
|
mvec, mcfi);
|
||||||
else
|
else
|
||||||
CreateZeroExtensionInstructions(target, F, val, 8*srcSize, storeVal,
|
CreateZeroExtensionInstructions(target, F, val, storeVal, 8*srcSize,
|
||||||
mvec, mcfi);
|
mvec, mcfi);
|
||||||
}
|
}
|
||||||
MachineInstr* store=new MachineInstr(ChooseStoreInstruction(storeType));
|
MachineInstr* store=new MachineInstr(ChooseStoreInstruction(storeType));
|
||||||
@@ -640,27 +640,27 @@ CreateBitExtensionInstructions(bool signExtend,
|
|||||||
const TargetMachine& target,
|
const TargetMachine& target,
|
||||||
Function* F,
|
Function* F,
|
||||||
Value* srcVal,
|
Value* srcVal,
|
||||||
unsigned int srcSizeInBits,
|
Value* destVal,
|
||||||
Value* dest,
|
unsigned int numLowBits,
|
||||||
vector<MachineInstr*>& mvec,
|
vector<MachineInstr*>& mvec,
|
||||||
MachineCodeForInstruction& mcfi)
|
MachineCodeForInstruction& mcfi)
|
||||||
{
|
{
|
||||||
MachineInstr* M;
|
MachineInstr* M;
|
||||||
assert(srcSizeInBits <= 32 &&
|
|
||||||
"Hmmm... 32 < srcSizeInBits < 64 unexpected but could be handled.");
|
|
||||||
|
|
||||||
if (srcSizeInBits < 32)
|
assert(numLowBits <= 32 && "Otherwise, nothing should be done here!");
|
||||||
|
|
||||||
|
if (numLowBits < 32)
|
||||||
{ // SLL is needed since operand size is < 32 bits.
|
{ // SLL is needed since operand size is < 32 bits.
|
||||||
TmpInstruction *tmpI = new TmpInstruction(dest->getType(),
|
TmpInstruction *tmpI = new TmpInstruction(destVal->getType(),
|
||||||
srcVal, dest,"make32");
|
srcVal, destVal, "make32");
|
||||||
mcfi.addTemp(tmpI);
|
mcfi.addTemp(tmpI);
|
||||||
M = Create3OperandInstr_UImmed(SLLX, srcVal, 32-srcSizeInBits, tmpI);
|
M = Create3OperandInstr_UImmed(SLLX, srcVal, 32-numLowBits, tmpI);
|
||||||
mvec.push_back(M);
|
mvec.push_back(M);
|
||||||
srcVal = tmpI;
|
srcVal = tmpI;
|
||||||
}
|
}
|
||||||
|
|
||||||
M = Create3OperandInstr_UImmed(signExtend? SRA : SRL,
|
M = Create3OperandInstr_UImmed(signExtend? SRA : SRL,
|
||||||
srcVal, 32-srcSizeInBits, dest);
|
srcVal, 32-numLowBits, destVal);
|
||||||
mvec.push_back(M);
|
mvec.push_back(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,13 +676,13 @@ UltraSparcInstrInfo::CreateSignExtensionInstructions(
|
|||||||
const TargetMachine& target,
|
const TargetMachine& target,
|
||||||
Function* F,
|
Function* F,
|
||||||
Value* srcVal,
|
Value* srcVal,
|
||||||
unsigned int srcSizeInBits,
|
Value* destVal,
|
||||||
Value* dest,
|
unsigned int numLowBits,
|
||||||
vector<MachineInstr*>& mvec,
|
vector<MachineInstr*>& mvec,
|
||||||
MachineCodeForInstruction& mcfi) const
|
MachineCodeForInstruction& mcfi) const
|
||||||
{
|
{
|
||||||
CreateBitExtensionInstructions(/*signExtend*/ true, target, F, srcVal,
|
CreateBitExtensionInstructions(/*signExtend*/ true, target, F, srcVal,
|
||||||
srcSizeInBits, dest, mvec, mcfi);
|
destVal, numLowBits, mvec, mcfi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -698,11 +698,11 @@ UltraSparcInstrInfo::CreateZeroExtensionInstructions(
|
|||||||
const TargetMachine& target,
|
const TargetMachine& target,
|
||||||
Function* F,
|
Function* F,
|
||||||
Value* srcVal,
|
Value* srcVal,
|
||||||
unsigned int srcSizeInBits,
|
Value* destVal,
|
||||||
Value* dest,
|
unsigned int numLowBits,
|
||||||
vector<MachineInstr*>& mvec,
|
vector<MachineInstr*>& mvec,
|
||||||
MachineCodeForInstruction& mcfi) const
|
MachineCodeForInstruction& mcfi) const
|
||||||
{
|
{
|
||||||
CreateBitExtensionInstructions(/*signExtend*/ false, target, F, srcVal,
|
CreateBitExtensionInstructions(/*signExtend*/ false, target, F, srcVal,
|
||||||
srcSizeInBits, dest, mvec, mcfi);
|
destVal, numLowBits, mvec, mcfi);
|
||||||
}
|
}
|
||||||
|
@@ -194,8 +194,8 @@ struct UltraSparcInstrInfo : public MachineInstrInfo {
|
|||||||
virtual void CreateSignExtensionInstructions(const TargetMachine& target,
|
virtual void CreateSignExtensionInstructions(const TargetMachine& target,
|
||||||
Function* F,
|
Function* F,
|
||||||
Value* srcVal,
|
Value* srcVal,
|
||||||
unsigned int srcSizeInBits,
|
Value* destVal,
|
||||||
Value* dest,
|
unsigned int numLowBits,
|
||||||
std::vector<MachineInstr*>& mvec,
|
std::vector<MachineInstr*>& mvec,
|
||||||
MachineCodeForInstruction& mcfi) const;
|
MachineCodeForInstruction& mcfi) const;
|
||||||
|
|
||||||
@@ -208,8 +208,8 @@ struct UltraSparcInstrInfo : public MachineInstrInfo {
|
|||||||
virtual void CreateZeroExtensionInstructions(const TargetMachine& target,
|
virtual void CreateZeroExtensionInstructions(const TargetMachine& target,
|
||||||
Function* F,
|
Function* F,
|
||||||
Value* srcVal,
|
Value* srcVal,
|
||||||
unsigned int srcSizeInBits,
|
Value* destVal,
|
||||||
Value* dest,
|
unsigned int numLowBits,
|
||||||
std::vector<MachineInstr*>& mvec,
|
std::vector<MachineInstr*>& mvec,
|
||||||
MachineCodeForInstruction& mcfi) const;
|
MachineCodeForInstruction& mcfi) const;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user