mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
Move decoding of insertps back to avoid unused warnings in x86 isel lowering, and fix movlhps/movhlps to decode 4 elements shuffles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3f74a116c8
commit
5594560766
@ -19,6 +19,34 @@
|
||||
#include "../X86ShuffleDecode.h"
|
||||
using namespace llvm;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Vector Mask Decoding for non-shuffles
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static void DecodeINSERTPSMask(unsigned Imm,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
// Defaults the copying the dest value.
|
||||
ShuffleMask.push_back(0);
|
||||
ShuffleMask.push_back(1);
|
||||
ShuffleMask.push_back(2);
|
||||
ShuffleMask.push_back(3);
|
||||
|
||||
// Decode the immediate.
|
||||
unsigned ZMask = Imm & 15;
|
||||
unsigned CountD = (Imm >> 4) & 3;
|
||||
unsigned CountS = (Imm >> 6) & 3;
|
||||
|
||||
// CountS selects which input element to use.
|
||||
unsigned InVal = 4+CountS;
|
||||
// CountD specifies which element of destination to update.
|
||||
ShuffleMask[CountD] = InVal;
|
||||
// ZMask zaps values, potentially overriding the CountD elt.
|
||||
if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero;
|
||||
if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero;
|
||||
if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero;
|
||||
if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Top Level Entrypoint
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -42,13 +70,13 @@ void llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
|
||||
case X86::MOVLHPSrr:
|
||||
Src2Name = getRegName(MI->getOperand(2).getReg());
|
||||
Src1Name = getRegName(MI->getOperand(0).getReg());
|
||||
DecodeMOVLHPSMask(ShuffleMask);
|
||||
DecodeMOVLHPSMask(2, ShuffleMask);
|
||||
break;
|
||||
|
||||
case X86::MOVHLPSrr:
|
||||
Src2Name = getRegName(MI->getOperand(2).getReg());
|
||||
Src1Name = getRegName(MI->getOperand(0).getReg());
|
||||
DecodeMOVHLPSMask(ShuffleMask);
|
||||
DecodeMOVHLPSMask(2, ShuffleMask);
|
||||
break;
|
||||
|
||||
case X86::PSHUFDri:
|
||||
|
@ -26,38 +26,24 @@ enum {
|
||||
SM_SentinelZero = ~0U
|
||||
};
|
||||
|
||||
static void DecodeINSERTPSMask(unsigned Imm,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
// Defaults the copying the dest value.
|
||||
ShuffleMask.push_back(0);
|
||||
ShuffleMask.push_back(1);
|
||||
ShuffleMask.push_back(2);
|
||||
ShuffleMask.push_back(3);
|
||||
// <3,1> or <6,7,2,3>
|
||||
static void DecodeMOVHLPSMask(unsigned NElts,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
for (unsigned i = NElts/2; i != NElts; ++i)
|
||||
ShuffleMask.push_back(NElts+i);
|
||||
|
||||
// Decode the immediate.
|
||||
unsigned ZMask = Imm & 15;
|
||||
unsigned CountD = (Imm >> 4) & 3;
|
||||
unsigned CountS = (Imm >> 6) & 3;
|
||||
|
||||
// CountS selects which input element to use.
|
||||
unsigned InVal = 4+CountS;
|
||||
// CountD specifies which element of destination to update.
|
||||
ShuffleMask[CountD] = InVal;
|
||||
// ZMask zaps values, potentially overriding the CountD elt.
|
||||
if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero;
|
||||
if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero;
|
||||
if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero;
|
||||
if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero;
|
||||
for (unsigned i = NElts/2; i != NElts; ++i)
|
||||
ShuffleMask.push_back(i);
|
||||
}
|
||||
|
||||
static void DecodeMOVHLPSMask(SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
ShuffleMask.push_back(3);
|
||||
ShuffleMask.push_back(1);
|
||||
}
|
||||
// <0,2> or <0,1,4,5>
|
||||
static void DecodeMOVLHPSMask(unsigned NElts,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
for (unsigned i = 0; i != NElts/2; ++i)
|
||||
ShuffleMask.push_back(i);
|
||||
|
||||
static void DecodeMOVLHPSMask(SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
ShuffleMask.push_back(0);
|
||||
ShuffleMask.push_back(2);
|
||||
for (unsigned i = 0; i != NElts/2; ++i)
|
||||
ShuffleMask.push_back(NElts+i);
|
||||
}
|
||||
|
||||
static void DecodePSHUFMask(unsigned NElts, unsigned Imm,
|
||||
|
Loading…
Reference in New Issue
Block a user