diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-06-28 21:12:19 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-06-28 21:12:19 +0000 |
commit | d896a97dc7c14675c08520847b45a60a200b8cf5 (patch) | |
tree | 3f8e5d1858252bb1b7710575ed9bbe650f32696c /lib | |
parent | c25ccf85e55137d9d5cc6f607317d841ff5ae347 (diff) | |
download | external_llvm-d896a97dc7c14675c08520847b45a60a200b8cf5.zip external_llvm-d896a97dc7c14675c08520847b45a60a200b8cf5.tar.gz external_llvm-d896a97dc7c14675c08520847b45a60a200b8cf5.tar.bz2 |
Support Thumb mode encoding of NEON instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMCodeEmitter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMCodeEmitter.cpp b/lib/Target/ARM/ARMCodeEmitter.cpp index 49e83c3..cf3ae98 100644 --- a/lib/Target/ARM/ARMCodeEmitter.cpp +++ b/lib/Target/ARM/ARMCodeEmitter.cpp @@ -1585,6 +1585,15 @@ static unsigned encodeNEONRm(const MachineInstr &MI, unsigned OpIdx) { 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) { unsigned Binary = getBinaryCodeForInstr(MI); @@ -1630,6 +1639,8 @@ void ARMCodeEmitter::emitNEON1RegModImmInstruction(const MachineInstr &MI) { Binary |= (Imm3 << 16); unsigned Imm4 = Imm & 0xf; Binary |= Imm4; + if (Subtarget->isThumb()) + Binary = convertNEONDataProcToThumb(Binary); emitWordLE(Binary); } @@ -1642,6 +1653,8 @@ void ARMCodeEmitter::emitNEON2RegInstruction(const MachineInstr &MI) { if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1) ++OpIdx; Binary |= encodeNEONRm(MI, OpIdx); + if (Subtarget->isThumb()) + Binary = convertNEONDataProcToThumb(Binary); // FIXME: This does not handle VDUPfdf or VDUPfqf. emitWordLE(Binary); } @@ -1658,6 +1671,8 @@ void ARMCodeEmitter::emitNEON3RegInstruction(const MachineInstr &MI) { if (TID.getOperandConstraint(OpIdx, TOI::TIED_TO) != -1) ++OpIdx; Binary |= encodeNEONRm(MI, OpIdx); + if (Subtarget->isThumb()) + Binary = convertNEONDataProcToThumb(Binary); // FIXME: This does not handle VMOVDneon or VMOVQ. emitWordLE(Binary); } |