mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-28 07:17:32 +00:00
Support Thumb mode encoding of NEON instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1585,6 +1585,15 @@ static unsigned encodeNEONRm(const MachineInstr &MI, unsigned OpIdx) {
|
|||||||
return Binary;
|
return Binary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// convertNEONDataProcToThumb - Convert the ARM mode encoding for a NEON
|
||||||
|
/// data-processing instruction to the corresponding Thumb encoding.
|
||||||
|
static unsigned convertNEONDataProcToThumb(unsigned Binary) {
|
||||||
|
assert((Binary & 0xfe000000) == 0xf2000000 &&
|
||||||
|
"not an ARM NEON data-processing instruction");
|
||||||
|
unsigned UBit = (Binary >> 24) & 1;
|
||||||
|
return 0xef000000 | (UBit << 28) | (Binary & 0xffffff);
|
||||||
|
}
|
||||||
|
|
||||||
void ARMCodeEmitter::emitNEONGetLaneInstruction(const MachineInstr &MI) {
|
void ARMCodeEmitter::emitNEONGetLaneInstruction(const MachineInstr &MI) {
|
||||||
unsigned Binary = getBinaryCodeForInstr(MI);
|
unsigned Binary = getBinaryCodeForInstr(MI);
|
||||||
|
|
||||||
@@ -1630,6 +1639,8 @@ void ARMCodeEmitter::emitNEON1RegModImmInstruction(const MachineInstr &MI) {
|
|||||||
Binary |= (Imm3 << 16);
|
Binary |= (Imm3 << 16);
|
||||||
unsigned Imm4 = Imm & 0xf;
|
unsigned Imm4 = Imm & 0xf;
|
||||||
Binary |= Imm4;
|
Binary |= Imm4;
|
||||||
|
if (Subtarget->isThumb())
|
||||||
|
Binary = convertNEONDataProcToThumb(Binary);
|
||||||
emitWordLE(Binary);
|
emitWordLE(Binary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1642,6 +1653,8 @@ void ARMCodeEmitter::emitNEON2RegInstruction(const MachineInstr &MI) {
|
|||||||
if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1)
|
if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1)
|
||||||
++OpIdx;
|
++OpIdx;
|
||||||
Binary |= encodeNEONRm(MI, OpIdx);
|
Binary |= encodeNEONRm(MI, OpIdx);
|
||||||
|
if (Subtarget->isThumb())
|
||||||
|
Binary = convertNEONDataProcToThumb(Binary);
|
||||||
// FIXME: This does not handle VDUPfdf or VDUPfqf.
|
// FIXME: This does not handle VDUPfdf or VDUPfqf.
|
||||||
emitWordLE(Binary);
|
emitWordLE(Binary);
|
||||||
}
|
}
|
||||||
@@ -1658,6 +1671,8 @@ void ARMCodeEmitter::emitNEON3RegInstruction(const MachineInstr &MI) {
|
|||||||
if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1)
|
if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1)
|
||||||
++OpIdx;
|
++OpIdx;
|
||||||
Binary |= encodeNEONRm(MI, OpIdx);
|
Binary |= encodeNEONRm(MI, OpIdx);
|
||||||
|
if (Subtarget->isThumb())
|
||||||
|
Binary = convertNEONDataProcToThumb(Binary);
|
||||||
// FIXME: This does not handle VMOVDneon or VMOVQ.
|
// FIXME: This does not handle VMOVDneon or VMOVQ.
|
||||||
emitWordLE(Binary);
|
emitWordLE(Binary);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user